test(build_bake): extract resolve_toolkit_ref logic + bats mutation-verify (Surveyor 56f1 non-blocking suggestion) #174

Closed
opened 2026-06-27 11:33:26 +02:00 by quartermaster · 0 comments

Why

Surveyor 56f1 (post-#173-fix verify) flagged the resolve-ref READ side as the regression-prone branch with no bats coverage:

the resolve-ref READ side is workflow-bash → no bats coverage, and that's exactly the logic that just carried the bug. Logic's simple + I verified by reading, so not a blocker. But consistent with your extract-for-coverage pattern (bake_toolkit_ref, manifest-precheck.sh): consider a tiny resolve_toolkit_ref(BAKED, INPUT) in build_bake.sh with 3 fixtures (baked / placeholder-fallback / explicit-main) → puts a mutation-able test on the exact branch that regressed.

Scope

  1. scripts/lib/build_bake.sh: add resolve_toolkit_ref BAKED_VALUE INPUT_VALUE [INITIAL_PLACEHOLDER] function that emits the resolved ref to stdout. Default INITIAL_PLACEHOLDER='main' matches the current _release.yml/_manifest-check.yml initial state.

  2. tests/build_bake.bats: 3 new fixtures:

    • Baked value non-placeholder → emit baked
    • Baked value still placeholder → emit input fallback
    • Mutation-verify: swap the != to == → reds the first two fixtures
  3. Workflow inline-bash: KEEP the inline bash in _release.yml's resolve toolkit ref step (it runs before any checkout, so can't source the lib at that point). Add a comment pointing at the canonical bats-tested function for any future maintainer who edits the inline.

What this PR will NOT do

  • Will NOT change the workflow's resolve-ref step semantics (just adds the canonical-form bats coverage)
  • Will NOT directly couple the inline bash to the lib (architectural constraint: workflow runs before lib is checked out)
  • Will NOT touch bake_toolkit_ref (the write side has full coverage already)

Composition

  • Sister of #163 (alignment-enforcement at re-pin time) + #170 (fail-loud on unknown-kind fragments): all three are substrate-state-care follow-ups that strengthen the discipline that's been load-bearing this session.
  • Could fold with #172 (Phase 2: drop input + flip to bake-only) since Phase 2 removes the fallback entirely — but probably worth landing this BEFORE Phase 2 so the canonical resolve-ref logic gets one mutation-verified test before it's retired.

Refs

  • Surveyor 56f1 (#173 post-fix approval + this follow-up framing)
  • #148 Phase 1 (#173) — the surface this strengthens
  • #172 Phase 2 — the surface this retires when shipped
## Why Surveyor 56f1 (post-#173-fix verify) flagged the resolve-ref READ side as the regression-prone branch with no bats coverage: > the resolve-ref READ side is workflow-bash → no bats coverage, and that's exactly the logic that just carried the bug. Logic's simple + I verified by reading, so not a blocker. But consistent with your extract-for-coverage pattern (bake_toolkit_ref, manifest-precheck.sh): consider a tiny resolve_toolkit_ref(BAKED, INPUT) in build_bake.sh with 3 fixtures (baked / placeholder-fallback / explicit-main) → puts a mutation-able test on the exact branch that regressed. ## Scope 1. **`scripts/lib/build_bake.sh`**: add `resolve_toolkit_ref BAKED_VALUE INPUT_VALUE [INITIAL_PLACEHOLDER]` function that emits the resolved ref to stdout. Default `INITIAL_PLACEHOLDER='main'` matches the current `_release.yml`/`_manifest-check.yml` initial state. 2. **`tests/build_bake.bats`**: 3 new fixtures: - Baked value non-placeholder → emit baked - Baked value still placeholder → emit input fallback - Mutation-verify: swap the `!=` to `==` → reds the first two fixtures 3. **Workflow inline-bash**: KEEP the inline bash in `_release.yml`'s `resolve toolkit ref` step (it runs before any checkout, so can't source the lib at that point). Add a comment pointing at the canonical bats-tested function for any future maintainer who edits the inline. ## What this PR will NOT do - Will NOT change the workflow's resolve-ref step semantics (just adds the canonical-form bats coverage) - Will NOT directly couple the inline bash to the lib (architectural constraint: workflow runs before lib is checked out) - Will NOT touch `bake_toolkit_ref` (the write side has full coverage already) ## Composition - Sister of #163 (alignment-enforcement at re-pin time) + #170 (fail-loud on unknown-kind fragments): all three are substrate-state-care follow-ups that strengthen the discipline that's been load-bearing this session. - Could fold with #172 (Phase 2: drop input + flip to bake-only) since Phase 2 removes the fallback entirely — but probably worth landing this BEFORE Phase 2 so the canonical resolve-ref logic gets one mutation-verified test before it's retired. ## Refs - Surveyor 56f1 (#173 post-fix approval + this follow-up framing) - #148 Phase 1 (#173) — the surface this strengthens - #172 Phase 2 — the surface this retires when shipped
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
frankenbit/release-toolkit#174
No description provided.