T-5AMB-lease-tests-plant-literal-namespace-ref
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.
Expose a plant_literal_namespace_ref(authority, sha) helper on the
lease library’s local-bare-repo test fixture so that tests
simulating operator-induced ref damage (e.g. a leaf refs/sdlc
shadowing the namespace) don’t each re-derive the
“git push is rejected by the funny-refname guard, so go through
git update-ref inside the bare repo” workaround. See
T-K3RR-add-lease-namespace-conflict-guard for the live
incident where this cost ~10 minutes of investigation while writing
AC-1 for the namespace-conflict guard.
| Location | Role today |
|---|---|
plugin/lib/lease/tests/conftest.py | Defines the local-bare-repo fixture (bare authority + worker checkout) added by T-S0PK-add-lease-protocol-library-and-schemas. Does not expose any helper for planting a literal refs/<namespace> ref. |
plugin/lib/lease/tests/test_guard.py | The namespace-conflict guard’s AC-1 test currently hand-rolls the git update-ref refs/sdlc <sha> invocation inline. |
Proposed
Section titled “Proposed”A plant_literal_namespace_ref(authority, sha, *, namespace="refs/sdlc")
helper on the fixture’s returned object (or sibling pytest fixture)
that:
- Takes the authority path and a SHA (any reachable commit).
- Invokes
git -C <authority> update-ref <namespace> <sha>(NOT viagit pushfrom a worker — the funny-refname guard rejects that). - Returns nothing on success; raises on subprocess failure.
- Carries a docstring explaining why this looks weird (the funny- refname rejection on push, the local-write carveout in bare repos) so future readers don’t re-investigate.
test_guard.py’s AC-1 test (and any future test simulating the
same conflict shape) calls the helper instead of inlining the
update-ref call.
Approach
Section titled “Approach”- Add
plant_literal_namespace_refto the local-bare-repo fixture inplugin/lib/lease/tests/conftest.py. Decision deferred: method on the returned object vs sibling fixture — depends on the fixture’s existing return shape. - Retrofit
test_guard.py’s AC-1 test to call the helper. - Cross-link from the helper’s docstring to the Namespace conflict guard section of the ADR so the “why” is one click away.
Files to touch
Section titled “Files to touch”| Location | Kind | Change |
|---|---|---|
plugin/lib/lease/tests/conftest.py | modify | Add plant_literal_namespace_ref(authority, sha, *, namespace="refs/sdlc") helper with docstring explaining the funny-refname workaround. |
plugin/lib/lease/tests/test_guard.py | modify | Replace the inline git update-ref invocation in AC-1’s test with a call to the helper. |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1: The local-bare-repo fixture exposes a
plant_literal_namespace_ref(authority, sha)helper callable from any test consuming the fixture. - AC-2:
test_guard.py’s AC-1 test calls the helper instead of inlininggit update-ref; the test still passes. - AC-3: The helper’s docstring names the
git pushfunny-refname rejection by name and explains whygit update-refinside the bare repo is the workaround, so future readers don’t re-derive it.
Out of scope
Section titled “Out of scope”- Generalising the helper to plant arbitrary “operator-induced ref damage” beyond literal namespace shadowing. If other ref-damage shapes emerge as test concerns, they get their own helpers.
- Reconcile-side detection of the same conflict (the ADR’s reconcile checklist already calls this out and a future reconcile task will own that surface).
Dependencies
Section titled “Dependencies”- T-S0PK-add-lease-protocol-library-and-schemas — owns the fixture this task extends.
- T-K3RR-add-lease-namespace-conflict-guard — owns the test this task retrofits.
Discovery context
Section titled “Discovery context”Spawned by /sdlc:task-work post-mortem of T-K3RR-add-lease-namespace-conflict-guard on 2026-05-24.
Dedup search (spawn-from-post-mortem)
Section titled “Dedup search (spawn-from-post-mortem)”Bullet: Planting a literal refs/sdlc via git push is rejected by git’s funny-refname guard. Worked
around by pushing the SHA via a normal branch first, then git update-ref refs/sdlc
- 2 / open/ready / 2026-05-21-investigate-skill-prompt-freshness — Investigate whether sub-skill prompts re-read SKILL.md each call or cache stale prose
- 2 / planning/draft / 2026-05-21-post-mortem-evidence-reproducibility — spawn-from-post-mortem: capture reproducibility tier (reliable vs intermittent) per bullet
- 1 / closed/done / 2026-05-19-document-commit-message-pattern — Document robust commit-message pattern (mktemp + git commit -F) for SDLC skills
- 1 / closed/done / 2026-05-19-document-grep-alias-bypass — Document /usr/bin/grep pattern for SDLC skills to bypass shell aliases
- 1 / closed/done / 2026-05-19-extract-ensure-ready-mutate-script — Extract ensure-ready frontmatter mutation into a shared script Decision: SPAWNED