mirror of
https://github.com/block/buzz.git
synced 2026-11-01 15:01:12 +00:00
Replace the flat-map decode path with a parseContexts() function that
returns {frontiers, overrides} — separate namespaces keyed by raw
context ID. This fixes three correctness defects in the previous
implementation:
- Frontier keys were stored with their esc: prefix intact, so
isOverrideActive evaluated against the wrong frontier for any raw
context ID starting with ov_ or esc: (e.g. raw ov_s:evil had its
frontier stored as esc:ov_s:evil while the override register was
keyed by ov_s:evil).
- The 256-byte UTF-8 key-length check was applied only to frontier
entries; ov_* sibling keys were written back unchecked, allowing
wire keys up to 5 + suffix bytes through.
- extractOverrideRegisters accepted an arbitrary flat map and zero-filled
missing components, reconstructing partial groups that group-first
validation had already rejected.
Changes:
- readStateFormat.ts: add ParsedContexts interface and parseContexts();
make partitionOverrideGroups internal; add 256-byte enforcement to
every wire key (frontier and override siblings alike); fix the
sanitizeContexts doc comment.
- readStateSnapshot.ts: add contexts: ParsedContexts to
ParsedReadStateEvent; parseReadStateEvent populates both blob.contexts
(flat, for readStateManager backward compat) and contexts (structured);
mergeReadStateEvents iterates parsed.contexts.frontiers so callers
receive unescaped raw ctx IDs; remove extractOverrideRegisters; update
mergeOverrideRegisterMaps to accept ReadonlyMap inputs.
- readStateOverride.test.mjs: rewrite around parseContexts(); add the
full partial-group rejection matrix (S-only, B-only, S+B, C+B, S+C),
invalid sibling at each position, uint32 boundary values, 256/257-byte
key-length cases for live and floor shapes, multibyte UTF-8 boundary,
and Thufir's exact collision witness (raw ctx ov_s:evil alongside ctx
evil with its own ov_s:evil counter). 3968/3968 pass.
Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Buzz
Desktop chat shell with:
- Tauri + React + TypeScript + Vite
- Tailwind CSS
- shadcn/ui-ready shared components
- Biome (lint/format/check)
- Feature-driven frontend structure
Scripts
pnpm dev- run the web frontendpnpm tauri dev- run the desktop apppnpm build- typecheck and build frontendpnpm typecheck- TypeScript checkspnpm lint- Biome lintpnpm format- Biome format (write)pnpm check- Biome check
Structure
src/shared- reusable app-wide code (ui,lib,styles)src/features- feature modules (vertical slices)src/app- top-level app composition