Repository navigation
Description
Context
FastLED migration FastLED/cli#242 at73c2a33 still directly depends on serde/serde_json. Ten source modules use JSON: source receipts, dynamic-cache metadata, editor snapshots, project configuration, toolchain state, clangd settings, debug symbols, build asset manifests, DWARF smoke requests and server replies. Calls include typed records and mutable unknown-field-preserving objects. The kernel has private JSON uses, but no general owned JSON document surface for these clients.
Proposal
Add a feature-gated json module with facade-owned values, parse/encode errors, and compact/pretty output selection. Support null, booleans, UTF-8 strings, signed64/unsigned64/finite floating numbers, arrays and ordered objects. Parsing and encoding enforce documented byte/node/depth limits. Backend Serde/JSON crates remain private: no public Serialize/Deserialize bounds, derive reexports, Value aliases or generic backend convenience escape hatch.
Apps retain field names, required/optional/default semantics, enum spellings, cache versions, record validation, unknown-field preservation, trailing-newline policy and HTTP status behavior. App schema adapters should replace their derives gradually, then remove both direct Serde dependencies with boundary enforcement. Do not replace JSON with a new wire format.
Acceptance criteria
- RED→GREEN upstream contract tests before implementation, then app dependency bans and schema-parity tests before adoption.
- Preserve i64/u64 extrema, finite float semantics, Unicode/escaping, ordered object output, array order, compact/two-space pretty encoding, and explicit duplicate-key policy. Reject malformed/trailing/invalid UTF-8 input and nonfinite output without source-echoing errors or partial output.
- Source/output byte bounds, decoded traversal node/depth bounds, safe bounded encoding even for values constructed by callers; document preparse versus postparse limitations honestly.
- Private exact pins; optional API absent by default. Do not falsely claim whole-graph serde_json absence when existing kernel facilities already require it.
- Move generic parser/encoder tests upstream, keep FastLED receipt/manifest/editor/HTTP schema and business validation tests local. Both owned and dynamic-object callers must migrate; no permanent Serde trait forwarding.
- Full relevant tests, Clippy, review, platform checks, actual WASM compile when adopting compiler-side callers, plus HTTP/editor regression coverage. No JSPI/default-toolchain change or unmeasured speedup claim.
- Linked PRs and usable exact published dependency without a local path patch for final release acceptance.
Decisions
- PriorityP2: removes the last serialization implementation boundary used throughout the app.
- Start with8MiB source/output,262144values and depth64 (root0); choose explicit errors on exceeding bounds. These are new bounded contracts, not claims that arbitrary historical input remains accepted.
- Keep JSON separate from TOML values because null/unsigned numbers and output semantics differ; avoid a speculative generalized serialization framework.
- Preserve current serde_json object duplicate handling (last key wins), and document it. Product schemas can impose stricter validation separately if explicitly required.
- Use the current upstream exact JSON backend version initially; schema identity stays with FastLED.
Activity
zackees commentedon Sep 13, 2026
Typed-record adoption exposed a concrete duplicate-key fidelity gap. New passing FastLED source-receipt baseline tests verify: omitted/null resolved_commit is None and omitted on write; u64::MAX remains exact; wrong/missing field types reject; duplicate known fields (including null then string for an optional field) reject; duplicate unknown fields are ignored. Current json::parse builds a last-key-wins BTreeMap and irreversibly loses the information needed for the app to distinguish those cases. A global reject-all-duplicates parser would also change existing behavior. Before migrating typed records, add a bounded owned duplicate-aware document/member inspection surface (including nested objects for other record schemas), retaining current parse last-key-wins behavior for dynamic-object clients. Field recognition and whether a duplicate is an error must remain application policy. Do not add public Serde bounds or an app-local JSON scanner. Refs FastLED/cli#242. Baseline tests currently pass locally; receipt production parsing is intentionally unchanged until the kernel can express this policy.
refactor(build): use kernal-api JSON for compiler flags cache
refactor(build): move asset manifests to kernal-api JSON
refactor(install): use kernal-api JSON for toolchain state
refactor(install): finish kernal-api JSON migration and remove Serde
refactor(build): use kernal-api JSON for compiler flags cache
refactor(build): move asset manifests to kernal-api JSON
refactor(install): use kernal-api JSON for toolchain state
refactor(install): finish kernal-api JSON migration and remove Serde
feat(json): add bounded owned JSON documents (refs #211)
feat: rebase application foundations onto kernal-api (#220)
zackees commentedon Sep 16, 2026
Complete and adopted on both sides; closing with the evidence rather than leaving it open.
kernal-api — gated behind
json, implemented insrc/json.rs. withtests/json_documents.rsas its contract tests, and documented indocs/json.md. It landed with #220's application-foundations rebase.FastLED — adopted through the pinned release tag: crates/fastled-cli/src/dwarf_smoke.rs:
use kernal_api::json::{self, Layout, Value};🤖 Generated with Claude Code