Repository navigation
fix(lint): the record-write-discarded hint prescribes a write the sandbox installs; app-dependencies lists the closure-judged bindings - #38628
Conversation
… id, … }), a write the sandbox installs Claude-Session: https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B Co-authored-by: Claude <noreply@anthropic.com>
…does not read it as a rule id Claude-Session: https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check2 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 4 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 6b269940633b8ddca2309d60d2e2766778a905ff && git checkout 6b269940633b8ddca2309d60d2e2766778a905ff
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin eec2bc3e3a0ec0dda41ab73d73cda4a71d37d32a c2b9cffb57c128e3922f52b1b9cd4345ee277c0b && git checkout -B drift-repro eec2bc3e3a0ec0dda41ab73d73cda4a71d37d32a && git merge --no-ff c2b9cffb57c128e3922f52b1b9cd4345ee277c0b
node scripts/docs-audit/affected-docs.mjs --json eec2bc3e3a0ec0dda41ab73d73cda4a71d37d32a |
|
repo:objectstack#3 · os-steve · session_01ADHkmSwS4mQyXWrddL4r6B Final green head · 2026-11-29T16:37Z · zone o3-B · |
|
repo:objectstack#3 · os-steve · session_01ADHkmQm8PTU4AkVU5kdwEv L1-a, the seat's L1 thread · 2026-11-29T16:41Z · first review 席位核对ACCEPT @ Read at this head
Out of scope
Nit, not blocking
Landing note
|
|
repo:objectstack#3 · os-steve · session_01ADHkmSwS4mQyXWrddL4r6B Landing · 2026-11-29T16:42Z · zone o3-B · head
State: ready for review + auto-merge in this stroke. Body says |
Requested by Steve · project thread
Refs #37815 (items c, d)
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
action-record-write-discardedhint. It prescribedctx.api.object('OBJECT').updateById(ctx.recordId, { … }). Probed for real (below): a sandboxed action body or hook body has noupdateByIdonctx.api.object(…), so following the hint throwsTypeError: not a functionand writes nothing. The hint now prescribesctx.api.object('OBJECT').update({ id: ctx.recordId, FIELD: … }), the single-record form the sandbox installs andHookObjectApi.updatedocuments (the id travels inside the payload). The method name lives in one constant,ACTION_RECORD_WRITE_REMEDY_METHOD(not re-exported from the package index), pinned toSANDBOX_API_WRITE_METHODS, which is itself pinned to the runner'sWRITElist.os explain action-body-write-unknown-fieldtext said an action body persists "only throughinsert / create / update / updateById".createandupdateByIdare not installed in the sandbox either. It now namesinsert({ … })andupdate({ id, … }). Same defect class, same file, bounded fix.content/docs/deployment/app-dependencies.mdx. The page said the save door judges "a list view" against the package closure. It now has a table of the bindings that door judges, including the two that PR fix(lint)!: three publish-time checks for seeds, flow nodes and actions that save and do not work #37807 added: a standalone action'sobjectNameand a flowget_record/create_record/update_record/delete_record/ object-formscreennode'sobjectName. Sources:validateObjectReferencesruns on theflow,datasetandactionruntime doors (packages/lint/src/reference-integrity-suite.ts, memberruntimeTypes: ['flow', 'dataset', 'action'], handedctx.packageScope), and the flow-node and action sites are inpackages/lint/src/validate-object-references.ts(OBJECT_BOUND_FLOW_NODE_TYPES,actions[i].objectName). The form and knowledge-source rows come fromform-object-outside-closure(validate-form-items.ts) andknowledge-source-object-unknown(validate-knowledge-source.ts). The table says "include" because other closure-aware rules exist (email template holes, AI tool and context references) that this PR did not audit.updateByIdpayload in a body is still graded (API_WRITE_METHODS, the ledger'sapi-crud-literalsyntax line and example, and the explanations that say what is judged), because a body can still contain the call.Tests
validate-action-body-writes.test.ts: the existing case that pinnedhintto containupdateByIdnow pins the remedy method. A new case asserts the method the hint calls is inSANDBOX_API_WRITE_METHODSand that the payload is addressed byid: ctx.recordId. Subjects, not prose.updateById(ctx.recordId, …)viascripts/ablation-replace.mjs, anchor 1 to 0, blob 262ceea2 to a2f3f908): 2 cases red (expected [ 'updateById' ] to deeply equal [ 'update' ]), 50 passed. Restored:git diff HEADempty, 0 hits of the mutation.Sandbox probe (throwaway test, not committed): real ObjectQL, real better-sqlite3 SqlDriver, real QuickJSScriptRunner and body-runner factories
Hook bodies run in the same sandbox and fail the same way.
Local runs (head c2b9cff)
pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2(the whole package) at c2b9cff: lock VERDICT command-exit 0, Test Files 246 passed (246), Tests 9959 passed (9959). The first whole-package run, at 0dfeeda, had 1 red inrule-id-barrel-exports.test.ts: it reads an unannotated exported string constant as a rule id. The constant is now annotatedstring(second commit).pnpm --filter @objectstack/lint typecheck: VERDICT command-exit 0.dispatch-gates.mjs --commandsderived 100 families; all 100 run locally: 97 exit 0; 3 exit 3 PREREQUISITE NOT MET, so NOT MEASURED here and left to CI (check-plugin-teardown-shape --self-testneeds an unshallow clone;spec check:skill-examplesandcheck:dual-build-cjs-loadsneed packages this worktree did not build). None of the three reads a file this PR changes.--ranreconciliation: 100 derived, 100 run, 0 UNRUN. Re-run on c2b9cff after the second commit:check:doc-authoring,check:issue-citations,check:nul-bytes,check:adr-anchors,check:cross-package-test-inputs,check:undeclared-dep-imports,check:type-check-debt,check:closed-ceremony-text, all exit 0.test:reponot run locally (CI'sTest Core).Acceptance notes
content/docs/automation/hook-bodies.mdx(the "exactly one way an action body persists anything" snippet) still teachesupdateById(ctx.recordId, …)in an action body. The spec contract (HookObjectApi.updateByIdinpackages/spec/src/data/hook-api.ts,IScopedObjectRepository.updateById) declares the member a body cannot call, andobjectstack builddoes not refuse.updateById(at lowering the way it refuses.create(. Whether the sandbox should install the leaf or the body-facing contract should drop it is a decision; it is raised in the report.api-crud-literalsyntax line and example still nameupdateById: they mirror the extractor's graded verbs (validate-readonly-hook-writes.test.tsreads the syntax line as that mirror) and are not shown to authors.Verification
Read first:
packages/lint/src/validate-action-body-writes.ts(the hint andACTION_RECORD_WRITE_REMEDY_METHOD), then the new test case, then the docs table.Two-minute check:
pnpm --filter @objectstack/lint exec vitest run src/validate-action-body-writes.test.tsshows all cases passing, and theprescribes a write the sandbox installscase among them.Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B