Skip to content

fix(release): make tag workflow the single npm publisher - #20

Merged
echoVic merged 3 commits into
mainfrom
codex/release-publish-owner
Aug 3, 2026
Merged

fix(release): make tag workflow the single npm publisher#20
echoVic merged 3 commits into
mainfrom
codex/release-publish-owner

Conversation

@echoVic

@echoVic echoVic commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • make the tag-triggered workflow the only npm publisher
  • keep local release scripts responsible for versioning, tagging, and pushing
  • require Discord notification credentials through DISCORD_WEBHOOK_URL instead of shipping a source default

Verification

  • bun x vitest run --config vitest.config.ts --project unit tests/unit/scripts/release-config.test.ts
  • bun x biome check release.config.js tests/unit/scripts/release-config.test.ts
  • bun x tsc --noEmit --pretty false
  • bun run release:minor --dry-run (resolved 0.7.0)

Summary by CodeRabbit

  • Bug Fixes

    • Prevented local release scripts from publishing packages to npm.
    • Removed embedded Discord webhook credentials; release notifications now require configured credentials.
    • Ensured public npm publishing occurs through the designated tag-based workflow.
  • Tests

    • Added release configuration checks covering publishing behavior and credential handling.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The release configuration disables local npm publishing and removes the hardcoded Discord webhook fallback. Unit tests verify publishing ownership and confirm that webhook credentials are not embedded in the configuration.

Changes

Release configuration

Layer / File(s) Summary
Release ownership and credential contract
packages/cli/release.config.js, packages/cli/tests/unit/scripts/release-config.test.ts
Local npm publishing is disabled, Git publishing remains enabled, and the Discord webhook uses only DISCORD_WEBHOOK_URL. Unit tests verify publishing ownership and check that the source contains no embedded webhook URL.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states that the tag workflow is the single npm publisher, which matches the main change.
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/release-publish-owner

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.

@echoVic
echoVic marked this pull request as ready for review August 3, 2026 02:01

@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

🧹 Nitpick comments (2)
packages/cli/tests/unit/scripts/release-config.test.ts (2)

25-32: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Test the runtime DISCORD_WEBHOOK_URL contract.

Line 31 only checks that one URL prefix is absent from source. It does not verify that releaseConfig.notifications.discord.webhookUrl resolves from process.env.DISCORD_WEBHOOK_URL. A regression to undefined would still pass and the notifier would silently skip. Set a fake environment value before importing release.config.js, assert the resolved property, and restore the environment.

🤖 Prompt for 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.

In `@packages/cli/tests/unit/scripts/release-config.test.ts` around lines 25 - 32,
Update the release-config test around the existing source scan to set a fake
process.env.DISCORD_WEBHOOK_URL before loading release.config.js, assert that
releaseConfig.notifications.discord.webhookUrl equals that value, and restore
the environment afterward, ensuring module import occurs only after the variable
is configured.

19-22: 🗄️ Data Integrity & Integration | 🔵 Trivial | 🏗️ Heavy lift

Verify exclusive npm ownership.

Lines 19-22 verify that local npm publishing is disabled and that one workflow contains npm publish. They do not verify that no other release script or workflow publishes npm. A second publisher could be added without failing this test. Add an exclusivity check or an integration test for the tag-triggered release path.

As per coding guidelines, tests should cover unit tests, integration tests, and end-to-end user workflows.

🤖 Prompt for 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.

In `@packages/cli/tests/unit/scripts/release-config.test.ts` around lines 19 - 22,
Extend the release configuration tests around releaseConfig and publishWorkflow
to verify exclusive npm ownership: confirm the local npm publish setting remains
disabled, the tag-triggered workflow performs npm publishing, and no other
release script or workflow contains an npm publish command. Cover the
tag-triggered release path with an integration or end-to-end assertion if the
unit fixtures cannot establish exclusivity.

Source: Coding guidelines

🤖 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 `@packages/cli/tests/unit/scripts/release-config.test.ts`:
- Line 21: Update the publishWorkflow assertion in release-config.test.ts to use
a single-quoted TypeScript string, escaping the embedded YAML quotes while
preserving the expected "- 'v*.*.*'" content; keep the statement
semicolon-terminated and within the configured line width.

---

Nitpick comments:
In `@packages/cli/tests/unit/scripts/release-config.test.ts`:
- Around line 25-32: Update the release-config test around the existing source
scan to set a fake process.env.DISCORD_WEBHOOK_URL before loading
release.config.js, assert that releaseConfig.notifications.discord.webhookUrl
equals that value, and restore the environment afterward, ensuring module import
occurs only after the variable is configured.
- Around line 19-22: Extend the release configuration tests around releaseConfig
and publishWorkflow to verify exclusive npm ownership: confirm the local npm
publish setting remains disabled, the tag-triggered workflow performs npm
publishing, and no other release script or workflow contains an npm publish
command. Cover the tag-triggered release path with an integration or end-to-end
assertion if the unit fixtures cannot establish exclusivity.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 642adb0f-e5fe-43a5-9898-6c6e9fac0433

📥 Commits

Reviewing files that changed from the base of the PR and between a141169 and 22d71f9.

📒 Files selected for processing (2)
  • packages/cli/release.config.js
  • packages/cli/tests/unit/scripts/release-config.test.ts

Comment thread packages/cli/tests/unit/scripts/release-config.test.ts
@echoVic

echoVic commented Aug 3, 2026

Copy link
Copy Markdown
Owner Author

Addressed the valid review suggestions in 3d7445e9: the test now loads release.config.js after setting a fake DISCORD_WEBHOOK_URL, verifies the resolved runtime value, restores the environment, and asserts that publish.yml is the only active workflow containing npm publish. Local Vitest, Biome, TypeScript, and diff checks pass.

@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 `@packages/cli/tests/unit/scripts/release-config.test.ts`:
- Around line 37-48: Update the `loads notification credentials only from the
environment` test to first remove `DISCORD_WEBHOOK_URL`, load the configuration
with a distinct cache key, and assert
`releaseConfig.notifications.discord.webhookUrl` is undefined. Then restore the
environment value, load the configured case, and retain the existing assertion
that it is selected.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3fb90862-1812-45c8-9336-6fdaa7e471af

📥 Commits

Reviewing files that changed from the base of the PR and between 22d71f9 and 3d7445e.

📒 Files selected for processing (1)
  • packages/cli/tests/unit/scripts/release-config.test.ts

Comment on lines +37 to +48
it('loads notification credentials only from the environment', async () => {
const previousWebhook = process.env.DISCORD_WEBHOOK_URL;
process.env.DISCORD_WEBHOOK_URL = 'https://example.invalid/test-webhook';

try {
const releaseConfig = await loadReleaseConfig('notification-env');
const configSource = fs.readFileSync(configPath, 'utf8');

expect(releaseConfig.notifications.discord.webhookUrl).toBe(
'https://example.invalid/test-webhook'
);
expect(/https:\/\/discord\.com\/api\/webhooks\//.test(configSource)).toBe(false);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Assert behavior when DISCORD_WEBHOOK_URL is absent.

The test verifies that an environment value is selected. It does not verify that no fallback credential exists. A hardcoded or constructed fallback can pass the current test.

Delete the variable, load the configuration with a distinct cache key, and assert that webhookUrl is undefined before testing the configured environment value.

Proposed test update
     try {
+      delete process.env.DISCORD_WEBHOOK_URL;
+      const missingCredentialConfig = await loadReleaseConfig(
+        'notification-no-env'
+      );
+      expect(
+        missingCredentialConfig.notifications.discord.webhookUrl
+      ).toBeUndefined();
+
       const releaseConfig = await loadReleaseConfig('notification-env');
🧰 Tools
🪛 ast-grep (0.45.0)

[warning] 42-42: Filesystem path is not a string literal; a request-/variable-derived path can enable path traversal. Validate and normalize the path before use.
Context: fs.readFileSync(configPath, 'utf8')
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(detect-non-literal-fs-filename-typescript)

🤖 Prompt for 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.

In `@packages/cli/tests/unit/scripts/release-config.test.ts` around lines 37 - 48,
Update the `loads notification credentials only from the environment` test to
first remove `DISCORD_WEBHOOK_URL`, load the configuration with a distinct cache
key, and assert `releaseConfig.notifications.discord.webhookUrl` is undefined.
Then restore the environment value, load the configured case, and retain the
existing assertion that it is selected.

@echoVic
echoVic merged commit 411dc62 into main Aug 3, 2026
8 checks passed
@echoVic
echoVic deleted the codex/release-publish-owner branch August 3, 2026 02:18
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