fix: preserve JSON false/null through the document pipeline - #134
Open
lost-rob0t wants to merge 1 commit into
Open
fix: preserve JSON false/null through the document pipeline#134lost-rob0t wants to merge 1 commit into
lost-rob0t wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Canonical v0.9 ingest rejected schema-valid documents carrying JSON
falsevalues (e.g.handling.pii: false) with:Root cause
jsown's default reader parses JSON
falseandnullto CLnil, andjsown:to-jsonserializesnilas[]. 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/:nullkeywords round-trip losslessly):http-boundary-core.lispparse-json-octets(canonical boundary routes)http-api.lisplegacy/new/document,/documents/bulk,/new/targetroutesRepresentations and accessors are unchanged; the keywords serialize back to the original literals through validation, RabbitMQ wire bodies, and CouchDB persistence.
Verification
handling.pii: falseaccepted byPOST /documents/bulkand stored in CouchDB with booleanfalseKnown 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.