Atrium — shared contracts and the typesetting engine
    Preparing search index...

    Variable noteToolSchemaConst

    noteToolSchema: ZodCatch<
        ZodEnum<["pen", "fountain-pen", "pencil", "highlighter"]>,
    > = ...

    .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.

    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.