Skip to content

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.

LocationRole today
plugin/lib/lease/tests/conftest.pyDefines 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.pyThe namespace-conflict guard’s AC-1 test currently hand-rolls the git update-ref refs/sdlc <sha> invocation inline.

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 via git push from 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.

  1. Add plant_literal_namespace_ref to the local-bare-repo fixture in plugin/lib/lease/tests/conftest.py. Decision deferred: method on the returned object vs sibling fixture — depends on the fixture’s existing return shape.
  2. Retrofit test_guard.py’s AC-1 test to call the helper.
  3. Cross-link from the helper’s docstring to the Namespace conflict guard section of the ADR so the “why” is one click away.
LocationKindChange
plugin/lib/lease/tests/conftest.pymodifyAdd plant_literal_namespace_ref(authority, sha, *, namespace="refs/sdlc") helper with docstring explaining the funny-refname workaround.
plugin/lib/lease/tests/test_guard.pymodifyReplace the inline git update-ref invocation in AC-1’s test with a call to the helper.
  • 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 inlining git update-ref; the test still passes.
  • AC-3: The helper’s docstring names the git push funny-refname rejection by name and explains why git update-ref inside the bare repo is the workaround, so future readers don’t re-derive it.
  • 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).

Spawned by /sdlc:task-work post-mortem of T-K3RR-add-lease-namespace-conflict-guard on 2026-05-24.

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 inside the bare repo (which has no funny-ref guard for local writes). Cost ~10 min of investigation. Suggests: a small fixture helper in plugin/lib/lease/tests/conftest.py (e.g. plant_literal_namespace_ref(authority, sha)) so future tests simulating operator-induced ref damage don’t re-derive the workaround. Keywords searched: plant_literal_namespace_ref, operator-induced, funny-refname, investigation, update-ref, simulating, workaround, funny-ref Excluded: 2026-05-23-add-lease-namespace-conflict-guard Top candidates (score / status / headline):

  • 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

← Back to Tasks