You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
security: an unrestricted reader of a controlled_by_parent detail with a required FK drops the vacuous parent-chain leaf (epic #33631 R4) #33696
Filing gate: ④ child of epic #33631 (SQL performance; maintainer's direct word on the epic). Item R4 of the M0 ranked list (#33633): #33631 (comment), corrected by #33631 (comment) (review#2 PASS 6890102899).
「只在父字段必填时去掉」: for an unrestricted (admin) reader of a controlled_by_parent detail, drop the vacuous parent-chain leaf only when the controlling FK is required. When the FK is nullable, keep the chain, so orphan details (master gone or unset) stay hidden exactly as today. No change to which rows any reader sees.
Today
engine-readable-ids-permission-formula.ts ~207 composes ReadableIds.compose(leaf, undefined) with the leaf from security-plugin-cbp-read-filter.ts ~156, so an admin read carries fk IN (SELECT id FROM master WHERE fk2 IN (SELECT id FROM master2)); the analytics path ANDs the same chain twice.
Measured (1M rows)
Dropping the leaf: page SQLite 397 → 281 ms, PG 97 → 56 ms; total SQLite 217 → 136 ms, PG 78 → 54 ms (−29% to −42%, twice per list). It also unlocks the SQLite half of the created_at index card (1.7 s → 0.09 ms).
Rules
Parity test: the same admin read with the chain and without it returns the same rows when the FK is required; a nullable-FK object keeps the chain (orphan row stays hidden, pinned).
Restricted readers are untouched.
Business reason
Every admin list, count and aggregate over a detail object pays for a security subquery that cannot filter anything when the parent is mandatory.
Reader
domain:server#5 area A2 (plugin-security cbp leaf) with A4 (objectql ReadableIds compose), next account; size S–M.
Dedupe
Covered by the M0 inventory; no open card on ReadableIds.compose vacuous leaf.
Ruled: option A · the maintainer (Steedos) on the seat thread decision card (2026-11-15T10:38Z), answering the decision request 6892447012. Chosen option, verbatim as the card read: 「A: drop the check, admins see orphans」.
Ruling as it binds this card: when every hop's read scope is unrestricted (the engine's per-hop scope answers undefined, not hasSuperuserReadBypass), the parent chain is dropped for a required master FK, and an unrestricted reader also sees orphan detail rows inside its own tenant wall. No reader with a restricted hop sees more. Closing the orphan sources (option B) is a separate follow-up, not part of this card.
Claim: server area S1 (A1+A2) under #33751 §2 area-lease mode, area A2, seat domain:server#5 · p2 (epic #33631 R4) · executed by an os-dev subagent of the area S1 thread · posted at 2026-11-15T10:40Z
Session: session_01QsR2jVPGBoi3MCGoKbW1Hv
Account: zhuangjianguo
Branch: claude/area-A2-33696
Worktree: objectstack-area-A2-33696
Domain: domain:server
Seat: domain:server#5
File surface: packages/plugins/plugin-security/src/security-plugin-cbp-read-filter.ts (+ its tests), packages/objectql/src/engine-readable-ids-permission-formula.ts and the engine-readable-ids-* tests, the analytics site that ANDs the same chain if it reads the same leaf, a changeset (stop on breach; explain in the report)
Container & model: M, mode:subagent, model: default (no path-derived mandate; dispatch-gates --tier at bd96ec9c), effort: high
Clause-②: no
Metadata-protocol: none
Responsibility: n/a — not a defect card (ruling 6893097935: option A, admins also see in-tenant orphans)
Thread-read: 6893097935
Premise: corrected 6893097935
Serial constraints cleared: #33524 (this area, cbp-write-gate.ts + operation-message.ts, disjoint from the read filter); #33683 (plugin-sharing, disjoint); the dev re-greps open PRs on both files before pr_create
Claim amendment · 2026-11-15T10:44Z · to claim 6893117018 · file surface widened by the area (routing, no ruling change)
Added: packages/objectql/src/engine.ts, at most 4 lines, all inside the host literal of the private method composeReadableIdsChain: a _registry getter shaped like the other host literals. The reason: only the engine sees the per-hop scope answer the ruling (6893097935) requires, and it must also read whether the leaf's master_detail field is required. Dropping the leaf at the source instead would make the synchronous cbp read filter async, which reaches further. No behaviour change in engine.ts, and no public surface move. Clause-② no and Metadata-protocol none are unchanged.
Re-ruled: option 「只对管理员去掉」 (drop the chain for administrators only) · the maintainer (Steedos) on the seat thread decision card (2026-11-15T11:31Z), after an independent Fable re-review. This replaces record 6893097935.
Why it was re-asked: 6893097935 (decision request 6892447012) did not show the maintainer two recorded decisions it reversed. They are #24932 ruling B item 4 (comment 6303721609, 10-20, ⛔ "no interim removal of the predicate for an unrestricted master scope: it would expose rows with a null or dangling foreign key (measured)") and ADR-0139 D6 (docs/adr/0139-engine-internal-semi-join-leaf-readable-parent-ids.md:295-297). As written it would also have shown members unowned rows, against #30905 ruling A (11-06, ADR-0055: rows with no master are visible only to their owner and to view-all holders on the detail). Area S1 found this while building.
Pins: the three controlled-by-parent-leaf-switch tests are rewritten for the view-all + unrestricted reader. Reverse pins stay: a reader with a restricted master hop, and a reader with view-all on the detail only, still never see null or dangling rows.
Release note: totals, counts and aggregates for that reader may include orphan rows. A follow-up card to close the orphan sources (option B of the original request) is owed as the PR's one loose-ends card.
Multi-tenant deployments: a tenant admin's master scope is the tenant wall, so it is not unrestricted. No speed-up there, by design; widening that is a separate decision.
State: stays pm:dispatched with area S1 (branch claude/area-A2-33696 pushed, no PR). The route is now narrower; S1 reworks it to this ruling.
{
"issue": 33696,
"status": "done",
"branch": "claude/area-A2-33696",
"pr": "https://github.com/objectstack-ai/objectstack/pull/33897",
"session": "session_01QsR2jVPGBoi3MCGoKbW1Hv",
"premise_still_valid": true,
"summary": "Built ruling record 6893666857, which replaces 6893097935. composeReadableIdsChain step 5 drops the leaf over a controlled_by_parent object's REQUIRED master in an AND position. It does so only when that master answers unrestricted at every hop (the engine's per-hop scope; a nested scope left empty answers undefined) AND the caller holds View All on the detail. View All is read from ISecurityService.getEffectiveObjectPermissions, once per read. A delegated caller, a service without that member, or a call that throws keeps the chain. Every other reader keeps the chain unchanged: a restricted hop, View All on the detail only, a plain member. Optional masters and $or/$not positions compose as before. The View All reader now sees null and dangling-FK rows inside its own tenant wall, and the changeset carries the ruling's release note. PR is draft and must not land before #33820 (ADR-0139 status-line amendment), as its body says near the top.",
"tests": "Head 2c6025c0 (implementation 521ba7e7 plus origin/main merged), runs under os-verify-lock with exits captured before any pipe. objectql: pnpm test exit 0, 596/596 files, 13141 tests; typecheck exit 0. plugin-security: pnpm test exit 0, 268/268 files, 6690 passed and 45 skipped; typecheck exit 0. New real-stack pins in security-plugin-cbp-read-filter.test.ts, 8 tests: (a) View All plus unrestricted reader has no subquery, all rows, count 7, findOne of a dangling row, plus parity and the analytics door; (b) restricted hop keeps the chain; (c) View All on the detail only keeps the chain; (d) member keeps the chain over a restricted and over a public master; optional master keeps its leaf; (e) isolated tenancy wall. Unit pins in engine-readable-ids-nested-composition.test.ts: 17 tests. Leaf-switch: 23 tests, the three tests gain the View All everywhere reader leg. Ablations via ablation-replace on the committed head, each restore proven blob==HEAD 8ec17d58c0bb with git diff HEAD empty. Per-hop check removed: (b) and (c) red, plus 2 unit pins. readerViewsAllOf forced true: (d) red, plus 1 unit pin. Step 5 disabled: (a), parity, analytics and the (d) admin control red, plus 2 unit pins. Direct runtime dependents after building PKG^... (exit 0): example-embed-objectql 1/1, plugin-audit 94/94, plugin-email 53/53, plugin-pinyin-search 4/4, plugin-sharing 74/74, plugin-webhooks 25/25, runtime 603/603, service-automation 282/282, cloud-connection 82/82, example-todo 9/9, plugin-dev 10/10, verify 52/52. scenarios was 31/33 on the first pass: 2 test/build files refused because its own dist was not built (a prerequisite, not a result); after building scenarios both pass, 2/2 files, 14 tests. cli vitest --project unit exit 0, 421/421 files, 6000 tests.",
"gates": "dispatch-gates --commands --repo objectstack-ai/objectstack derived 74 at 2c6025c0. 71 run locally: 70 exit 0 on the first pass; check:query-options-erasure exit 124 (runner timeout 300 s on the shared box), then exit 0 on a re-run with no timeout. --ran reconciliation: 74 derived, 71 run, 0 NOT-MEASURED, 3 UNRUN (check:i18n, check:dual-build-cjs-loads, check:type-check-debt are whole-repo runs left to CI). check-nul-bytes exit 0. pnpm lint is left to CI. PR check-runs: in_progress at report time, not waited on. git merge-tree against origin/main (16 commits newer) is clean.",
"dogfood_battery": "n/a: no ! in the PR title and no (narrowing) arm",
"line_budget": "7 files, +730 / -9 against origin/main. engine.ts +2 (approved widening, max 4). controlled-by-parent-leaf-switch.test.ts +22/-3 (approved widening, about 15 asked; 25 lines touched in all). No skills/** or docs/adr/** touched.",
"files_changed": [
".changeset/33696-drop-unrestricted-cbp-chain.md (new, objectql patch, Clause-2 no, Metadata-protocol none, release note)",
"packages/objectql/src/engine-readable-ids-permission-formula.ts (step 5, readerViewsAllOf, pruning helpers)",
"packages/objectql/src/engine.ts (APPROVED WIDENING: 2 lines, _registry getter in the composeReadableIdsChain host literal)",
"packages/objectql/src/engine-readable-ids-nested-composition.test.ts (unit pins)",
"packages/plugins/plugin-security/src/security-plugin-cbp-read-filter.ts (docblock only)",
"packages/plugins/plugin-security/src/security-plugin-cbp-read-filter.test.ts (new, real-stack pins a to e)",
"packages/plugins/plugin-security/src/controlled-by-parent-leaf-switch.test.ts (APPROVED WIDENING: View All everywhere reader legs; the existing pins are unchanged)"
],
"deviations": [
"pnpm lint was not run locally. common.txt lists it before push, but os-dev.md says a repo-wide scan is CI-owned and that the os-dev file wins on a conflict, so it is left to CI.",
"3 derived gate families are left to CI as whole-repo runs: check:i18n, check:dual-build-cjs-loads, check:type-check-debt.",
"Packages that depend on objectql only as a devDependency, and dogfood, are left to CI (Test Core). Only the direct runtime and peer dependents were run.",
"The PR body starts with the HTML attribution comment that common.txt mandates. os-dev.md otherwise bans HTML comments in bodies.",
"The merge commit 2c6025c0 is git's default merge message with no trailers."
],
"mcp_calls": "0",
"api_writes": "2 relay writes (with this comment): pr_create POST /repos/objectstack-ai/objectstack/pulls via fleet-write run 43720623596 (PR #33897), and this os-dev-report comment via post-stamped. Earlier rounds of this claim: 1 comment (6892424473). Plus git push (not REST).",
"open_questions": [],
"security_findings": "none",
"out_of_scope_findings": [
"carrier: seat · loose-ends card owed by ruling 6893666857: stop orphan rows at their sources (option B). Measured sources: a system-context insert or update naming a missing master is stored (residual in engine-referential-integrity.ts), and promoting an optional master to required leaves NULL-FK rows. Dedupe words: orphan detail rows, dangling master_detail, system write referential integrity, required promotion null",
"carrier: #33820 · ADR-0139 status-line amendment (lines 295-297, D6) is the landing precondition; docs/adr not touched",
"carrier: seat · security-plugin.ts docblock on computeControlledByParentFilter still says the composed leaf always compiles to a subquery; outside the claim surface",
"carrier: seat · open PR #33652 (other seat) edits composeReadableIdsChain in the same file (import line, final composeReadableIdsLeaves call): a textual conflict for whichever lands second. Its planned relation leaves are never asked into chain.answers, so step 5 leaves them alone and the two do not conflict in meaning",
"noted, not filed · walled tenancy: the tenant admin's master scope carries the Layer-0 equality, so nothing is dropped there, by design (pin e)"
]
}
After review FAIL 6895328067 on PR #33897 (head 2c6025c), route (a): the write doors stay byte-identical. File surface adds: write-door pins (predicate delete, predicate update, by-id 404 over an orphan, each red on head 2c6025c) in plugin-security *.test.ts, and a prose-only paragraph in the computeControlledByParentFilter docblock in security-plugin.ts (review should-fix 2). Preferred build: the drop stays confined to the read door that asks for it, so no write-door source file changes. If a write-door source file (security-plugin-cbp-write-gate.ts, security-plugin-authz-middleware.ts, security-plugin-addressed-writes.ts) must change, the dev stops and reports first: #33524 in this area edits two of them.
Clause-②: no
Metadata-protocol: none
Route (a) build: packages/objectql/src/engine-middleware-and-context.ts joins the surface, about 4 lines in executeWithMiddleware only: a write-epoch operation runs its middleware chain inside an engine-owned store, and the chain drop answers "no drop" while that store is set, so every read made on behalf of a write keeps the chain as on main. No plugin-security write-door source file changes. Open PR #33887 (S2) edits a different function of the same file (claimReferentialCascadeDelete); whichever lands second merges main.
Clause-②: no
Metadata-protocol: none
{
"issue": 33696,
"status": "done",
"branch": "claude/area-A2-33696",
"pr": "https://github.com/objectstack-ai/objectstack/pull/33897",
"session": "session_01QsR2jVPGBoi3MCGoKbW1Hv",
"premise_still_valid": true,
"delta_of": "review FAIL 6895328067 on head 2c6025c0; route (a), claim amendments 6895345175 and 6895620230",
"head": "df3fb3b9ad5558a2e9ebf205e12ac0fbd4499fe1",
"summary": "Write doors are byte-identical to main again. A write's middleware chain (insert, update, delete, purge, restore) now runs inside READABLE_IDS_WRITE_IN_FLIGHT, an engine AsyncLocalStorage set in executeWithMiddleware (+4/-1, approved widening) and exported from engine-readable-ids-permission-formula.ts. readerViewsAllOf answers no drop inside it, so every read made on a write's behalf keeps the chain: the predicate-write narrowing, the 2.8 predicate leg, the step-2.7 by-id read, and hook reads. No plugin-security write-door source file changed. Should-fix 2: a prose-only paragraph in the computeControlledByParentFilter docblock (security-plugin.ts). The changeset gains a writes-unchanged note.",
"findings": [
"Finding 1, predicate delete with an empty-required-master orphan in the set: red on 2c6025c0 (refused MISSING_REQUIRED_FIELD / 422); green on df3fb3b9 (lands on the other row, the orphan stays); passes on main's objectql source.",
"Finding 2, predicate update with an empty-master orphan and a dangling-master orphan in the set: red on 2c6025c0 (refused MISSING_REQUIRED_FIELD / 422); green on df3fb3b9 (lands on the other row, both orphans unchanged); passes on main's objectql source.",
"Finding 3, by-id update of a dangling orphan and by-id delete of an empty-master orphan: red on 2c6025c0 (refused PERMISSION_DENIED / 403, not RECORD_NOT_FOUND / 404); green on df3fb3b9 (404 for both); passes on main's objectql source.",
"Extra pin asked in amendment 6895620230, a hook's read inside a write: red on 2c6025c0 (the hook read saw the 4 orphans); green on df3fb3b9. On main its write leg passes; its plain-read control leg is red there, as expected, because main drops nothing."
],
"tests": "The red legs were measured with the three objectql source files set back to 2c6025c0, then restored with git diff HEAD empty. Ablations via ablation-replace, each restore checked blob==HEAD: deleting the store guard in readerViewsAllOf turns 4/4 red; running the write chain outside the scope in executeWithMiddleware turns 4/4 red. At df3fb3b9: plugin-security pnpm test exit 0, 269/269 files, 6705 passed and 45 skipped, typecheck exit 0; objectql pnpm test exit 0, 598/598 files, 13238 tests, typecheck exit 0. At 3089656f (the same code, one main merge earlier): 13 direct runtime dependents all exit 0 after building PKG^... (runtime 605/605, plugin-sharing 74/74, scenarios 34/34, service-automation 282/282 and the rest), and cli --project unit 422/422 files, 6002 tests.",
"gates": "At df3fb3b9, dispatch-gates derived 77; 74 run locally, all exit 0. --ran: 77 derived, 74 run, 0 NOT-MEASURED, 3 UNRUN (check:i18n, check:dual-build-cjs-loads, check:type-check-debt, whole-repo runs left to CI). check-nul-bytes exit 0. pnpm lint left to CI.",
"merge_tree": "git merge-tree --write-tree --name-only from df3fb3b9. origin/main: clean (main is 18 commits ahead; none of them touches this PR's files). #33887 at eab93bab: clean. #33884 merged as c59198f05 and is included in this head. #33652 at 1b832c58: CONFLICT in engine-readable-ids-permission-formula.ts, 2 hunks (the import block; the step-5 / final composeReadableIdsLeaves lines). The overlap was known; whichever lands second rebases.",
"dogfood_battery": "n/a: no ! in the PR title and no (narrowing) arm",
"line_budget": "Delta since 2c6025c0: engine-middleware-and-context.ts +4/-1 (approved); engine-readable-ids-permission-formula.ts +17; security-plugin.ts +12 (docblock prose only); security-plugin-cbp-read-filter.test.ts +82; changeset +4.",
"files_changed": [
"packages/objectql/src/engine-middleware-and-context.ts (APPROVED WIDENING 6895620230, executeWithMiddleware only)",
"packages/objectql/src/engine-readable-ids-permission-formula.ts",
"packages/plugins/plugin-security/src/security-plugin.ts (docblock only)",
"packages/plugins/plugin-security/src/security-plugin-cbp-read-filter.test.ts",
".changeset/33696-drop-unrestricted-cbp-chain.md"
],
"deviations": [
"The write pins seed two admin-created rows through the driver. The rig's member_default adds the own-records write predicate (created_by = caller), and on main an admin predicate write over the seeded rows lands on zero rows.",
"The new pins are in security-plugin-cbp-read-filter.test.ts, a file this PR creates, not in a new file named for the card.",
"Dependents were not re-run after the second main merge (df3fb3b9). That merge (#33884 among others) touches none of this PR's files. plugin-security and objectql were re-run there.",
"pnpm lint is left to CI (os-dev.md: repo-wide scans are CI-owned)."
],
"mcp_calls": "0",
"api_writes": "2 relay writes this round: issue_patch of the PR #33897 body (run 43734784781, read-back identical), and this comment via post-stamped. Plus git push (not REST).",
"open_questions": [],
"security_findings": "none",
"out_of_scope_findings": [
"carrier: seat · the follow-up card to close the orphan sources (option B) is still owed",
"carrier: #33820 · the ADR-0139 status-line amendment is still the landing precondition"
]
}
Unblocked: the ADR status-line card #33820 landed as PR #33992 (merged 2026-11-15T16:34Z). ADR-0139 and ADR-0055 now record the 6893666857 ruling, so the PR for this card no longer waits on it.
Carrier for this card (F3 of the at-tier review 6899080787 on PR #34075, card #33432): ADR-0055's 2026-11-14 "What a refusal answers" paragraph has two sentences that rest on "a detail row's own read derives from its master (§2)": the by-id 404 sentence (on main now) and the predicate (multi: true) sentence PR #34075 adds. Both are true on main today. When this card's code lands and its reader class reads a required master's empty or dangling rows, both sentences need this card's 2026-11-15 note, in the PR that lands it. Nothing to do before then.
Activity
objectstack-fleet commentedon Nov 15, 2026
domain:server#5 · zhuangjianguo · session_01QsR2jRsWwTRkuRCyQwvpAG
Ruled: option A · the maintainer (Steedos) on the seat thread decision card (2026-11-15T10:38Z), answering the decision request 6892447012. Chosen option, verbatim as the card read: 「A: drop the check, admins see orphans」.
Ruling as it binds this card: when every hop's read scope is unrestricted (the engine's per-hop scope answers undefined, not
hasSuperuserReadBypass), the parent chain is dropped for a required master FK, and an unrestricted reader also sees orphan detail rows inside its own tenant wall. No reader with a restricted hop sees more. Closing the orphan sources (option B) is a separate follow-up, not part of this card.State:
needs-user-decision→pm:queue(area S1 re-claims; branchclaude/area-A2-33696exists empty).Generated by Claude Code
objectstack-fleet commentedon Nov 15, 2026
domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv
Claim: server area S1 (A1+A2) under #33751 §2 area-lease mode, area A2, seat
domain:server#5· p2 (epic #33631 R4) · executed by anos-devsubagent of the area S1 thread · posted at 2026-11-15T10:40ZSession:
session_01QsR2jVPGBoi3MCGoKbW1HvAccount:
zhuangjianguoBranch:
claude/area-A2-33696Worktree:
objectstack-area-A2-33696Domain:
domain:serverSeat:
domain:server#5File surface:
packages/plugins/plugin-security/src/security-plugin-cbp-read-filter.ts(+ its tests),packages/objectql/src/engine-readable-ids-permission-formula.tsand theengine-readable-ids-*tests, the analytics site that ANDs the same chain if it reads the same leaf, a changeset (stop on breach; explain in the report)Container & model:
M,mode:subagent,model: default (no path-derived mandate; dispatch-gates --tier at bd96ec9c),effort: highClause-②: no
Metadata-protocol: none
Responsibility: n/a — not a defect card (ruling 6893097935: option A, admins also see in-tenant orphans)
Thread-read: 6893097935
Premise: corrected 6893097935
Serial constraints cleared: #33524 (this area, cbp-write-gate.ts + operation-message.ts, disjoint from the read filter); #33683 (plugin-sharing, disjoint); the dev re-greps open PRs on both files before pr_create
objectstack-fleet commentedon Nov 15, 2026
domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv
Claim amendment · 2026-11-15T10:44Z · to claim 6893117018 · file surface widened by the area (routing, no ruling change)
Added:
packages/objectql/src/engine.ts, at most 4 lines, all inside the host literal of the private methodcomposeReadableIdsChain: a_registrygetter shaped like the other host literals. The reason: only the engine sees the per-hop scope answer the ruling (6893097935) requires, and it must also read whether the leaf's master_detail field is required. Dropping the leaf at the source instead would make the synchronous cbp read filter async, which reaches further. No behaviour change in engine.ts, and no public surface move. Clause-② no and Metadata-protocol none are unchanged.objectstack-fleet commentedon Nov 15, 2026
domain:server#5 · zhuangjianguo · session_01QsR2jRsWwTRkuRCyQwvpAG
Re-ruled: option 「只对管理员去掉」 (drop the chain for administrators only) · the maintainer (Steedos) on the seat thread decision card (2026-11-15T11:31Z), after an independent Fable re-review. This replaces record 6893097935.
Why it was re-asked: 6893097935 (decision request 6892447012) did not show the maintainer two recorded decisions it reversed. They are #24932 ruling B item 4 (comment 6303721609, 10-20, ⛔ "no interim removal of the predicate for an unrestricted master scope: it would expose rows with a null or dangling foreign key (measured)") and ADR-0139 D6 (docs/adr/0139-engine-internal-semi-join-leaf-readable-parent-ids.md:295-297). As written it would also have shown members unowned rows, against #30905 ruling A (11-06, ADR-0055: rows with no master are visible only to their owner and to view-all holders on the detail). Area S1 found this while building.
Ruling as it binds this card:
hasSuperuserReadBypass), with a required master FK. That reader sees null and dangling-FK rows inside its own tenant wall, consistent with controlled_by_parent admits an optional master (1/3): spec, lint and the read owner branch: a null-master detail row is readable by its owner only #30905 ruling A. Every other reader, members included, keeps the chain unchanged.State: stays
pm:dispatchedwith area S1 (branch claude/area-A2-33696 pushed, no PR). The route is now narrower; S1 reworks it to this ruling.objectstack-fleet commentedon Nov 15, 2026
domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv
os-dev-report
{ "issue": 33696, "status": "done", "branch": "claude/area-A2-33696", "pr": "https://github.com/objectstack-ai/objectstack/pull/33897", "session": "session_01QsR2jVPGBoi3MCGoKbW1Hv", "premise_still_valid": true, "summary": "Built ruling record 6893666857, which replaces 6893097935. composeReadableIdsChain step 5 drops the leaf over a controlled_by_parent object's REQUIRED master in an AND position. It does so only when that master answers unrestricted at every hop (the engine's per-hop scope; a nested scope left empty answers undefined) AND the caller holds View All on the detail. View All is read from ISecurityService.getEffectiveObjectPermissions, once per read. A delegated caller, a service without that member, or a call that throws keeps the chain. Every other reader keeps the chain unchanged: a restricted hop, View All on the detail only, a plain member. Optional masters and $or/$not positions compose as before. The View All reader now sees null and dangling-FK rows inside its own tenant wall, and the changeset carries the ruling's release note. PR is draft and must not land before #33820 (ADR-0139 status-line amendment), as its body says near the top.", "tests": "Head 2c6025c0 (implementation 521ba7e7 plus origin/main merged), runs under os-verify-lock with exits captured before any pipe. objectql: pnpm test exit 0, 596/596 files, 13141 tests; typecheck exit 0. plugin-security: pnpm test exit 0, 268/268 files, 6690 passed and 45 skipped; typecheck exit 0. New real-stack pins in security-plugin-cbp-read-filter.test.ts, 8 tests: (a) View All plus unrestricted reader has no subquery, all rows, count 7, findOne of a dangling row, plus parity and the analytics door; (b) restricted hop keeps the chain; (c) View All on the detail only keeps the chain; (d) member keeps the chain over a restricted and over a public master; optional master keeps its leaf; (e) isolated tenancy wall. Unit pins in engine-readable-ids-nested-composition.test.ts: 17 tests. Leaf-switch: 23 tests, the three tests gain the View All everywhere reader leg. Ablations via ablation-replace on the committed head, each restore proven blob==HEAD 8ec17d58c0bb with git diff HEAD empty. Per-hop check removed: (b) and (c) red, plus 2 unit pins. readerViewsAllOf forced true: (d) red, plus 1 unit pin. Step 5 disabled: (a), parity, analytics and the (d) admin control red, plus 2 unit pins. Direct runtime dependents after building PKG^... (exit 0): example-embed-objectql 1/1, plugin-audit 94/94, plugin-email 53/53, plugin-pinyin-search 4/4, plugin-sharing 74/74, plugin-webhooks 25/25, runtime 603/603, service-automation 282/282, cloud-connection 82/82, example-todo 9/9, plugin-dev 10/10, verify 52/52. scenarios was 31/33 on the first pass: 2 test/build files refused because its own dist was not built (a prerequisite, not a result); after building scenarios both pass, 2/2 files, 14 tests. cli vitest --project unit exit 0, 421/421 files, 6000 tests.", "gates": "dispatch-gates --commands --repo objectstack-ai/objectstack derived 74 at 2c6025c0. 71 run locally: 70 exit 0 on the first pass; check:query-options-erasure exit 124 (runner timeout 300 s on the shared box), then exit 0 on a re-run with no timeout. --ran reconciliation: 74 derived, 71 run, 0 NOT-MEASURED, 3 UNRUN (check:i18n, check:dual-build-cjs-loads, check:type-check-debt are whole-repo runs left to CI). check-nul-bytes exit 0. pnpm lint is left to CI. PR check-runs: in_progress at report time, not waited on. git merge-tree against origin/main (16 commits newer) is clean.", "dogfood_battery": "n/a: no ! in the PR title and no (narrowing) arm", "line_budget": "7 files, +730 / -9 against origin/main. engine.ts +2 (approved widening, max 4). controlled-by-parent-leaf-switch.test.ts +22/-3 (approved widening, about 15 asked; 25 lines touched in all). No skills/** or docs/adr/** touched.", "files_changed": [ ".changeset/33696-drop-unrestricted-cbp-chain.md (new, objectql patch, Clause-2 no, Metadata-protocol none, release note)", "packages/objectql/src/engine-readable-ids-permission-formula.ts (step 5, readerViewsAllOf, pruning helpers)", "packages/objectql/src/engine.ts (APPROVED WIDENING: 2 lines, _registry getter in the composeReadableIdsChain host literal)", "packages/objectql/src/engine-readable-ids-nested-composition.test.ts (unit pins)", "packages/plugins/plugin-security/src/security-plugin-cbp-read-filter.ts (docblock only)", "packages/plugins/plugin-security/src/security-plugin-cbp-read-filter.test.ts (new, real-stack pins a to e)", "packages/plugins/plugin-security/src/controlled-by-parent-leaf-switch.test.ts (APPROVED WIDENING: View All everywhere reader legs; the existing pins are unchanged)" ], "deviations": [ "pnpm lint was not run locally. common.txt lists it before push, but os-dev.md says a repo-wide scan is CI-owned and that the os-dev file wins on a conflict, so it is left to CI.", "3 derived gate families are left to CI as whole-repo runs: check:i18n, check:dual-build-cjs-loads, check:type-check-debt.", "Packages that depend on objectql only as a devDependency, and dogfood, are left to CI (Test Core). Only the direct runtime and peer dependents were run.", "The PR body starts with the HTML attribution comment that common.txt mandates. os-dev.md otherwise bans HTML comments in bodies.", "The merge commit 2c6025c0 is git's default merge message with no trailers." ], "mcp_calls": "0", "api_writes": "2 relay writes (with this comment): pr_create POST /repos/objectstack-ai/objectstack/pulls via fleet-write run 43720623596 (PR #33897), and this os-dev-report comment via post-stamped. Earlier rounds of this claim: 1 comment (6892424473). Plus git push (not REST).", "open_questions": [], "security_findings": "none", "out_of_scope_findings": [ "carrier: seat · loose-ends card owed by ruling 6893666857: stop orphan rows at their sources (option B). Measured sources: a system-context insert or update naming a missing master is stored (residual in engine-referential-integrity.ts), and promoting an optional master to required leaves NULL-FK rows. Dedupe words: orphan detail rows, dangling master_detail, system write referential integrity, required promotion null", "carrier: #33820 · ADR-0139 status-line amendment (lines 295-297, D6) is the landing precondition; docs/adr not touched", "carrier: seat · security-plugin.ts docblock on computeControlledByParentFilter still says the composed leaf always compiles to a subquery; outside the claim surface", "carrier: seat · open PR #33652 (other seat) edits composeReadableIdsChain in the same file (import line, final composeReadableIdsLeaves call): a textual conflict for whichever lands second. Its planned relation leaves are never asked into chain.answers, so step 5 leaves them alone and the two do not conflict in meaning", "noted, not filed · walled tenancy: the tenant admin's master scope carries the Layer-0 equality, so nothing is dropped there, by design (pin e)" ] }objectstack-fleet commentedon Nov 15, 2026
domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv
Claim amendment · #33696 · 2026-11-15T13:53Z
After review FAIL 6895328067 on PR #33897 (head 2c6025c), route (a): the write doors stay byte-identical. File surface adds: write-door pins (predicate delete, predicate update, by-id 404 over an orphan, each red on head 2c6025c) in plugin-security
*.test.ts, and a prose-only paragraph in thecomputeControlledByParentFilterdocblock insecurity-plugin.ts(review should-fix 2). Preferred build: the drop stays confined to the read door that asks for it, so no write-door source file changes. If a write-door source file (security-plugin-cbp-write-gate.ts,security-plugin-authz-middleware.ts,security-plugin-addressed-writes.ts) must change, the dev stops and reports first: #33524 in this area edits two of them.Clause-②: no
Metadata-protocol: none
objectstack-fleet commentedon Nov 15, 2026
domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv
Claim amendment · #33696 · file surface · 2026-11-15T14:06Z
Route (a) build:
packages/objectql/src/engine-middleware-and-context.tsjoins the surface, about 4 lines inexecuteWithMiddlewareonly: a write-epoch operation runs its middleware chain inside an engine-owned store, and the chain drop answers "no drop" while that store is set, so every read made on behalf of a write keeps the chain as on main. No plugin-security write-door source file changes. Open PR #33887 (S2) edits a different function of the same file (claimReferentialCascadeDelete); whichever lands second merges main.Clause-②: no
Metadata-protocol: none
objectstack-fleet commentedon Nov 15, 2026
domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv
os-dev-report
{ "issue": 33696, "status": "done", "branch": "claude/area-A2-33696", "pr": "https://github.com/objectstack-ai/objectstack/pull/33897", "session": "session_01QsR2jVPGBoi3MCGoKbW1Hv", "premise_still_valid": true, "delta_of": "review FAIL 6895328067 on head 2c6025c0; route (a), claim amendments 6895345175 and 6895620230", "head": "df3fb3b9ad5558a2e9ebf205e12ac0fbd4499fe1", "summary": "Write doors are byte-identical to main again. A write's middleware chain (insert, update, delete, purge, restore) now runs inside READABLE_IDS_WRITE_IN_FLIGHT, an engine AsyncLocalStorage set in executeWithMiddleware (+4/-1, approved widening) and exported from engine-readable-ids-permission-formula.ts. readerViewsAllOf answers no drop inside it, so every read made on a write's behalf keeps the chain: the predicate-write narrowing, the 2.8 predicate leg, the step-2.7 by-id read, and hook reads. No plugin-security write-door source file changed. Should-fix 2: a prose-only paragraph in the computeControlledByParentFilter docblock (security-plugin.ts). The changeset gains a writes-unchanged note.", "findings": [ "Finding 1, predicate delete with an empty-required-master orphan in the set: red on 2c6025c0 (refused MISSING_REQUIRED_FIELD / 422); green on df3fb3b9 (lands on the other row, the orphan stays); passes on main's objectql source.", "Finding 2, predicate update with an empty-master orphan and a dangling-master orphan in the set: red on 2c6025c0 (refused MISSING_REQUIRED_FIELD / 422); green on df3fb3b9 (lands on the other row, both orphans unchanged); passes on main's objectql source.", "Finding 3, by-id update of a dangling orphan and by-id delete of an empty-master orphan: red on 2c6025c0 (refused PERMISSION_DENIED / 403, not RECORD_NOT_FOUND / 404); green on df3fb3b9 (404 for both); passes on main's objectql source.", "Extra pin asked in amendment 6895620230, a hook's read inside a write: red on 2c6025c0 (the hook read saw the 4 orphans); green on df3fb3b9. On main its write leg passes; its plain-read control leg is red there, as expected, because main drops nothing." ], "tests": "The red legs were measured with the three objectql source files set back to 2c6025c0, then restored with git diff HEAD empty. Ablations via ablation-replace, each restore checked blob==HEAD: deleting the store guard in readerViewsAllOf turns 4/4 red; running the write chain outside the scope in executeWithMiddleware turns 4/4 red. At df3fb3b9: plugin-security pnpm test exit 0, 269/269 files, 6705 passed and 45 skipped, typecheck exit 0; objectql pnpm test exit 0, 598/598 files, 13238 tests, typecheck exit 0. At 3089656f (the same code, one main merge earlier): 13 direct runtime dependents all exit 0 after building PKG^... (runtime 605/605, plugin-sharing 74/74, scenarios 34/34, service-automation 282/282 and the rest), and cli --project unit 422/422 files, 6002 tests.", "gates": "At df3fb3b9, dispatch-gates derived 77; 74 run locally, all exit 0. --ran: 77 derived, 74 run, 0 NOT-MEASURED, 3 UNRUN (check:i18n, check:dual-build-cjs-loads, check:type-check-debt, whole-repo runs left to CI). check-nul-bytes exit 0. pnpm lint left to CI.", "merge_tree": "git merge-tree --write-tree --name-only from df3fb3b9. origin/main: clean (main is 18 commits ahead; none of them touches this PR's files). #33887 at eab93bab: clean. #33884 merged as c59198f05 and is included in this head. #33652 at 1b832c58: CONFLICT in engine-readable-ids-permission-formula.ts, 2 hunks (the import block; the step-5 / final composeReadableIdsLeaves lines). The overlap was known; whichever lands second rebases.", "dogfood_battery": "n/a: no ! in the PR title and no (narrowing) arm", "line_budget": "Delta since 2c6025c0: engine-middleware-and-context.ts +4/-1 (approved); engine-readable-ids-permission-formula.ts +17; security-plugin.ts +12 (docblock prose only); security-plugin-cbp-read-filter.test.ts +82; changeset +4.", "files_changed": [ "packages/objectql/src/engine-middleware-and-context.ts (APPROVED WIDENING 6895620230, executeWithMiddleware only)", "packages/objectql/src/engine-readable-ids-permission-formula.ts", "packages/plugins/plugin-security/src/security-plugin.ts (docblock only)", "packages/plugins/plugin-security/src/security-plugin-cbp-read-filter.test.ts", ".changeset/33696-drop-unrestricted-cbp-chain.md" ], "deviations": [ "The write pins seed two admin-created rows through the driver. The rig's member_default adds the own-records write predicate (created_by = caller), and on main an admin predicate write over the seeded rows lands on zero rows.", "The new pins are in security-plugin-cbp-read-filter.test.ts, a file this PR creates, not in a new file named for the card.", "Dependents were not re-run after the second main merge (df3fb3b9). That merge (#33884 among others) touches none of this PR's files. plugin-security and objectql were re-run there.", "pnpm lint is left to CI (os-dev.md: repo-wide scans are CI-owned)." ], "mcp_calls": "0", "api_writes": "2 relay writes this round: issue_patch of the PR #33897 body (run 43734784781, read-back identical), and this comment via post-stamped. Plus git push (not REST).", "open_questions": [], "security_findings": "none", "out_of_scope_findings": [ "carrier: seat · the follow-up card to close the orphan sources (option B) is still owed", "carrier: #33820 · the ADR-0139 status-line amendment is still the landing precondition" ] }objectstack-fleet commentedon Nov 15, 2026
domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv
Unblocked: the ADR status-line card #33820 landed as PR #33992 (merged 2026-11-15T16:34Z). ADR-0139 and ADR-0055 now record the 6893666857 ruling, so the PR for this card no longer waits on it.
objectstack-fleet commentedon Nov 15, 2026
domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv
Carrier for this card (F3 of the at-tier review 6899080787 on PR #34075, card #33432): ADR-0055's 2026-11-14 "What a refusal answers" paragraph has two sentences that rest on "a detail row's own read derives from its master (§2)": the by-id 404 sentence (on
mainnow) and the predicate (multi: true) sentence PR #34075 adds. Both are true onmaintoday. When this card's code lands and its reader class reads a required master's empty or dangling rows, both sentences need this card's 2026-11-15 note, in the PR that lands it. Nothing to do before then.objectstack-fleet commentedon Nov 15, 2026
domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv
Landed: PR #33897 merged as 3c2fb32; card closed by its Fixes line.
pm:dispatchedremoved · 2026-11-15T21:56Zdocs(adr): ADR-0139 / ADR-0055 record the view-all unrestricted-reade…
perf(objectql): drop a required master's parent chain for a View All …
feat(driver-sql, driver-turso): schema sync indexes (created_at, id) …
docs(adr-0055,skills-data): wording follow-ups from the writeRequires…