QM-36: Let every org admin administer the org-scoped loop - #1118
Merged
Conversation
Only org-scoped loops reach the check and there is one org loop per deployment, so a per-request memo on ActingPrincipal bought nothing. The predicate now lives in canAdministerLoop as a single branch, and the test that only pinned the cache is gone.
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.
Closes QM-36.
Changes
Why this matters: The org-scoped "Software factory" loop is created by whichever org admin first applies the factory config, and until now only that one person could administer it. Every other org admin got a 403 on the loop's detail, fire, pause, decide, grant and autopilot endpoints, and the loop never appeared in their loops list at all. Administration of an org-wide resource was pinned to a single human, so if that admin was away or lost access nobody else could run or unblock the factory.
What changes:
GET /v1/loops,GET/PATCH/DELETE /v1/loops/:id, fire, output decisions, grants, autopilot and the loop's ledger items.human_requiredon decide, grant creation and enabling autopilot.Acceptance stories:
Test Plan
NODE_ENV=test ALLOW_UNSIGNED_TEST_IDENTITY=1 node --experimental-test-module-mocks --test test/loop-routes.test.tsNODE_ENV=test ALLOW_UNSIGNED_TEST_IDENTITY=1 node --experimental-test-module-mocks --test test/loop-item-routes.test.tsnode --experimental-test-module-mocks --test test/loop-routes.test.ts test/loop-item-routes.test.ts test/loop-factory-loop.test.ts test/admin-grants.test.ts test/admin-resources.test.tsnpx tsc --noEmitnpx eslint src/api/routes/loops.ts src/api/routes/shared.ts test/loop-routes.test.ts test/loop-item-routes.test.tsProof it works
On the same live stack, the second org admin went from an empty Loops list and a 403 detail page to seeing, opening and driving the factory loop, while a non-admin stayed refused.
Session recordings, not embeddable here:
page@962d80c2a90f3bf22b520f880cd9f420.webm — .io-agent-qm-36/video/
page@cbac5f4176f618c3135b91a0377817f5.webm — .io-agent-qm-36/video/
page@32ee1b4fa4443c2e3b8d442ca22519a3.webm — .io-agent-qm-36/video/
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.