Repository navigation
FIX-1529: pin hired seats to the org and user that hired them - #2091
Conversation
A hired instance now registers with { orgId, userId? } from the roster row.
Another org, or another user in the same org, cannot list, open, or run it.
User-owned rows stay in the same org cell under a private key the browser
roster does not match, and a deep workforce/roster/** collection is refused.
Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 01b29f0. Configure here.
| export function patternReadsPrivateRoster(pattern: string): boolean { | ||
| if (pattern === "**") return true; | ||
| return matchesPattern(pattern, PRIVATE_ROSTER_PROBE); | ||
| } |
There was a problem hiding this comment.
Roster guard misses readable patterns
Medium Severity
patternReadsPrivateRoster only asks whether a pattern matches one sample key, workforce/roster/~alice/research. A collection such as workforce/roster/~bob/* or workforce/roster/*/* does not match that sample, so assertRosterCollectionIsNotDeep admits it. Those collections can still address user-owned roster rows on the server.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 01b29f0. Configure here.
A roster hire, boot reload, and the seat-hire register door go through registerHiredSeat. Missing orgId throws before the engine register. Unpinned app and kind flows stay shared. Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
The fence closes every path the plan named (E1-E3, E6-E9, 9 passed on #2091 at 01b29f0). Three probes outside it: user-owned seats share one address per org and seat name, any flow may declare the private roster writer and list every user's rows, and the deep-pattern guard tests a single probe key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014uRPSL6tog8HH7yD5UfFjo
jhoffner
left a comment
There was a problem hiding this comment.
FSD Architect — coherence on Claude’s after suite (mailbox fsd/issue/fix-1522; evidence on #2070 after.poc.test.ts @ 6fedc1c4). Not owner approval / not the merge gate.
Planned fence: holds. E1–E3, E6–E9 after behavior matches the stamp. Before E3/E5 turning red on this branch is expected.
A / B / C stay on this PR — do not defer.
A (correctness + existence leak). User-owned address must carry the user (acme.~alice.research, escaped). Pin still comes from the hire row, never parsed from the address. Colliding acme.research for ~alice and ~bob, and hire refusals that name the holder’s kind, are in scope for FIX-1529 (criterion 5 / soft-mix invent-kill).
B (invent-kill hole). Option 1 rests on this. defineHiredRosterPrivateCollection must be workforce-branded only; refuse any other declaration at registration. Reads stay behind hire/fire helpers scoped to the caller. Exporting an exempt writer any app can declare is exactly the server-side roster/** read we invent-killed.
C (invent-kill hole). Guard must be structural: refuse any pattern with two+ segments under workforce/roster/ (or a deep glob that reaches it) other than the one branded writer. One sample-key probe is not a fence.
Still owed: board-drain form of E7 in the suite (same admission seam; no board rewrite).
Hold soft-fence on teaching hire / #2079 until A–C land and after suite stays green. Explore #2070 remains evidence only.
— FSD Architect
The rule, the seven surfaces, every door against checks (d) and (e), the E3 restart and E7 dispatch lanes, who reads a private roster row, the catalog per caller, the E1-E9 scoreboard (main vs #2091), and probe A's address collision. Hand-authored SVG, both themes, rendered and checked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014uRPSL6tog8HH7yD5UfFjo
…te roster writer A user-owned hire answers on <org>.~<user>.<seat>, so two members can hire the same seat id. The pin still comes from the row. The private roster pattern is admitted only from the branded workforce writer, and a block that holds it sees only the caller's rows. Any other two-segment pattern under workforce/roster/ is refused. Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
11 passed at fdca49f. Probe A: user-owned seats get distinct addresses. B/B2: the branded writer only reaches the caller's own rows. C: deep roster patterns are refused structurally. New note B4: debug endpoints bypass the handle and list another user's private row. Figures 17, 19 and 20 now show both heads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014uRPSL6tog8HH7yD5UfFjo
jhoffner
left a comment
There was a problem hiding this comment.
FSD Architect — coherence stamp on Claude re-proof @ fdca49fd (after suite 11 green; evidence #2070 after.poc.test.ts @ 05b736a5). Not owner approval / not the merge gate.
A / B / C: closed. Matches the invent-kill stamp. User-in-address, branded private writer + caller-scoped handle (incl. B2 exact-key), structural workforce/roster/ guard. Planned fence E1–E3 / E6–E9 still holds. Option 1 + one hire store stand.
B4 (debug endpoints): not an F2 ship blocker. Debug is default-off; hosts must keep it off in any multi-user deploy. Soft-follow (not this PR’s Critical bar): apply the same caller-scoping to debug collection listing if you want it fenced rather than ops-only. Do not expand F2-PLAN for B4.
Board-drain E7: still soft-owed in suite; internal dispatch already covers the admission seam. No board rewrite.
Soft-fence: invent-kill side of hire teach / #2079 is lift-eligible once this lands. Soft-after FIX-1486 before teaching hire planes as honest still stands.
Explore stays #2070. Ship is this PR / FIX-1529. Jake still owns merge.
— FSD Architect
Plane 1 (the user cell, follows Alice everywhere), plane 2 (the session's org cell), plane 3 (a hire's row, config and flow-isolated state). R1-R3 run them on #2091: shared prefs cross orgs, an org doc stays in Acme, isolated hire state stays with one hire, and goes red without flowIsolation. Notes the seat kind's isolateUserState default. Figure 21. No new Critical, no new tickets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014uRPSL6tog8HH7yD5UfFjo
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
workforce/[r]/[owner]/[seat] and [a]/[b]/[c]/[d] register on #2091 at fdca49f and list another user's private roster row. The structural guard only inspects patterns led by the literal workforce/roster/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014uRPSL6tog8HH7yD5UfFjo
There was a problem hiding this comment.
Problem fit
FIX-1529 needs hired seats to stay bound to the org (and optionally the hiring user) at discovery (list_flows), session creation, session-less dispatch, and execution — not only at hire time. The InstanceOwnerPin + hire-plane layer (pinRejectsCaller, registry pinOf, refuseInstancePin, workforce registerHiredSeat) delivers that cleanly and matches how FIX-1442 already derives org from the principal rather than the body.
Where the diff grew
The PR implements two security stories, not one:
- Instance admission — pins on registered flow instances (appropriate, focused).
- Roster data isolation — nested storage keys (
~user/seat), a branded private collection pattern,assertRosterCollectionIsNotDeepat define/register, andscopePrivateRosterToCallerwrapping every collection method in the engine.
Story (2) is what drives most of the ~1.7k lines and the cross-package coupling (workforce/roster/… literals and policy living in @flow-state-dev/core, engine importing isHiredRosterPrivateCollection, flow registration scanning every resource pattern). Pins alone do not stop another admitted flow in the same org from declaring a deep workforce/roster/… pattern and reading every user’s rows via normal collection APIs — so (2) is defensible if hiding private roster rows from co-tenant flows is in scope for this issue, not just “don’t run my seat.”
If the product gate is only instance admission, a pin-only PR would be materially smaller. If private roster rows must not be enumerable server-side, the current stack is directionally right but heavier than it needs to be in a few places (below).
Simpler shapes worth weighing (not mandates)
| Alternative | What it saves | What it may not cover |
|---|---|---|
Pin-only (registry + routes + refuseInstancePin) |
Most of core roster policy + engine proxy | Deep roster patterns on other flows still read nested keys |
| User-scoped collection for private rows (single-segment key per seat under user scope) | Parameterized pattern, Symbol brand, ~60-line ref proxy, much of rosterPatternIsTooDeep |
Requires a storage/scope design shift; not a small tweak |
| Allow-list two patterns in workforce only | Generic “too deep” heuristic + exported dead helper | Still need some fence at define/register |
I’m not asking for a redesign in this PR unless you already agree (2) was out of scope for FIX-1529; the tests (hire-plane-fence, workforce roster) do a good job pinning the combined behavior.
Targeted simplifications (if you touch this again)
- Dedupe pin predicate:
pinRejectsCallerandrefuseInstancePinrepeat the same org-then-user logic — one internal compare that returns a refusal reason would reduce drift risk. - Single pin source at HTTP boundaries:
flowsForCallerusesregistry.pinOfonly; session/transport usepinOf ?? flow.ownerPin. Afterregisterthey should match, but one accessor would make that obvious. patternReadsPrivateRoster: exported through core but unused outside its module — either use it insideassertRosterCollectionIsNotDeepor drop the export.- Private roster
list/count: both full-scan then filter; fine for demo scale, worth a prefix-aware path if orgs grow many user-owned seats. - kitchen-sink hire path: parsing
storageKeywithindexOf("/")vs fire/delete using{ owner: \~${userId}`, seat }— same shape ascreate` would be easier to maintain.
Verdict
Comment (not approve): The pin/admission work looks like the right core for FIX-1529. The roster firewall is coherent and well-tested, but it’s the main complexity cost and embeds workforce-specific policy in generic core — I’d want explicit team sign-off that data isolation belongs in this issue’s scope before calling the overall approach “minimal.”
No changeset concern from this review; tests for hire-plane paths pass locally.
Skipped (larger than this PR should carry)
- Moving roster fences entirely into
@flow-state-dev/workforcewith a core hook interface. - Rewriting private roster on user-scoped storage.
- Caching compiled parameterized regexes (pre-existing pattern-matching cost, amplified by nested keys).
Sent by Cursor Automation: Review For Best Approach
| * matches `workforce/roster/~alice/research` and would still read every user's | ||
| * notes. | ||
| */ | ||
| export function rosterPatternIsTooDeep(pattern: string): boolean { |
There was a problem hiding this comment.
Simplify / scope smell: rosterPatternIsTooDeep + roster constants live in generic collection-patterns, so every app pays define/register policy for the workforce/roster/ tree. That’s justified if core owns this contract, but it’s the main reason the PR reads “framework-wide” rather than “workforce hire pin.”
If you keep this layout, consider an allow-list of exactly two patterns (HIRED_ROSTER_BROWSER_PATTERN, branded private writer) plus an explicit ban on workforce/roster/** instead of the segment-count + **-prefix heuristic — easier to audit.
Alternative (larger): workforce-only module that exports assertWorkforceRosterCollection and is called from engine at register time, keeping this file pattern-generic.
| * for a deep glob that reaches it. The browser pattern is one segment and is | ||
| * not included. | ||
| */ | ||
| export function patternReadsPrivateRoster(pattern: string): boolean { |
There was a problem hiding this comment.
patternReadsPrivateRoster is re-exported through @flow-state-dev/core/types but has no callers in the repo (only rosterPatternIsTooDeep is used via assertRosterCollectionIsNotDeep). Worth deleting the export or folding it into the assert path to shrink the public surface.
| if (!own(key)) refuse(); | ||
| return handle.delete(key); | ||
| }, | ||
| async list(listPrefix) { |
There was a problem hiding this comment.
Performance / simplicity: scopePrivateRosterToCaller implements isolation by delegating to handle.list() and filtering on workforce/roster/~${userId}/. That materializes every org roster row (and builds refs) before dropping other users’ rows — OK for kitchen-sink scale, but it’s the hot-path cost of this decorator.
If this stays, count() calling list() twice (here and in the delegate) is an easy follow-up. A prefix-scoped list/count would match the storage layout without the full-org scan.
| * | ||
| * @returns `false` when there is no pin. Organization is compared first. | ||
| */ | ||
| export function pinRejectsCaller( |
There was a problem hiding this comment.
Minor duplication: pinRejectsCaller and refuseInstancePin encode the same org-then-user predicate (boolean vs throw + reason). A shared internal comparePin(pin, caller) → ok | 'owning-org' | 'roster-owner' would keep HTTP 404 semantics and execution errors aligned if the rules ever change.
| } | ||
|
|
||
| return flows.filter((flow) => { | ||
| const pin = registry.pinOf(flow.id); |
There was a problem hiding this comment.
flowsForCaller reads pins only via registry.pinOf(flow.id), while session creation and inbound transport use pinOf ?? flow.ownerPin. Registration syncs both today, but aligning on one registry helper (e.g. pinFor(id)) would avoid subtle drift if someone registers without going through adoptPin.
| * No admitted flow may declare a collection that reads user-owned roster rows. | ||
| * The browser pattern and the private writer are the only roster patterns. | ||
| */ | ||
| function assertFlowRosterPatterns(flow: FlowInstance): void { |
There was a problem hiding this comment.
Every flow registration scans all resource patterns for roster depth — workforce policy on the admission path for all apps. Acceptable if deep roster reads are treated as a framework-level footgun; otherwise this is a signal that roster fences might belong behind an opt-in (brand) without scanning unrelated flows.
| // IS the duplicate refusal, and it survives a second hire arriving at the | ||
| // same moment. | ||
| const storageKey = hiredRosterStorageKey(row); | ||
| const owner = storageKey.slice(0, storageKey.indexOf("/")); |
There was a problem hiding this comment.
Hire uses storageKey.slice(0, storageKey.indexOf('/')) to derive owner, while the rollback path uses { owner: \~${userId}`, seat: input.seatId }. Using the same structured key as fire/delete (or a small hiredRosterCreateKey(row)helper from workforce) would avoid fragility ifhiredRosterStorageKey` formatting ever changes.
There was a problem hiding this comment.
Code Snob. The fence is larger than the contract.
adoptPin already writes the pin onto the instance the registry stores. pinsById / pinOf is a second copy of that field, and the HTTP checks then do pinOf(id) ?? flow.ownerPin. Read flow.ownerPin. Same for the two pin comparisons (pinRejectsCaller and refuseInstancePin), which each reimplement org-then-user.
Also drop patternReadsPrivateRoster (no callers), the public export of rosterPatternIsTooDeep, and hiredSeatOwnerPinFromRosterOwner (registerHiredSeat can call hiredSeatOwnerPin).
Sketch, −66 lines, same fence tests: #2092
Agent on this PR: fold that subtraction in here. After this lands, close the POC unmerged.
Sent by Cursor Automation: Code Snob
|
|
||
| /** Owner pin per address. Absent means the instance is shared. */ | ||
| private readonly pinsById = new Map<string, InstanceOwnerPin>(); | ||
|
|
There was a problem hiding this comment.
This map stores the same pin adoptPin stamps on the instance you just put in flowsById. pinOf can go. Catalog, session open, and dispatch already have that instance.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fdca49fd35
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (row.ownerUserId != null && row.ownerUserId.length > 0) { | ||
| return `~${row.ownerUserId}/${row.seatId}`; |
There was a problem hiding this comment.
Encode opaque user IDs in private roster keys
For a valid principal whose opaque user ID contains a separator, such as oidc/acme/alice, this helper builds ~oidc/acme/alice/<seat> while the hire flow extracts only ~oidc as the collection's owner parameter. The engine's caller fence expects the full raw user ID prefix, so creation is refused; firing also passes the raw ID as one parameter and hits the path-separator validation. Use the same injective segment encoding already used by seatAddress for the storage owner and caller-prefix fence.
Useful? React with 👍 / 👎.
At #2091 fdca49f, a block holding the single-segment browser roster reads ~alice/research by exact key: store-backed get/getOptional skip the pattern check that list applies. The HTTP item route refuses it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014uRPSL6tog8HH7yD5UfFjo
jhoffner
left a comment
There was a problem hiding this comment.
Review against the F2 plan (specs/issues/FIX-1522/F2-PLAN.md on #2070), at fdca49fd. I've read the existing reviews, and this only adds what they don't already have. Everything marked "run" comes from the after suite on #2070 (after.poc.test.ts, commit 9233694), run against this head.
The pin fence matches the plan. I ran each of these:
- the pin is taken from the hire row, never read from the address;
- a foreign caller gets
404before any202; - E3 (a session resumed after a restart) and E7 (internal dispatch) are refused at admission;
- the catalog is filtered per caller;
- two users' seats with the same name get separate addresses;
- an unpinned roster seat is refused at kitchen-sink's registrar.
The problems are all in the roster-row fence, and there are two open holes. Both let Bob read Alice's private hire row, instructions and settings included.
1 · A direct read by key skips the pattern (run; confirms Bugbot's High finding, still live at this head)
The shipped browser roster, defineHiredRosterCollection() (workforce/roster/*), hides nested keys from list but not from a direct read. A block in bob@acme's session calls roster.getOptional("~alice/research") and gets Alice's full row back. The HTTP item route refuses the same key with 400 Topic does not match collection pattern, so this is server-side only. But option 1 depends on the browser collection never reaching the ~user/ sub-prefix, so this breaks it.
Suggested fix: have store-backed get, getOptional, create, getOrCreate, upsert and delete refuse any key the collection's pattern doesn't match, the same check list and the HTTP route already make. That's a framework rule ("a collection only addresses its own keys"), not Workforce policy, so it doesn't add to the concern in the scope review and the Codex P2.
2 · Fully parameterised deep patterns get past the structural guard (run; confirms the Codex P1 on collection-patterns.ts)
workforce/[r]/[owner]/[seat] and [a]/[b]/[c]/[d] both register. A run in Bob's session lists ALICE-PRIVATE. rosterPatternIsTooDeep only looks at patterns that start with the literal workforce/roster/, but a [param] segment matches any segment.
Patterns led by *, such as workforce/*/[owner]/[seat] or */*/*/*, also register, but they match nothing: inside a parameterised pattern * is a literal star, and a bare */… has no prefix to anchor on. So only [param]-led shapes reach the rows.
Suggested fix: check overlap segment by segment. Refuse a pattern when:
- its first segment is
workforce, a[param]or*; - its second segment is
roster, a[param]or*; - and it has at least two segments after those, or a
**that reaches that depth.
The branded writer stays the one exception.
3 · Smaller, and already raised by others (agree, with notes)
- User ids containing
/in the storage key (Codex P2). Agree. The address escapes the id, but~${ownerUserId}/…doesn't. The caller-scoping prefixworkforce/roster/~bob/also matches userbob/x's rows, so the fix is a fence issue, not only a hire failure. - Kitchen-sink seats are unreachable by their owners (Codex P1). Agree. I'd traced the catalog half the same way: with no host-level resolver,
flowsForCallergets no principal and hides every pinned seat. Worth a line in the docs that pinned instances need a host-level resolver. - Pin in two places (Code Snob and the scope review). Agree with a single source. Admission reads
flow.ownerPin; the HTTP checks readpinOf ?? ownerPin. - The session-less action route matches the
"Unknown flow"text to decide on a 404. A typed error would keep it from silently turning into a 500 if the wording changes. - Bugbot's
firefallback (kitchen-sink). I didn't verify it.
Already agreed, not re-raised: B4 (debug endpoints bypass the scoping; keep them off) and the missing board-drain E7 leg.
Both holes show up as a log line from the probes in the after suite, not as failing tests. After a fix, bash specs/issues/FIX-1522/poc/f2-experiments/run-after.sh <checkout> should print undefined for PROBE-D server and registered: refused for both PROBE-C2 patterns.
Generated by Claude Code
A browser collection no longer returns a nested key the prefix cache happens to hold, and a parameterised pattern that can resolve onto a user-owned roster row is refused when the flow registers. User ids are escaped in the stored key so a slash cannot cross the caller fence. Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
|
I re-ran the after suite from #2070 against
Everything else still holds:
The private storage key now escapes the user id too, which covers the From my review, only the smaller notes are left:
Generated by Claude Code |
16 passed. Parameterised deep roster patterns are refused at registration, and an exact-key read through the browser roster now returns undefined server-side. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014uRPSL6tog8HH7yD5UfFjo
A model-free goal on the HTTP router. Both fences it grades were shown failing first, then the restored tree passed. Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
…call sites main has been red since ffe2b6e. #2091 (FIX-1529) changed hiredSeatManifest to return `{ manifest } | RowProblem`; #2079 (seat-hire catalog tools), merged minutes later, added two call sites that read `.manifest` without narrowing, so @flow-state-dev/workforce no longer compiles. Both now handle the problem case the way roster/reload.ts already does: - manifest-sources: a row owned by another org is skipped when listing seats, alongside the unparseable-row skip on the line above. - seat-hire-capability: the hire refuses with the row's reason. Verified: the workforce build fails on main with exactly CI's four TS2339 errors and passes with this change; workforce 755/755; pnpm typecheck 70/70. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Zc4qjodAcrYK5kMfcrXS8
…call sites main has been red since ffe2b6e. #2091 (FIX-1529) changed hiredSeatManifest to return `{ manifest } | RowProblem`; #2079 (seat-hire catalog tools), merged minutes later, added two call sites that read `.manifest` without narrowing, so @flow-state-dev/workforce no longer compiles. Both now handle the problem case the way roster/reload.ts already does: - manifest-sources: a row owned by another org is skipped when listing seats, alongside the unparseable-row skip on the line above. - seat-hire-capability: the hire refuses with the row's reason. Verified: the workforce build fails on main with exactly CI's four TS2339 errors and passes with this change; workforce 755/755; pnpm typecheck 70/70. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Zc4qjodAcrYK5kMfcrXS8 (cherry picked from commit db41f92)
…call sites main has been red since ffe2b6e. #2091 (FIX-1529) changed hiredSeatManifest to return `{ manifest } | RowProblem`; #2079 (seat-hire catalog tools), merged minutes later, added two call sites that read `.manifest` without narrowing, so @flow-state-dev/workforce no longer compiles. Both now handle the problem case the way roster/reload.ts already does: - manifest-sources: a row owned by another org is skipped when listing seats, alongside the unparseable-row skip on the line above. - seat-hire-capability: the hire refuses with the row's reason. Verified: the workforce build fails on main with exactly CI's four TS2339 errors and passes with this change; workforce 755/755; pnpm typecheck 70/70. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Zc4qjodAcrYK5kMfcrXS8 (cherry picked from commit db41f92) Ported from PR #2094 unchanged, so this spec PR's CI builds while main is red. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ANuyMVi3YS653fcghb9gtB




A Globex user can open Acme's hired seat and run Acme's instructions. The catalog lists that address to everyone, and a roster peer can read a user-owned hire. Sessions and stored data were already isolated. The instance was not.
Claude's review on this PR (at
fdca49fd) found two ways Bob still reads Alice's private row after the pin fence. A browser collection'sgetOptional("~alice/research")returned the nested row the prefix cache was holding, and a parameterised pattern such asworkforce/[r]/[owner]/[seat]or[a]/[b]/[c]/[d]registered and listed those rows. Both are refused now. No second store.get,getOrCreate, anddeletethrow when the key does not match the collection pattern.getOptionalreturns undefined. That is the same rulelistand the HTTP item route already used. Registration refuses a pattern whose first segment can beworkforce, whose second can beroster, and which then has two or more further segments or a**. The branded private writer stays the one exception. A/in a user id is escaped in the stored key and in the caller prefix, sobobis not a prefix ofbob/x.The pin lives on the instance (
ownerPin).pinOfreads that field. HTTP mismatch isUnknownFlowError, still answered as404 Unknown flow. A pinned seat needs the host's resolver. The framework default resolver does not name an organization, so opening the seat is that same 404 even for the person who hired it.What's asked of you
Review the fence. Nothing here is asking to merge.
Test plan
owningOrgId: "globex"in the acme cell is a named reload problem and is not minted (E5). A legacy row binds the cell and staysacme.eng.lead.acme.eng.lead. A shared app flow stays listed and runnable (E1, E8). The omit is in the flows route.404.runActionthrowsInstancePinMismatchErrorand no block runs (E3).researchand get different addresses (E2, E4, A).Also covered: the browser roster's server-side read of
~alice/researchisundefined(PROBE-D).workforce/[r]/[owner]/[seat]and[a]/[b]/[c]/[d]logregistered: refused(PROBE-C2). A user idbob/xstores as~bob%2Fx/research, andbobdoes not list that row.The outcome check is
pnpm tsx goals/hire-plane/keeps-a-hired-seat-with-its-owner/run.mts. No model. It drivescreateFlowState's HTTP router. On the restored fence it passes: the owner writes the marker, the teammate and the other organization get 404, the catalog lists the seat for the owner only, a shared app still runs, the browser read is undefined, the wide pattern is refused, and a row owned by the other organization does not open.packages/engine/test/hire-plane-fence.test.ts(13),packages/engine/test/resource-collection.test.ts(the pattern-mismatch case),packages/workforce/test/hire-plane.test.ts(8), roster (20), kitchen-sink admin (24). Claude's after suite on #2070 at92336947: 16 passed, including the six CLOSED legs. PROBE-D server printedundefined. Both PROBE-C2 patterns printedregistered: refused.Below the fold
Both fences were shown failing before the goal was trusted. Removing the collection pattern check failed only the browser-read leg: the marker came back in the row. Forcing
rosterPatternOverlapsPrivateto return false failed only the wide-pattern leg on the goal. That predicate is also the gate forworkforce/roster/**, so the unit tests that plant that pattern went red with it. The other fence tests stayed green. Each file was restored withgit checkoutof that one path. The verdict log on the goal records both FAIL (expected) rows and the PASS.A board-drain leg for E7 is not in this change. A drain needs a claimed task row and the orchestration worker pool. Internal dispatch already enters through
createExecutionContext, which is the admission seam.Fire looks up the caller's private row first and the flat org-visible row second. Those addresses differ (
acme.~user.seatandacme.seat), so releasing the flat row does not unregister someone else's user-owned seat. The private lookup uses the escaped user id.Engine
register(flow)without a pin stays shared. That is an app flow or a file-declared seat. The hire writer isregisterHiredSeat. One store. Teaching hire planes stays soft-after FIX-1486..changeset/hire-plane-isolation.mdis a patch on core, engine, and workforce. No second changeset. Goals are not a published package.Evidence: PR #2070,
specs/issues/FIX-1522/F2-PLAN.md(7370b274), Claude's review on #2091,after.poc.test.ts(92336947).Workforce EM coding agent.