Skip to content

Split the pinned-arm containment remedy by refusal code - #1049

Merged
brettheap merged 1 commit into
mainfrom
fix/pinned-arm-unresolvable-remedy
Sep 16, 2026
Merged

brettheap merged 1 commit into
mainfrom
fix/pinned-arm-unresolvable-remedy

Conversation

@brettheap

@brettheap brettheap commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openxfactory-2 (openXfactory-2)

Summary

_pinned_arm's resolve_in_root containment refusal reused ONE action
string for every refusal code -- "keep the pin record inside its root's
contracts/ directory rather than a symlink out of it" -- including the
unresolvable code (a symlink loop, an unreadable link, a malformed
path), for which "a symlink out of it" is not the defect. Surfaced by
Copilot on PR #1040 (rounds 1 and 8); RULED STANDS at landing because
the rule text already names the code and round 1 deliberately chose
one remedy string per remedy CLASS. #1046 files the remaining wording
gap as a standalone finding.

This PR branches the action string on the refusal code, wording only,
no behaviour change:

  • OUTSIDE_ROOT / OUTSIDE_BOUNDARY keep the existing remedy: "keep
    the pin record inside its root's contracts/ directory rather than a
    symlink out of it (document-lifecycle grammar)".
  • every other code (the unresolvable class) now gets: "make the pin
    record's path resolvable inside its root's contracts/ -- no symlink
    loop, no unreadable link, no malformed path (document-lifecycle
    grammar)".

EXPECTED_ACTIONS in tests/doc-health/test_families.py grows from
fourteen to fifteen pinned-arm strings (the FOURTEEN prose corrected to
FIFTEEN in both the docstring and the inline comment). The
self-looping-symlink (m) test in
tests/doc-health/test_tag_hygiene_pinned_targets.py
(test_a_self_looping_symlink_record_cannot_be_resolved_and_reads_nothing)
now asserts the new string; the two boundary-escape (m) tests
(test_a_candidate_symlink_leaving_the_repository_is_refused and
test_a_candidate_symlink_inside_the_repository_but_outside_contracts_is_refused)
keep the old one, since their refusal code is still
OUTSIDE_ROOT/OUTSIDE_BOUNDARY.

Code-only change; no OpenSpec packet (per brief).

Files changed

  • scripts/doc_health/families.py -- _pinned_arm: branch the hit(...)
    action string on the refusal code instead of one shared literal.
  • tests/doc-health/test_families.py -- add the new action string to
    EXPECTED_ACTIONS (14 -> 15 pinned-arm entries); FOURTEEN -> FIFTEEN
    in the docstring and inline comment.
  • tests/doc-health/test_tag_hygiene_pinned_targets.py -- update the
    self-looping-symlink (m) test's asserted action string; the two
    boundary-escape (m) tests are unchanged.

Validation

  • pytest -q tests/doc-health -p no:cacheprovider -- 1816 passed, 1
    skipped, 7 failed. The 7 failures are pre-existing and unrelated:
    test_ideation_readiness.py (x3) and test_readiness_dispatch.py
    (x1) hit a validator harness error, and test_sentinel_vocabulary.py
    (x2) / test_status_reader_real_lines.py (x1) raise
    carved_reach.CarveReachUnavailable because this fresh clone has no
    openDox/openXdox submodules materialized (git submodule status
    shows both - prefixed). Confirmed identical on this branch's parent
    commit with the diff stashed -- same 7 tests fail the same way with
    none of this PR's changes applied.
  • pytest -q tests/doc-health/test_families.py tests/doc-health/test_tag_hygiene_pinned_targets.py -- 78 passed.
  • python3 scripts/proposal-support.py . verify -- "proposal support
    verification ok".
  • OPENSPEC_TELEMETRY=0 openspec validate --all --strict | tail -1 --
    "Totals: 106 passed, 2 failed (108 items)", the same two pre-existing
    failures as origin/main (add-chain-attestation,
    add-composed-view-authoring).
  • python3 scripts/validate-sequenced-after.py . --ledger-diff --
    "per-change sweep ledger consistent with the corpus (214 rows)."
    (no new change packet, so no new ledger row is owed).
  • python3 scripts/doc-health.py --single-repo . --as-of <today> --family tag-hygiene -- 4 pre-existing findings, all about a
    contracts/openxwallet-pin.yaml missing a capabilities:
    enumeration in two ideation/staging/ docs; identical with the diff
    stashed, so unrelated to this change.

Open questions

None.

refs #1046

🤖 Generated with Claude Code

Summary by Sourcery

Differentiate pinned-arm containment remediation guidance by refusal code without changing validation behavior.

Bug Fixes:

  • Use a refusal-specific remediation message for unresolvable pinned-arm targets so symlink loops, unreadable links, and malformed paths are described accurately.

Tests:

  • Expand pinned-arm action coverage and update assertions for unresolvable and boundary-refusal cases.

`_pinned_arm`'s resolve_in_root refusal carried ONE action string for
every refusal code -- "keep the pin record inside its root's
contracts/ directory rather than a symlink out of it" -- including the
`unresolvable` code (a symlink loop, an unreadable link, a malformed
path), for which "a symlink out of it" is not the defect. RULED STANDS
at #1040 landing because the rule text already names the code; the
action text is the part that fit one code only (#1046).

Branch the action on the code: OUTSIDE_ROOT/OUTSIDE_BOUNDARY keep the
existing remedy; every other code now gets "make the pin record's
path resolvable inside its root's contracts/ -- no symlink loop, no
unreadable link, no malformed path (document-lifecycle grammar)".

EXPECTED_ACTIONS in test_families.py grows from fourteen to fifteen
pinned-arm strings (the FOURTEEN prose corrected to FIFTEEN). The
self-looping-symlink (m) test in test_tag_hygiene_pinned_targets.py
now asserts the new string; the two boundary-escape (m) tests keep
the old one, since their code is still OUTSIDE_ROOT/OUTSIDE_BOUNDARY.

Wording only -- no behaviour moves.

Lane: openxfactory-2
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 15, 2026 21:00
@sourcery-ai

sourcery-ai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This wording-only change splits pinned-arm containment remediation by refusal code: boundary escapes retain the existing guidance, while unresolvable paths receive guidance addressing symlink loops, unreadable links, and malformed paths. Tests and the canonical action inventory are updated accordingly; no detection behavior or OpenSpec packet changes are introduced.

Flow diagram for pinned-arm refusal-specific remediation

flowchart TD
    A[_pinned_arm finds pinned record] --> B{Refusal code}
    B -->|OUTSIDE_ROOT or OUTSIDE_BOUNDARY| C[Report containment rule]
    C --> D[Keep pin record inside root contracts/ directory rather than a symlink out of it]
    B -->|unresolvable| E[Report resolution rule]
    E --> F[Make path resolvable inside root contracts/; avoid symlink loops, unreadable links, and malformed paths]
    D --> G[hit ERROR]
    F --> G
Loading

File-Level Changes

Change Details Files
Differentiate pinned-arm remediation guidance by refusal code while preserving detection behavior.
  • Retain the symlink-outside-root remedy for OUTSIDE_ROOT and OUTSIDE_BOUNDARY.
  • Use a resolvability-focused remedy for unresolvable links, including loops, unreadable links, and malformed paths.
scripts/doc_health/families.py
Expand action-string coverage to include the new unresolvable remedy.
  • Increase the pinned-arm expected action count from fourteen to fifteen and update related prose.
  • Assert the new remedy for self-looping symlinks while retaining existing boundary-escape expectations.
tests/doc-health/test_families.py
tests/doc-health/test_tag_hygiene_pinned_targets.py

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.

🟢 Approval recommended

No unresolved review issues remain, and targeted tests passed.

Pull request overview

This PR splits pinned-target containment remediation guidance by refusal code without changing validation behavior.

Changes:

  • Uses distinct messages for boundary escapes and unresolvable paths.
  • Updates expected action coverage and the affected self-loop test.
File summaries
File Description
tests/doc-health/test_tag_hygiene_pinned_targets.py Updates the unresolvable-path assertion.
tests/doc-health/test_families.py Registers the additional action string and count.
scripts/doc_health/families.py Branches remediation wording by refusal code.
Review details
  • Files reviewed: 3/3 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.

@sonarqubecloud

Copy link
Copy Markdown

@brettheap
brettheap marked this pull request as ready for review September 16, 2026 00:25

@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 5 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap
brettheap merged commit cb2d3a2 into main Sep 16, 2026
14 checks passed
brettheap added a commit that referenced this pull request Sep 16, 2026
`origin/main` moved twelve commits since the eighth re-measurement, one of
them PR #1064 archiving `add-declared-former-id`, so the merge is taken here
and the re-measurement WITH it.

  $ python3 scripts/validate-code-surface.py .     # exit 0
  code_surface: 45 active proposals, 45 declaring — 4 `none`, 33 a repository
  list, 8 named by the register, 0 outside the grammar.
    archive (read, never judged): 169 proposals, 123 declaring, 3 of them
    outside the grammar.
  $ python3 scripts/validate-scope-globs.py .      # exit 0

THE SECOND RE-MEASUREMENT AT WHICH THE ACTIVE CORPUS SHRANK, and a
measurement rather than an inference: `git diff --name-status
3c614d3..b1df95e -- 'openspec/changes/*/proposal.md'` is exactly one
`R100` — `add-declared-former-id` moving to
`archive/2026-09-15-add-declared-former-id/` on its merged-plus-green
realization evidence (#1064). That carrier CONFORMS — it was one of the 34,
which is where the 33 comes from — and is NOT one of the eight, so no carrier
arrived, NO ENTRY WENT STALE (`scan().stale` is empty) and the register
stands at EIGHT untouched. The other eleven commits are PR #1064's own seven
internal commits plus three that reached `main` directly while it was in
flight (#1025, #1049, #1031) and this lane's own #1044; none besides the one
`R100` touches `gate-code-surface-declarations/`, `code_surface.py` or
`code-surface-register.yaml`, and the merge resolved ZERO conflicts. The arm
the sixth exercised once now answers a second time the same way: an
archiving packet makes its entry stale only if it has one, and this one, like
the sixth's, was never registered.

Recorded in the three places the packet keeps this — `tasks.md` § 3's
transcript, `CLOSED_REGISTER`'s provenance comment and this register's
header — and the eighth's "as this transcript/file stands" is demoted to "at
that re-measurement" in the same edit, since a clause that means "latest" has
to move every time the latest does.

tests/code_surface 153, tests/scope_globs 99, tests/target_release 96, 348
for the three suites, all unchanged by the merge.

Lane: openxfactory-5 (openXfactory-5)
Co-Authored-By: Claude Fable 5.1 <[email protected]>
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