Skip to content

Form reads at the form doors: push the name and package predicates down (SQL first) — residual of #37086 review S5 #37709

Description

@objectstack-fleet

repo:objectstack#7 · os-alice · session_011y7As8wf3DSPRevwNnYLcM
Filing gate: ① · Source: fleet · finding class b · reach: named producer (readEffectiveForms / readEffectiveFormItem in packages/metadata-protocol, every form read and every anonymous form-door request)

What

Residual of contract review finding S5 on PR #37422 (card #37086; first recorded in 7184811209, carried through 7203725192). readEffectiveForms drops names and packageId from the request and filters in memory after full reads of both types (view and form) and of every stored row of both. readEffectiveFormItem can call it up to three times for one by-name read, and each anonymous form-door request repeats the view-list and stored-row reads for the form read, the two per-package layers and the unreadable bodies.

Why its own card

Prime Directive 5 (SQL first): the name and package predicates should be pushed down, or the code should state why the two-type resolution (D5 served-row order across view and form) cannot take them. #37422 already narrowed part of it in its rework rounds; the seat took the residual out of that PR to land the form type, by the seat's ruling recorded in its ACCEPT 7204181264.

Acceptance (proposed, for triage)

  • A by-name form read and a form-door request read only the rows the name (and package, where given) can resolve to, or the code states, at readEffectiveForms, the measured reason it cannot.
  • A pin counts the reads for one by-name read and one door request, with a CONTROL.

Activity

  1. added
    priority:p2
    pm:queue
    on Nov 26, 2026
  2. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in area:data · domain:server · Task · priority:p2 · pm:queue · size S; rationale: the form doors should push the name and package predicates down to SQL instead of filtering in memory (the residual of #37086 review S5). Performance on SQL drivers; p2 as filed.

  3. added
    domain:server
    on Nov 26, 2026
  4. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-alice · session_011y7As8wf3DSPRevwNnYLcM

    Acceptance, measurable · 2026-11-26T23:46Z

    The maintainer accepted S5 as a deviation of #37422's landing and carried it here (ruling recorded on #37422, comment 7205846098). Measurable acceptance for this card:

    • Measure first, on feat(spec)!: form is a metadata type of its own, and the form doors read a form over both types #37422's merged tree: for one by-name form read and for one anonymous form-door GET, count the view list reads and the stored-row reads (sys_metadata) the request issues. Record the counts in the PR.
    • Target: each request reads the view list at most once and the stored rows at most once; where names / packageId can be pushed down without changing the D5 cross-type resolution, they are; where they cannot, the code at readEffectiveForms states the measured reason.
    • A pin asserts the counts, with a CONTROL; an ablation that re-adds a repeated read turns it red.
  5. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

    Picked by card-pick.mjs --order area:data --seat repo:objectstack#8 at 2026-11-28T02:19Z: rank 10 (p2, order 1; ranks 5–9 are claimed by this seat, held for a decision, or a seat-2 trunk card). The maintainer in this seat's session, verbatim: 「开一个 objectstack 全仓座位」 with intake area:data, then 「batch 调到 5,可以用云卡」.

    Claim: PM loop round 1
    Session: session_017xRBcSAaBEfQpU2yJexSJ8
    Account: sunhaolin
    Branch: claude/issue-37709-form-reads-once
    Worktree: objectstack-issue-37709
    Domain: domain:server
    Seat: repo:objectstack#8
    File surface: packages/metadata-protocol/src/protocol-form-reads.ts, protocol-meta-item-reads.ts (readEffectiveFormItem), the form-door read path in packages/metadata-protocol/src/** that calls them, co-located tests (a new *-37709.test.ts for the read-count pin), one changeset; ⛔ no packages/spec/src/**, no change to the D5 served-row order (stop on breach; explain in the report)
    Container & model: M, mode:subagent, model: opus (dispatch-gates --tier: no path-derived mandate; default tier), effort: high (S card, design in the pushdown: M treatment)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: n/a — not a defect card
    Thread-read: 7205862309
    Premise: corrected — read on origin/main at 2026-11-28T02:19Z: names is already pushed into both generic reads and packageId's reason is already stated at readEffectiveFormList (protocol-form-reads.ts docblock above it, landed in #37422's rework). The residual this claim takes: repeated view-list / stored-row reads per request (readEffectiveFormItem, protocol-meta-item-reads.ts:691-699, can call readEffectiveForms up to three times; each anonymous door request repeats them), against 7205862309's target "each request reads the view list at most once and the stored rows at most once", with the count pin + CONTROL + ablation it asks.
    Serial constraints cleared: no open in-flight claim names packages/metadata-protocol except seat 3's packages/** claims #37856 / #36495 (check-handover.mjs --inflight). Textual overlap re-checked with overlap-check.mjs before every push.
    Scope this dispatch: the residual above. Fixes #37709.

  6. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 28, 2026
  7. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8
    os-dev-report

    {
     "issue": 37709,
     "status": "done",
     "branch": "claude/issue-37709-form-reads-once",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/38164",
     "session": "session_017xRBcSAaBEfQpU2yJexSJ8",
     "premise_still_valid": true,
     "summary": "Measured first on origin/main 93fa9118a (#37422 merged), real protocol over ObjectQL + SQLite, overlay row cache off (TTL=0), one warm-up: a by-name form read (authored form item) read the view list 1x, the form row set 2x and the view row set 2x (old-shape form: 1/1/1); a form-door GET read the effective view list 2x, view rows 5x, form rows 3x (old shape: 2/4/2). After (73983efb0): both requests, both shapes, read the view list once and each type's row set once (plus the by-name read's own name-predicated row read, unchanged). Mechanism: formRequestScope in protocol-form-reads.ts memoizes each stored row set and flattened list per request (readFlattenedMetaItems takes the scope's row reader), and readInFormRequest/readFormRequest (new server-only protocol extension, AsyncLocalStorage) lets the door's five existing protocol calls share one scope; the reading memoizes nothing once it settles. Premise check: names already pushed into both generic reads and the packageId reason already stated at readEffectiveFormList (confirmed, cited, not redone); the card's 'readEffectiveFormItem calls readEffectiveForms up to three times' is stale on this tree (one call; the repeats were inside it). D5 served-row order untouched; no packages/spec change.",
     "tests": "On f97bc7d66 (merged origin/main): @objectstack/metadata-protocol vitest run: Test Files 372 passed | 9 skipped (381), Tests 23605 passed | 45 skipped; @objectstack/rest vitest run --project local: Test Files 433 passed (433), Tests 8981 passed | 351 skipped; both typechecks exit 0. On final head 73983efb0 (protocol.ts text-only change after that run): rebuilt, both typechecks exit 0, pin + 11 form-door files Test Files 12 passed (12), Tests 898 passed (898). New pin packages/rest/src/public-form-reads-once-37709.test.ts, 8 cases (by-name read and door GET x 2 shapes, exact counts, CONTROL two-requests-read-twice, CONTROL five-calls-outside-a-reading reads view list 2x / view rows 4x). Ablations on 6178fb1fb via scripts/ablation-replace.mjs, each leg rebuilt and dist-preflighted: A1 drop scope in readEffectiveFormList gives 2 failed/6 passed; A2 readFormRequest opens no reading gives 4 failed/4 passed; A3 scope's list reads get no row reader gives 6 failed/2 passed; restore leg markers absent, tree clean vs HEAD, pin 8/8. test:repo (vitest repo project) not run locally: owned by CI Test Core.",
     "gates": "Local, on 73983efb0: all 75 commands of `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` exit 0 (exit captured before any pipe, per-command log); check:dual-build-cjs-loads first exit 3 PREREQUISITE NOT MET, exit 0 on re-run after check:type-check-debt's full build on the same head; check:facade-delegation-only was exit 1 on f97bc7d66 (protocol.ts 11719, over its ceiling 11705), fixed in 73983efb0 (11705), exit 0. --ran reconciliation: 75 derived, 75 run, 0 NOT-MEASURED, 0 UNRUN. Raw control-byte self-scan of changed files: no match. CI check-runs on 73983efb0 at report time: 23 total, 1 success, 17 in_progress/queued, 0 failed (in_progress, not awaited).",
     "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
     "mcp_calls": "0",
     "api_writes": "2 relay strokes — fleet-write pr_create (POST /repos/objectstack-ai/objectstack/pulls draft #38164, POST /repos/objectstack-ai/objectstack/issues/38164/assignees sunhaolin) and post-stamped os-dev-report comment (POST /repos/objectstack-ai/objectstack/issues/37709/comments); git push not counted",
     "line_budget": "8 files, +409 / -51 vs merge base bbe425864; protocol.ts net 0 lines (facade ceiling 11705 held)",
     "files_changed": [
      ".changeset/37709-form-reads-once.md",
      "packages/metadata-protocol/src/protocol-form-reads.ts",
      "packages/metadata-protocol/src/protocol-meta-item-reads.ts",
      "packages/metadata-protocol/src/protocol-meta-list-reads.ts",
      "packages/metadata-protocol/src/protocol.ts",
      "packages/rest/src/form-routes.ts",
      "packages/rest/src/public-form-reads-once-37709.test.ts",
      "packages/rest/src/rest-write-route-hook-refusal-sentence.ledger.test.ts"
     ],
     "deviations": [
      "File surface: packages/rest/src/form-routes.ts changed (the measured producer of the door's repeated reads: five separate protocol calls); reason in PR body Acceptance notes. protocol.ts and protocol-meta-list-reads.ts are in packages/metadata-protocol/src/** read path.",
      "'Existing tests unchanged': packages/rest/src/rest-write-route-hook-refusal-sentence.ledger.test.ts gains one pass-through entry (readFormRequest) in its catch-all protocol double's READS table (+2 lines, no assertion changed), as that table gained getMetaItemsPerPackage and getUnreadableFormBodies when those door extensions landed. A first design (one new door call returning all five readings) was dropped because it bypassed the read doubles four other door tests install.",
      "Pin lives in packages/rest (the door and the real ObjectQL + SQL stack are there; metadata-protocol has no objectql/driver-sql devDeps).",
      "Commit trailers model-free per AGENTS.md (harness reminder's model-named Co-Authored-By not used)."
     ],
     "open_questions": [],
     "security_findings": "none",
     "out_of_scope_findings": [],
     "l2_review": "Owed, in my view: a new public method on ObjectStackProtocolImplementation (readFormRequest, server-only, feature-detected) and AsyncLocalStorage in @objectstack/metadata-protocol (node:async_hooks; package already node-only, check:lean-entry-closure green)."
    }
  8. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

    Claim amendment · 2026-11-28T04:55Z — the seat's Clause-② line in claim 7232299134 was wrong for what PR #38164 delivers: the diff adds readFormRequest, a public method on ObjectStackProtocolImplementation, which @objectstack/metadata-protocol exports from its . entry (src/index.ts:3) — a widening of the published surface. Everything else stands.

    Clause-②: yes (widening)
    Metadata-protocol: none
    File surface: as claimed, plus packages/rest/src/form-routes.ts (the measured producer of the door's repeated reads) and the one pass-through row in packages/rest/src/rest-write-route-hook-refusal-sentence.ledger.test.ts, both reported by the dev.
    Owed: the TIER_DEFAULT review the declaration face alone owes, by this seat.

  9. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8
    os-dev-report

    {
     "issue": 37709,
     "status": "done",
     "branch": "claude/issue-37709-form-reads-once",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/38164",
     "session": "session_017xRBcSAaBEfQpU2yJexSJ8",
     "round": "patch (seat order: Clause-② widening)",
     "head": "c1aaf1cee64e259ab228c6a69d83df4f7d35ddc7",
     "summary": "Changeset .changeset/37709-form-reads-once.md now reads `Clause-②: yes (widening) — ObjectStackProtocolImplementation.readFormRequest`; `Metadata-protocol: none` kept; both entries stay `patch`. Level: AGENTS.md Post-Task Checklist step 3 ('a kind takes at least minor on a package the diff moves, none takes patch; a non-protocol change, widening or breaking, ships patch') and check-changeset-no-major's level axis ('a declared none must grade every entry it introduces patch') both say patch for a new public method under Metadata-protocol: none. PR body NOT patched by this dev: .claude/agents/os-dev.md says the PR body is written by a subagent only at pr_create and never PATCHed (the seat writes it), which outranks the order; the seat's line to set in the body is the same line as the changeset. The body carries no signed trailer line today (only the session-URL footer), so there is none to keep.",
     "gates": "On c1aaf1cee: node scripts/check-changeset-no-major.mjs --base origin/main exit 0 (level axis not applicable without a pull_request event); the same with --event over the live PR body exit 0 (declares no / none, patch) and over that body with the corrected line exit 0 (declares yes (widening) / none, patch); check-adr-0087-registration --base origin/main exit 0; check-empty-changeset --base origin/main exit 0; pnpm check:changeset-gate-self-tests exit 0; check-closing-keyword-parity exit 0; overlap-check VERDICT clean exit 0. Code unchanged since 73983efb0.",
     "mcp_calls": "0",
     "api_writes": "1 this round: post-stamped delta comment (POST /repos/objectstack-ai/objectstack/issues/37709/comments); no PR body write",
     "files_changed": [
      ".changeset/37709-form-reads-once.md"
     ],
     "deviations": [
      "Step 2 (PR body Clause-② via issue_patch) not performed: conflicts with os-dev.md (subagent never PATCHes a PR body; the seat writes it). Left for the seat."
     ],
     "security_findings": "none",
     "out_of_scope_findings": []
    }
  10. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

    ACCEPT → PR #38164 comment 7234807820 · L2 PASS 7234800035 · 2026-11-28T05:41Z · landing armed; this card closes on merge (Fixes #37709). #37852 (same package, serial queue) is taken after it lands.

  11. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8
    os-dev-report

    {
     "issue": 37709,
     "status": "done",
     "branch": "claude/issue-37709-form-reads-once",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/38164",
     "session": "session_017xRBcSAaBEfQpU2yJexSJ8",
     "round": "fix (queue ejection: Test Core 9/10, plugin-approvals stranded-request-inspection timeout)",
     "head": "c1aaf1cee64e259ab228c6a69d83df4f7d35ddc7",
     "verdict": "not this PR",
     "summary": "packages/plugins/plugin-approvals/src/stranded-request-inspection.test.ts, case 'an older strand outside the newest window is reached by the cursor within a bounded number of sweeps' (1200 single-row inserts plus 6 sweeps, real ObjectQL over SQLite). Locally, 3 runs each, every run 39/39 green. Test time and file wall time: head c1aaf1cee 1040 / 999 / 976 ms (file wall 11.0 / 10.9 / 11.3 s); merge base bbe425864 1127 / 1038 / 916 ms (10.97 / 10.87 / 10.62 s); origin/main 9609c137e 1086 / 996 / 1111 ms (11.33 / 11.18 / 11.15 s). None comes near 5 s, and head matches base and main within noise. Reach, measured with on-disk probes through scripts/ablation-replace.mjs (restored, tree clean against HEAD): the file loads metadata-protocol source through plugin-approvals' vitest alias, so the module-load probe in protocol-form-reads.ts and in protocol-meta-list-reads.ts fires once each. The call probes, though, count 0 calls of formRequestScope, 0 of readFlattenedMetaItems and 0 of readActiveOverlayRows in that file. CONTROL: get-meta-items-package-writable.test.ts in metadata-protocol counts 7 of readFlattenedMetaItems and 7 of readActiveOverlayRows under the same probes, so the probes fire when the code runs. The AsyncLocalStorage store is only touched inside readInFormRequest and formRequestScope, which never run here. The only cost this PR adds to that file is the import of one extra module-scope AsyncLocalStorage; the timings above show no change. Base run: the same case timed out the same way in queue build 46121613844 for #38167 (job 140908004794, Test Core 9/10, merge-group head 5cb8389bf): '× an older strand outside the newest window ... 5792ms', file 9649 ms. Comparing c1aaf1cee with 5cb8389bf answers diverged, behind 7 (that build does not contain this PR's commits). In this PR's two ejections the file took 13422 ms (job 140886441960, run 46114725605) and 9385 ms (job 140888894163, run 46115033565), against about 11 s on this container; the case runs about 1 s locally and more than 5 s on a loaded queue runner. I made no fix, did not touch the timeout, and skipped or quarantined nothing.",
     "mcp_calls": "0",
     "api_writes": "1 this round: post-stamped delta comment (POST /repos/objectstack-ai/objectstack/issues/37709/comments). All other GitHub access was reads (job logs, runs, compare).",
     "files_changed": [],
     "deviations": [
      "I recreated the worktree on the existing branch with git worktree add, and used a second detached worktree first at the merge base, then at origin/main. Both are removed at the end of this round."
     ],
     "security_findings": "none",
     "out_of_scope_findings": [
      "class: a · reach: queue build 46121613844 (#38167, without this PR) times out at 5792 ms on the plugin-approvals case 'an older strand outside the newest window is reached by the cursor within a bounded number of sweeps', the same case that ejected #38164 twice · evidence: about 1 s locally on base, main and head, 5.8 to 13 s file time on queue runners: a load-sensitive budget for 1200 serial inserts · dedupe words: stranded-request-inspection, older strand, Test timed out 5000ms, plugin-approvals cursor sweep"
     ]
    }
  12. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

    Closed by PR #38164 (merged, Fixes #37709) · 2026-11-28T11:04Z. The claim (seat repo:objectstack#8) ends with the merge; pm:dispatched removed. Serial follower #37852 waits on #35924, whose in-flight claim holds packages/metadata-protocol/src/**.

  13. removed
    pm:dispatched
    on Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:datadomain:serverpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions