fix(ci): detect the Hypatia caller job structurally, not by last bare key - #879
Merged
Merged
Conversation
… 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).
Contributor
|
Warning Review limit reachedNext included review available in 11 minutes. View limit detailsLimit 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. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
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. Comment |
|
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.



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 reusableuses:line"):permissions:block (deed-core,deed-validate-action,lol) — the heuristic reported the caller id aspermissionsand rewrote the permissions key itself, which would have produced an invalid wrapper;jobs:.The fix
key:(trailing comment allowed) — above the reusableuses:line.permissions:key, a comment, or any otherscan:-shaped line cannot be touched by accident.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).