Skip to content

fix(release): flag caller permission increases as breaking - #76

Merged
Sayt-0 merged 1 commit into
mainfrom
fix/issue-72-caller-permissions
Aug 5, 2026
Merged

fix(release): flag caller permission increases as breaking#76
Sayt-0 merged 1 commit into
mainfrom
fix/issue-72-caller-permissions

Conversation

@Sayt-0

@Sayt-0 Sayt-0 commented Aug 5, 2026

Copy link
Copy Markdown
Member

Related Issues

Fixes #72

Summary

  • documents the complete caller-job permission block for the reusable PR-review workflow, including the actions: write requirement introduced in v2.0.3
  • explains that callers granting only actions: read fail GitHub workflow validation before any job starts
  • compares caller-facing permissions with the previous stable release and prepends a breaking-change migration warning to generated release notes when a scope increases
  • keeps helper failures non-fatal after release creation while preserving fatal release-note read and edit failures
  • adds unit and shell coverage, including CI execution of the release safeguard test

Issue expectations

Expectation Implementation
Document required caller permissions Root and PR-review READMEs include the complete permissions block and v2.0.3 migration warning
Include actions: write Explicitly documented as required for review-lock cleanup and feedback artifacts
Mark caller-permission changes as breaking Release automation detects none < read < write increases and prepends migration guidance
Avoid silent downstream breakage Release notes identify changed scopes and require callers to update before upgrading

Validation

  • build passed
  • TypeScript typecheck passed
  • Biome passed
  • actionlint passed
  • unit tests: 789 passed
  • integration tests: 16 passed, 3 credential-dependent tests skipped
  • release caller-permissions shell tests: 7 passed
  • existing job-summary and output-extraction shell tests passed

Document the actions: write requirement for reusable review workflow callers and prepend migration guidance to release notes when caller-facing permissions increase.
@Sayt-0
Sayt-0 enabled auto-merge (squash) August 5, 2026 14:31
@Sayt-0
Sayt-0 requested a review from derekmisler August 5, 2026 14:31
Comment on lines +76 to +81
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || '' }}

- name: Run release caller-permissions tests

@derekmisler derekmisler left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nice work overall. the new caller-permissions module is well-structured and the test coverage is solid. a few small things worth considering:

return LEVEL_RANK[direct] >= LEVEL_RANK[wildcard] ? direct : wildcard;
};

const scopes = [...new Set([...Object.keys(previous), ...Object.keys(current)])].sort();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

suggestion (non-blocking): when previous has an explicit scope and current uses write-all (stored as {'*': 'write'}), the scopes union includes both * and the explicit key. diffCallerRequirements then flags both as increases, so the rendered warning has redundant bullets — one for * (which subsumes everything) and one for the explicit scope. probably worth filtering out explicit-scope entries after computing increases when a * entry already covers them (LEVEL_RANK[wildcard_from] <= LEVEL_RANK[inc.from] && LEVEL_RANK[wildcard_to] >= LEVEL_RANK[inc.to]).

echo "ℹ️ First release — no previous requirement to compare against."
exit 0
fi
PREV_FILE=/tmp/review-pr-previous.yml

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

suggestion (non-blocking): PREV_FILE is hardcoded to /tmp/review-pr-previous.yml. if two release jobs overlap on a shared or self-hosted runner (e.g. a stable and a beta release triggered close together), they race to overwrite each other's snapshot, which could produce a missed or spurious breaking-change warning. consider PREV_FILE=/tmp/review-pr-previous-${VERSION}.yml (and update the matching trap cleanup in tests/test-release-caller-permissions.sh).

if (inner === '') return {};
const permissions: PermissionsMap = {};
for (const part of inner.split(',')) {
const m = part.trim().match(/^([A-Za-z][A-Za-z0-9_-]*):\s*(\S+)$/);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nitpick (super non-blocking): this regex rejects keys starting with _, but KEY_RE (used for block-map entries) allows [A-Za-z_] as the first character. github scope names don't use underscores today, but the inconsistency is worth aligning.

Suggested change
const m = part.trim().match(/^([A-Za-z][A-Za-z0-9_-]*):\s*(\S+)$/);
const m = part.trim().match(/^([A-Za-z_][A-Za-z0-9_-]*):\s*(\S+)$/);

@Sayt-0
Sayt-0 merged commit 5396207 into main Aug 5, 2026
10 checks passed
@Sayt-0
Sayt-0 deleted the fix/issue-72-caller-permissions branch August 5, 2026 14:50
Sayt-0 added a commit that referenced this pull request Aug 5, 2026
Move the PR-controlled shell test out of the workflow_run context and into the pull_request test workflow to resolve the CodeQL untrusted-checkout finding introduced by #76.
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.

v2.0.3: undocumented breaking change — review-pr.yml callers must now grant actions: write

3 participants