Skip to content

feat(json): bounded owned JSON documents - #212

Closed
zackees wants to merge 3 commits into
feat/source-cppfrom
feat/json-documents
Closed

zackees wants to merge 3 commits into
feat/source-cppfrom
feat/json-documents

Conversation

@zackees

@zackees zackees commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Refs #211.

Coordinated with FastLED/cli#242. Stacked on #210 (feat/source-cpp); upstream must land and ship a usable exact release before final app consumption.

Adds an opt-in JSON capability with facade-owned null/bool/i64/u64/finite-float/string/array/ordered-object values, bounded diagnostics, byte parsing, and compact/two-space pretty encoding. Serde and serde_json remain private exact-pinned implementations; no public serialization trait bounds, backend aliases, or derives.

Input/output limits are 8 MiB, decoded values 262144, depth 64 (root zero). Source size is checked before parsing; decoded traversal limits apply after private parsing, not as independent parser allocation/CPU quotas. Encoding validates caller trees then uses a private borrowed adapter and capped output writer without cloning the tree or returning partial bytes. Documents last-key-wins objects, sorted output, numeric limitations, and no trailing newline.

Validation:

  • RED: focused integration test failed on unresolved kernal_api::json before implementation.
  • GREEN: five contract tests covering extrema/Unicode, deterministic compact/pretty output, malformed input/nonfinite numbers, exact source/output/node/depth bounds.
  • Full json-enabled Rust suite, strict all-target Clippy, formatting and Ruff passed locally.
  • Windows x86_64 MSVC and macOS ARM64 cross-compilation passed (not native execution).
  • Real Cargo graph verifies serde_json absent by default and present with json; CI isolation checker and each-feature matrix include JSON.
  • Single-reviewer review clean; focused review rerun passed all five tests.

FastLED schema adoption and removal of direct Serde dependencies remain separate work. No published release, app adoption, browser parity or measured build-speed improvement is claimed by this PR.

@zackees

zackees commented Sep 13, 2026

Copy link
Copy Markdown
Owner Author

First app adoption is pushed in FastLED/cli@beb3a91 on PR #242: project JSON and the DWARF smoke client/source-map reader now use owned kernel values. App field selection, unknown-setting preservation, malformed/nonobject reset, trailing newline and HTTP status handling remain local. Resource-limit failures do not overwrite existing project settings. Both module boundary tests observed RED then GREEN. Full 268 library + 3 binary + 1 integration + 1 doc tests, 34 Python tests (1 skipped), strict all-target Clippy, formatting/Ruff and single-reviewer review pass. Eight app JSON modules still need adoption; direct Serde dependencies remain. No release, browser parity or build-speed claim. Your current Dylint CI fails in setup-soldr before source linting: nightly catalogue digest mismatch f1711f51... expected versus c30a132c... received. No integrity bypass or merge attempted.

@zackees

zackees commented Sep 13, 2026

Copy link
Copy Markdown
Owner Author

App adoption update: fastled-wasm commit 806e791 replaces source-receipt Serde parsing/encoding with json::parse_members and ObjectMembers from upstream d2879eb. Known-field duplicate rejection (including null), unknown-field tolerance, strict unsigned timestamps, positional records, declared output order and no trailing newline remain app policy. Boundary test RED -> GREEN; app gates pass: 273 library + 3 binary + 1 integration + 1 doc tests, Python 36 passed/1 skipped, strict Clippy, formatting, Ruff and read-only review. Coordinated with FastLED/cli#242. Still path-patched; this does not claim registry release or browser acceptance.

* feat(command): add bounded schema facade

Refs #215. Keep Clap private behind an opt-in facade with bounded input and schema validation.

* feat(command): support option relations and repeats

Refs #215. Add bounded optional values, repeated strings, relations, and exclusive groups.

* feat(command): add positional schema values

Refs #215. Preserve nested command matches and bounded positional parsing.

* feat(command): parse bounded numeric scalars

Refs #215. Add typed f64 and u32 schema values with validated defaults.

* feat(command): render facade-owned help

Refs #215. Render deterministic command help without exposing Clap.

* fix(command): reject non-finite floating values

Refs #215. Enforce finite float values and defaults in the facade.

* feat(command): support hidden options

Refs #215. Keep internal options parseable while omitting them from help.

* feat(command): render facade-owned version text

Refs #215. Add deterministic version metadata and rendering.

* fix(command): distinguish explicit options from defaults

Refs #215. Apply option relations only to caller-supplied options.

* feat(command): preserve declared native path values

Refs #215. Allow explicitly declared OS-string arguments without a lossy UTF-8 conversion while retaining bounded input validation and relation checks.

* feat(error): add bounded application context facade

Refs #218. Provide owned errors, source chains, context helpers, and a Result alias without a third-party error carrier.

* feat(error): support generic result conversions

* style(error): format generic conversion facade

* ci(release): automate versioned GitHub releases

* feat(http): own bounded websocket upgrades

* feat(http): split owned websocket sessions

* feat(pty): add owned terminal session facade

* fix(pty): avoid Windows-only unused trait import
@zackees

zackees commented Sep 14, 2026

Copy link
Copy Markdown
Owner Author

Closing as superseded: #220 replayed this stacked FastLED foundation onto current main after the #216 merge diverged, and it has landed.

Verified against origin/main (e0666e0): every file this PR's own commits add exists on main, and every distinctive added source/test line is present on main (one JSON doc-comment line was reworded). Merging this branch now would only reintroduce pre-refactor code that main has since replaced.

Reopen if something here is still missing from main.

@zackees zackees closed this Sep 14, 2026
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