Slice 10 of #1618: refuse a link mark whose title attr is present but neither a string nor null, before storage.
Oracle: prosemirror-schema-basic declares the link mark attrs: {href: {validate: "string"}, title: {default: null, validate: "string|null"}}, and web/src/editor.ts never updates the link mark (its marks are basicSchema.spec.marks.append({strikethrough})), so the validation is live in the editor schema. Verified empirically against prosemirror-model 1.25.12 + prosemirror-schema-basic 1.2.5 (the versions in pkgs/id/web/package.json): Mark.fromJSON and Step.fromJSON throw "Expected value of type string,null for attribute title on type link, got number" (also boolean/object) for a bad title in a step's mark field and in a slice node's marks alike; a string title, a null title and an absent title (declared default) all parse.
Before: check_mark in collab_steps.rs validated only the link href (slice 7, #16400), so a link mark with title: 42 was stored, broadcast and Acked, then threw on every receiving client — the exact #1618 poison shape.
Change: check_mark now also refuses a present non-string, non-null link title (mark \link` needs a string or null `title` attr), in step marks and slice-node marks alike, all-or-nothing before storage/version/content-size/broadcast via the existing check_steps` path, for anonymous and authenticated senders alike. Module doc updated.
Tests (oracle = the schema-basic link mark spec):
link_mark_titles_must_be_strings_or_null — 6 refusal cases (numeric/boolean/object/array titles across addMark/removeMark/addNodeMark/slice marks) + 5 valid controls (string, null, absent title; strong mark; slice control).
test_apply_steps_rejects_link_mark_with_non_string_title in collab.rs — refusal leaves version/steps/content-size untouched and broadcasts nothing; string-title control accepted.
Both authored files are rustfmt-clean (edition 2024). Verification: fleet-command cargo test dispatch on the exact head; conclusion recorded on #1618 and here when it lands. The parent issue stays open for its remainder (full server-side transform application), as in slices 1–9.
Refs #1618.
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.