This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
refactor(plugin-grid): import the batch-explain cap from @objectstack/spec/security - #6333
Merged
os-support-ai merged 2 commits intoAug 25, 2026
Merged
Conversation
`useRecordCrudVerdicts` declared `EXPLAIN_BATCH_MAX_RECORD_IDS = 200` locally, a hand copy of a server contract constant, under a doc comment that named its own expiry condition. `@objectstack/spec/security` exports the constant, so the copy is replaced by an import and only the "why it was declared locally" half of the comment is dropped. No value and no behaviour change: the spec exports 200, verified statically and at runtime against the resolved package. What changes is reference identity — the client can no longer drift from the server's cap. Covered by a reference-identity test that stands the spec module in at a cap no hand copy could produce; an assertion on 200 passes on both sides and proves nothing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011SfZeFWrhGLHmfq61xbz4q
The ablation leg found "exactly cap ids is one request" surviving the revert: three ids fit under a cap of 200 as readily as under a cap of 3, so that half is another ghost. The case now asserts the cap + 1 side in the same breath, which only passes when the boundary being applied is the spec's. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011SfZeFWrhGLHmfq61xbz4q
Contributor
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
os-support-ai
marked this pull request as ready for review
August 25, 2026 13:29
os-support-ai
deleted the
claude/issue-6286-explain-batch-cap-from-spec
branch
August 25, 2026 13:41
huangyiirene
pushed a commit
that referenced
this pull request
Sep 28, 2026
…filter in the past tense (objectui#9528) The pending `6286-explain-batch-cap-from-spec.md` said both scanners of `scripts/check-spec-symbol-derivation.mjs` "skip non-exported declarations". That was true when #6333 landed (c38162d: both `scanFile` and `scanFileForClaims` opened with `if (!hasExportModifier(stmt)) continue;`) and stopped being true at 9207c53 (objectui#6291), which dropped the filter from both. The body publishes verbatim at the next release, so the sentence now keeps the history and dates it: skipped when this change landed, filter since removed. Frontmatter (package, bump level) unchanged. Claude-Session: https://claude.ai/code/session_01EBx9rvB7dufCz4at53x35U Co-authored-by: Claude <noreply@anthropic.com>
This was referenced Sep 28, 2026
akarma-synetal
pushed a commit
to akarma-synetal/objectui
that referenced
this pull request
Oct 7, 2026
…ectstack-ai#6286 release note (objectui#9528) (objectstack-ai#10970) Fixes objectstack-ai#9528 Clause-②: no — release-note prose; no contract, accept set or public surface changes (a contract review is still owed: the diff is `.changeset` prose) ## What changes One sentence in the **pending** `.changeset/6286-explain-batch-cap-from-spec.md`. That body publishes verbatim into `@object-ui/plugin-grid`'s CHANGELOG at the next release, and the release PR objectui#5400 regenerates from `main`, so this only helps if it lands before that PR merges. The frontmatter is untouched: `check-changeset-overwrite.mjs` prints `declared at base: @object-ui/plugin-grid: patch` and `declares now: @object-ui/plugin-grid: patch`. Before: > … is exactly the drift `scripts/check-spec-symbol-derivation.mjs` argues about — and could not catch here, because both of its scanners skip non-exported declarations and this const was module-local (objectui#5899). After: > … is exactly the drift `scripts/check-spec-symbol-derivation.mjs` argues about — and could not catch here: when this change landed, both of its scanners skipped non-exported declarations, and this const was module-local (objectui#5899). objectui#6291 has since removed that filter from both scanners. ## Why this wording, and why the history stays The sentence was **true when written and went false later**. It is not a false sentence from the start. So the fix keeps the explanation, puts it in the past tense and dates it. Deleting it would lose true history. **1. True when the changeset landed.** `c38162d7c9` (objectstack-ai#6333, 2026-08-25) added the changeset. At that commit, both scanners in the gate open with the same filter line, once in `scanFileForClaims` (rule 2) and once in `scanFile` (rule 1): ``` if (!hasExportModifier(stmt)) continue; ``` The table below counts that line and two related markers in each revision of the gate file (`git show REV:scripts/check-spec-symbol-derivation.mjs | grep -c …`): | revision | `if (!hasExportModifier(stmt)) continue;` | `const hasExportModifier` | `// No export filter` | |---|---|---|---| | `c38162d7c9` (objectstack-ai#6333 lands) | 2 | 1 | 0 | | `9207c53e45^` | 2 | 1 | 0 | | `9207c53e45` (objectstack-ai#7274, objectui#6291) | 0 | 1 | 2 | | `b120b66077` (this PR's base) | 0 | 0 | 3 (two code comments plus one header mention of them) | **2. False since `9207c53e45`** (objectstack-ai#7274, objectui#6291, 2026-09-02). On the base, the two scanners now carry `// No export filter: a module-local declaration carrying a spec-alignment` in `scanFileForClaims` and `// No export filter (objectui#6291). A module-local declaration under a spec` in `scanFile`. The gate's own header says the same thing: "⛔ HISTORY, NOT BEHAVIOUR. Neither scanner has an export filter today." The order of the two commits was checked on a shallow checkout, so it needs a control leg: - `git merge-base --is-ancestor c38162d 9207c53` exits 0. - The reverse check exits 1. - Control leg: `git merge-base --is-ancestor 62311b6 c38162d` exits 0. `62311b6419` is the gate's first commit (2026-07-30), older than both. **3. Which rule would catch this const, then and now.** I measured this with a 2×2 probe, not read it off the header: - **Fixture A** is the pre-objectstack-ai#6333 hook source, `git show c38162d^:packages/plugin-grid/src/hooks/useRecordCrudVerdicts.ts`. In it, `const EXPLAIN_BATCH_MAX_RECORD_IDS = 200;` is module-local. - **Fixture B** is the same file with `export` added. It is the control. - Both fixtures were fed to the scanners of both gate versions, using today's spec export set (5085 names; `EXPLAIN_BATCH_MAX_RECORD_IDS` maps to `@objectstack/spec/security`). - The only change to the `c38162d7c9` copy was exporting its `scanFile`. The anchor count was checked on disk: 1 plain before and 0 after; 0 exported before and 1 after. | fixture | gate at `c38162d7c9`: rule 1 | rule 2 | gate at `b120b66077`: rule 1 | rule 2 | |---|---|---|---|---| | A — module-local (verbatim) | none | none | `const` finding | none | | B — `export` added (control) | `const` finding | none | `const` finding | none | What the probe shows: - **When objectstack-ai#6286 landed, the export filter is what hid the const from rule 1.** The control proves the old rule 1 flags the const as soon as it is exported. - **Today rule 1 (the name match) reports it.** `DEBT` is empty and no `ALLOW` key names it, so it would be a fresh finding and the gate would exit 1. - **Rule 2 reports it in no cell, and no filter is involved.** `findClaim` returns `null` on the const's doc comment. The comment names `@objectstack/spec@17.0.0-rc.6` but contains none of the `CLAIM_PATTERNS` phrases. - So for this const, the card is right that rule 1 is the operative rule. The claim note's point is also true: both scanners dropped the filter. But that matters for rule 2 only in general, not for this const. The new sentence therefore states only history: the filter existed when the change landed, and objectui#6291 removed it from both scanners. It asserts no live capability of the gate, so a later change to the gate cannot make it false the way the old sentence became false (AGENTS.md objectstack-ai#9). ## The other pending changesets that name the gate `git grep -l check-spec-symbol-derivation b120b66 -- .changeset` lists **seven** files. As a positive control, the same form of search for `plugin-grid` in the 6286 file counts 1. I widened the search to every spelling of the gate (`spec-symbol`, `check:spec-symbols`), which gives **17** files, and read all 17 in full. I also grepped every pending body for `non-exported|unexported|not exported|export filter|hasExportModifier|export modifier|exported only` and for `module-local`. **Only the 6286 file states the export-filter property.** The other 16 say nothing about it: - `7265-core-context-token-mirrors`, `7265-data-objectstack-filter-operator-rename`, `7265-components-sort-direction-bound`, `7265-plugin-detail-record-alert-renderer-props`, `spec-symbol-mirrors-app-shell-7265`, `7265-types-user-filter-field-derives`, `9596-debt-issue-anchor-truthiness`: these describe module-local mirrors that the rule-1 `DEBT` ledger carried, which fits today's behaviour. - `console-form-container-specs-one-declaration-5596`: says derivation is the gate's sanctioned form. - `listview-comment-pair-4559`: says rule 2 reads the *attached* comment block. - `9542-result-dialog-i18nlabel`: names the rule-2 failure class. - `3162-types-ledger-batch8-verdicts`, `spec-pin-17-1-0-5328`, `spec-refresh-17-2-0-5668`: ledger and pin history. - `ci-decide-markdown-trace-9241`: says the gate opens `content/docs/**`. - `8841-tree-view-config-derive` and `date-range-default-range-binding-4984`: explain a miss by **name matching** (and, in 4984, rule 2's tie test). That is a different property, which I did not re-measure here. ## Gates (all read at HEAD `25b8b6eeb2`, the only commit on this branch) | command | exit | verdict line | |---|---|---| | `pnpm check:changeset-claims` | 0 | `✅ No pending changeset names a file this change touches.`; self-contradiction: `Every package declared across those 1 body(ies) is either not negated in its own prose, …`; born-false: `Line addresses read in them: 0.` | | `node scripts/check-changeset-presence.mjs` | 0 | `✅ No source or published contract of a released package changed in this range, so no changeset is owed.` | | `node scripts/check-changeset-overwrite.mjs` | 0 (report-only) | `1 modified` — case 2, "CORRECTING a declaration on purpose … prose that no longer matches the change"; the declared package set is unchanged | | `node scripts/check-changeset-no-major.mjs` | 0 | ✅ No changeset declares a major bump. | | `node scripts/check-changeset-fixed.mjs` | 0 | `✅ All workspace packages are in the changeset fixed group.` | | `pnpm check:control-bytes` | 0 | `✅ check-control-bytes: OK (scanned 9240 tracked text file(s); skipped 85 binary).` | | `pnpm check:new-line-citations` | 0 | `VERDICT new-cross-file-line-citations: 0 new citation(s), enforcement report-only -> exit 0` | | `pnpm exec vitest run --maxWorkers=2` on the 24 `scripts/__tests__/*.test.ts` that mention `.changeset` (via `os-verify-lock.sh`) | 0 | `Test Files 24 passed (24)` / `Tests 914 passed (914)` / `VERDICT command-exit 0` | The 24-file set is a superset of what `node scripts/markdown-test-inputs.mjs --changed -` returns for this file. That helper records `.changeset/**` as the input of `check-changeset-no-major.test.ts`; the positive control is `packages/plugin-dashboard/README.md`, which it echoes back. No package source, gate or test is touched, so nothing else is owed. `node scripts/check-governed-queue-guard.mjs --test` on the file answers `✅ NOT GOVERNED`. ## Acceptance notes - `spec-symbol-mirrors-app-shell-7265` reads "held six declarations … Four are now bound … and three were renamed". That is 4 + 3 against six. Its commit (`14a1b92035`, objectstack-ai#9465) removes six app-shell names from `DEBT`, so one name may have held two declarations. **I did not measure this.** That changeset has empty frontmatter, so it publishes nothing. Nobody is carrying this; it is only noted here. - The 24-file test run printed one `fatal: Invalid symmetric difference expression 0000…` line on stderr while every test passed. The SHA in it is all zeros; `check-changeset-overwrite.test.ts` and `docs-build-trigger.test.ts` are the two files in the set that spell such a SHA. I did not trace it further. It is not a failure. ## Contract review A contract review is owed and the PM seat commissions it. Everything above is meant to be re-runnable: every quoted code string, commit and command reproduces on this repo. This PR touches no gate, adds no checker, and leaves the frontmatter and bump level unchanged. Session: `https://claude.ai/code/session_01EBx9rvB7dufCz4at53x35U` --- _Generated by [Claude Code](https://claude.ai/code/session_01EBx9rvB7dufCz4at53x35U)_ Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6286
useRecordCrudVerdictsdeclaredconst EXPLAIN_BATCH_MAX_RECORD_IDS = 200— a hand copy of a server contract constant — under a doc comment naming its own expiry condition. The spec exports the constant, so the copy becomes an import and only the half of the comment explaining why it was declared locally is dropped. The half explaining why the cap exists and what the server does with an over-cap request (400 VALIDATION_FAILED, never truncation) is kept and now sits on the import.All measurements below were run at
db31e5fe9, the head of this branch.Premise, re-derived from the resolved package (not the changelog)
@objectstack/spec@17.2.0resolves tonode_modules/.pnpm/@objectstack+spec@17.2.0_ai@7.0.65_zod@4.4.3_/node_modules/@objectstack/spec, and./securityexports the constant:dist/security/index.d.mts's re-export list, declareddeclare const EXPLAIN_BATCH_MAX_RECORD_IDS = 200in the shared chunk;typeof number, value200,hasOwnPropertytrue (control: 43 exported keys, so the module resolved rather than answering an empty namespace).No value disagreement, so the premise fork in the dispatch does not fire.
Correction: the declaration expired one release earlier than the card assumed
The card attributes the expiry to the pin reaching
17.2.0. Measured against the published tarballs, that is later than the truth:./securityexports the constant17.0.0-rc.617.0.0= 20017.1.0= 20017.2.0= 200This matters beyond trivia.
packages/plugin-grid/package.jsondeclares"@objectstack/spec": "^17.0.0", and a runtime import into published source is judged byscripts/check-spec-range-floors.mjsagainst the minimum that range admits, not against the installed version. Had17.0.0lacked the symbol, this PR would have owed a floor bump, and a consumer resolving17.0.0would have gotundefined— which in the chunking loop (i += undefined) degrades to one empty request and a silent fail-open for every row, not a crash.17.0.0carries it, so no manifest change is needed and no range moves. That gate ispush+paths-triggered (release path, not per-PR), so this reasoning is the evidence for it rather than a green job.The riders the card names — both declined, with evidence
Measured:
@objectstack/spec/securitydoes exportExplainRequest(withrecordIds?: string[]) andExplainDecision(withrecords?: Array<{recordId: string; visible: boolean; decidedBy?}>). It does not export a standalone type for a batchrecords[]entry —ExplainRecordAttributionis the layer-level row attribution offExplainLayer, a different thing — soWireRecordVerdicthas no counterpart to swap in beyond an indexed access.Neither is adopted here, deliberately and not by drift. The response side is a posture conflict rather than a mechanical swap:
WireRecordVerdictis{ recordId?: unknown; visible?: unknown }because the payload is unvalidated, and asserting the spec's validated shape ontores.json()would turn the hook's own fail-open guards into type-level dead code. The genuinely contract-first move isExplainDecisionSchema.safeParse, which is a behaviour change (the schema requiresallowed/object/operation/principal) and needs its own card. The request side is adoptable and nearly free, but carries a real review question —RecordCrudOperationis deliberately two verbs whereExplainRequest['operation']is eight.Filed as #6332 with the full reasoning and a suggested three-step shape, so the thread survives this card closing.
Verification — and why an assertion on
200would have proved nothingThe values agree on both sides of this change, so every assertion on the value passes before and after. The pre-existing cap test in
rowRecordCrudVerdict.test.tsxis exactly that ghost. What changes is reference identity, so that is what is pinned.packages/plugin-grid/src/hooks/useRecordCrudVerdicts.batchCap.test.tsx(new) stands the spec module in at a cap of3and asserts the request chunking follows it — a boundary no hand copy of200can produce. It carries a control case proving the stand-in actually installed (the factory ran, i.e. the hook's own import graph pulled the module in) and that the stub differs from the shipped value. This matters becausescripts/check-vi-mock-specifiers.mjsjudges relative specifiers only — its own verdict line counts this mock among the "651 bare (out of scope)" — so an inert bare-specifier mock has no gate, and the control is the substitute.rowRecordCrudVerdict.test.tsxalso now derives its cap fixture and bound from the same export instead of re-typing200/250, removing the last hand copy on this surface. That is a cleanup, not a two-world assertion, and the ablation proves it: it stays fully green against the reverted hook.Ablation
Revert the import alone (restore the local const, delete the spec import), under
trap … EXIT INT TERMwith absolute paths. Both directions are single-line markers, counted before and after, plus a blob-hash comparison against theHEADblob:Result on the mutated tree: 4 of 4 failed in the new file; 15 of 15 still passed in
rowRecordCrudVerdict.test.tsx. Restored via the trap and verified byte-exact —git diff HEAD --statempty and the blob hash back to5065876b….No rebuild is involved: vitest aliases
@object-ui/plugin-gridtosrc/, and the test imports the hook by relative path, so nothing readsplugin-grid/dist. The mutated file is the one the runner executes.The first ablation ran red 3 of 4, not 4 of 4, and that caught a ghost of my own. The case "exactly cap ids is one request" survived the revert — three ids fit under a cap of 200 as readily as under a cap of 3. It now asserts the
cap + 1side in the same breath (commitdb31e5fe9), and the second ablation is 4 of 4.Gates run (derived from each CI job's own step list, not memory)
At
db31e5fe9, quoting each gate's own verdict line rather than a shell$?:vitest run packages/plugin-gridTest Files 88 passed (88)·Tests 827 passed (827)tsc --noEmit(src project)SRC_EXIT=0tsc -p tsconfig.test.jsonTEST_EXIT=0eslint .(plugin-grid)0 errors, 683 warnings— all pre-existing; the new file linted with 0/0check:spec-symbols✅ 1305 files scanned against 4959 spec export namescheck:phantom-deps✅ Every in-scope import is declared by the package that publishes itcheck:vi-mock-specifiers✅ OK (…433 carry a mock; …651 bare (out of scope))check:control-bytes✅ OK (scanned 5197 tracked text file(s))check:self-import,check:esm-specifiers,check:pre-install-import-graphcheck-changeset-presence.mjs✅ 3 source file(s) of 1 released package(s) changed, and this change declares 1 changeset(s)check-lint-coverage.mjs✅ 46/46 packages linted, 0 with outstanding errorscheck-type-check-coverage.mjs✅ 41/41 packages compile their testsBoth
tscprojects were red onTS2307before the dependency closure was built (pnpm --filter '@object-ui/plugin-grid^...' build) — pre-existing, in files this PR does not touch, and reported here because a reader running them cold will hit the same thing.Not measured, said plainly:
tsc --listFilesshowsspec/dist/security/index.d.mtsas a program input of plugin-grid's src project — but it does so on the reverted tree too, becausepackages/types/dist/index.d.tscarriesexport type * as Security from '@objectstack/spec/security'. It is a degenerate control, not provenance evidence, and is not offered as any.Lint narrowing declared:
pnpm lintisturbo run lint(per-packageeslint .), andeslint.config.jssets noparserOptions.project, so linting is not type-aware and a change in this package cannot move a verdict in another. This PR ran plugin-grid's owneslint .in full — 124 files, the package's entire lint job — rather than the whole farm; CI runs the rest regardless.Generated by Claude Code