The published-text set carries the destination guard, so a gh invocation bound for a repository the workspace does not own is refused by a rule the fleet inherits rather than one it transcribes - #203
Conversation
…ion bound for a repository the workspace does not own is refused by a rule the fleet inherits rather than one it transcribes 84 consumer policies declared unowned-forge-target by hand, 74 of them byte-identical, each under the same comment and each justified by the published-text header's line that a set ships checkers and never shims. The rule is a checker. ADR 0006 puts the shim on the repository's side of the seam and the rules a shim consults on the engine's, and the set's commands ceiling already named gh, so the rule now ships in the set with owner_required = true and command.scope = "always" in the bundled declaration: without the first the only owner is the one read off origin, and without the second a public-target table stands the rule down for a private destination and for a forge that did not answer, which are the two invocations the rule exists for. The loader admitted the rule under the existing ceiling. What it did not do was name it: a destination refusal at the shim seam printed the report alone, where a text refusal goes through refused_by and carries the set. A reader who greps their policy for unowned-forge-target now finds nothing, so the shim labels a destination refusal the way a hook does, id and set together. uphold's own policy keeps a same-id shadow for the one thing the set cannot say, command.before widened to glab, and its comment now records that the promotion happened rather than deferring it. The reference names the set as the rule's carrier, the lock is regenerated, and three CLI cases drive a fixture that inherits the set with only its own shim tables: the refusal names the rule with its set, a fixture that has not declared owner is exit 2 naming the line to write, and one without the gh table is refused at load with the cure the ADR describes. Closes #197
|
Warning Review limit reachedNext included review available in 13 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: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (7)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #203 +/- ##
==========================================
+ Coverage 93.63% 93.65% +0.02%
==========================================
Files 44 44
Lines 17057 17066 +9
==========================================
+ Hits 15971 15983 +12
+ Misses 1086 1083 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Closes #197.
What the set now carries
Under a header giving the two justifications the 84 hand copies shared:
owner_requiredbecause the only other owner is the one read offorigin, which is the remote a destination guard exists to catch being wrong;alwaysbecause whether a repository is yours is a fact about the destination and not its visibility, and a forge that does not answer is the invocation that most needs asking about.ghalone: the set'scommandsceiling admitsghandgit push, and a repository whose tables also stand in front ofglabshadows the id with the wider list, which is the ADR 0006 override.What else changed
stands_in_front_of_a_commandalready countsTARGET_GUARDS, andvalidate_shimsalready names the set in its cure). What was missing was the label: a destination refusal at the shim seam printed the report alone, where a text refusal goes throughrefused_by. With the rule arriving from a set, a reader who greps their policy forunowned-forge-targetfinds nothing, so the shim now printsunowned-forge-target [set: published-text]: ...the way a hook does.command.before = ["gh", "glab"](theglabtable is declared there), and its comment now records that the promotion happened and that the copy remains only to widen the command list. The two counts of shadowed rules in the file are updated.policy/base/sets.lock.jsonregenerated.docs/REFERENCE.md: thepublished-textrow and theprevent-unowned-targetrow say the set carries it; the checker passage shows the bundled declaration and theglabshadow instead of a hand copy.Tests
tests/shim_cli.rs, three cases over a fixture that declaresowner, inheritspublished-text, and writes only its owngh(public-target) andgittables, with a stubghthat answers private / not-the-owner / not-admin:gh pr create --repo other-owner/their-repo -b ...is refused, exit 1, namingunowned-forge-target [set: published-text]and the pin; the same verb underexample-user/widgetruns.owneris exit 2 namingowner_requiredand the line to write.ghtable is refused at load namingpublished-text,[[shim]]andcommand = "gh".src/config.rs: the load test for inheriting the set now asserts the four ids that arrive.Not a corpus case: the corpus covers pattern rules and exempts built-ins by design.
Gates:
cargo fmt,clippy -D warnings,cargo test(897 passed),uphold check,uphold scan,validate.py,build_reference.py --check,unittest(89) all green; lefthook pre-commit, commit-msg and pre-push ran.