Skip to content

fix: preserve JSON false/null through the document pipeline - #134

Open
lost-rob0t wants to merge 1 commit into
masterfrom
fix/v09-false-value-pipeline
Open

fix: preserve JSON false/null through the document pipeline#134
lost-rob0t wants to merge 1 commit into
masterfrom
fix/v09-false-value-pipeline

Conversation

@lost-rob0t

Copy link
Copy Markdown
Owner

Problem

Canonical v0.9 ingest rejected schema-valid documents carrying JSON false values (e.g. handling.pii: false) with:

$.handling.pii: expected boolean, got array

Root cause

jsown's default reader parses JSON false and null to CL nil, and jsown:to-json serializes nil as []. Documents were therefore re-serialized as arrays before validation, publishing, and persistence.

Fix

Wrap every document-body parse in jsown:with-injective-reader (:true/:false/:null keywords round-trip losslessly):

  • http-boundary-core.lisp parse-json-octets (canonical boundary routes)
  • http-api.lisp legacy /new/document, /documents/bulk, /new/target routes

Representations and accessors are unchanged; the keywords serialize back to the original literals through validation, RabbitMQ wire bodies, and CouchDB persistence.

Verification

  • All unit suites green: 20 suites, 184 tests
  • End-to-end: a real corpus document with handling.pii: false accepted by POST /documents/bulk and stored in CouchDB with boolean false
  • flake.lock updated: star-cl input NAR hash moved upstream

Known follow-up

The outbox event fan-out path (publish-outbox-event -> public-document-copy) still re-serializes via jsown objects parsed elsewhere; documents at rest and on the canonical wire are correct, event bodies may still conflate false/null in rare legacy paths. Full jsown-to-jzon migration is the durable fix.

jsown's default reader parses JSON false and null to CL nil, and
jsown:to-json serializes nil as []. Documents carrying false values
(e.g. handling.pii) were therefore published to RabbitMQ and validated
as arrays, so canonical ingest rejected them with wrong_type
('expected boolean, got array').

Wrap every document-body parse in jsown:with-injective-reader
(:true/:false/:null keywords round-trip losslessly) at:

- http-boundary-core parse-json-octets (canonical boundary routes)
- http-api /new/document, /documents/bulk, /new/target legacy routes

All existing representations and accessors are unchanged; the keywords
serialize back to the original literals in validation, RabbitMQ wire
bodies, and CouchDB persistence.

Verified: full unit suites green (20 suites, 184 tests); end-to-end
ingest of a document with handling.pii=false accepted by /documents/bulk
and stored with boolean false.

Also updates flake.lock: star-cl input NAR hash moved upstream.
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