chore: reduce complexity of three C901-flagged functions - #92081
Draft
posthog[bot] wants to merge 1 commit into
Draft
chore: reduce complexity of three C901-flagged functions#92081posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
Extract helpers to bring three functions under Ruff's C901 limit of 10, preserving query bounds, retry behavior, and resolution semantics. - build_person_properties_at_time: split input validation, query construction, and property reconstruction into helpers. - resolution_states: separate run loading, liveness filtering, and verdict aggregation. - get_rows: isolate the retrying request builder, page extraction, and scroll cleanup. Generated-By: PostHog Desktop Task-Id: 14988e0a-3dae-4762-aeba-ca4db6b456ef
Contributor
Author
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
Contributor
🤖 CI report
|
There was a problem hiding this comment.
Approved.
Verified line-by-line: each of the three refactors extracts existing logic into helpers with identical control flow, no behavior change, and none of the touched code enters risky territory (no schema/API/auth/billing/dependency/CI changes).
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 263L, 3F substantive — within ceiling |
| tier | ✓ | T1-agent / T1c-medium (263L, 3F, two-areas, chore) |
| stamphog 2.0.0b4 | .stamphog/policy.yml @ f82e49c · reviewed head f82e49c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
build_person_properties_at_timescored 17,resolution_statesscored 12, andget_rowsscored 11.Changes
No behavior changes — each function keeps its query bounds, retry behavior, and resolution semantics. The split is mechanical helper extraction.
build_person_properties_at_time: input validation, ClickHouse query construction, and property reconstruction now live in focused helpers. A shared JSON parser removes the two duplicated$set/$set_oncetry/except blocks.resolution_states: run loading, liveness filtering (supersession and completion), and verdict aggregation are separate helpers; the top-level function reads as three steps plus the final state build.get_rows: the retrying POST builder, scroll-page extraction with float coercion, and best-effort scroll cleanup are separate helpers; the walk loop stays inget_rows.How did you test this code?
ruff check --select C901reports no violations on the three files; fullruff checkandruff format --checkpass.Automatic notifications
Docs update
None — no user-facing behavior, API, or config change.
🤖 Agent context
Autonomy: Fully autonomous
/writing-code-comments,/writing-pr-descriptions.resolution_statesclosure_latest_afterwas promoted to a module-level_latest_created_athelper so the liveness filter could move out cleanly; same query and behavior.Created with PostHog Desktop from this inbox report.