Skip to content

Commit 7b9c8f2

Browse files
committed
test(runtime): authorize the org-scope harness for the #7043 gate; changeset to patch (#7018)
Rebased-in-place adjustments for the r2 takeover branch, on top of the prior session's ad11fe5 + 1a01e8d: - ctx() now grants manage_metadata: the dispatcher's /meta PUT gate (#7019, landed on main after the prior branch forked) 403s an unauthorized caller before the org-scoping decision these tests pin is ever reached. - registry stub carries isPackageDisabled + applyNavContributions — the two methods getMetaItems grew on main (disabled-package filter, ADR-0029 D7 nav merge); without them the ADR-0045 flip cases fail on a TypeError inside the flip's try, not on the partition assertion. - reverse verification re-measured on the merged #7043 base: same 4 red / 4 green, same failure shapes (header updated in place). - changeset level minor -> patch: behavioural fix, no new API surface. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LGRN2cSRfggfX9B2L83bQc
1 parent 731e899 commit 7b9c8f2

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

.changeset/runtime-meta-write-org-scope.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
"@objectstack/runtime": minor
2+
"@objectstack/runtime": patch
33
---
44

55
fix(runtime): a metadata write carries the session's organization only for types that declare `allowOrgOverride` (#7018)

packages/runtime/src/meta-write-org-scope.test.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
* "fix" that simply stopped threading the org anywhere would pass every red
3535
* case and fail there, silently retiring ADR-0005 per-org overlays.
3636
*
37-
* Predicted 4 red / 4 green; measured 4 red / 4 green, against the real stack:
37+
* Predicted 4 red / 4 green; measured 4 red / 4 green, against the real stack
38+
* (re-measured 2026-08-09 on the merged #7043 base — same 4/4, same shapes):
3839
*
3940
* with the fix without it (origin/main)
4041
* ------------------ ---------------------------------------------------
@@ -130,6 +131,10 @@ function makeEngine() {
130131
getArtifactItem: () => undefined,
131132
getObject: () => undefined,
132133
getPackage: () => undefined,
134+
// `getMetaItems` filters every listed item through the disabled-
135+
// package gate and, for apps, merges nav contributions (ADR-0029
136+
// D7) — the same stubs every metadata-protocol harness carries.
137+
// No package is disabled and nothing contributes nav here.
133138
isPackageDisabled: () => false,
134139
applyNavContributions: (app: unknown) => app,
135140
registerItem: (type: string, name: string, item: unknown) => {
@@ -210,11 +215,18 @@ function makeDispatcher(protocol: unknown, engine: any, activeOrganizationId: st
210215
return new HttpDispatcher(kernel);
211216
}
212217

213-
/** An authenticated request context — the anonymous-deny gate (#3963) is unconditional. */
218+
/**
219+
* An authenticated request context — the anonymous-deny gate (#3963) is
220+
* unconditional, and since #7019 the dispatcher's `/meta` PUT also requires
221+
* the `manage_metadata` capability (ADR-0066 D1). These tests are about which
222+
* PARTITION an authorized write lands in, so the caller is authorized: without
223+
* the capability every PUT 403s before the scoping decision is ever reached,
224+
* and each case would pass for the wrong reason.
225+
*/
214226
const ctx = (): any => ({
215227
request: { headers: {} },
216228
environmentId: 'env_1',
217-
executionContext: { userId: 'usr_1', systemPermissions: [] },
229+
executionContext: { userId: 'usr_1', systemPermissions: ['manage_metadata'] },
218230
});
219231

220232
function makeStack(activeOrganizationId: string | undefined) {

0 commit comments

Comments
 (0)