Skip to content

fix(release): revalidate main and package modes - #236

Merged
khaliqgant merged 4 commits into
mainfrom
codex/publish-revalidate-main-modes
Aug 12, 2026
Merged

fix(release): revalidate main and package modes#236
khaliqgant merged 4 commits into
mainfrom
codex/publish-revalidate-main-modes

Conversation

@barryollama

Copy link
Copy Markdown
Contributor

Summary

  • revalidate that GITHUB_SHA is still current origin/main immediately before release tag creation and immediately before npm publish
  • compare extracted package file types, contents, symlink targets, and permission/executable modes during registry/tag recovery
  • add deterministic mode/content comparator coverage

Context

Follow-up to #235 for Cubic findings posted on head 708c177 shortly before that PR was merged externally. This PR contains only those two review fixes. It does not publish, tag, or change version 0.1.58.

Verification

  • npm run build
  • npx vitest run src/release-state.test.ts (10 passed)
  • actionlint v1.7.12 + YAML parse
  • bash syntax checks
  • current payload/provenance comparison
  • stale-main rejection proof
  • rebuilt and packed v0.1.58 orphan tag matches npm including file modes
  • git diff --check

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 815952ef-9a37-4ab7-b46f-b641c98e45a9

📥 Commits

Reviewing files that changed from the base of the PR and between f526169 and 469eebf.

📒 Files selected for processing (4)
  • .github/workflows/publish.yml
  • scripts/compare-package-trees.mjs
  • scripts/require-current-main.sh
  • src/release-state.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • scripts/require-current-main.sh
  • scripts/compare-package-trees.mjs

📝 Walkthrough

Walkthrough

The release process now uses a reusable package-tree comparator and a Bash guard for current-main validation. Payload verification compares modes, links, types, and contents. Publishing validates the current commit before release actions.

Changes

Release integrity

Layer / File(s) Summary
Package tree comparison and payload verification
scripts/compare-package-trees.mjs, scripts/verify-release-payload.sh, src/release-state.test.ts
The comparator checks filesystem entries, permission modes, symbolic-link targets, and file contents. Payload verification and tests use it.
Current-main release guard
scripts/require-current-main.sh, .github/workflows/publish.yml, src/release-state.test.ts
The workflow uses ref-only validation for live-release reruns and full current-main validation before tag creation and npm publishing. Tests cover guard arguments and workflow policy checks.

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

Suggested reviewers: barryonthecape, khaliqgant

Poem

A rabbit checks each package tree,
For modes and links in harmony.
Main’s current commit guards the way,
Before tags and packages leave today.
“Hop verified!” says the rabbit.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the release validation and package-mode changes.
Description check ✅ Passed The description accurately covers the release validation, package comparison, tests, and verification steps.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/publish-revalidate-main-modes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/publish.yml:
- Around line 217-219: Update the publish step containing npm publish to pass
github.event.inputs.tag through the step’s env configuration, then reference
that environment variable as a quoted shell variable in the command. Remove
direct expression interpolation from the Bash command while preserving the
existing provenance, access, and publish-tag options.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3fb8d298-90d5-4872-b1bd-d0b5e5425c4e

📥 Commits

Reviewing files that changed from the base of the PR and between 0ef6790 and f526169.

📒 Files selected for processing (5)
  • .github/workflows/publish.yml
  • scripts/compare-package-trees.mjs
  • scripts/require-current-main.sh
  • scripts/verify-release-payload.sh
  • src/release-state.test.ts

Comment thread .github/workflows/publish.yml Outdated
@barryollama

barryollama commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Addressed CodeRabbit's publish-shell finding in 4b5933f: the workflow now passes the selected npm dist-tag through NPM_DIST_TAG and quotes the shell variable. Focused tests (10/10), actionlint, and diff checks pass.

@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.

1 issue found and verified against the latest diff

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/require-current-main.sh">

<violation number="1" location="scripts/require-current-main.sh:9">
P2: The new revalidation hard-blocks the workflow's documented recovery path. The tag/publish steps are designed to be resumable for a missing tag with an already-published, matching npm payload (see release-state.mjs's 'recover-missing-tag' state and the 'safely resumable' comment at the Create release tag step). But a re-run reuses the original triggering GITHUB_SHA, and require-current-main.sh now requires that SHA to equal the current origin/main. If any commit lands on main between the original partial failure and the recovery rerun, the revalidation fails and the tag can no longer be restored even though the published payload already matches the checkout. Consider scoping the main-current revalidation only to the fresh 'new-release' path so that recovery of an already-published equivalent payload is not permanently blocked.</violation>
</file>

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

Re-trigger cubic

Comment thread scripts/compare-package-trees.mjs Outdated
Comment thread scripts/require-current-main.sh
@barryollama

Copy link
Copy Markdown
Contributor Author

Addressed both Cubic findings in f7fc299: package-tree comparison now includes setuid/setgid/sticky bits with a regression test, and current-main SHA validation is limited to the fresh new-release state while main-ref validation remains universal. Verified recovery states (resume-after-tag and recover-missing-tag) remain resumable after main advances. Focused tests 10/10, actionlint, YAML parsing, shell syntax, and diff checks pass.

@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 (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread scripts/require-current-main.sh
require-current-main.sh --ref-only extra silently exited 0 instead of
failing, because the --ref-only check ran before argument validation.
Move the count check first so misuse (extra/unknown args) is caught.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@khaliqgant
khaliqgant merged commit bd361e0 into main Aug 12, 2026
7 checks passed
@khaliqgant
khaliqgant deleted the codex/publish-revalidate-main-modes branch August 12, 2026 17:55
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.

4 participants