Skip to content

fix: float32 formatting, CI alloc gate, CSP-nonced SSE pushes, sess.Clear(CtxR)#59

Merged
joaomdsg merged 5 commits into
mainfrom
pr/holistic-fixes
May 30, 2026
Merged

fix: float32 formatting, CI alloc gate, CSP-nonced SSE pushes, sess.Clear(CtxR)#59
joaomdsg merged 5 commits into
mainfrom
pr/holistic-fixes

Conversation

@joaomdsg

Copy link
Copy Markdown
Member

A batch of small, independent correctness fixes (each test-first, full go test -race ./... + golangci-lint clean locally), plus a README line-wrap.

Fixes

  • fix(encoding)float32 Signal/StateTab values were formatted at bitSize 64, so reflect.Value.Float widening leaked the float64 expansion (float32(0.1)0.10000000149011612) into both the data-signals wire payload and the rendered DOM. Now branches on reflect.Float32 and formats at bitSize 32. Tests: TestStateTabText_rendersFloat32WithoutFloat64Noise, TestSignalEncode_float32WireValueHasNoFloat64Noise.

  • fix(ci) — the allocation-regression gate failed open: || true swallowed the bench exit status and a missing/unparseable benchmark WARN+skipped the gate, so a renamed/broken bench left CI green with the only perf guard disabled. Now captures the bench status and treats "benchmark not found" / "unparseable allocs/op" as hard errors.

  • fix(csp) — under mw.CSP() every server-pushed script (Toast/Reload/ExecScript/Redirect) was silently blocked, because the datastar-injected <script> carried no nonce. The page document's CSP nonce is now captured at render (a dedicated read-only field, never lazily minted) and threaded — HTML-escaped at the sink — into sse.ExecuteScript/sse.Redirect, reusing the page nonce the loaded document's CSP honors. First coverage of the interactive SSE path under CSP (csp_push_test.go).

  • fix(sess)sess.Clear accepted only *via.Ctx/*http.Request; a *via.CtxR (held by a View) fell through to a silent no-op. Added the missing *via.CtxR case mirroring Get, and corrected the godoc. Test: TestClearSess_viaCtxRRemovesValue.

  • docs(readme) — wrap prose to 80 columns (matching CONVENTIONS.md) and tidy section headings.

Rebased onto current main (post-#57/#58); no overlap with the via.sse.disconnect reason-label work.

joaomdsg added 5 commits May 30, 2026 12:12
float32 Signal/StateTab values were formatted at bitSize 64, so
reflect.Value.Float widening leaked the float64 expansion
(float32(0.1) -> 0.10000000149011612) into both the data-signals wire
payload and the rendered DOM text. Branch on reflect.Float32 and format
at bitSize 32 in encodeScalar and scalarString.
The allocation regression gate suffixed the bench invocation with
`|| true`, swallowing its exit status, and turned a missing or
unparseable benchmark into a WARN+skip. A renamed, broken, or panicking
benchmark left CI green with the only perf guard silently disabled.
Capture the bench exit status (any non-zero fails the gate) and make
"benchmark not found" / "unparseable allocs/op" hard errors.
Under mw.CSP() every server-pushed script (Toast/Reload/ExecScript/
Redirect) was silently blocked: drainQueue emitted the datastar-injected
<script> with no nonce. Capture the page document's CSP nonce at render
(a dedicated read-only field) and thread it, HTML-escaped, into
sse.ExecuteScript and sse.Redirect via WithExecuteScriptAttributes, so
the push reuses the page nonce the loaded document's CSP honors.
sess.Clear handled only *via.Ctx and *http.Request; a *via.CtxR (which a
View holds) fell through to a silent no-op. Add the missing *via.CtxR
case mirroring Get, and correct the godoc that omitted CtxR.
@joaomdsg
joaomdsg merged commit a65de08 into main May 30, 2026
4 checks passed
@joaomdsg
joaomdsg deleted the pr/holistic-fixes branch May 30, 2026 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant