Repository navigation
v0.1.0 — Go-conventional naming, and a lint config that is actually enforced
BREAKING. Public identifiers now follow Go's initialism conventions:
Doc.Guid -> Doc.GUID
Doc.GetSubdocGuids -> Doc.GetSubdocGUIDs
Doc.GetXmlFragment -> Doc.GetXMLFragment
ToJson -> ToJSON on Doc, YArray, YMap, YText, YXmlFragment
Mechanical to adopt: rename the call sites. A library pitched as the standard Go
Yjs implementation should not read as a transliteration of JavaScript, and doing
this before promotion costs less than doing it after.
The rename exposed a real defect rather than only tidying names. YXmlText carried
BOTH an inherited ToJson() interface{} and its own ToJSON() string, returning
DIFFERENT strings — YText.ToString() is plain text, YXmlText.ToString() builds
the XML form. Two methods differing only in capitalisation, invisible for exactly
that reason. Each type's public method now keeps its Yjs-correct signature and
the polymorphism moved to an unexported method.
A COMMITTED .golangci.yml, so "0 issues" means the same thing on every machine
and across a linter upgrade. Fourteen linters, no exclusions section, no nolint
directives anywhere in the tree. Adopting it closed 1073 findings by changing
code rather than configuration; four linters are deliberately not enabled and are
recorded in docs/LIBRARY-GAPS.md with counts and reasons, because a rule excluded
everywhere is a rule you have not adopted.
The most useful thing that came out of it: gocritic's ifElseChain suggestion is
NOT safe to apply mechanically. Rewriting if/else to switch changes break
semantics — the break that exits the loop starts exiting the switch. That turned
a termination condition into an infinite loop in merge.go, and item.go's
integration loop had three loop-breaking breaks inside a chain it wanted
rewritten. Labelled breaks now, and the hazard is written down.
Documentation defects found the same way: a 25-line block documenting
decodeAwarenessEntries sat above ParseAwarenessStateJSON; YArray.Splice and
YXmlFragment.Slice both carried ToArray's description; ~70 exported comments did
not name the identifier they document, which is what godoc renders.
Also fixed: protocol.InspectMessage wrapped an inner error with %v instead of %w,
so it could not be unwrapped.
New: SECURITY.md, CONTRIBUTING.md, CHANGELOG.md. SECURITY.md states the threat
model plainly — this library decodes untrusted bytes, so anything reachable from
the decoders that panics, hangs or allocates without bound is a vulnerability
here rather than caller error — and records that the panic audit was a trace
through the guards, not "the fuzzer has not found one".
README corrected: it claimed Go 1.24+ while go.mod requires 1.26, and described
implementing persistence.Store as "the whole job" although the checkpoint profile
has existed since v0.0.2.