test: librarian PROMOTE/CULL step idempotency#51
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Adds two tests to
formulas/formulas_test.gocovering the idempotencycontract of the librarian's PROMOTE/CULL candidate-bead sweep steps
(
promote-candidate-beadsandcull-candidate-beadsinmol-cairn-librarian.formula.toml):TestLibrarianPromoteAndCullStepsSkipWhenAlreadyTracked— assertsboth steps' Descriptions contain the
ANCHOR="[entry:${ENTRY_ID}]"+bd list ... --title-contains=$ANCHORdedup idiom, and skip when amatching bead already exists.
TestLibrarianCullStepChecksExistingBeforeCallingCullEvict— assertsthe
EXISTING-check textually precedes thecairn cull-evict "$ENTRY_ID"call incull-candidate-beads' Description.Why this ordering matters
EvictToReviewBranchhard-errors if a cull proposal is already pending forthe same entry (
internal/cairn/evict.go:92, exercised byTestEvictToReviewBranchRefusesWhenProposalAlreadyPending). If the sweepstep ever called
cairn cull-evictbefore checking for an existingproposal 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
shell (via
decodeFormula/stepByID), matching this file's existingidiom (
TestLibrarianRigFormulaHasSameStepsAsLibrarian,TestCriticFormulaHasVaporPhase) — not a novel pattern.Test plan
go build ./...,go vet ./...,golangci-lint run ./...all clean.go test ./... -race -count=1— all packages green.-v -race.