Skip to content

A JSON reader that keeps numbers as text (#211) - #271

Draft
flyingrobots wants to merge 2 commits into
mainfrom
feat/json-reader
Draft

flyingrobots wants to merge 2 commits into
mainfrom
feat/json-reader

Conversation

@flyingrobots

Copy link
Copy Markdown
Owner

Closes #211

Work in progress: a JSON reader in the lumen crate (module json, re-exported at the crate root like write_png). Description to be rewritten before the pull request leaves draft.

The entry says what the reader will be, so the pull request opens with its
contract written down.

Issue: #211
Agent-Session: 3f0c1b7e-6a52-4d1e-9a4c-211a0b5e7c10
Agent-Tool: Claude Code
@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Parser, scanner, limits, errors and a first unit-test file. Three position
tests have hand-derived expectations that disagree with the reader and are
not yet adjudicated. conformance.rs and generated.rs are placeholders.

Issue: #211
Agent-Session: 3f0c1b7e-6a52-4d1e-9a4c-211a0b5e7c10
Agent-Tool: Claude Code
@flyingrobots

Copy link
Copy Markdown
Owner Author

Handoff (paused)

Done (commit 461f4f9, pushed): crates/lumen/src/json.rs plus json/{limits,value,error,scan,parser}.rs, re-exported at the crate root (parse_json, JsonValue, JsonLimits, JsonError, JsonErrorKind, JsonLimitError, JSON_READER_ID, default/ceiling constants). Placement: a private module of the lumen crate re-exported at the root, like png.rs and sha256.rs. Iterative parser, numbers kept as text, duplicate keys refused, BTreeSet for keys, columns count characters. The changelog entry is in. json/tests.rs has 20 unit tests; conformance.rs and generated.rs are placeholders.

Not done: the conformance table (JSONTestSuite y/n/i categories, written by hand, source noted), the generated round trip with an independent writer, number-token generation and malformed-number tests, the corpus replay, the library reference table and section (a test requires every root export there), the evidence-map row, clippy/fmt, the full gate, the PR description. Nothing has been run beyond cargo test -p lumen --lib json.

Test state: 17 pass, 3 fail. The failures are my hand-derived expectations in tests.rs, not yet adjudicated against the contract. (a) a_carriage_return_is_a_character_of_its_line: [1,\r2 3] gives column 7 and I wrote 6; recount by hand. (b) objects_count_toward_depth_like_arrays: the offset is 10 and I wrote 11. (c) positions_count_characters...: column 6 against my 5. For (b) and (c), recount the bytes; the reader is probably right and the expectations wrong. Decide by hand first, not by copying the output.

Next step: fix those three expectations, then write the conformance and generated tests, the docs and the evidence row, then run the gate.

Command: python3 ~/git/devcontainers/bin/devrun lumen ~/git/lumen-211 --worktree --cpus 4 --memory 8g --timeout 2400 -- cargo test --locked -p lumen --lib json

Uncommitted: nothing. Open questions: none; the scene ADR (#186) and an ADR for the reader are left to the coordinator.

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.

A JSON reader that keeps numbers as text

1 participant