Skip to content

fix(ci): detect the Hypatia caller job structurally, not by last bare key - #879

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/hypatia-caller-id-job-key
Sep 20, 2026
Merged

hyperpolymath merged 1 commit into
mainfrom
fix/hypatia-caller-id-job-key

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

The estate sweep hit two live wrapper shapes that the first cut of this script mis-read (it identified the caller as "the last bare key: line above the reusable uses: line"):

  • a job-level permissions: block (deed-core, deed-validate-action, lol) — the heuristic reported the caller id as permissions and rewrote the permissions key itself, which would have produced an invalid wrapper;
  • a job key with a trailing comment — the heuristic walked back past it and resolved to jobs:.

The fix

  • Detect the caller structurally: the nearest job key — a line indented exactly two spaces whose value begins with key: (trailing comment allowed) — above the reusable uses: line.
  • Rewrite that line by number, so a nested permissions: key, a comment, or any other scan:-shaped line cannot be touched by accident.
  • The rewrite is now self-asserting: accepted only when it is a one-line in-place replacement (same line count, exactly one differing line, that line the key line, now canonical). Trailing-newline state is preserved, so a wrapper without a final newline does not gain one. Anything else is refused and the file is left byte-identical.

Verification

Fixture suite extended with all three shapes (job-level permissions: block, commented job key, no trailing newline): 27/27 green, no network, no token.

The guard is not theoretical: three live repositories hit the first shape on the sweep's first batch, and the runner's diff assertion refused the edit before it was committed (nothing was pushed). Those repositories are re-run with this fix.

Refs: hyperpolymath/tropical-types#17 (the defect class the sweep removes).

… key

The first cut of propagate-hypatia-caller-id.sh identified the caller as "the
last bare `key:` line above the reusable `uses:` line". The estate sweep hit
two shapes that breaks on:

  * a job-level `permissions:` block (three live wrappers) — the heuristic
    reported the caller id as `permissions` and rewrote the permissions key
    itself, which would have produced an invalid wrapper;
  * a job key with a trailing comment — the heuristic walked back past it and
    resolved to `jobs:`.

Detect the caller structurally instead: the nearest job key — a line indented
exactly two spaces whose value begins with `key:` (trailing comment allowed) —
above the reusable `uses:` line, and rewrite that line by number.

The rewrite is now self-asserting: it is accepted only when it is a one-line
in-place replacement (same line count, exactly one differing line, that line
the key line, now canonical). Trailing-newline state is preserved so a wrapper
without a final newline does not gain one. Anything else is refused and the
file is left byte-identical.

Fixtures added for all three shapes; 27/27 green.

Refs: hyperpolymath/tropical-types#17 (the defect class this sweep removes).
@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 90f9c752-b441-4a4d-9138-b89ade4e25ed

📥 Commits

Reviewing files that changed from the base of the PR and between bf41f3a and 5cfdf20.

📒 Files selected for processing (2)
  • scripts/propagate-hypatia-caller-id.sh
  • scripts/tests/propagate-hypatia-caller-id-test.sh

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.

@sonarqubecloud

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath merged commit 6e8770f into main Sep 20, 2026
23 of 30 checks passed
@hyperpolymath
hyperpolymath deleted the fix/hypatia-caller-id-job-key branch September 20, 2026 23:24
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