T-A5BL-lease-fixture-exposes-fetch-helper
Status: closed/superseded · Impact: low · Complexity: small
Auto-generated from a /sdlc:task-work post-mortem. Review and
promote to open/ready before picking up.
The lease library’s local-bare-repo test fixture creates a worker
repo + bare-remote authority, but the worker doesn’t auto-track the
lease refs (refs under refs/sdlc/* aren’t in the worker’s default
fetch refspec). The lease-CLI byte-equivalence test
(test_inspect_json_is_byte_identical_to_git_show) flaked because
it called git show <ref>:lease.json from the worker without first
fetching the ref. The fix landed as an explicit git fetch inside
the test, but every future test that wants to read a lease ref from
the worker will have to reinvent the same call. Exposing a
fetch_sdlc_refs(worker) helper on the fixture closes the gap
once. Cite T-QC31-add-sdlc-lease-cli-commands for the live
incident.
| Location | Role today |
|---|---|
plugin/lib/lease/tests/conftest.py (best guess — path established by T-S0PK-add-lease-protocol-library-and-schemas) | Defines the local-bare-repo fixture: creates the bare authority, a worker checkout, sets the worker’s remote. Does NOT configure an refs/sdlc/* refspec, and does NOT expose a fetch helper. |
plugin/scripts/lease_cli/tests/test_inspect.py (best guess) | Contains test_inspect_json_is_byte_identical_to_git_show which explicitly calls subprocess.run(["git", "fetch", ...]) before git show — the workaround. |
Proposed
Section titled “Proposed”- Add a
fetch_sdlc_refs(worker)helper to the fixture’s returned object (or a sibling pytest fixture) that runsgit -C <worker> fetch <authority> 'refs/sdlc/*:refs/sdlc/*'and returns nothing on success. - Retrofit
test_inspect_json_is_byte_identical_to_git_showto call the helper instead of inlining the fetch. - Document the helper in the fixture’s docstring as “use this
before any test that reads a lease ref from the worker via
git show.”
Optional v2 (out of scope here): make the worker’s default fetch
refspec include refs/sdlc/* so reads are transparent — but
that’s a behavior change to the fixture’s authority/worker
contract and is worth its own discussion.
Approach
Section titled “Approach”- Locate the lease library’s
conftest.py(path established by T-S0PK-add-lease-protocol-library-and-schemas). - Add
fetch_sdlc_refs(worker)as a method on the fixture’s returned object, OR as a sibling fixture if the existing fixture returns a plain path. - Retrofit the inspect byte-equivalence test to call the helper.
- Add a one-line note to the fixture’s docstring so future test authors find it.
Files to touch
Section titled “Files to touch”| Location | Kind | Change |
|---|---|---|
plugin/lib/lease/tests/conftest.py | modify | Add fetch_sdlc_refs(worker) helper to the local-bare-repo fixture. |
plugin/scripts/lease_cli/tests/test_inspect.py | modify | Replace the inline git fetch with a call to the new helper. |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1: The local-bare-repo fixture exposes a
fetch_sdlc_refs(worker)helper (callable from any test consuming the fixture). - AC-2:
test_inspect_json_is_byte_identical_to_git_showis simplified to call the helper instead of inlining the fetch. - AC-3: Removing the helper call from the test reproduces the original flake (regression-test the helper’s necessity).
Out of scope
Section titled “Out of scope”- Auto-configuring the worker’s default fetch refspec to include
refs/sdlc/*. Worth its own conversation; touches the authority/worker contract. - Generalizing the helper for non-test callers (the CLI runtime, for example). The library’s primitives already handle fetching for runtime calls — this helper is test-fixture-only.
Dependencies
Section titled “Dependencies”- T-S0PK-add-lease-protocol-library-and-schemas — the fixture this task extends.
- T-QC31-add-sdlc-lease-cli-commands — the inspect test this task retrofits.
Discovery context
Section titled “Discovery context”Spawned by /sdlc:task-work post-mortem of T-QC31-add-sdlc-lease-cli-commands on 2026-05-23.
Dedup search (spawn-from-post-mortem)
Section titled “Dedup search (spawn-from-post-mortem)”Bullet: Test fixture for git show byte-equivalence flake. test_inspect_json_is_byte_identical_to_git_show initially failed because the CLI runs against a worker repo’s bare-remote authority and the worker repo doesn’t auto-track the lease ref. Fixed by explicit git fetch in the test before git show. Suggests: the lease library’s local-bare-repo fixture should expose a ‘fetch all sdlc refs into worker’ helper so tests don’t reinvent this. Keywords searched: test_inspect_json_is_byte_identical_to_git_show, byte-equivalence, local-bare-repo, bare-remote, auto-track, initially, authority, explicit Excluded: 2026-05-23-add-sdlc-lease-cli-commands Top candidates (score / status / headline):
- 21 / planning/draft / 2026-05-23-add-lease-namespace-conflict-guard — Add lease-namespace conflict guard
- 19 / in-progress / 2026-05-23-add-lease-protocol-library-and-schemas — Add lease-protocol library and payload schemas
- 5 / closed/done / 2026-05-23-establish-plugin-lib-convention — Establish
plugin/lib/convention for Python libraries - 4 / closed/done / 2026-05-19-co-locate-skill-specific-scripts — Co-locate skill-specific scripts under their skill dir; promote when shared
- 4 / closed/done / 2026-05-20-task-work-sub-agent-verdict-contract-clarity — Tighten task-work
sub-agent verdict contract so ensure-ready’s READY marker isn’t mistaken for task-work’s final
verdict
Decision: LINKED-EXISTING 2026-05-23-add-lease-namespace-conflict-guard Rationale: Overridden to
SPAWNED. The top candidate (lease-namespace-conflict-guard) is about a literal
refs/sdlcref shadowing the namespace — a totally different concern from test-fixture refspec ergonomics. Keyword overlap (lease/authority) inflated the score but the proposed fixes don’t intersect. The lease-library task is the foundation but doesn’t itself own this helper. Spawning as a sibling task.