Skip to content

[CEL-1328] Harden static preview cleanup - #19

Merged
mong-x merged 2 commits into
mainfrom
mjnong/cel-1328-cleanup-auth-followup
Aug 27, 2026
Merged

[CEL-1328] Harden static preview cleanup#19
mong-x merged 2 commits into
mainfrom
mjnong/cel-1328-cleanup-auth-followup

Conversation

@mong-x

@mong-x mong-x commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to merged CEL-1328 PR #16.

  • revalidate closed PR, same-repository source, and closer's current write-capable permission immediately before cleanup OIDC
  • allow authorized closer independent from PR author
  • serialize gcloud storage cleanup workers after observed SQLite lock failure
  • execute trusted and adversarial cleanup fixtures

Linear

CEL-1328

Exact head

0a03a445ac329dcdc7b4689de59b1dbb674b4413

Evidence

  • Exact-head validation run 33087567251: passed
  • ruby .github/tests/deploy-static-lock-validator.test.rb: 28 lock fixtures and 40 manifest executions passed
  • ruby .github/tests/deploy-static-job-boundaries.test.rb: passed
  • ruby .github/tests/discord-metadata-boundary.test.rb: passed
  • actionlint .github/workflows/deploy-static-website.yaml .github/workflows/validate-static-deploy.yaml: passed
  • git diff --check: passed

Review

  • Independent review A: approved exact head
  • Independent review B: P0/P1/P2 none; P3 harness-extraction nit only
  • CodeRabbit check: success; latest detailed review rate-limited
  • Unresolved review threads: zero
  • Five-lane exact-head review: goal, code, context, security, and QA passed; P0/P1 none

Manual QA

Exact-head authorization matrix accepts write-capable maintainer and author closers; rejects open PR, forked head, and revoked permission. Authorization runs immediately before OIDC. Cleanup gcloud process/thread counts both equal 1.

Merge order

Merge this PR before Producer #674, Importer #279, Admin #251, and E-label #200. Callers pin this exact SHA.

CEL-1422 remains held and untouched.

@coderabbitai

coderabbitai Bot commented Aug 27, 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: 2e791bea-9164-4dc2-9c0b-65d2544f3b67

📥 Commits

Reviewing files that changed from the base of the PR and between 0620ad4 and ccf499a.

📒 Files selected for processing (2)
  • .github/tests/deploy-static-job-boundaries.test.rb
  • .github/workflows/deploy-static-website.yaml

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Important

Approval pending

CodeRabbit has no unresolved comments, but it has not reviewed the latest commit.

Use the checkbox below to review the latest commit. CodeRabbit will approve the changes if it finds no blocking issues.

  • 🔍 Trigger review
📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Strengthened preview cleanup authorization checks to prevent unauthorized or mismatched cleanup requests.
    • Restricted preview deletion to closed pull requests with verified repository, author, and permission details.
    • Improved cleanup reliability by serializing storage deletion workers and threads.
  • Tests
    • Expanded automated coverage for authorization ordering, authentication, forked requests, and pull request validation.

Walkthrough

The pull request tightens cleanup-job authorization in the static website workflow. It requires pull request metadata and collaborator permission checks before preview deletion. It also forces the delete step to use one gcloud process and one thread. Tests cover the new workflow rules and failure cases.

Changes

Cleanup preview authorization

Layer / File(s) Summary
Cleanup authorization gate
.github/workflows/deploy-static-website.yaml, .github/tests/deploy-static-job-boundaries.test.rb
The cleanup job now reads pull request data and blocks cleanup unless the pull request is closed, the actor matches the author, the source repository matches, and the actor still has write, maintain, or admin permission. Tests also require this authorization step to run before OIDC and to use the pinned github-script action and job token.
Serialized preview deletion
.github/workflows/deploy-static-website.yaml, .github/tests/deploy-static-job-boundaries.test.rb
The delete step now sets Google Cloud Storage process and thread counts to 1. Tests require the same serialized settings in the cleanup job.

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

Merge Risk: ⚪ Minimal · up to ccf49

The change adds authorization rechecks and serializes cleanup workers, with the supplied validation checks passing. No actionable merge-blocking risk remains beyond normal checks and review.

Suggested labels: enhancement

Suggested reviewers: lebedevdsl

Poem

Rabbit checks the gate before the broom can sweep.
Closed trails only; open ones must sleep.
One paw on threads, one paw on process too.
The preview path stays narrow, clear, and true.
I twitch my ears at tests that guard the way.
Small hops, strict checks, and tidy work today.

🚥 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. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
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 clearly identifies the main change: hardening static preview cleanup authorization and execution.
Description check ✅ Passed The description directly explains the authorization revalidation, serialized cleanup workers, tests, and validation results described by the changeset.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.)

✨ 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 mjnong/cel-1328-cleanup-auth-followup

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 added the enhancement New feature or request label Aug 27, 2026
@mong-x

mong-x commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Independent exact-SHA gate review — reviewer identity/lane: independent_two / independent reviewer lane

Full SHA: ccf499a9e6f2c492e83e252e07cc865ffd2a70b5
Verdict: PASS (HIGH confidence)

Tests reproduced:

  • ruby .github/tests/deploy-static-lock-validator.test.rb — 28 lock fixtures + 40 manifest fixtures passed
  • ruby .github/tests/deploy-static-job-boundaries.test.rb — passed
  • ruby .github/tests/discord-metadata-boundary.test.rb — passed
  • actionlint .github/workflows/deploy-static-website.yaml .github/workflows/validate-static-deploy.yaml — passed
  • git diff --check origin/main...HEAD — passed

Trace: cleanup revalidation is directly before OIDC and requires closed PR, event actor = current PR author, same-repository head, and current admin|maintain|write permission. Delete step serializes gcloud storage with process/thread counts 1; run 33084226342 attempt 1 confirms prior database is locked failure.

Findings: P0 none; P1 none; P2 none; P3 none. CodeRabbit passed at exact SHA; no unresolved review threads. Cubic check remained pending and produced no blocker at review time.

@mong-x

mong-x commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Independent reviewer mong-x; lane independent_one.

Exact SHA: ccf499a.
Verdict: PASS. Confidence: HIGH.

P0: none.
P1: none.
P2: none.
P3: pull_request_target lifecycle uses default-branch workflow definitions. Exact-head close-cleanup runtime remains post-merge canary work. Cubic status remains IN_PROGRESS; CodeRabbit SUCCESS; unresolved review threads: 0.

Verified full two-file diff and full workflow/boundary-test files. Cleanup matrix: closed PR; actor=author; same-repository head; current admin|maintain|write; authorization immediately before OIDC. gcloud cleanup serialization: process/thread counts 1.

Tests: ruby .github/tests/deploy-static-job-boundaries.test.rb; ruby .github/tests/deploy-static-lock-validator.test.rb; ruby .github/tests/discord-metadata-boundary.test.rb; actionlint .github/workflows/deploy-static-website.yaml .github/workflows/validate-static-deploy.yaml; git diff --check 0620ad4...ccf499a — PASS.

Skill-perspective check ran: omo:programming, omo:remove-ai-slops. No brittle/tautological/deletion-only or implementation-mirroring test defect; no needless production parsing, normalization, or abstraction.

@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 across 2 files

Confidence score: 5/5

  • In .github/tests/deploy-static-job-boundaries.test.rb, the cleanup test duplicates the existing Open3.capture3/AsyncFunction harness, increasing maintenance risk if the two copies drift—extract the shared harness before adding further cases.
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=".github/tests/deploy-static-job-boundaries.test.rb">

<violation number="1" location=".github/tests/deploy-static-job-boundaries.test.rb:233">
P3: The new cleanup test block copies the entire Open3.capture3 node AsyncFunction harness that the preview-authorization cases already define in the same file. Both harnesses are byte-near-identical; only the injected env vars differ. Extract the harness (pullRequest/context/core mocks plus the node `-e` invoker) into a shared helper, and have both the preview and cleanup case loops call it, so the two copies cannot drift apart.</violation>
</file>

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

Re-trigger cubic

Comment thread .github/workflows/deploy-static-website.yaml Outdated
Comment thread .github/tests/deploy-static-job-boundaries.test.rb
@mong-x

mong-x commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

reviewer: independent_b
head: 0a03a44
verdict: NIT-ONLY
findings: P0 none; P1 none; P2 none; P3 duplicated Node authorization harness remains in deploy-static-job-boundaries test (unresolved thread). No criterion failure.
security/goal: PASS. Cleanup rechecks closed PR, same-repo head, current actor write permission, then OIDC; non-author maintainer accepted. OIDC ordering and exact action pins verified. Slop/overfit pass: tests execute trusted/adversarial behavior; P3 duplication only.
tests/CI: local lock validator 28 fixtures/40 manifests, job boundaries, Discord boundary, actionlint, diff-check PASS. GitHub lock-validator and CodeRabbit PASS.

@mong-x

mong-x commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

independent_a
HEAD: 0a03a44
VERDICT: APPROVE
P0: none. P1: none. P2: none. P3: none.
Evidence: full diff and final delta inspected. Recheck allows write-capable non-author closer, rejects open/fork/read, runs directly before OIDC. Ruby boundary test, actionlint, and diff check passed. Required CI: none reported.

@mong-x
mong-x merged commit 660b0cf into main Aug 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant