Skip to content

ci(claude): full Day 2 caller migration — review + mention + issue-to-PR + caller validator#478

Merged
heskew merged 4 commits intomainfrom
workflow/claude-review-caller-migration
May 6, 2026
Merged

ci(claude): full Day 2 caller migration — review + mention + issue-to-PR + caller validator#478
heskew merged 4 commits intomainfrom
workflow/claude-review-caller-migration

Conversation

@heskew
Copy link
Copy Markdown
Member

@heskew heskew commented May 6, 2026

Summary

Day 2 of the AI workflow caller migration for harper. Mirrors oauth #75: now that all three reusables exist on ai-review-prompts main (post-#11 / #12 / #14), close out harper's caller migration in one shot rather than dragging it across PRs.

After this lands, harper has zero inline Claude workflow logic — everything flows through the centralized reusables in HarperFast/ai-review-prompts, pinned to 11872cb1cc2d0e90659659ade6d8ddbbdfbf1d05.

What's migrated to thin callers

  • claude-review.yml → caller of _claude-review.yml. Kept the existing repo-specific-checks (Harper core: oxlint, RocksDB, TypeStrip, dependencies.md, no tsc || true tolerance). Pin bumped from bac5e45 to 11872cb for parity with the other two.
  • claude-mention.yml → caller of _claude-mention.yml. Harper conventions flow through repo-specific-conventions: input.
  • claude-issue-to-pr.yml → caller of _claude-issue-to-pr.yml. Same harper conventions; default pre-commit-validation (npm-only, label-scoped) matches harper's existing flow — no override needed.

What's added

  • .github/workflows/validate-caller-workflows.yml — thin caller of _validate-caller-workflows.yml. Catches shadow jobs (a non-uses: job alongside the legit reusable call would run with the caller's perms, bypassing the auth gate) and mutable refs in either uses: or with.ai-review-prompts-ref. Recommend making the validate job a required status check on main alongside CODEOWNERS review on .github/.

What's removed

  • .github/scripts/authorize-claude-workflow.sh — now shipped by the reusables.
  • .github/scripts/parse-claude-mention.sh — same.
  • .github/scripts/validate-auth-gate-invariants.sh — replaced by the new caller-validator workflow (which fully covers the caller pattern; no inline workflows remain to validate).
  • .github/workflows/auth-gate-invariants.yml — replaced by validate-caller-workflows.yml.

Net: 8 files touched (4 deleted + 1 added + 3 modified), +122 / −795 (inline prompt bodies and scripts now centralized in ai-review-prompts).

Caveat: workflow-modifying-PR App-token-401

This PR will continue to hit the GitHub-side gotcha that's already kept it from getting reviewed by Claude — the action's App token exchange returns 401 because the checked-out workflow content differs from main's. Subsequent harper PRs will be reviewed normally and will exercise the new validate-caller-workflows.yml job.

Test plan

  • Caller validator script (validate-caller-workflow.sh from ai-review-prompts main) dry-run locally against the new tree: 3 caller workflows pass, no inline files remain.
  • Validator catches shadow jobs and mutable refs (verified via separate self-test against synthetic fixtures during the validator's own PR).
  • Live exercise after merge: open a tiny doc PR, verify the caller-validator job fires green; trigger an @claude mention, verify the mention reusable picks up Harper conventions; label a test issue with claude-fix:typo, verify the issue-to-PR reusable opens a PR.

Commits

  1. 9bbdae2 — initial migration of claude-review.yml to caller pattern
  2. d2a8e87 — pass ai-review-prompts-ref explicitly (post-auto-derive bug)
  3. 5c3f255 — bump ai-review-prompts pin to bac5e45
  4. f9b1c57(this push) expand to full Day 2: mention + issue-to-PR migrations, caller validator added, local scripts dropped, pin bumped to 11872cb

🤖 Generated with Claude Code

…ew-prompts reusable

Day 1 of revised Plan A — replaces harper's inline 463-line
`claude-review.yml` with a ~75-line caller of the reusable
workflow shipped in `HarperFast/ai-review-prompts#8`. The single
`uses:` ref pin (currently `0a5ccbc6...` = ai-review-prompts main
2026-05-05) controls everything that needs to move together:

  * The workflow logic itself (the reusable's authorize +
    review jobs, including the marker-based comment edit, the
    learnings-channel via $RUNNER_TEMP, the post-#444/#447/#452
    calibration shape).
  * The layer files referenced by `review-layers` (universal,
    harper/common, harper/v5).
  * The bash scripts the reusable invokes
    (compose-review-scope, find-prior-review-comment,
    log-review-to-ai-review-log, authorize-claude-workflow).
  * The fix-up commit baking in the honest-allowlist comment
    block (no longer claiming "Tool allowlist is a security
    boundary").

What lands

  * `.github/workflows/claude-review.yml` — replaced with the
    thin caller. Inputs: `review-layers` (universal +
    harper/common + harper/v5), `repo-specific-checks` (the
    Harper-core block, including the "this repo IS Harper core,
    so 'defer to Harper docs' applies to PLUGIN docs, not
    in-repo docs" caveat that was previously inline). Secrets
    passed through.
  * Removes three scripts the reusable now owns:
    `.github/scripts/compose-review-scope.sh`,
    `find-prior-review-comment.sh`,
    `log-review-to-ai-review-log.sh`.
  * Keeps three scripts still used by the inline mention /
    issue-to-pr workflows:
    `.github/scripts/authorize-claude-workflow.sh` (used by
    mention + issue-to-pr's authorize jobs; same script as the
    reusable, intentional duplication until those workflows
    migrate too), `parse-claude-mention.sh`,
    `validate-auth-gate-invariants.sh`.
  * Updates `validate-auth-gate-invariants.sh` to handle
    caller-pattern workflows: when a `claude-*.yml` has no
    inline authorize job, the validator now confirms the
    workflow invokes a `HarperFast/...` reusable via `uses:`
    pinned to a 40-char SHA (mutable refs would let an
    attacker silently repoint to a weakened version of the
    reusable). The reusable's structural invariants are
    validated separately by ai-review-prompts' own
    auth-gate-invariants.yml.

What's NOT in this PR

  * `claude-mention.yml` and `claude-issue-to-pr.yml` stay
    inline. Reusables for those will land later as Day 2 of
    the revised Plan A; same caller-migration pattern.
  * oauth migration to caller — separate PR after this lands.

Verified locally

  * YAML parses for both the new caller and the updated
    validator.
  * `bash .github/scripts/validate-auth-gate-invariants.sh`
    against all three current workflows: passes.
    `claude-review.yml` is recognized as caller-pattern and the
    SHA pin is enforced. The two inline workflows still pass
    the structural check.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Same fix as oauth#73: the reusable's auto-derive of the called-
workflow ref doesn't work in workflow_call context (github.workflow_ref
resolves to the CALLER's ref). Pass the SHA explicitly via the
existing ai-review-prompts-ref input until the followup PR drops
the broken auto-derive.

See HarperFast/oauth#73 for the prior art and rationale.
@heskew heskew marked this pull request as ready for review May 6, 2026 02:11
HarperFast/ai-review-prompts#10 dropped the broken github.workflow_ref
auto-derive and made ai-review-prompts-ref required. Bump both places
in lockstep.
…idator

Mirrors the oauth #75 shape: now that all three reusables exist on
ai-review-prompts main (post-#11/#12/#14), close out harper's
caller migration in one shot rather than dragging it across PRs.

- `claude-mention.yml`     → caller of `_claude-mention.yml`
- `claude-issue-to-pr.yml` → caller of `_claude-issue-to-pr.yml`
- `claude-review.yml`      → SHA pin bumped from `bac5e45` to
                             `11872cb` for parity with the other
                             two

Both new callers carry the harper-specific repo conventions
(oxlint, RocksDB primary, TypeStrip, `dependencies.md`, no
`tsc || true` build tolerance) via the reusables'
`repo-specific-conventions:` input. Default
`pre-commit-validation` matches the harper-style npm-only
flow already shipped in the reusables — no override needed.

Adds `validate-caller-workflows.yml` — thin caller of
`_validate-caller-workflows.yml`. Catches shadow jobs and
mutable refs in the caller files. Make this `validate` job a
required status check on `main`.

Removes harper's now-redundant local files (oauth dropped the
same set in #75; the centralized scripts in `ai-review-prompts`
are the single source of truth):

- `.github/scripts/authorize-claude-workflow.sh`
- `.github/scripts/parse-claude-mention.sh`
- `.github/scripts/validate-auth-gate-invariants.sh`
- `.github/workflows/auth-gate-invariants.yml`

Net: 8 files touched (4 deleted + 1 added + 3 modified),
+122 / -795. Caller validator passes locally against the
all-caller tree.

Workflow-modifying-PR caveat applies — same App-token-401
gotcha that's already kept this PR from getting reviewed by
Claude. Subsequent harper PRs will be reviewed normally and
will exercise the new `validate-caller-workflows.yml` job.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@heskew heskew changed the title ci(claude): migrate claude-review.yml to caller of HarperFast/ai-review-prompts reusable ci(claude): full Day 2 caller migration — review + mention + issue-to-PR + caller validator May 6, 2026
@heskew heskew merged commit 8b71ac7 into main May 6, 2026
24 of 25 checks passed
@heskew heskew deleted the workflow/claude-review-caller-migration branch May 6, 2026 16:37
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