Skip to content

fix(release): validate planned source before tag publication - #73

Merged
slashdevcorpse merged 3 commits into
mainfrom
fix/release-reserved-tag-revalidation
Jul 22, 2026
Merged

fix(release): validate planned source before tag publication#73
slashdevcorpse merged 3 commits into
mainfrom
fix/release-reserved-tag-revalidation

Conversation

@slashdevcorpse

@slashdevcorpse slashdevcorpse commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • validate the exact planned protected-main source in native build lanes without requiring its unpublished tag
  • keep tag creation exclusively in the final atomic draft-publication transition
  • lock the Windows and macOS lane contract to the admitted draft source and add explicit conflicting-tag coverage

Failure addressed

Controller run 29876040712 admitted the exact empty draft and checked out the intended commit, but the Windows lane still used the obsolete reserved-tag proof from the former pre-build tag reservation flow. The native jobs remain gated on the write-scoped exact-draft admission job, while the release-state checks fail closed on moved or annotated tags and revalidate state immediately before publication.

Verification

  • bun run --cwd scripts test lib/super-synara-workflow-contract.test.ts lib/super-synara-release-state.test.ts (34 passed)
  • node scripts/verify-workflow-contracts.ts
  • exact-file bunx oxfmt --check and bunx oxlint
  • clean-commit source proof succeeds with no reserved tag; obsolete reserved-tag mode reproduces the original failure
  • live draft 357584899 admitted at exact source d4b3d64940737627a7a5014346df1d0bcdc7e37a

Summary by cubic

Validate the admitted draft’s planned source before tag publication to prevent drift and conflicting-tag releases. Tag creation happens only in the final publish step; native lanes no longer rely on reserved tags.

  • Bug Fixes
    • Windows/macOS lanes checkout and revalidate the exact planned commit; provenance runs with github-unsigned-prerelease false.
    • Workflow contract enforces proof before the native build, exact checkout ref, and no masked failures.
    • Contract tests now cover each lane independently to lock down Windows and macOS source proof.
    • Release state fails closed on conflicting or annotated tags; moved these checks into a focused test.

Written for commit 0eff73b. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes

    • Improved prerelease build validation so Windows and macOS native builds must verify the exact approved planned source via a dedicated revalidation proof step.
    • Strengthened safeguards to fail closed when release tag/commit references conflict, and to ensure source verification happens before native compilation.
    • Updated rules so native builds can validate against the admitted draft source without requiring (or reserving) its tag.
  • Tests

    • Added/expanded contract tests for tag-conflict “fails closed” behavior and for invalid workflow configurations around planned-source verification.
  • Chores

    • Retitled specific CI checkout step names for planned versus tagged source.

Greptile Summary

This PR removes the pre-publication tag reservation requirement from the native build lanes. Previously, both Windows and macOS jobs called verify-release-source-provenance.ts with github-unsigned-prerelease true, which required the release tag to already exist on GitHub at build time; the flag is now false so the source is validated against the admitted draft commit without needing a pre-created tag.

  • The workflow step names are updated to "Checkout exact planned source" / "Revalidate exact planned source" to match the new semantics, and a new verifyNativePlannedSource() function in the contract verifier enforces the exact checkout ref, proof command, and ordering (proof before native build) for both lanes.
  • A new workflow contract test exercises three mutations that would re-introduce the old tag-reservation behaviour; a new release-state test documents conflicting-tag rejection during the draft phase.

Confidence Score: 4/5

The workflow change is safe to merge; the contract verifier and its tests lock down the new behavior end-to-end.

The core logic and contract enforcement are correct and well-tested. The two observations are test-quality issues: the new workflow contract mutations only exercise the Windows lane (not macOS), and the new release-state test duplicates two assertions already present in an existing test. Neither affects production behavior.

scripts/lib/super-synara-workflow-contract.test.ts — the three new mutation checks only mutate the first occurrence in the YAML, leaving the macOS lane's enforcement untested in isolation.

Important Files Changed

Filename Overview
scripts/lib/super-synara-workflow-contract.ts Adds verifyNativePlannedSource() that enforces both native lanes check out source_commit (not a reserved tag) and run verify-release-source-provenance.ts with github-unsigned-prerelease false, and integrates the result into verifyNativeJobCommands to guarantee the proof step precedes the native build. Logic is sound.
.github/workflows/super-synara-prerelease.yml Both Windows and macOS native lanes switch from github-unsigned-prerelease true to false and rename the checkout/revalidate steps; step names and script arguments are now consistent with the contract enforced in super-synara-workflow-contract.ts.
scripts/lib/super-synara-workflow-contract.test.ts Adds a new test that mutates github-unsigned-prerelease, the checkout step name, and the run line to confirm the contract rejects each variation; all three mutations use String.replace() (first-match-only), so only the Windows lane is exercised by each mutation rather than macOS independently.
scripts/lib/super-synara-release-state.test.ts Adds a focused test for conflicting-tag rejection during the draft phase; the two assertions it contains are already present verbatim in the pre-existing "rejects unknown reruns, moved tags, and unowned releases" test.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant RD as release-drafter.yml
    participant DA as draft_admission
    participant PF as preflight
    participant WX as windows_x64
    participant MA as macos_arm64
    participant PB as publish

    RD->>DA: dispatch (version, tag, source_sha, draft_id)
    DA->>DA: Authorize exact protected-main owner
    DA->>DA: Checkout admitted source (SHA pin)
    DA->>DA: Validate exact owned draft visibility
    Note over DA: writes source_commit output

    DA-->>WX: needs: [draft_admission, preflight]
    DA-->>MA: needs: [draft_admission, preflight]

    PF->>PF: bun install + cleanliness checks
    PF->>PF: preflight.outputs.source_commit

    WX->>WX: Checkout exact planned source (source_commit)
    WX->>WX: bun install
    WX->>WX: Revalidate exact planned source (github-unsigned-prerelease false)
    Note over WX: No pre-publication tag required
    WX->>WX: Native Windows build + tests

    MA->>MA: Checkout exact planned source (source_commit)
    MA->>MA: bun install
    MA->>MA: Revalidate exact planned source (github-unsigned-prerelease false)
    Note over MA: No pre-publication tag required
    MA->>MA: Native macOS build + tests

    WX-->>PB: artifact
    MA-->>PB: artifact (if windows-and-macos scope)
    PB->>PB: Adopt exact Release Drafter draft
    PB->>PB: Atomic gh PATCH creates immutable tag and publishes
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant RD as release-drafter.yml
    participant DA as draft_admission
    participant PF as preflight
    participant WX as windows_x64
    participant MA as macos_arm64
    participant PB as publish

    RD->>DA: dispatch (version, tag, source_sha, draft_id)
    DA->>DA: Authorize exact protected-main owner
    DA->>DA: Checkout admitted source (SHA pin)
    DA->>DA: Validate exact owned draft visibility
    Note over DA: writes source_commit output

    DA-->>WX: needs: [draft_admission, preflight]
    DA-->>MA: needs: [draft_admission, preflight]

    PF->>PF: bun install + cleanliness checks
    PF->>PF: preflight.outputs.source_commit

    WX->>WX: Checkout exact planned source (source_commit)
    WX->>WX: bun install
    WX->>WX: Revalidate exact planned source (github-unsigned-prerelease false)
    Note over WX: No pre-publication tag required
    WX->>WX: Native Windows build + tests

    MA->>MA: Checkout exact planned source (source_commit)
    MA->>MA: bun install
    MA->>MA: Revalidate exact planned source (github-unsigned-prerelease false)
    Note over MA: No pre-publication tag required
    MA->>MA: Native macOS build + tests

    WX-->>PB: artifact
    MA-->>PB: artifact (if windows-and-macos scope)
    PB->>PB: Adopt exact Release Drafter draft
    PB->>PB: Atomic gh PATCH creates immutable tag and publishes
Loading

Fix All in Codex

Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
scripts/lib/super-synara-workflow-contract.test.ts:496-521
**macOS lane not independently exercised by these mutations**

All three calls to `main.replace()` in this test use the first-match-only form, so they always mutate the Windows lane (`windows_x64` appears before `macos_arm64` in the YAML). The macOS lane's `verifyNativePlannedSource` path is never specifically broken in isolation here.

If a future refactor accidentally skips the `verifyNativePlannedSource` call for `macos_arm64` in `verifyNativeJobCommands`, these three checks would continue to pass because they only exercise the Windows lane's constraint. Consider adding a `replaceAll` variant or a targeted macOS-lane mutation (e.g., replacing the second occurrence of each needle) to give symmetric coverage for both lanes.

### Issue 2 of 2
scripts/lib/super-synara-release-state.test.ts:67-74
**Assertions duplicate an existing test**

Both `expect` calls here — `tagCommit: "b".repeat(40), tagObjectType: "commit"``"points to"` and `tagCommit: "a".repeat(40), tagObjectType: "tag"``"directly to a commit object"` — are already present verbatim in the "rejects unknown reruns, moved tags, and unowned releases" test at lines 89–93. The new test title adds useful semantic documentation, but if the behavior changes and both tests need updating, it's easy to miss the older location.

Reviews (1): Last reviewed commit: "fix(release): validate planned source be..." | Re-trigger Greptile

Greptile also left 2 inline comments on this PR.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Native release jobs now verify the exact admitted draft source before native builds. The workflow contract enforces planned-source checkout, provenance-command, environment, and ordering requirements, while tests cover tag conflicts and invalid tagless-source configurations.

Changes

Native planned-source validation

Layer / File(s) Summary
Planned-source contract enforcement
scripts/lib/super-synara-workflow-contract.ts
Adds exact planned-source proof validation, checks its structure and command, and requires it to precede native builds.
Native workflow wiring
.github/workflows/super-synara-prerelease.yml
Windows and macOS jobs rename their exact-source checkout steps to “Checkout exact planned source”.
Contract and state validation tests
scripts/lib/super-synara-workflow-contract.test.ts, scripts/lib/super-synara-release-state.test.ts
Tests planned-source mutations, rejects pre-publication tag requirements, and covers conflicting draft-release tags.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant NativeJob as Native build job
  participant PlannedSource as Planned source checkout
  participant Provenance as verify-release-source-provenance.ts
  participant Build as Native build
  NativeJob->>PlannedSource: Check out exact planned source
  PlannedSource->>Provenance: Revalidate planned-source provenance
  Provenance->>Build: Continue only after successful proof
Loading

Possibly related PRs

Suggested labels: ready-to-merge

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title concisely matches the main change: validating planned source before tag publication.
Description check ✅ Passed It covers what changed, why, and verification; the template headings are not exact, but the required content is present.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

Comment thread scripts/lib/super-synara-workflow-contract.test.ts
Comment thread scripts/lib/super-synara-release-state.test.ts

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread scripts/lib/super-synara-workflow-contract.test.ts Outdated
Comment thread scripts/lib/super-synara-release-state.test.ts
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
scripts/lib/super-synara-workflow-contract.ts 71.42% 3 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

…tag-revalidation

# Conflicts:
#	.github/workflows/super-synara-prerelease.yml
#	scripts/lib/super-synara-workflow-contract.test.ts

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slashdevcorpse has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@coderabbitai coderabbitai Bot added the ready-to-merge Approved for Mergify auto-merge after required checks pass label Jul 22, 2026
@mergify

mergify Bot commented Jul 22, 2026

Copy link
Copy Markdown

Merge Queue Status

  • Entered queue2026-07-22 01:58 UTC · Rule: default · triggered by merge protections
  • Checks skipped · PR is already up-to-date
  • 🚫 Left the queue2026-07-22 01:59 UTC · at 0eff73bceed44e053299a2361731fcb028558256

This pull request spent 29 seconds in the queue, including 3 seconds running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub repository ruleset rule Super Synara main protection]
  • base = main
  • github-review-approved [🛡 GitHub repository ruleset rule Super Synara main protection] (documentation)
  • any of [🛡 GitHub repository ruleset rule Super Synara main protection]:
    • check-success = quality
    • check-neutral = quality
    • check-skipped = quality
  • any of [🛡 GitHub repository ruleset rule Super Synara main protection]:
    • check-success = windows_x64
    • check-neutral = windows_x64
    • check-skipped = windows_x64
  • any of [🛡 GitHub repository ruleset rule Super Synara main protection]:
    • check-success = macos_arm64
    • check-neutral = macos_arm64
    • check-skipped = macos_arm64
  • any of [🛡 GitHub repository ruleset rule Super Synara main protection]:
    • check-success = release_smoke
    • check-neutral = release_smoke
    • check-skipped = release_smoke
  • any of [🛡 GitHub repository ruleset rule Super Synara main protection]:
    • check-success = dependency-review
    • check-neutral = dependency-review
    • check-skipped = dependency-review
  • any of [🛡 GitHub repository ruleset rule Super Synara main protection]:
    • check-success = codeql-actions
    • check-neutral = codeql-actions
    • check-skipped = codeql-actions
  • any of [🛡 GitHub repository ruleset rule Super Synara main protection]:
    • check-success = codeql-javascript-typescript
    • check-neutral = codeql-javascript-typescript
    • check-skipped = codeql-javascript-typescript
  • any of [🛡 GitHub repository ruleset rule Super Synara main protection]:
    • check-success = codeql-swift
    • check-neutral = codeql-swift
    • check-skipped = codeql-swift

Reason

Pull request #73 has been merged manually at 5900bc5

Hint

You were too fast!

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

@slashdevcorpse
slashdevcorpse merged commit 5900bc5 into main Jul 22, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dequeued ready-to-merge Approved for Mergify auto-merge after required checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant