Extract canonical JSON serializer core #30

Merged
lost-rob0t merged 11 commits from extract/canonical-json-core into main 2026-08-15 14:25:30 +00:00
lost-rob0t commented 2026-08-15 14:21:00 +00:00 (Migrated from github.com)

Scope

Continue the dependency-ordered one-authority extraction after PR #29 by moving the existing deterministic JSON serializer core from prototype/ into star-canonical-json.

This follows STAR-LANG-006 / STAR-LANG-RESEARCH-017 ordering: lifecycle first, canonical JSON next, then durable journal/runtime state extraction.

What moves

star-canonical-json is now authoritative for:

  • canonical JSON object and array node representation
  • explicit JSON true / false / null sentinels
  • JSON string escaping
  • deterministic lexicographic object-key ordering
  • integer/string/boolean/null/array/object emission
  • canonical JSON string serialization
  • typed final-package serializer failures

prototype/canonical-json-prototype.lisp delegates those behaviors to the final package.

Deliberately still prototype-owned

This slice does not move the schema-aware manifest/wire conversion layer yet. Prototype still owns:

  • manifest plist → JSON-object composition
  • StarLang type/schema-aware wire validation
  • document inheritance validation
  • decimal validation
  • generic wire-value conversion
  • manifest/envelope object assembly

Those now consume final serializer nodes/encoding rather than carrying a second encoder.

Out of scope

  • float/RFC 8785/Ryu work from issue #5
  • journal/replay extraction
  • runtime directory or deterministic dispatcher extraction
  • lease/fencing
  • compiler/parser changes

One-authority effect

Removed the prototype-owned JSON node structs, JSON sentinel allocation, string escaper, recursive serializer, and canonical string implementation. Compatibility constructors/sentinels and canonical-json-string are thin delegates only.

Extraction metrics

CI on final head 2f44a5f7b06cf6de2e920748c1c8800a3822e045 reports:

  • aggregate prototype/**/*.lisp: 19,692 → 19,664 LOC (-28)
  • prototype/canonical-json-prototype.lisp: +27 / -55, net -28 lines
  • final star-canonical-json/src/canonical-json.lisp: 82 LOC

Validation

GitHub Actions is green on the final head:

  • independent target-system loading ✅
  • asdf:test-system :star-actor-protocol ✅
  • asdf:test-system :star-canonical-json ✅ in a fresh process with no prototype package loaded
  • asdf:test-system :star-mailbox ✅
  • asdf:test-system :star-sento-compat ✅
  • asdf:test-system :starlang-runtime ✅
  • HTTP/scrape final-system tests ✅
  • asdf:test-system :starlang-prototype ✅ — 34 standalone prototype scripts
  • generated interchange artifact validation ✅
  • frozen canonical manifest fixture/hash verification ✅
  • nix flake check --print-build-logs ✅

Next dependency-correct slice

Extract the base runtime journal port/event/replay contract into star-journal, consuming final star-actor-protocol lifecycle validation and final canonical serialization where persistence requires it. Do not pull domain-remoting orchestration, leases/fencing, or deterministic dispatcher state into that slice.

## Scope Continue the dependency-ordered one-authority extraction after PR #29 by moving the existing deterministic JSON serializer core from `prototype/` into `star-canonical-json`. This follows STAR-LANG-006 / STAR-LANG-RESEARCH-017 ordering: lifecycle first, canonical JSON next, then durable journal/runtime state extraction. ## What moves `star-canonical-json` is now authoritative for: - canonical JSON object and array node representation - explicit JSON true / false / null sentinels - JSON string escaping - deterministic lexicographic object-key ordering - integer/string/boolean/null/array/object emission - canonical JSON string serialization - typed final-package serializer failures `prototype/canonical-json-prototype.lisp` delegates those behaviors to the final package. ## Deliberately still prototype-owned This slice does **not** move the schema-aware manifest/wire conversion layer yet. Prototype still owns: - manifest plist → JSON-object composition - StarLang type/schema-aware wire validation - document inheritance validation - decimal validation - generic wire-value conversion - manifest/envelope object assembly Those now consume final serializer nodes/encoding rather than carrying a second encoder. ## Out of scope - float/RFC 8785/Ryu work from issue #5 - journal/replay extraction - runtime directory or deterministic dispatcher extraction - lease/fencing - compiler/parser changes ## One-authority effect Removed the prototype-owned JSON node structs, JSON sentinel allocation, string escaper, recursive serializer, and canonical string implementation. Compatibility constructors/sentinels and `canonical-json-string` are thin delegates only. ## Extraction metrics CI on final head `2f44a5f7b06cf6de2e920748c1c8800a3822e045` reports: - aggregate `prototype/**/*.lisp`: **19,692 → 19,664 LOC (-28)** - `prototype/canonical-json-prototype.lisp`: **+27 / -55**, net **-28 lines** - final `star-canonical-json/src/canonical-json.lisp`: **82 LOC** ## Validation GitHub Actions is green on the final head: - independent target-system loading ✅ - `asdf:test-system :star-actor-protocol` ✅ - `asdf:test-system :star-canonical-json` ✅ in a fresh process with no prototype package loaded - `asdf:test-system :star-mailbox` ✅ - `asdf:test-system :star-sento-compat` ✅ - `asdf:test-system :starlang-runtime` ✅ - HTTP/scrape final-system tests ✅ - `asdf:test-system :starlang-prototype` ✅ — **34 standalone prototype scripts** - generated interchange artifact validation ✅ - frozen canonical manifest fixture/hash verification ✅ - `nix flake check --print-build-logs` ✅ ## Next dependency-correct slice Extract the base runtime journal port/event/replay contract into `star-journal`, consuming final `star-actor-protocol` lifecycle validation and final canonical serialization where persistence requires it. Do not pull domain-remoting orchestration, leases/fencing, or deterministic dispatcher state into that slice.
Sign in to join this conversation.
No description provided.