Skip to content

feat(review): add versioning carve-out, drift, and ordering bars to code-quality - #183

Merged
kyle-sexton merged 6 commits into
mainfrom
feat/code-quality-bars
Jul 18, 2026
Merged

feat(review): add versioning carve-out, drift, and ordering bars to code-quality#183
kyle-sexton merged 6 commits into
mainfrom
feat/code-quality-bars

Conversation

@kyle-sexton

Copy link
Copy Markdown
Contributor

What

Three additions to conventions/review/code-quality.md. A carve-out on the version-qualifiers bar: qualifiers are legitimate only under External contract or Production obligation exposure per the legacy-and-migration-debt.md classifier (versioned public APIs and published message contracts qualify; contract evolution itself stays owned by messaging.md and architecture.md), with internal V2 identifiers as temporary expand-and-contract states — Important when unreasoned — and a Suggestion-tier, non-prescriptive metadata-over-URL preference. A stale-descriptor drift bar in Authoring hygiene: a behavior change leaving comments, docs, names, or examples describing the old behavior (Suggestion inline; Important for user-facing or operator docs), now the single owner of comment-staleness (the "false current fact" clause moved here from the comments bar). An alphabetical-by-default ordering bar in Style for order-independent enumerable sets, with semantic and community-prescribed orders winning and tool-sortable surfaces routed to the enforcement-escalation path.

Phase 4 of the criteria-backlog program — #179 tracks the full sequence.

Reconciliation checklist

  • Cross-doc reconciliation run; checked-not-contradicted: ../engineering/legacy-and-migration-debt.md (classifier cited with exact tier tokens, not restated), messaging.md and architecture.md (contract-evolution ownership pointed at, not restated), ../engineering/enforceability-tiers.md (tool-sortable routing cited), code-design.md (no overlap with its cross-unit scope).
  • REVIEW.md checked-not-contradicted; the add-a-line decision is deliberately batched at program Phase 6 (Criteria-backlog authoring program: timebombs, date-time, atomicity, hygiene bars (7 phases) #179), not made per-PR.
  • Fresh-context reviewer agent run on this diff: 0 Critical, 3 Important, 2 Suggestions. Four applied (exact classifier tier tokens; explicit Important severity for the unreasoned internal-V2 case; staleness ownership consolidated into the new drift bar; section-anchored escalation link). One declined with reason: moving the metadata-over-URL note to architecture.md — the note exists to answer "what instead of a v2 identifier" at the point of flagging, the plan locked it to this bar, and architecture.md is edited by the in-flight Phase 5 branch.
  • npm run lint:md green; sanity checks pass (alphabetical, exposure, expand-and-contract greps all ≥ 1).
  • Citations are repo-internal pointers by design; no new external facts introduced.

🤖 Generated with Claude Code

https://claude.ai/code/session_019LAz83zmsgyd4cTCKuYtS6

Related

No linked issue: this PR advances the criteria-backlog program without closing it.

kyle-sexton and others added 2 commits July 17, 2026 22:03
…ode-quality

Versioning carve-out: qualifiers legitimate only under External-contract
or Production-obligation exposure per the legacy-and-migration-debt
classifier; internal V2 identifiers are temporary expand-and-contract
states. Stale-descriptor drift bar in Authoring hygiene. Suggestion-tier
alphabetical-ordering bar in Style with the tool-sortable escalation path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019LAz83zmsgyd4cTCKuYtS6
Exact classifier tier tokens, explicit Important severity for the
unreasoned internal-V2 case, staleness ownership moved wholly to the
stale-descriptor bar, and a section-anchored escalation link.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019LAz83zmsgyd4cTCKuYtS6

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c163448d6c

ℹ️ 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".

Comment thread conventions/review/code-quality.md Outdated
@claude

claude Bot commented Jul 18, 2026

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 3m 19s —— View job


Review

  • Gather context (PR diff, changed file, AGENTS.md, REVIEW.md)
  • Assess Codex P1 finding (missing primary-source citations)
  • Review new bars for correctness, internal consistency, and alignment with project standards
  • Post findings

Three changes in scope: the alphabetical-ordering bar added to Style; the version-qualifiers bar expanded with the carve-out and mechanism preference; a stale-descriptor bar added to Authoring hygiene with ownership of the "false current fact" moved here from the comments bar.

On the Codex P1 (missing primary-source citations)

Partially confirmed, but narrowed.

AGENTS.md says: "New or changed review criteria are authored fresh from primary sources and cite them." The Sources section is unchanged across all three additions.

Alphabetical ordering — this is the one with a real gap. The criterion is sound but has no traceable primary external source. It's not covered by Fowler/Martin/Ousterhout (the existing three). A community style guide (e.g., a PEP, a Google Style Guide section) would supply it; none is cited. This criterion is new enough that the AGENTS.md rule applies squarely.

Version qualifiers carve-out — the expand-and-contract concept is already covered by the Fowler & Beck cite; the exposure classifier it references lives in legacy-and-migration-debt.md which is an internal normative cross-reference (not a new external source). No gap for existing sources.

Stale-descriptor bar — traceable to Clean Code (Ch. 4 principles on comment honesty, keeping code and its documentation in sync), already cited. No new external source needed.

So the Codex finding is accurate in identifying a gap, but overstates it as covering all three bars. The concrete deficit is: the alphabetical-ordering bar lacks a primary external source in the Sources section. Fix this →

Severity: Suggestion — AGENTS.md's requirement is real, but alphabetical ordering is a universal convention without one canonical source (unlike a named Fowler pattern). A style guide citation would satisfy the letter; whether the spirit requires it here is a judgment call for the author.


Correctness and consistency checks

README.md#enforcement-escalation link on line 34 — valid. The heading ## Enforcement escalation exists in conventions/review/README.md line 49 and resolves to the #enforcement-escalation anchor under GFM rules. No broken link.

Staleness ownership transfer — clean. The comments bar (line 32) now reads "a comment left stating a false current fact belongs to the stale-descriptor bar under Authoring hygiene"; the stale-descriptor bar (line 40) owns the check. No duplication; pointer is unambiguous.

Version qualifiers severity — the carve-out correctly applies Important only for the specific internal-V2 case where there is no recorded reasoning or removal path. This is consistent with the severity-shift pattern used elsewhere (e.g., magic literals: "Usually Suggestion; Important when…").

Mechanism preference placement — the Suggestion-tier URL/metadata note lives inside the version-qualifiers bar. The PR description records the deliberate decision not to move it to architecture.md because the in-flight Phase 5 branch edits that file. That tradeoff is documented; nothing in the current bar contradicts architecture.md or messaging.md.

Expand-and-contract reference — grounded. legacy-and-migration-debt.md line 41 also uses and defines the pattern; Fowler & Beck (already cited) is the authoritative source.


Overall

The three additions are internally consistent, cross-doc references check out, severity assignments follow the file's established patterns, and the ownership consolidation of stale-descriptor is correct. One substantive gap: the AGENTS.md-required primary source citation for the alphabetical-ordering bar is missing from the Sources section.

Google C++ include-order and Java import-order guides, anchor-verified,
inline and in Sources per the AGENTS.md primary-source requirement.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019LAz83zmsgyd4cTCKuYtS6

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ee4159e33

ℹ️ 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".

Comment thread conventions/review/code-quality.md Outdated
@claude

claude Bot commented Jul 18, 2026

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 2m 16s —— View job


Review

  • Load tools
  • Read changed file and diff
  • Assess Codex P2 finding against current file state
  • Post findings

On the Codex P2 finding

Not confirmed as a genuine gap. The P2 finding repeats the same structural complaint as P1 ("only internal cross-doc pointers") without accounting for the existing Sources coverage. Here is the per-item breakdown:

Versioning carve-out + internal-V2 severity rule
Both build on the expand-and-contract concept. That concept is defined in legacy-and-migration-debt.md line 41 and its authoritative external source is Fowler & Beck (Refactoring), already in Sources. No new concept is introduced; the carve-out is a policy refinement of an existing rule that already had primary-source provenance.

URL-versioning preference (prefer headers/media type over URL paths)
Marked Suggestion, explicitly non-prescriptive, and the text itself acknowledges URL versioning as "a widely-adopted convention." This is editorial guidance rather than a normative rule, so the AGENTS.md "cite primary sources" requirement applies with less force here than it did to the alphabetical-ordering bar. A Roy Fielding / RFC 7231 content-negotiation cite would be the natural one if the author wants it, but it is not a clear deficit.

Stale-descriptor bar
Directly traceable to Clean Code Ch. 4 ("Comments"), which argues that comments that contradict the code are worse than no comments at all. The Martin citation is already in Sources (Ch. 3 and Ch. 10 listed). Ch. 4 is the precise chapter — see below.


P1 fix verification

Commit 5ee4159 added inline hyperlinks to the Google C++ and Java style guide pages inside the alphabetical-ordering bar text (line 34) and added a corresponding entry to the Sources section (line 51). The fix is correct — inline anchors link to the exact style guide sections (C++ include ordering, Java import ordering in ASCII sort order) and the Sources entry matches.


One Suggestion: Martin citation missing Ch. 4

Sources, line 49:

Martin, *Clean Code* — Ch. 3 (function arguments), Ch. 10 (classes)

The stale-descriptor bar is most precisely grounded in Clean Code Ch. 4 (Comments), where Martin argues that inaccurate comments are actively harmful. Adding Ch. 4 (comments) to this entry would make the traceability explicit and preempt any future Codex pattern-match of the same kind. Suggestion only — the source is already present; this is a chapter annotation. Fix this →


Overall

The three additions are correct and internally consistent. The P1 fix is properly applied. The Codex P2 finding is not substantiated — the versioning and stale-descriptor criteria are already covered by existing citations; the URL-versioning preference is Suggestion-tier editorial guidance that sits below the threshold where a missing external cite is a clear requirement. The only actionable item is the Martin Ch. 4 annotation, which is a Suggestion-level precision improvement rather than a blocking gap.

Microsoft API design guidance for the versioning-mechanism landscape,
Clean Code Ch. 4 named for stale-comment coverage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019LAz83zmsgyd4cTCKuYtS6

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 89d8a77a7f

ℹ️ 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".

Comment thread conventions/review/code-quality.md Outdated
@claude

claude Bot commented Jul 18, 2026

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 1m 46s —— View job


Review

  • Load tools
  • Read changed file at HEAD and conventions/engineering/code-organization.md
  • Assess latest Codex P2 finding (internal-V2 conflict with code-organization.md:39)
  • Post findings

On the Codex P2 finding (line 38: internal-V2 clause)

Confirmed. The conflict is genuine.

The relevant texts:

code-quality.md:38 (new bar):

"An internal V2 identifier is a temporary expand-and-contract state: flag it — Important when it carries no recorded reasoning or removal path."

code-organization.md:39:

"There is no versioning of internal surfaces — no parallel old-and-new entry points, no v2 alongside v1. Version control holds the history; the change replaces the surface rather than duplicating it. (Externally published contracts — packages, HTTP APIs — are the exception and follow expand-and-contract…)"

Two specific problems in the current wording:

1. Expand-and-contract is the wrong frame for internal surfaces.
code-organization.md explicitly reserves expand-and-contract for externally published contracts (packages, HTTP APIs) and points to architecture.md for that. By calling the internal-V2 "a temporary expand-and-contract state," the review criterion borrows a pattern the engineering rule expressly withholds from internal surfaces. A reviewer can read this as "internal V2 is just like a public API migration in progress," which is exactly what code-organization.md rules out.

2. The conditional severity is the operative conflict.
"Important when it carries no recorded reasoning or removal path" implies that with a documented removal path, the finding is lower severity — Suggestion, or perhaps just a passing note. But code-organization.md is unconditional: internal surfaces are replaced atomically, not versioned. A removal plan doesn't make the identifier acceptable; it means someone is aware of a rule violation and intends to fix it. That is still a finding — urgency changes, not whether there is a finding.

A reviewer who reads the current bar and sees a UserServiceV2 with a Jira ticket attached could in good faith rate it Suggestion and not block. That is the doctrinal gap Codex identified.


Suggested rewrite for the internal-V2 clause

Replace:

An internal V2 identifier is a temporary expand-and-contract state: flag it — Important when it carries no recorded reasoning or removal path.

With something like:

An internal V2 identifier signals an incomplete atomic refactor — ../engineering/code-organization.md disallows parallel internal versioning; flag as Important. Where a removal path is already tracked, note it but do not reduce severity.

This removes the expand-and-contract framing, makes Important unconditional, and gives reviewers the right action when a ticket exists (note it, not drop the finding).

Severity: Important — the current wording lets code-organization.md:39 be effectively bypassed at review time whenever a developer has a sunset comment or ticket linked.

Fix this →


Everything else

The rest of the diff is clean: the alphabetical-ordering bar, the stale-descriptor bar, staleness ownership transfer from comments, source additions (Google style guides, Microsoft API design guidance, Martin Ch. 4), and the exposure carve-out for the version-qualifiers bar all hold up. The only substantive issue is this internal-V2 clause.

Internal surfaces are never versioned per code-organization.md; a V2
identifier is tolerated only as transient expand-and-contract state of
an external contract, still flagged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019LAz83zmsgyd4cTCKuYtS6

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f7dd76fea4

ℹ️ 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".

Comment thread conventions/review/code-quality.md Outdated
@claude

claude Bot commented Jul 18, 2026

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 1m 48s —— View job


Review

  • Load tools
  • Read changed file at HEAD and assess latest Codex P2 finding (line 40: stale-descriptor coverage gap)
  • Post findings

On the Codex P2 finding (line 40: stale-descriptor scope too narrow)

Confirmed. The gap is real.

Two relevant texts at HEAD:

code-quality.md:32 (comments bar):

"a comment left stating a false current fact belongs to the stale-descriptor bar under Authoring hygiene"

code-quality.md:40 (stale-descriptor bar):

"Stale descriptors after a behavior change — a change that alters behavior but leaves comments, docs, names, or examples still describing the old behavior."

The ownership transfer from the comments bar to stale-descriptor is correct in intent, but the stale-descriptor bar's trigger condition — "a change that alters behavior" — is strictly narrower than the concept it now owns. A docs-only or comment-only diff that introduces a false statement about current behavior does not fire the stale-descriptor trigger as written, even though the comments bar delegates exactly that case there.

Practical failure path: reviewer sees a docs-only PR update a comment to say something incorrect about the current code. Goes to comments bar → "false current fact → stale-descriptor." Goes to stale-descriptor → title says "after a behavior change," body says "a change that alters behavior." No behavior change in this diff. Reviewer may in good faith conclude the bar doesn't apply and not flag the false statement. That is the coverage gap.


Suggested fix:

Drop the behavior-change precondition from the bar. The fundamental problem — a descriptor that doesn't match actual behavior — is the same whether the mismatch was left behind by a refactor or introduced directly by a docs-only change. Suggested rewrite:

Stale descriptors — a descriptor (comment, doc, name, or example) that does not match current behavior: left behind by a behavior change, or independently introduced as inaccurate. The change is not complete until every invalidated descriptor is updated. Suggestion for an inline comment; Important where the stale descriptor is user-facing or operator documentation.

This satisfies the comments bar's delegation for "false current fact" without a behavior-change precondition, and remains compatible with the ownership consolidation already applied.

Severity: Suggestion — the gap is genuine but bounded to an uncommon PR type (docs-only changes that actively introduce false statements). The most common case (behavior change → forgotten update) is correctly covered by the current text; only the independent false-descriptor case falls through.

Fix this →


Everything else

The rest of the current file is clean: internal-V2 / code-organization.md alignment (previous P2), source citations for alphabetical ordering and Microsoft API guidance, Martin Ch. 4 annotation, staleness ownership transfer, and the exposure carve-out all hold up at HEAD. The only open item is this stale-descriptor scope narrowing.

Drift bar broadened to any edit introducing a descriptor false about
current behavior, closing the docs-only gap left when false-current-fact
ownership moved here from the comments bar.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019LAz83zmsgyd4cTCKuYtS6
@claude

claude Bot commented Jul 18, 2026

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 3m 1s —— View job


Review

  • Load tools
  • Read changed file at HEAD and diff
  • Read REVIEW.md for review criteria
  • Assess all four Codex-finding fixes
  • Check for any remaining issues
  • Post findings

Reviewed the file at HEAD (2f80c5a). All four Codex findings have been addressed correctly. Details below.

Fix verification

P1 — Alphabetical ordering citations (5ee4159)
Clean. The bar (line 34) now carries inline anchors to the Google C++ include-order and Java ASCII-sort-order import sections, and Sources (line 51) has the matching entry. AGENTS.md requirement satisfied.

P2 — Versioning mechanism and stale-descriptor sources (89d8a77)
Clean. Microsoft API design guidance added for the URL/header/media-type landscape; Martin Ch. 4 (line 49) now appears with the correct chapter annotation ("comments, including stale and misleading ones"). Both are precise matches to what the criteria actually invoke.

P2 — Internal-V2 / code-organization.md alignment (f7dd76f)
Confirmed fixed. The prior wording called an internal V2 "a temporary expand-and-contract state," which borrowed a pattern code-organization.md:39 reserves for externally published contracts. Current wording (line 38) scopes the tolerance explicitly — "tolerated only as transient mid-migration state inside an expand-and-contract rollout of an external contract" — which is consistent with code-organization.md's own carve-out ("Externally published contracts — packages, HTTP APIs — are the exception and follow expand-and-contract").

P2 — Stale-descriptor coverage gap (2f80c5a)
Confirmed fixed. The bar is now "Stale or false descriptors" (line 40) and covers both the standard case (behavior change → left-behind descriptor) and the independently-introduced false descriptor (docs-only / comment-only change). The comments bar pointer at line 32 ("a comment left stating a false current fact belongs to the stale-descriptor bar") is now fully satisfied — the delegation lands somewhere that covers it.


One residual Suggestion

Line 38 — severity condition could be read as applying outside the tolerated context

The sentence reads:

An internal V2 identifier is tolerated only as transient mid-migration state inside an expand-and-contract rollout of an external contract, and is still flagged — Important when it carries no recorded reasoning or removal path.

The conditional ("Important when…") strictly governs the tolerated case (mid-migration state for an external rollout). In that case the logic is sound: a tracked removal plan makes the transience credible, so the finding stays open but drops in urgency.

The potential read-across: a reviewer encountering an internal V2 that is not inside any external contract rollout — a straight rule violation per code-organization.md — might still apply the conditional and rate it Suggestion if a removal ticket exists. In the non-tolerated context, a removal path doesn't make the identifier acceptable; code-organization.md says the change replaces the surface, not that a sunset note downgrades the finding.

A one-clause addition would close this: e.g., after "still flagged — Important when it carries no recorded reasoning or removal path," add "(Important regardless when the identifier falls outside any active external contract rollout)." Suggestion only — the text's current structure already limits tolerance to the external-rollout context, and a careful reader reaches the same conclusion; the ambiguity arises only if the conditional is read in isolation.

Fix this →


Everything else

All clean: alphabetical-ordering Suggestion tier and escalation routing correct; staleness ownership consolidation consistent; Sources section complete with accurate chapter and section annotations; README.md#enforcement-escalation anchor resolves to line 49 of conventions/review/README.md; cross-doc references to legacy-and-migration-debt.md, code-organization.md, messaging.md, architecture.md, and enforceability-tiers.md verified against current file state.

@kyle-sexton
kyle-sexton merged commit f77c8f1 into main Jul 18, 2026
46 of 47 checks passed
@kyle-sexton
kyle-sexton deleted the feat/code-quality-bars branch July 18, 2026 05:07
kyle-sexton added a commit that referenced this pull request Jul 21, 2026
…#225)

Adopt the new zizmor SARIF-guard gating shipped in ci-workflows #183.
The zizmor lane now runs `--format=sarif` through the in-lane guard and
**blocks on any high-severity (SARIF `error`) workflow-security
finding** — template-injection, dangerous-triggers, unpinned-uses, etc.
— while lower severities still only annotate. Gating rides the existing
required `ci-status` lane: no code-scanning, no `security-events` grant,
no org-wide ruleset change.

## Changes
- `ci.yml`: bump the `zizmor.yml` pin to `31a5b76` and set
`fail-on-severity: high`; comment updated.
- `components/runner-policy/policy.json`: register the new runner-input
contract for `zizmor.yml@31a5b76` with `fail-on-severity` in
`allowedInputs` — `runner-policy` would otherwise reject the new pin +
input (its lane is in `ci-status`).

## Safety
Pre-flight `zizmor --persona=regular` (online) on this repo → **0 high
findings** (3 notes: 2 `adhoc-packages`, 1 `use-trusted-publishing`).
The `high` gate does not block existing workflows. `lint:runner-policy`
+ `test:runner-policy` (227/227) pass locally.

## Related
No related issue: rolls out the consumer-side opt-in for the gating
capability added in melodic-software/ci-workflows#183. The 3 remaining
note-level findings are a separate follow-up (documented-ignore / OIDC
trusted-publishing), below this gate's threshold.

Co-authored-by: Claude Opus 4.8 <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.

1 participant