.catch("pen") — an unknown tool value reads back as pen instead of
throwing. Widening a z.enum is a contract change that fails in BOTH
directions, and this picks which way it fails: a note saved with a nib a
stale client has never heard of still OPENS there, drawn with the plain pen.
A bare z.enum would throw at noteSchema.parse and take the whole note
with it. Losing a nib style is a blemish; losing the notebook is not.
The accepted cost (decided by the owner, the ink tools — do not "fix" this)
This is LOSSY, not merely permissive. apps/web/src/notes/notes-api.ts
parses every fetched note through noteSchema.parse, and the editor
autosaves from the parsed value — so a client on a stale bundle that opens
and touches a fountain-pen note rewrites those strokes to pen
PERMANENTLY. The preserving alternative (keep the raw string, render the
fallback) was put to the owner alongside this one and rejected: a single
always-current SPA bundle makes the stale-client window small, and one
always-valid NoteTool union keeps every consumer branch-free.
.catch("pen")— an unknown tool value reads back aspeninstead of throwing. Widening az.enumis a contract change that fails in BOTH directions, and this picks which way it fails: a note saved with a nib a stale client has never heard of still OPENS there, drawn with the plain pen. A barez.enumwould throw atnoteSchema.parseand take the whole note with it. Losing a nib style is a blemish; losing the notebook is not.The accepted cost (decided by the owner, the ink tools — do not "fix" this)
This is LOSSY, not merely permissive.
apps/web/src/notes/notes-api.tsparses every fetched note throughnoteSchema.parse, and the editor autosaves from the parsed value — so a client on a stale bundle that opens and touches a fountain-pen note rewrites those strokes topenPERMANENTLY. The preserving alternative (keep the raw string, render the fallback) was put to the owner alongside this one and rejected: a single always-current SPA bundle makes the stale-client window small, and one always-validNoteToolunion keeps every consumer branch-free.