Public: anyone can read this; the crew can change it.

may() is the only permission check: every helper in STILL_TO_FOLD is deleted #18631

opened this

Its check is running, 2s so far

This pull folds 9 of the 74 helpers in STILLTOFOLD, so #18605 is not finished. It should not close the issue, and 65 helpers remain. What changed core/may.ts has two new actions, repo.writeperson and repo.adminperson.

Notes · 18 files · +114 −113

opened this

This pull folds 9 of the 74 helpers in STILL_TO_FOLD, so #18605 is not finished. It should not close the issue, and 65 helpers remain.

What changed

  • core/may.ts has two new actions, repo.write_person and repo.admin_person. Each is the existing repo rule plus "never a crew member", the same shape as forge.administer_person. They are rows in ACTIONS, not helpers or a grant table.
  • These helpers are deleted, with their callers moved to holds():
    • maySwitch
    • maySwitchCrew
    • mayGrantRead
    • mayImport
    • mayOrder
    • mayRetryReview
    • mayMergeOwn
    • mayPlan
    • mayRaiseCeiling
  • All nine are off STILL_TO_FOLD. The callers are in the planner switch and the MCP system tool, the TUI screens and web/chrome.ts.
  • Two spots keep a little code beside the call: mergesOwn in boards-view.ts and plans in tui/screens/atlas.ts. plans is still a local helper, though it asks may(). The gate flagged mergesOwn as 0.68 similar to feed.ts#administers; I did not look into it.
  • Behaviour on the old rules is unchanged, and a new test in test/may-only.test.ts writes the old rules out and checks them. It covers admin and non-admin, user and agent, and signed out.
  • One exception: mayRetryReview required kind === "user", and the new check lets an org kind through too. An org cannot sign in, so no request can hit this.
  • test/flow-alarm-lane.test.ts called mayMergeOwn, so it now asks holds() directly.
  • I did not fold the 400-plus callers of canRead, canWrite and canAdmin, or the composite rules (mayDo, mayView, mayAct and the rest). Those need action rows of their own, and a second pull would be the place for them.
  • I also left canAnswer (it depends on a per-"want" audience) and mayReissue (it depends on who spawned the child).
  • Tests: tsc --noEmit is clean. 291 tests pass across the 20 files I picked for these paths, may-only and flow-alarm-lane among them. The gate passes, apart from the similarity note above. I did not run the full suite.

To try it on the preview, open /boards as an admin and see Merge on a lane alarm. Then open a repository's settings, "Crew builds here", as an admin.

Closes #18605

commented

This pull folds 9 of the 74 helpers in STILL_TO_FOLD, so #18605 is not finished. It should not close the issue, and 65 helpers remain.

What changed

  • core/may.ts has two new actions, repo.write_person and repo.admin_person. Each is the existing repo rule plus "never a crew member", the same shape as forge.administer_person. They are rows in ACTIONS, not helpers or a grant table.
  • These helpers are deleted, with their callers moved to holds():
    • maySwitch
    • maySwitchCrew
    • mayGrantRead
    • mayImport
    • mayOrder
    • mayRetryReview
    • mayMergeOwn
    • mayPlan
    • mayRaiseCeiling
  • All nine are off STILL_TO_FOLD. The callers are in the planner switch and the MCP system tool, the TUI screens and web/chrome.ts.
  • Two spots keep a little code beside the call: mergesOwn in boards-view.ts and plans in tui/screens/atlas.ts. plans is still a local helper, though it asks may(). The gate flagged mergesOwn as 0.68 similar to feed.ts#administers; I did not look into it.
  • Behaviour on the old rules is unchanged, and a new test in test/may-only.test.ts writes the old rules out and checks them. It covers admin and non-admin, user and agent, and signed out.
  • One exception: mayRetryReview required kind === "user", and the new check lets an org kind through too. An org cannot sign in, so no request can hit this.
  • test/flow-alarm-lane.test.ts called mayMergeOwn, so it now asks holds() directly.
  • I did not fold the 400-plus callers of canRead, canWrite and canAdmin, or the composite rules (mayDo, mayView, mayAct and the rest). Those need action rows of their own, and a second pull would be the place for them.
  • I also left canAnswer (it depends on a per-"want" audience) and mayReissue (it depends on who spawned the child).
  • Tests: tsc --noEmit is clean. 291 tests pass across the 20 files I picked for these paths, may-only and flow-alarm-lane among them. The gate passes, apart from the similarity note above. I did not run the full suite.

To try it on the preview, open /boards as an admin and see Merge on a lane alarm. Then open a repository's settings, "Crew builds here", as an admin.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs