Skip to content

test(ui): lock in state-management semantics (vs React)#50

Merged
monstercameron merged 1 commit into
masterfrom
react-parity/state-semantics
Jun 25, 2026
Merged

test(ui): lock in state-management semantics (vs React)#50
monstercameron merged 1 commit into
masterfrom
react-parity/state-semantics

Conversation

@monstercameron

Copy link
Copy Markdown
Owner

Locks in verified state-management behavior from the correctness hunt: functional-update composition, live-read getter (intentional vs React snapshot), slice/map vs struct dedup, function-as-state. Documents GWC's correct behavior + intentional divergences. No version bump.

🤖 Generated with Claude Code

Captures the state-management behaviors verified during the correctness hunt that
produced the v3.5.3 render-phase fix:
- functional updaters compose; a plain value can follow an updater
- the GoUseState getter is a LIVE read (deliberate difference from React's
  per-render snapshot): a getter captured at an earlier render returns the latest
  value, avoiding React's stale-closure footgun
- reference/value dedup: slice/map state re-renders on a new equal-content value
  (like Object.is on a new object); a comparable struct value dedups on equality
  (Go value semantics)
- a function can be stored as state (the setter distinguishes a func(T) T updater
  from a plain function value)

All pass; documents GWC's correct behavior and its intentional divergences. No
version bump.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@monstercameron monstercameron merged commit caf7dbe into master Jun 25, 2026
2 checks passed
@monstercameron monstercameron deleted the react-parity/state-semantics branch June 25, 2026 05:11
monstercameron pushed a commit that referenced this pull request Jul 6, 2026
…ndary (#88)

Assessment of the #88 logging-redaction findings:
- struct-field blind spot: already fixed — normalizeLogValue walks structs
  into maps (json tags, unexported skipped, nested recursion) so redaction
  reaches their fields. Added an END-TO-END pin proving a struct logged
  through buildLogRecord has its sensitive field scrubbed in the final
  record (the standalone helpers were pinned; the composition was not).
- unredacted console PII: the console emits the REDACTED record; only the
  message string is verbatim, so this collapses into the message gap.
- message not redacted: real, but the message is free text with no field
  key for the key-based RedactionPolicy to match, so content/pattern-based
  message scrubbing is a deferred policy decision (owner-level, cf. #50).
  Documented the redaction boundary at the record's message field so
  callers keep PII in fields, not the message.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
monstercameron pushed a commit that referenced this pull request Jul 6, 2026
…alue (#50)

redactValue only walks JSON-like shapes (map[string]any, []any, scalars); a
struct or pointer falls through and is returned WITHOUT redacting its nested
fields. Verified every in-tree caller normalizes to JSON first (the three devtools
exporters do a json.Marshal->Unmarshal round-trip; logging's record path runs
normalizeLogValue, which flattens structs to map[string]any), so the fallthrough
is unreachable today — decision (a): keep the JSON-decoded contract and add a
cheap, fail-visible dev guard rather than a risky reflect walker.

Value now flags any non-JSON-scalar reaching the default branch via a
diagnostics.Emit (GWC-TELEMETRY-NONJSON), deduplicated per Go type so it cannot
spam the sink, so a FUTURE caller passing a raw struct with secret fields is
caught in dev/test instead of leaking silently. The scalar hot path adds only one
cheap type switch and no reflection. Pins (negative-verified):
TestValueGuardsAgainstNonJSONValues, TestNonJSONReportDedupesPerType.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants