Skip to content

scripts/repo_shape.py: the four functions Sonar flagged for cognitive complexity are split along the decisions they already enumerate, and the largest of them reads as the line grammar it implements (#135) - #143

Merged
brettheap merged 5 commits into
mainfrom
refactor/repo-shape-cognitive-complexity
Sep 12, 2026

Conversation

@brettheap

@brettheap brettheap commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openreposhape-2 (openRepoShape-2)
Claim: #135 (comment)

Closes #135.

What was wrong

SonarCloud reported python:S3776 — Cognitive Complexity of functions should
not be too high
, limit 15 — against four functions in scripts/repo_shape.py,
the digest-pinned, dependency-free module every validator and every shipped
script imports. At main d682127:

scripts/repo_shape.py 360  from 71 to the 15 allowed   _tokenise
scripts/repo_shape.py 469  from 17 to the 15 allowed   _parse_mapping
scripts/repo_shape.py 1015 from 28 to the 15 allowed   NamingPolicy.resolve_referent
scripts/repo_shape.py 1159 from 49 to the 15 allowed   NamingPolicy.classify

_tokenise was the largest function in the repository by that measure. It
carried the whole block-scalar reader inline — a nested line-swallowing loop,
the folded-scalar fold and both chomping indicators — on top of the tab
refusal, the document-marker rule, the - peeling loop and two more
refusals. classify decided seven branches in one body and built each
branch's --explain sentence in place, so the ORDER of the decision, which is
the whole rule it implements and which its own docstring enumerates in seven
numbered lines, could not be read without reading the wording of every answer
on the way past. resolve_referent answered five separate questions at once,
and _parse_mapping spelled the three answers to "what is a bare key:
worth" as a nested ladder inside its loop.

What landed

scripts/repo_shape.py and nothing else — it is DIGEST-PINNED, so this
shows as upstream-changed scripts/repo_shape.py in every project's
update-shape.py check until an estate re-pin. No other file in the
repository is touched; no public name, signature or default changes; the
module stays Python 3.9-safe and standard-library only.

Four commits, one per flagged function. Each split follows the decisions the
function already enumerated, in the order it enumerated them, and each new
helper carries a WHY docstring in the file's voice saying what it decides and
that it was split from its parent for this issue.

function cc before cc after how it was split
_tokenise 71 9 one helper per step of the line grammar, in the order it is decided: _significant_text (tab refusal, blank and comment lines), _document_marker, _peel_dashes, _refuse_unsupported, _opens_block_scalar, _block_scalar_body, _fold_block_body, _block_scalar_text. The header pattern becomes a compiled _BLOCK_HEADER_RE, spelled the way _DASH_RE and every other pattern in this file already is.
_parse_mapping 17 10 the nested ladder answering "what is a key: with nothing after the colon worth" becomes _nested_value, whose docstring says why a sequence is admitted at the key's own column and a mapping is not.
NamingPolicy.resolve_referent 28 7 _pinned_basenames, _chain_links, _referent_in, _link_declarations, _chain_link_findings, _unverified_note, and the method _chain_shape_problem, which needs the policy's own chain_rule() and asks its four questions in the order the parent asked them. directly() and broken() stay where they are, so a reader who wants to know how a STATUS is chosen still finds the whole of that in one function.
NamingPolicy.classify 49 13 each branch becomes a helper returning an answer's INGREDIENTS, (family_id, role_id, reason, matched_key): _unambiguous_answer and _descendant_answer as methods (they read the family's own admits_declared_role:), plus _leg_answer, _descendant_reason, _forms_by_family, _leg_roles and _other_forms. None of them builds a Classification — classify's own answer() closure stays the single place also_matches is computed.

cc before is SonarCloud's own number for that line; cc after is
complexipy's, which implements the same SonarSource specification and
additionally counts comprehensions, so it reads at or above Sonar's. The
highest cognitive complexity left in the file is 9 for a helper
(_tokenise itself), and every new helper is at 8 or below.

Three comments became docstrings, because the code they annotated became a
function of its own: the 2026-09-05 neutral-product ruling and why its or ()
fallback is deliberately stricter than the descendant branch's
or ("assembly",) now sit on _unambiguous_answer; the 2026-09-02
descendant-carries-legs ruling on _descendant_answer; NAME THE LINK on
_leg_answer. The role clause a descendant's reason ends with was spelled
twice, in the chain branch and the direct-pin branch; _descendant_reason
reaches it by one path and spells it once.

The rule orders the rest of the standard rests on are byte-identical.
resolve_link_source's four rules are untouched — rule 2's environment
override still sits ahead of rule 3's sibling checkout (#114, #120, #126).
checked_value and SAFE_PATH_RE are untouched (#119's accepted security
disposition). pin_source_env_name and PIN_SOURCE_ENV_PREFIX, which
tests/conftest.py imports, are untouched. A recorded chain is still read
before the direct pin; a broken chain beside a direct pin still answers
direct with the chain reported as a warning; an unreadable link is still
declared-unverified rather than a failure.

How it was proven

Two differential harnesses against origin/main's module, both loading
this module and d682127's side by side in one interpreter and comparing the
returned value — or the exception type AND message — for every input:

  • the YAML reader over every .yaml and .yml file in the tree plus fifty
    crafted edge cases (both chomping indicators, an explicit indentation
    digit, a folded body ending blank, a folded body beginning blank, >= 3 as
    an ordinary scalar, a block scalar at end of file, blank lines inside and
    after a block body, peeled dash chains, two documents, ..., a tab in the
    indentation, a tab inside a quoted scalar, an escaped Windows path, anchors,
    aliases, tags, explicit keys, merge keys, CRLF): 64 cases, 0 differences.
  • the naming policy over 31 names x 6 declared roles x 11 pin sets x 11
    recorded chains x 8 link-pin mappings — 174,240 combinations, 0
    differences
    — comparing classify (the 2-tuple, family, role,
    also_matches and the reason sentence), resolve_referent (status,
    referent, chain, reason, warnings, unverified, reached, by_chain),
    matches, accepts_role and descendant_referents. The inputs include a
    chain longer than the policy admits, a repeated link, a chain beginning off
    the pins, one ending at a referent the name could not have, a link declaring
    nothing, a link that did not answer, and both the singular and the plural
    unverified notes.

The suite, from this worktree, in the foreground, in bounded chunks:
1136 passed, 1 skipped — tests/test_[a-f]*.py 328 passed 1 skipped;
tests/test_[g-r]*.py 387 passed; the four scaffold/setup files 186 passed;
test_shape_doctor.py + test_update_shape*.py + test_windows_paths.py 235
passed. That is the count main gives today. The four files the issue names
as load-bearing were run after every individual split as well:
tests/test_naming_policy.py (162), tests/test_shape_doctor.py (144),
tests/test_adopt_plan.py, tests/test_windows_paths.py.

No tool's --help text changed — scripts/repo_shape.py has no command line
— so docs/cli.md is unchanged and tests/test_cli_reference.py passes
unregenerated.

The PR-scoped SonarCloud query, at head 57feee5:

$ curl -s 'https://sonarcloud.io/api/issues/search?componentKeys=opensoft_openRepoShape&pullRequest=143&statuses=OPEN&ps=100'
total OPEN issues on PR 143: 0

No python:S3776 in this file and no new issue of any other rule — no
duplicated literal, no unused parameter, nothing in a new helper. The quality
gate is OK on all five conditions (reliability 1, security 1,
maintainability 1, duplicated lines 0.0%, security hotspots reviewed 100%).
CI green on all three platforms at that commit: ubuntu 3m29s, macOS 6m45s,
Windows 12m46s.

Reviewers. Codex: no major issues (at 81b0573). Sourcery: declined, its
own 7-day review budget is spent. Copilot: two rounds — round 1 raised one
documentation nit, taken in 57feee5; round 2 generated no new comments.

Left for later, deliberately

  • python:S1845 at scripts/repo_shape.py:831 (Rename method "reached" to prevent any misunderstanding/clash with field "REACHED") is open at
    main and stays open here. ReferentResolution.reached is read by name
    outside this module, so renaming it is a behaviour change and not this
    issue's; no issue is filed for it yet.
  • _flow reads 18 under complexipy and is NOT flagged by Sonar, which
    counts no comprehension and puts it at or below 15. It was not in the four
    this issue claims and is left alone rather than refactored on a local
    tool's number.
  • No defect was found while restructuring; nothing is left unfixed that was
    working before.

🤖 Generated with Claude Code

brettheap and others added 4 commits September 11, 2026 23:38
…t implements, one named helper per step, and its cognitive complexity is 9 rather than 71 (#135)

`_tokenise` was the largest function in the repository by SonarSource's
cognitive-complexity measure — 71 against a limit of 15 (`python:S3776`) —
because it carried the whole block-scalar reader inline: a nested
line-swallowing loop, the folded-scalar fold and both chomping indicators,
on top of the tab refusal, the document-marker rule, the `- ` peeling loop
and the explicit-key and merge-key refusals.

The rule that function implements is the ORDER those steps are decided in,
so each step is now a helper named after the question it answers —
`_significant_text`, `_document_marker`, `_peel_dashes`,
`_refuse_unsupported`, `_opens_block_scalar`, `_block_scalar_body`,
`_fold_block_body` and `_block_scalar_text` — and the loop that remains is
the order itself, at complexity 9. Every helper carries a WHY docstring
saying what it decides and that it was split from `_tokenise` for this
issue. The block-scalar header pattern moves to a compiled `_BLOCK_HEADER_RE`
beside the two functions that read the body it introduces, matching how
`_DASH_RE` and every other pattern in this file are already spelled.

NOTHING ABOUT THE OUTPUT CHANGES. Proven by a differential harness that
parses every `.yaml` and `.yml` file in the tree plus fifty crafted edge
cases — both chomping indicators, an explicit indentation digit, a folded
body ending blank, `>= 3` as an ordinary scalar, a block scalar at end of
file, peeled dash chains, two documents, a tab in the indentation, anchors,
aliases and tags — through this reader and through `origin/main`'s, and
compares the value or the exception type and message: 64 cases, 0
differences.

`scripts/repo_shape.py` is digest-pinned, so this shows as
`upstream-changed scripts/repo_shape.py` in every project's
`update-shape.py check` until an estate re-pin.

Lane: openreposhape-2 (openRepoShape-2)

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…what a bare `key:` is worth instead of spelling the three answers inline, and its cognitive complexity is 10 rather than 17 (#135)

`_parse_mapping` was at 17 against `python:S3776`'s limit of 15, and the
whole of the excess was one nested ladder: a `key:` with nothing after the
colon is a sequence at the key's own column or deeper, a mapping strictly
deeper than it, or null — three answers to ONE question, indented inside the
loop that reads the rest of the mapping.

That question is now `_nested_value`, whose docstring says why the two
admitted columns differ: `- ` markers are conventionally written flush with
the key they belong to, so a sequence is admitted at `>= indent`, while a
mapping at the key's own column is a SIBLING KEY and not a value. The loop
that remains reads as the four shapes a mapping entry can take.

NOTHING ABOUT THE OUTPUT CHANGES — the same comparisons in the same order,
moved. Proven by the same differential harness as the previous commit, which
parses every `.yaml` and `.yml` file in the tree plus fifty crafted edge
cases through this reader and through `origin/main`'s and compares the value
or the exception type and message: 64 cases, 0 differences.

Lane: openreposhape-2 (openRepoShape-2)

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…what it used to answer inline, and its cognitive complexity is 7 rather than 28 (#135)

`NamingPolicy.resolve_referent` was at 28 against `python:S3776`'s limit of
15. It answered five separate questions in one body: which pins a manifest
declares, which links a chain records, whether the chain's SHAPE holds (four
checks), what each link's own tree says about the next one, and how to word
the note when a link could not be read.

Each is now its own function, named for the question — `_pinned_basenames`,
`_chain_links`, `_referent_in`, `_link_declarations`,
`_chain_link_findings`, `_unverified_note`, and the method
`_chain_shape_problem`, which needs the policy's own `chain_rule()`. NONE OF
THE MODULE-LEVEL ONES KNOWS WHAT A `ReferentResolution` IS, deliberately:
`directly()` and `broken()` stay where they are, so a reader who wants to
know how a STATUS is chosen still finds the whole of that in one function.
`_chain_shape_problem` asks its four questions in the order `resolve_referent`
asked them, and returns the `detail` a `broken` resolution is worded with, so
the message still NAMES the link that broke.

The rule order that the rest of the standard rests on is untouched: a
recorded chain is still read before the direct pin, a broken chain beside a
direct pin still answers `direct` with the chain reported as a warning, and
an unreadable link is still `declared-unverified` rather than a failure.

NOTHING ABOUT THE OUTPUT CHANGES. Proven by a differential harness that runs
`resolve_referent`, `classify`, `matches`, `accepts_role` and
`descendant_referents` through this module and through `origin/main`'s over
174,240 combinations of 31 names x 6 declared roles x 11 pin sets x 11
recorded chains x 8 link-pin mappings — including a chain longer than the
policy admits, a repeated link, a chain beginning off the pins, one ending
at a referent the name could not have, a link declaring nothing, a link that
did not answer, and the singular and plural unverified notes — comparing
status, referent, chain, reason, warnings and unverified entries: 0
differences.

Lane: openreposhape-2 (openRepoShape-2)

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…n answer's INGREDIENTS to the one closure that builds a Classification, and its cognitive complexity is 13 rather than 49 (#135)

`NamingPolicy.classify` was at 49 against `python:S3776`'s limit of 15. It
decided seven branches in one body and built each branch's `--explain`
sentence in place, so the ORDER of the decision — which is the whole rule
this classifier implements, and which its docstring enumerates in seven
numbered lines — could not be read without reading the wording of every
answer on the way past.

Each branch is now a helper that returns an answer's INGREDIENTS,
`(family_id, role_id, reason, matched_key)`: `_unambiguous_answer` and
`_descendant_answer` as methods, because they read the family's own
`admits_declared_role:`, and `_leg_answer`, `_descendant_reason`,
`_forms_by_family`, `_leg_roles` and `_other_forms` as functions.

NONE OF THEM BUILDS A `Classification`. `classify`'s own `answer()` closure
stays the single place `also_matches` is computed, because a branch that
built its own classification would be a second place for that record to be
got wrong — and `also_matches` contradicting the family a name was
classified INTO is precisely the failure `matched_key` exists to prevent.
What remains in `classify` is the seven-step order its docstring already
describes.

Two comments became docstrings where the code they annotated became a
function of its own: the 2026-09-05 neutral-product ruling and why its
`or ()` fallback is stricter than the descendant branch's `or ("assembly",)`
now sit on `_unambiguous_answer`, the 2026-09-02 descendant-carries-legs
ruling on `_descendant_answer`, and NAME THE LINK on `_leg_answer`. The
role-clause sentence a descendant's reason ends with was spelled twice, in
the chain branch and the direct-pin branch; `_descendant_reason` reaches it
by one path and spells it once.

NOTHING ABOUT THE OUTPUT CHANGES. Proven by the same differential harness as
the previous commit, running `classify`, `resolve_referent`, `matches`,
`accepts_role` and `descendant_referents` through this module and through
`origin/main`'s over 174,240 combinations of 31 names x 6 declared roles x 11
pin sets x 11 recorded chains x 8 link-pin mappings, comparing the 2-tuple,
the family, the role, `also_matches`, the reason sentence and the whole
referent resolution: 0 differences.

Lane: openreposhape-2 (openRepoShape-2)

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 12, 2026 14:43
@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 2 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Sep 12, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR restructures the four Sonar-flagged functions in the digest-pinned scripts/repo_shape.py along their existing decision boundaries, introducing focused helpers and preserving public APIs, rule ordering, Python 3.9 compatibility, and behavior. Review should focus on helper boundaries and the exact preservation of YAML grammar, chain-validation precedence, classification order, reason text, and role-admission edge cases; differential harnesses and the full test suite report no behavioral differences.

Sequence diagram for referent chain resolution

sequenceDiagram
    participant C as classify
    participant R as NamingPolicy.resolve_referent
    participant S as _chain_shape_problem
    participant F as _chain_link_findings
    participant N as _unverified_note
    C->>R: resolve_referent(name, declared_pins, referent_chain, link_pins)
    R->>R: _pinned_basenames(declared_pins)
    R->>R: _referent_in(referents, pins)
    R->>R: _chain_links(referent_chain)
    alt chain has invalid shape
        R->>S: _chain_shape_problem(name, chain, pins, referents)
        S-->>R: problem detail
    else chain shape is valid
        R->>F: _chain_link_findings(chain, link_pins)
        F-->>R: contradiction, warnings, unverified
        R->>N: _unverified_note(unverified)
        N-->>R: reason suffix
    end
    R-->>C: ReferentResolution
Loading

Flow diagram for the refactored YAML line grammar

flowchart TD
    A[_tokenise] --> B[_significant_text]
    B --> C[_document_marker]
    C --> D[_peel_dashes]
    D --> E[_refuse_unsupported]
    E --> F{_opens_block_scalar}
    F -->|yes| G[_block_scalar_body]
    G --> H[_block_scalar_text]
    H --> I[Append block record]
    F -->|no| J[Append ordinary record]
Loading

Flow diagram for naming classification decision order

flowchart TD
    A[classify] --> B[matches]
    B --> C[_forms_by_family]
    C --> D[_leg_roles]
    D --> E{_unambiguous_answer}
    E -->|answer| Z[answer closure builds Classification]
    E -->|none| F{Declared-only form requested}
    F -->|yes| Z
    F -->|no| G{Claimed descendant reached or referent not required}
    G -->|yes| H[_descendant_answer]
    H --> I[_descendant_reason]
    I --> Z
    G -->|no| J[_leg_answer]
    J -->|answer| Z
    J -->|none| K[Fallback classification]
    K --> Z
    Z --> L[_other_forms computes also_matches]
Loading

File-Level Changes

Change Details Files
Decomposed YAML tokenisation and scalar parsing into ordered grammar helpers while preserving parsing behavior.
  • Extracted line filtering, document-marker handling, dash peeling, unsupported-construct checks, block-scalar detection, body collection, folding, and chomping.
  • Added a compiled block-header pattern and reduced _tokenise to the line-grammar orchestration.
scripts/repo_shape.py
Extracted the bare-mapping-value decision from the mapping parser.
  • Moved sequence, nested mapping, and null-value selection into _nested_value without changing indentation rules.
scripts/repo_shape.py
Separated referent-resolution data preparation and chain validation from status construction.
  • Extracted pin/link normalization, chain-shape checks, link-declaration findings, and unverified-note formatting.
  • Kept resolution status precedence and externally visible result fields intact.
scripts/repo_shape.py
Refactored naming classification into branch-specific answer helpers while retaining centralized classification construction.
  • Extracted form grouping, leg-role selection, overlap calculation, unambiguous and descendant answers, descendant reasons, and residual leg handling.
  • Preserved decision order, role-admission fallbacks, reason text, and also_matches computation.
scripts/repo_shape.py
Validated the refactor through differential and regression testing.
  • Compared YAML behavior across 64 cases and naming-policy behavior across 174,240 combinations against the prior module with no differences.
  • Ran the repository suite with 1136 passed and 1 skipped; left unrelated Sonar and local complexity findings unchanged.
scripts/repo_shape.py

Assessment against linked issues

Issue Objective Addressed Explanation
#135 Refactor _tokenise and _parse_mapping to reduce their cognitive complexity by extracting the existing YAML line-grammar, block-scalar, and nested-value decisions without changing parsing behavior. ✅
#135 Refactor NamingPolicy.resolve_referent and NamingPolicy.classify into decision-specific helpers while preserving rule order, classifications, reasons, warnings, exception behavior, and public interfaces. ✅
#135 Ensure the refactoring remains Python 3.9-compatible, standard-library-only, and does not alter dependent behavior or the repository's load-bearing naming and shape rules. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

A documentation nit remains, and the broad refactor warrants human review.

Pull request overview

Refactors four high-complexity functions in scripts/repo_shape.py into focused helpers while preserving behavior and public APIs.

Changes:

  • Extracted YAML tokenization and block-scalar handling.
  • Simplified mapping and referent resolution.
  • Split naming classification branches.
  • Preserved rule ordering and Python 3.9 compatibility.
File summaries
File Summary Review note
scripts/repo_shape.py Refactors parser and naming-policy complexity. Nit (1 vote): Update the helper docstring to describe both supported paths.
Review details

Suppressed comments (1)

scripts/repo_shape.py:1595

  • This helper is also called when the descendant policy does not require a referent (classify passes declared=None in that case), and _descendant_reason returns the “this policy does not require a referent” explanation. The docstring therefore describes only one of the helper's two supported paths; please state that it handles either a reached referent or a policy that does not require one.
        """The answer for a descendant claim that REACHED its referent.
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 81b05730bc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…ths that reach it, not only the one where a referent was reached (#135)

Copilot's review of #143 is right. The helper's first line said "a descendant
claim that REACHED its referent", but `classify` also enters this branch when
the policy's descendant family does not require a referent at all —
`if claimed and (declared or not self.requires_referent("domain-descendant"))`
— and on that path `declared` is None and `_descendant_reason` returns
"descendant form (this policy does not require a referent)". The docstring
described one of the two supported paths and left a reader to discover the
other from the caller.

A comment-only change; no code, no behaviour, no test.

Lane: openreposhape-2 (openRepoShape-2)

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI review requested due to automatic review settings September 12, 2026 15:05
@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openreposhape-2 (openRepoShape-2)

Copilot round 1, one finding, taken — 57feee5.

Taken. _descendant_answer's docstring describes only one of the helper's two supported paths. Correct. classify enters that branch on if claimed and (declared or not self.requires_referent("domain-descendant")), so the helper is also reached with declared=None when the policy's descendant family requires no referent, and _descendant_reason then returns "descendant form (this policy does not require a referent)". The first line now reads "a descendant claim `classify` decided to honour" and the paragraph under it names both paths and says which one leaves declared as None. Comment-only; no code, no behaviour, no test.

Sourcery declined (own 7-day review budget spent, 2 days 2 hours to reset) and Codex found no major issues on 81b0573 — both before this commit, whose only change is that docstring.

The PR-scoped Sonar query at 81b0573 returned 0 open issues of any rule, the four python:S3776 findings included, and the gate passed. CI was green on all three platforms at that commit (ubuntu 3m27s, macOS 7m48s, Windows 10m45s).

@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The broad parsing and naming-policy refactor warrants final human review despite passing tests.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openreposhape-2 (openRepoShape-2)

Copilot round 2 at 57feee5: 0 new comments, no findings — the review body asks only for final human review of a broad refactor, which is a disposition and not something to fix. No inline comment threads exist on this PR at all (pulls/143/comments is empty), so round 1's nit was answered in the commit and in the comment above it.

Re-verified at 57feee5: PR-scoped Sonar 0 open issues of any rule, gate OK on all five conditions; CI green on ubuntu (3m29s), macOS (6m45s) and Windows (12m46s). Suite from the worktree, in bounded chunks: 1136 passed, 1 skipped.

Two rounds, one finding, taken. Nothing further from this lane — the orchestrator merges.

🤖 Generated with Claude Code

@brettheap
brettheap merged commit c224971 into main Sep 12, 2026
6 checks passed
@brettheap
brettheap deleted the refactor/repo-shape-cognitive-complexity branch September 12, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants