Harden correlate package correctness - #44
Conversation
…single-source isolation
Hostile review (own PR)Two of three findings are real. One was oversold. Embed panic: real, merge it
Making Doc drift: real, but it is docsThree descriptions of the same transform, code is the calibration-backed one. Aligning comments is correct. It is not a defect in behavior. Don't lead the PR with it. Also: MostIsolated n=1: not a user-visible bugOn master, n=1 does Empty TestsTransform breakpoint table + monotonicity: good, pins the thing the docs just started telling the truth about.
No test for negative index (only index 5 vs len 2). Cheap to add. VerdictMerge the Embed bounds/completeness work. Demote MostIsolated from "guard single-source isolation" to "avoid Inf in the n=1 loop." Fix the struct comment that points at an unexported name. Then this is a real, small correctness PR, not a dressed-up coverage bump. |
…egative-index test, demote MostIsolated n=1 to cleanup
What changed
Embed: bounds-check the APIindex(including negative) and report missing embeddings instead of panicking on malformed responses. Made the endpoint a package var for testability.cosineToEpistemicCorrelation: aligned the struct doc, function doc, and implementation to the same calibration-backed piecewise thresholds (0.53/0.65/0.82). Breakpoints are now spelled on the exportedCorrelationResultstruct so external readers can see them.MostIsolated(cleanup, not a bug): on master, n=1 produces +Inf internally but already returnsSources[0]because+Inf < MaxFloat64is false. The early return avoids the meaningless Inf and guards against future simplification of the loop.httptest(positive index, negative index, missing, reordered), and cover single- and multi-source isolation.Verification
go test -race ./...go vet ./...staticcheck ./correlate/Fixes #43