Skip to content

test: librarian PROMOTE/CULL step idempotency#51

Merged
quad341 merged 2 commits into
mainfrom
deploy/crn-0sdm-gate
Jul 24, 2026
Merged

test: librarian PROMOTE/CULL step idempotency#51
quad341 merged 2 commits into
mainfrom
deploy/crn-0sdm-gate

Conversation

@quad341

@quad341 quad341 commented Jul 24, 2026

Copy link
Copy Markdown
Owner

What changed

Adds two tests to formulas/formulas_test.go covering the idempotency
contract of the librarian's PROMOTE/CULL candidate-bead sweep steps
(promote-candidate-beads and cull-candidate-beads in
mol-cairn-librarian.formula.toml):

  • TestLibrarianPromoteAndCullStepsSkipWhenAlreadyTracked — asserts
    both steps' Descriptions contain the ANCHOR="[entry:${ENTRY_ID}]" +
    bd list ... --title-contains=$ANCHOR dedup idiom, and skip when a
    matching bead already exists.
  • TestLibrarianCullStepChecksExistingBeforeCallingCullEvict — asserts
    the EXISTING-check textually precedes the cairn cull-evict "$ENTRY_ID" call in cull-candidate-beads' Description.

Why this ordering matters

EvictToReviewBranch hard-errors if a cull proposal is already pending for
the same entry (internal/cairn/evict.go:92, exercised by
TestEvictToReviewBranchRefusesWhenProposalAlreadyPending). If the sweep
step ever called cairn cull-evict before checking for an existing
proposal bead, a re-run of the sweep would hard-fail instead of skipping
cleanly. These tests pin that ordering so a future edit to the step can't
silently break it.

What to review

  • Both tests are structural/presence assertions against the TOML-embedded
    shell (via decodeFormula/stepByID), matching this file's existing
    idiom (TestLibrarianRigFormulaHasSameStepsAsLibrarian,
    TestCriticFormulaHasVaporPhase) — not a novel pattern.
  • Test-only change, single file, +61/-0. No production code touched.

Test plan

  • go build ./..., go vet ./..., golangci-lint run ./... all clean.
  • go test ./... -race -count=1 — all packages green.
  • Both new tests individually verified with -v -race.

quad341 added 2 commits July 24, 2026 10:27
promote-candidate-beads and cull-candidate-beads (crn-28ge.1.8, now on
main) must skip already-tracked findings via the same bd-list-before-
bd-create idiom the other three sweep steps use, or a second pass over
an unchanged findings set files duplicate beads.

cull-candidate-beads carries a sharper invariant: cairn cull-evict
itself hard-errors on a repeat call for the same entry (its review
branch name is deterministic), so the EXISTING check must run BEFORE
that call, not just before the eventual bd create. Added an ordering-
specific test for that beyond the shared presence check.

Authored by validator (gc-validator-7306216f5c97 @ aa030f5); builder
independently re-verified against clean origin/main (4858187) in an
isolated worktree: gofmt/vet/build/full-suite -race all green,
targeted TestLibrarian* tests pass individually and via full run.

refs crn-28ge.1.11
Gate PASS for edc4937 (formulas/formulas_test.go, +61/-0, test-only).
Bounded self-rebase performed: origin/main advanced to 5bf87a6 (PR #50)
past the reviewed commit's assumed base; reconciled via cherry-pick
(disjoint files, clean merge-tree). New tip 34eb1fa, content-identical
to the reviewed commit.
@quad341
quad341 merged commit 5dcc495 into main Jul 24, 2026
2 checks passed
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.

1 participant