fix(ci): remove unused staging PR write authority - #1772
Merged
Conversation
Contributor
Contributor
Author
|
Integration in progress — owned by task 01KZMFQJ4VKXEFB9K9Q64QKDDF. PR Shepherd: hands off until this completes. |
simple-agent-manager
Bot
force-pushed
the
sam/wp-121-remove-unused-c1n154
branch
from
August 10, 2026 00:14
550a2e8 to
3b862fa
Compare
|
Contributor
Author
|
Integration in progress — owned by task 01M03VFVP79GR882BJMPKZV58V (overnight consolidated PR sweep authorized by Raphaël 2026-08-15). PR Shepherd: hands off until this completes. This supersedes the stale claim by failed task 01KZMFQJ4VKXEFB9K9Q64QKDDF where present. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
pull-requests: writeauthority from the staging deployment caller.contents: read,deployments: none, andid-token: none.Release contract: keep this PR open and unmerged. Do not deploy this individual source PR to shared staging; the final integration task owns staging.
Validation
pnpm lint -- --quiet— 7/7 taskspnpm typecheck— 16/16 taskspnpm test— the local full suite exposed timeout-only API flakes in files identical to the green base SHA; this is not represented as green. Clean-runner GitHub CI is mandatory below.pnpm install --frozen-lockfileactionlintv1.7.12 across every workflow (official release attestation verified)pnpm build— 9/9 tasksCurrent
mainSHA8eed3b7402d2e036900a67db0232fe6c8623155ahas a successful GitHub CI run. The branch was conservatively rebased onto that exact SHA before final validation.Staging Verification (EXPLICIT USER OVERRIDE — NOT PERFORMED)
The task's release contract expressly prohibits deploying this individual source PR to shared staging. The final integration task owns staging verification. No staging workflow was triggered and shared staging was not mutated.
Staging Verification Evidence
Explicit no-staging override. Local contracts verify the staging caller/reusable interface and GitHub CI must be completely green. Shared staging remains untouched.
UI Compliance Checklist
End-to-End Verification
Data Flow Trace
.github/workflows/deploy-staging.ymldeclares the exact root token scopes.jobs.deploy.usesinvokes.github/workflows/deploy-reusable.ymlwith the unchanged environment, skip-agent, dry-run, and inherited-secret contract.Untested Gaps
Live staging execution is intentionally omitted under the direct release contract. Clean-runner GitHub CI is required to close the local broad-suite timeout limitation before handoff.
Post-Mortem
What broke
The staging deployment retained repository pull-request write authority after the only PR-comment feature using it was deleted.
Root cause
Commit
3ec20f63badded the permission with the PR-comment step. Commitaaa6e00e6later removed the step without removing its adjacent permission.Class of bug
Orphaned security authority after feature removal.
Why it wasn't caught
Existing workflow tests covered deploy behavior and pins but did not connect granted token scopes to active capabilities.
Process fix included in this PR
scripts/quality/deploy-staging-permissions.test.tsstructurally enforces the exact caller permission map and rejects historical, relocated, broad, malformed/escaped, inherited-override, token-backed API, and PR-comment-action regressions.Post-mortem file
tasks/active/2026-08-08-staging-workflow-least-privilege.mdSpecialist Review Evidence
needs-human-reviewlabel is requiredExceptions
Agent Preflight (Required)
Classification
External References
Official GitHub documentation was consulted before coding: permissions for
GITHUB_TOKENand reusable-workflow access/permission propagation.Codebase Impact Analysis
.github/workflows/deploy-staging.yml: remove PR write authority and declare exact minimum scopes..github/workflows/deploy-reusable.yml: unchanged contract boundary inspected by the new test.scripts/quality/deploy-staging-permissions.test.ts: structural cross-workflow capability/permission regression coverage.package.jsonandpnpm-lock.yaml: direct test-onlyyaml@2.9.0dependency with a three-line importer-only lock delta.Documentation & Specs
N/A: no public behavior or documentation surface changes. The operational record is maintained in
tasks/active/2026-08-08-staging-workflow-least-privilege.md.Constitution & Risk Check
Principles II, VI, X, and XI were checked. The change removes authority, preserves all existing behavior, adds scenario-driven contract coverage, pins the structural parser dependency, and introduces no runtime URL, timeout, limit, secret, identifier, or deployment prerequisite. The principal risk was a false sense of coverage from regex parsing; independent defensive review drove the final structural parser and adversarial fixtures.