Skip to content

review-pr: add D11 and D12, and make complexity above 20 a gate - #1811

Merged
chaojhou merged 2 commits into
mainfrom
feature/xiaofei/review-pr-cc-gate
Oct 10, 2026
Merged

chaojhou merged 2 commits into
mainfrom
feature/xiaofei/review-pr-cc-gate

Conversation

@xiaofei-zheng

@xiaofei-zheng xiaofei-zheng commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator
  • Description: two review rules, plus the authority the second one cites.

    D11 -- fix(cli): export every --extra-env pin so all readers resolve it alike #1797's first version made --extra-env pins visible by re-merging the INFERENCE_OPTIMIZER_EXTRA_ENV blob inside agentx_env_for_conc, one consumer. The review passed it with no blocking issues: the body's stated cause matched the data flow, and V3 explicitly exempts a fix that is only narrower than the reviewer would have written. Every other reader kept its bare os.environ.get, so a pinned HYPERLOOM_AGENTIC_BACKEND selected the MLPerf client while the seeded grading axis, the persisted backend identity and the benchmark timeout all still resolved aiperf -- MLPerf publishes no interactivity series, so that session REVERTed every round. Fixing the producer instead, exporting each pin in _export_operator_launch_shape, corrected every reader without changing one. D11 makes that shape blocking: a value repaired where it is consumed while the single place that publishes it is untouched. It is D10's dual -- D10 is a concern copied beside its caller while an owner exports it, D11 is an owner that exists but does not publish, compensated for downstream. V3's exemption now names the boundary, so narrowness stays taste while a second resolution point blocks.

    D12 -- cyclomatic complexity above 20 blocks, for a function the diff adds or whose complexity the diff raises. The tree holds 124 units above 20, so the rule compares the head against the merge base and stays silent when the number did not move; the backlog is not the next PR's debt. This needed the authority to change with it: AGENTS.md and the style guide both said the size numbers are "review triggers, not gates", which left a blocking finding nothing to cite. The style guide gains a Complexity ceiling section carrying the two cases and the measurement, AGENTS.md separates the three triggers from the one gate, SKILL.md's contract-violation row stops demanding an owner module for a bullet that is not about ownership, and .github/copilot-instructions.md names which of the size cases blocks.

  • Linked issue(s): none

  • Tests: none -- rules, docs and skill prose only, no executable code. For D11: checked by hand that every rule resolves to an index row and no row names an undefined id, and that D11 sits on three rows a reviewer can match from files.txt and a diff skim. For D12: both Ruff invocations in the rule body were run against this tree -- --output-format concise reports the number, --force-exclude honours extend-exclude (remote_client.py stays silent), and git show <base>:<path> piped to ruff --isolated measures the base side. The SKILL.md rule count moved 53 -> 55 across the two commits.

  • Size/complexity triggers crossed: none

  • If this simplifies or refactors: n/a

  • Observable effect: a reviewer running review-pr now blocks on a value repaired at one consumer while its producer is untouched, where the fix(cli): export every --extra-env pin so all readers resolve it alike #1797 review returned "no blocking issues"; and on complexity above 20 in code the PR adds or makes worse, where before it could only ask. Nothing in CI changes -- C901 stays out of [tool.ruff.lint] select and Pylint stays --errors-only.

  • Breaking changes: no

  • PR addresses single concern: no -- two review rules land together. D11 was already on the branch and pushed when the D12 work started; splitting them now costs a rebase for no reviewer benefit.

  • Root cause is upstream: no

…inside one consumer

#1797's first version made --extra-env pins visible by re-merging the CLI
handoff blob inside agentx_env_for_conc. The review passed it: the body's
stated cause matched the data flow, and V3 exempts a fix that is merely
narrower than the reviewer would have written. But every other reader kept
its bare os.environ.get, so a pinned HYPERLOOM_AGENTIC_BACKEND selected the
MLPerf client while the grading axis, the persisted backend identity and the
benchmark timeout still resolved aiperf -- a session that REVERTed every
round. The producer fix, exporting each pin, corrected all of them without
changing a reader.

D11 is D10's dual: D10 is a concern copied beside its caller while an owner
exports it, D11 is an owner that exists but does not publish, compensated for
downstream. V3's exemption now names the boundary so narrowness stays taste
while a second resolution point blocks.
@xiaofei-zheng
xiaofei-zheng requested a review from a team as a code owner October 10, 2026 11:56
…nits

The three size numbers were review triggers only, so a reviewer could ask for
a split but not require one. 20 is the point where the trigger's accepted
answer ("this is one dispatch table") stops being checkable by reading. The
gate compares head against the merge base so the 124 units already above 20
stay backlog rather than becoming the next PR's debt.

review-pr carries it as D12; AGENTS.md and the style guide carry the rule it
cites, since blocking findings must name a bullet the repo states outright.
@xiaofei-zheng xiaofei-zheng changed the title review-pr: add D11 -- repair a value at its producer, not inside one consumer review-pr: add D11 and D12, and make complexity above 20 a gate Oct 10, 2026

@chaojhou chaojhou left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @xiaofei-zheng. D11 reads well: the trigger, the producer-versus-consumer test and the exceptions are clear, and the V3 boundary now points at it. The AGENTS.md, style guide, SKILL.md and Copilot edits agree with each other, and the rule count is right.

Requesting changes for one must-fix, in D12.

D12 keys the head/base comparison on the function name within the same path

rules.md:755 measures "the same paths at base.txt" and matches "per function name", and :768 fires on "present at head and absent at base". Ruff's C901 message carries only the bare name, with no class, so two cases go wrong:

  • A move or rename reads as a new function, and blocks.
    • Moving an existing complexity-25 function into another module, or renaming it, leaves it absent at that path in the base. So D12 fires on a change that added no branch at all.
    • With 124 units above 20 in the tree, that blocks exactly the splits the style guide asks for (§ Size and complexity: structure the split along the boundaries the code already has).
    • It also contradicts the rule's own premise that the backlog is not the next PR's debt.
  • Same-named functions in one file can't be told apart.
    • Two classes that each have a run, an __init__ or a nested _inner produce C901 lines that look the same.
    • So a new B.run at 22 can be matched to an existing A.run at 25 and stay silent, or the other way round.

Suggested fix:

  • Find the base side by the function's origin, not its head path. Follow git diff -M renames, or grep the base tree for the def, before calling it absent.
  • Key the match on the class-qualified name (or the name plus its order of occurrence), not on the bare name.
  • Add the same exemption in two places, Not a finding when (:778) and the style guide's Complexity ceiling (docs/contributing/style-guide.md:82): a function that was moved or renamed without raising its number.

@chaojhou
chaojhou dismissed their stale review October 10, 2026 12:59

Withdrawn: approving instead; the D12 points are follow-up suggestions, not blockers.

@chaojhou chaojhou left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. The strict bar is the point of D12, so I'm withdrawing my change request. The two points below are suggestions for a follow-up, not blockers:

  • Moves and renames.
    • The comparison looks up the same path at the base, so a function that is moved or renamed without a new branch reads as added.
    • Either state that moving a function above 20 requires splitting it, or exempt a move that does not raise the number.
    • As written, the measurement and the text ("not this PR's debt") disagree, and an automated reviewer will follow the measurement.
  • Same-named functions. Ruff's C901 line carries only the bare name, so two run methods in one file can be matched to each other. Keying on the class-qualified name closes that gap.

@chaojhou
chaojhou merged commit 880c167 into main Oct 10, 2026
14 checks passed
@chaojhou
chaojhou deleted the feature/xiaofei/review-pr-cc-gate branch October 10, 2026 13:00
zoroyihan7 added a commit that referenced this pull request Oct 10, 2026
Resolve the docs conflicts with #1811's complexity ceiling: the review
ceiling stays, and the code-metrics gate is described as stricter inside
its scope.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants