Repository navigation
proposal-support archives through the pinned OpenSpec CLI, never PATH (#691) - #694
Conversation
…#691) `scripts/proposal-support.py` is the SANCTIONED archive path — the origin gate, the open-task refusal, the deterministic support bundle, and then the act that moves a ratified delta into canon — and it performed every one of those against a corpus adjudicated by `["openspec", …]`: a NAME, resolved by the shell out of whatever was on PATH. `contracts/openspec-cli-pin.yaml` had meanwhile made `@fission-ai/openspec` a content-addressed consumption and named `scripts/validate-openspec-cli-pin.py` as the one entrypoint through which the estate obtains and runs it. On this workstation PATH answers `1.2.0` while the pin records `1.12.0`: the archive ran a version the repository does not pin, and nothing said so. Both invocations now go through the pin, in the two roles the pin defines: * STRICT VALIDATION is delegated to the CONSUMER ENTRYPOINT itself (`--change <id> --repo <root>`), rather than to a `validate` argv this file assembles. That is where the pin's `dispositions:` are applied, and a finding this repository has ACCEPTED in writing — with a citation and a named authority — must not block an archive because the wrapper re-asked the question with a rawer tool. * THE ARCHIVE runs the executable the entrypoint's own `resolve_pinned` returns: fetched, hashed against the recorded SHA-512 and SHA-1, installed, and asserted to report the pinned version before it is invoked. The entrypoint has no archive mode and never grows one, so what is reused is its RESOLVER; no version, integrity or package name is written in this file. A pin that cannot be satisfied REFUSES. The verifier's own named code and its one remediation trailer are printed verbatim and the exit is 2 — the exit the pin verifier and the pinned installer already use — kept distinct from the exit 1 this script has always used for "this change is not archivable". Nothing falls back to PATH silently. The single escape is the entrypoint's own `--path-mode`, passed through to BOTH halves so they can never run different binaries; no bypass is invented here. PROVED ON THIS WORKSTATION, with `1.2.0` on PATH: a throwaway change archived through the wrapper prints `@fission-ai/[email protected] from the pinned artifact (…); integrity sha512-oFE2Lj7WVSc87nSi… verified` and archives clean, and the same wrapper with `--path-mode` refuses `REFUSE pin-version-mismatch: … reports version '1.2.0', but the pin records '1.12.0'` with exit 2. Tests. `tests/proposal-support/test_pinned_openspec_cli.py` (16 new) pins the wiring, the refusals and the escape against a FICTIONAL registry installed at the verifier's subprocess boundary — no network, real SHA-512/SHA-1 over real bytes, the same route `tests/openspec_cli_pin/` takes and for the same stated reason. The three existing CLI-driving archive tests take the same double, whose fictional install forwards to the `openspec` their `skipUnless` guard already required, so they still drive a real CLI and now reach it only through the pin's resolver. `tests/proposal-support/` reads 52 passed / 2 subtests passed (was 36 / 2). Refs #691 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01H9aKd8YF3ktcLmVJJxQYKv Lane: openxfactory-1
There was a problem hiding this comment.
Hi @brettheap! 👋
Your private repo does not have access to Sourcery.
Please upgrade to continue using Sourcery ✨
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…indings Test-double hygiene only: the cache restore was a conditional expression inside a lambda, and two of the three archive tests bound a call list they never interrogate. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01H9aKd8YF3ktcLmVJJxQYKv Lane: openxfactory-1
There was a problem hiding this comment.
🟡 Changes recommended
The new PinnedCliRefusal documentation is internally inconsistent about wrapper-owned refusal codes (it states only one is introduced, but pin-refused is also used), which should be corrected to avoid misleading callers.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Updates the OpenSpec archiving wrapper (scripts/proposal-support.py) so it never runs an ambient openspec from PATH, and instead resolves and verifies the pinned OpenSpec CLI via the repository’s pin verifier/consumer entrypoint (scripts/validate-openspec-cli-pin.py), including a fail-closed refusal path.
Changes:
- Route strict validation through the pin’s consumer entrypoint and run
archiveusing the resolver’s pinned executable path (with exit-2 refusals when the pin can’t be satisfied). - Add
--path-modepassthrough as the only escape hatch, preserving the verifier’s semantics. - Expand test coverage with a fictional-registry double and a new focused suite asserting “no bare
openspecargv” and refusal behaviors.
File summaries
| File | Description |
|---|---|
| scripts/proposal-support.py | Resolves the OpenSpec CLI through the pin verifier, delegates strict validation to the consumer entrypoint, and archives via the resolved binary (plus --path-mode + exit-2 refusal handling). |
| tests/proposal-support/test_proposal_support.py | Adds a fictional-registry helper used by existing archive tests so they can satisfy the pin resolver without network access. |
| tests/proposal-support/test_pinned_openspec_cli.py | New pytest suite validating pinned-resolution wiring, refusal modes, memoization, and the absence of any bare ["openspec", ...] argv in the wrapper. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| `code` is the verifier's own refusal code, carried unchanged so a caller may | ||
| branch on it, and `str()` is the verifier's whole message — code, detail and | ||
| the one fixed remediation trailer — reproduced verbatim rather than reworded | ||
| here. The refusal vocabulary belongs to the pin verifier; this file adds | ||
| exactly one code of its own, `pin-entrypoint-unavailable`, for the single | ||
| condition the verifier cannot report because it is the condition of the | ||
| verifier being unreachable. |
There was a problem hiding this comment.
Taken — real defect, fixed in 79effea. The docstring claimed exactly one wrapper-owned code while validate_through_the_pin raises a second (pin-refused). Both are now declared in WRAPPER_REFUSAL_CODES with what each is for and why it is not the verifier's to raise, and test_the_wrapper_originated_refusal_codes_are_exactly_what_it_raises reads the codes actually raised in the file and asserts the two sets are equal — and disjoint from the verifier's own vocabulary — so a third code cannot land as prose alone.
Lane: openxfactory-1
…the code Copilot, PR #694: the `PinnedCliRefusal` docstring said this file adds exactly one refusal code of its own while `validate_through_the_pin` raises a second, `pin-refused`. A caller told to branch on a vocabulary is entitled to a list that is true. Both are now declared in `WRAPPER_REFUSAL_CODES` with what each means and why it is not the verifier's to raise, and a new test reads the codes actually raised in the file and asserts the two sets are equal — and disjoint from the verifier's own vocabulary, so a future third code cannot land as prose alone. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01H9aKd8YF3ktcLmVJJxQYKv Lane: openxfactory-1
There was a problem hiding this comment.
🟡 Changes recommended
The PR introduces new literal host-absolute paths in committed tests and contains an internal docstring contract mismatch that should be corrected before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
tests/proposal-support/test_pinned_openspec_cli.py:482
- The test hard-codes a host-absolute path ("/tmp") as the repo argument to the CLI parser. The constitution states committed files must not contain host-absolute paths (.specify/memory/constitution.md:66-73); using a relative placeholder keeps the test intent without embedding host-specific paths.
local = tmp_path / "bin"
local.mkdir()
(local / registry.binary).write_text("#!/bin/sh\n", encoding="utf-8")
(local / registry.binary).chmod(0o755)
monkeypatch.setattr(
- Files reviewed: 3/3 changed files
- Comments generated: 3
- Review effort level: Lite
| `code` is the verifier's own refusal code, carried unchanged so a caller may | ||
| branch on it, and `str()` is the verifier's whole message — code, detail and | ||
| the one fixed remediation trailer — reproduced verbatim rather than reworded | ||
| here. The refusal vocabulary belongs to the pin verifier; this file adds | ||
| exactly one code of its own, `pin-entrypoint-unavailable`, for the single | ||
| condition the verifier cannot report because it is the condition of the | ||
| verifier being unreachable. |
| monkeypatch.setattr( | ||
| verifier.shutil, "which", | ||
| lambda name, *a, **k: ("/usr/bin/npm" if name == "npm" | ||
| else real_which(name, *a, **k))) |
There was a problem hiding this comment.
Taken — fixed in 19b66f5. Both fictional registries now create a real npm inside their own temporary directory and answer shutil.which with that path (fetch_artifact only asks whether npm is obtainable), and the parser test takes pytest's tmp_path instead of a hard-coded temporary directory. The PATH-mode doubles moved to path-bin so the registry's npm and the escape's PATH binary keep separate directories.
Lane: openxfactory-1
| (shutil, "which", | ||
| lambda name, *a, **k: ("/usr/bin/npm" if name == "npm" | ||
| else real_which(name, *a, **k))), |
There was a problem hiding this comment.
Taken — fixed in 19b66f5. Both fictional registries now create a real npm inside their own temporary directory and answer shutil.which with that path (fetch_artifact only asks whether npm is obtainable), and the parser test takes pytest's tmp_path instead of a hard-coded temporary directory. The PATH-mode doubles moved to path-bin so the registry's npm and the escape's PATH binary keep separate directories.
Lane: openxfactory-1
There was a problem hiding this comment.
🔵 Needs a closer look
New tests introduce hard-coded host-absolute paths (e.g., /usr/bin/npm, /tmp), which violates the repository’s “no host-absolute paths in committed files” rule.
Review details
Suppressed comments (4)
Previously missed (1) — in code that hasn't changed since the last review.
tests/proposal-support/test_pinned_openspec_cli.py:506
- This test uses a hard-coded absolute path ("/tmp") as a parser argument. The repo constitution forbids committed host-absolute paths; use a relative placeholder (or a tmp_path-derived value) instead.
This issue also appears on line 507 of the same file.
tests/proposal-support/test_proposal_support.py:122
- This test introduces a hard-coded host-absolute path ("/usr/bin/npm"). The repo constitution forbids committed host-absolute paths; use runtime-generated paths instead (e.g., derived from the temp workspace) so the test remains portable.
(shutil, "which",
lambda name, *a, **k: ("/usr/bin/npm" if name == "npm"
else real_which(name, *a, **k))),
tests/proposal-support/test_pinned_openspec_cli.py:164
- This fixture hard-codes a host-absolute path ("/usr/bin/npm"). The repo constitution forbids committed host-absolute paths; return a runtime-generated path (e.g., under tmp_path) instead.
monkeypatch.setattr(
verifier.shutil, "which",
lambda name, *a, **k: ("/usr/bin/npm" if name == "npm"
else real_which(name, *a, **k)))
tests/proposal-support/test_pinned_openspec_cli.py:510
- This test uses hard-coded absolute paths ("/tmp") in additional parse_args calls. The repo constitution forbids committed host-absolute paths; use the same relative placeholder used above.
assert support.parser().parse_args(
["/tmp", "archive", "change-a"]).path_mode is False
with pytest.raises(SystemExit):
support.parser().parse_args(["/tmp", "archive", "change-a", "--no-pin"])
- Files reviewed: 3/3 changed files
- Comments generated: 0 new
- Review effort level: Lite
Copilot, PR #694, citing the constitution § IV ("Committed files MUST NOT contain host-absolute paths; use repo-relative paths or runtime resolution"): the fictional registries answered `shutil.which("npm")` with a hard-coded system path, and one parser test passed a hard-coded temporary directory as its repository root. Both doubles now create a real fictional npm inside their own temporary directory and answer with THAT path, which is the more honest double as well as the compliant one — `fetch_artifact` only asks whether npm is obtainable, and nothing here should depend on where a machine keeps it. The parser test takes pytest's `tmp_path`. The PATH-mode fixtures move to `path-bin` so the two fictions — the registry's npm and the escape's PATH binary — keep separate directories. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01H9aKd8YF3ktcLmVJJxQYKv Lane: openxfactory-1
There was a problem hiding this comment.
🟢 Approval recommended
The change addresses the reported defect directly, fails closed on pin resolution issues, and is backed by targeted, hermetic tests covering the critical execution paths and refusal semantics.
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
Lane: openxfactory-1 (openXfactory-1; session 5e783e4d) Provenance for the admin merge of #694 (proposal-support archives through the pinned OpenSpec CLI, issue #691).
🤖 Generated with Claude Code |
Resolves the conflict in scripts/proposal-support.py between #694 (the pinned-CLI archive wrapper, PinnedCliRefusal, exit 2) and this branch (origin_retention_errors, OriginRetentionError, exit 2). Kept both: archive_change already ran retention before pin resolution after the auto-merge (SHAPE FIRST via origin_errors, then RETENTION via origin_retention_errors, both before pinned_openspec/ validate_through_the_pin is ever reached), so the only remaining conflict was main()'s two exception arms. Combined them as two separate except clauses, OriginRetentionError first (matching the order archive_change actually raises them in), each keeping its own distinct message and both landing on exit 2 with a comment cross- referencing the other. No bypass flags added on either side. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01H9aKd8YF3ktcLmVJJxQYKv
…tures The merge of origin/main (#694, the pinned-CLI archive wrapper) brought in tests/proposal-support/test_pinned_openspec_cli.py, whose `a_change` fixture built a plain directory tree with no git history at all — sufficient before this branch's change, because `archive_change` never read history. Now it does (`origin_retention_errors`, before any CLI resolution), and eight of that file's tests failed with "not ratified" even after `a_change` was updated to commit a real, already-ratified one-commit repository, because the `recorded` fixture those eight tests install fakes EVERY call reachable through `subprocess.run` — the same module attribute `ratifying_commit`/`git_show_text`/`repo_revision` call `git` through — so the retention gate's own history reads came back empty regardless of what was on disk. Two changes, both scoped to this one test file: - `a_change` now creates a real one-commit git repository whose single commit already declares `Status: ratified`, built through a `subprocess .run` reference captured at import time (`_REAL_SUBPROCESS_RUN`) rather than through the module attribute the `recorded` fixture later replaces. - `recorded`'s `fake_run` passes a `git` argv straight through to that same real function and leaves it out of the recorded list, so the exact- equality assertions on openspec/npm calls are unaffected and the origin- retention gate reads the fixture's actual history. `pytest tests/proposal-support -q`: 68 passed, 2 subtests (60 passed + 8 failed before this commit). Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01H9aKd8YF3ktcLmVJJxQYKv
…n declaration `origin/main` moved to `9b1888bb` while this packet was in review — #693 restored the archived origin declaration of `amend-published-tip-unreadable-scenario` to its ratified text, #694 routed `proposal-support` archiving through the pinned OpenSpec CLI rather than PATH, and #684/#696 landed beside them. Every hunk auto-merged: README kept main's side and this packet's Active row, and the corpus ledger kept both this row (`moved_by: "#688"`) and #685's archived row for the predecessor. No row moved, no partner flipped, so no MOVEMENT LOG entry is owed. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01H9aKd8YF3ktcLmVJJxQYKv Lane: openxfactory-1
… realized by #688 (a59d546), green on main (run 33995187827) (#703) Lane: openxfactory-1 (openXfactory-1) Archive of amend-unreadable-read-sibling-scenarios (ratified 2026-09-05; realized by #688 a59d546; green on main run 33995187827). First archive under the origin-retention gate (#695) and the pinned-CLI archive (#694): origin block and records byte-identical to the ratifying commit d6fd07b; MODIFIED promoted into doc-health canon byte-identical; one ledger row; owed successor (D6) carried. Brett's word: 'land it when green'. Landed under Rule 6. Admin merge: self-authored PR (standing pattern B2). Refs #662 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01H9aKd8YF3ktcLmVJJxQYKv
Lane: openxfactory-1 (openXfactory-1)
Refs #691
The defect
scripts/proposal-support.pyis the sanctioned archive path — the origin gate, the open-task refusal, the deterministic support bundle, and thenopenspec archive, the act that moves a ratified delta into canon. It performed all of it with["openspec", …]: a name, resolved by the shell out of whatever was on PATH.contracts/openspec-cli-pin.yamlhad meanwhile made@fission-ai/openspeca content-addressed consumption and namedscripts/validate-openspec-cli-pin.pyas the one entrypoint through which the estate obtains and runs it — itsconsumer_entrypoint:says so in one field, and the pin's own header namesopenspec archiveas one of the two acts it exists to govern. On this workstation PATH answers1.2.0while the pin records1.12.0. The archive ran a version the repository does not pin, and nothing said so.What now runs
Both invocations go through the pin, in the two roles the pin defines:
--change <id> --repo <root>), not to avalidateargv this file assembles. That is where the pin'sdispositions:are applied — a finding this repository has accepted in writing, with a citation and a named authority, must not block an archive because the wrapper re-asked the question with a rawer tool. (Both live dispositions sit on changes that will archive through this wrapper.)resolve_pinnedreturns: fetched, hashed against the recorded SHA-512 and SHA-1, installed, and asserted to report the pinned version before it is invoked. The entrypoint has no archive mode and deliberately never grows one, so what is reused is its resolver; no version, integrity or package name is written intoproposal-support.py.A pin that cannot be satisfied refuses: the verifier's own named code and its one remediation trailer, printed verbatim, exit 2 — the exit the pin verifier and the pinned installer already use — kept distinct from the exit 1 this script has always used for "this change is not archivable". Nothing falls back to PATH silently.
The single escape is the entrypoint's own
--path-mode, passed straight through to both halves so they can never run different binaries. It refuses unless the PATH binary reports the pinned version, and it says in its own output that it checked the label and not the referent. No bypass is invented here.Proof on the workstation (PATH = 1.2.0)
A throwaway change archived through the wrapper:
And the fail-closed half, same wrapper,
--path-modeagainst the 1.2.0 on PATH:Tests
tests/proposal-support/test_pinned_openspec_cli.py— 17 new tests over a fictional registry installed at the verifier's subprocess boundary: no network, real SHA-512/SHA-1 over real bytes, the same route and the same stated reason astests/openspec_cli_pin/. They pin the resolved-binary argv for both halves, the AST-level absence of any argv beginning with the bare binary name (the defect itself),pin-tag-only/pin-integrity-mismatch/pin-unresolvable/pin-version-mismatch/pin-entrypoint-unavailablerefusals, exit 2 out ofmain, the exit-1 boundary for a failing delta, per-process memoization, the escape in both directions, and (after Copilot's finding) the equality ofWRAPPER_REFUSAL_CODESwith the codes this file actually raises.The three existing CLI-driving archive tests take the same double, whose fictional install forwards to the
openspectheirskipUnlessguard already required — so they still drive a real CLI, and now reach it only through the pin's resolver.tests/proposal-support/reads 53 passed, 2 subtests passed (was 36 / 2).tests/openspec_cli_pin/,tests/doc-health/test_proposal_origin.pyandtests/doc-health/test_sentinel_vocabulary.py: 196 passed.No OpenSpec change directory, no README OpenSpec Records row, no ledger row: this is a plain fix to running code, and it adds no contract.
🤖 Generated with Claude Code
https://claude.ai/code/session_01H9aKd8YF3ktcLmVJJxQYKv