Skip to content

A stored row has one decode, and a column it predates reads as absent: her learning runs again - #5907

Merged
joelteply merged 3 commits into
canaryfrom
fable/a-stored-row-has-one-decode
Nov 10, 2026
Merged

joelteply merged 3 commits into
canaryfrom
fable/a-stored-row-has-one-decode

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Serves learning (path step 3). The training trigger's recovery has failed on every tick since #5882, so no resident's in-place learning ran.

The defect

Every reader of a DataRecord decoded it with its own serde_json::from_value(row.data) (15 production sites).

  • A field added to an entity later, with #[serde(default)], is NULL in every row written before it.
  • serde reads that as a present null, not a missing field, so the default never applies and the decode fails.
  • On the M5 (2026-11-10, 26960c0): training.serving_wake.failed fired 279 times in 4 h, every one invalid type: null, expected u32.
  • training_trigger_submissions holds 381 rows; learned is NULL on 380 of them (read with continuum data/list).

The fix

DataRecord::decode in orm/record_decode.rs is the one owner:

  • It decodes strictly first, borrowing the row, so a null that a type can hold (Option, serde_json::Value) reads as written.
  • Only when that fails and the row holds NULLs are they read as columns the row predates. They count as absent, so a field's default answers them, and a required field still refuses.
  • All 15 sites migrate to it, plus one test site.
  • source-hygiene::row_decode keeps hand decodes of .data at zero.

Measured

  • Before: the counts above.
  • After: deploying to the M5 in the next window. The receipt (training.serving_wake.failed at 0, and in-place learning probes) follows in a comment.
  • Tests: record_decode pins an older row decoding with its default, a written null staying null, and a NULL required field still refusing. The ratchet's predicate test pins the shape. Local test run in the next serving-down window; CI confirms.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

joelteply and others added 2 commits November 10, 2026 04:54
…bsent: her learning runs again

Every reader of a DataRecord decoded it itself (serde_json::from_value(row.data), 15 production
sites). A field an entity gained later with #[serde(default)] is NULL in every older row, which
serde reads as a present null, so it failed: on the M5 (2026-11-10) the training trigger's
recovery died every 30 s on 380 submissions with `learned` NULL ("invalid type: null, expected
u32", 279 training.serving_wake.failed in 4 h), and no resident's in-place learning ran.

DataRecord::decode (orm/record_decode.rs) is the one owner: strict first, borrowing the row, so a
null a type can hold (Option, serde_json::Value) reads as written; only when that fails and the
row holds NULLs are they read as columns the row predates, absent, so the field's default answers
and a required field still refuses. All 15 sites migrate to it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…on its own row

- record_decode: an older row and a written null are separate cases; a row holding both refuses
  (documented: telling the two NULLs apart needs the field types).
- orm/store.rs: find_all and find_eq are the verbs themselves, each caller counted where it reads
  (bounded: exemption); a failure without a message says so.
- lived_examples: a call with no message yields no example, never an empty prompt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

@joelteply joelteply left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preliminary source review on exact62a1d6617d53d5c4bd83762d5f501be0deedc266: changes requested before merge. No local tests run.

record_decode.rs falls back by removing every null field when strict decoding fails. This does not preserve explicit nulls if another field needs a legacy default: for a row {learned:null,payload:null}, learned:u32 with serde(default) triggers the fallback; payload:Value with a non-null serde default then changes from the valid explicit null to that default. The existing test uses the implicit Value::Null default and therefore cannot distinguish preservation from removal. The same issue applies to an Option with a custom Some default.

Keep the shared decoder owner, but normalize only fields that cannot accept null and whose schema permits the legacy default, preserving unrelated explicit nulls. Add the mixed legacy-null plus valid explicit-null/non-null-default regression. An unrelated strict decoding error must not silently rewrite valid field semantics. This is source feedback, not a formal submission verdict or live learning acceptance.

@joelteply
joelteply merged commit 1015adb into canary Nov 10, 2026
37 checks passed
@joelteply
joelteply deleted the fable/a-stored-row-has-one-decode branch November 10, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant