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
fix(lint): write-set diagnostics describe the real driver split, not a silent no-op (#4271) (#4368)
`hook-body-write-unknown-field` and `action-body-write-unknown-field` told
authors the undeclared column "silently never lands in the stored record".
Measured on main, that is wrong in both directions.
Nothing between the body and the driver filters the key: `applyMutationsToInput`
is a plain `Object.assign`, and `validateRecord` walks declared fields on insert
and `continue`s past a key with no field def on update. So the driver decides —
SQL puts the stray column in the statement and the WHOLE write fails with a
driver-level error (nothing stored, error far from the authoring mistake), while
a schemaless driver spreads the payload and persists the stray key.
A lint that misdescribes the failure it warns about teaches the wrong debugging
instinct: an author told the value silently vanishes will not connect the driver
error they actually see to the typo that caused it, and on a schemaless driver
will not go looking for the stray key that is really there.
All three messages now state the split. The rule headers, the `ScriptBodySchema`
/ `ActionSchema.body` notes and the two still-unreleased #4271 changesets are
corrected to match. #4355 fixed the prose docs; this is the same correction on
the surfaces that ship in the packages.
Both outcomes are pinned by a new integration test,
`runtime/src/sandbox/undeclared-field-write-driver-split.integration.test.ts`.
Its insert cases run the full chain — real QuickJS sandbox, real hook body, real
engine, real SQLite table — so "reaches the driver unfiltered" is proved rather
than asserted: if anything on that path learns to filter, the SQL half stops
throwing and the test goes red.
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
0 commit comments