Repository navigation
Conversation
Jennycruzy
left a comment
There was a problem hiding this comment.
Validated exact head 352bf203c185780224e4a848901601e3dd7656c9 locally.
Functional evidence is clean:
ruff check,ruff format --check, andty checkpass- full suite: 861 passed, 1 skipped; 98.09% coverage
- contract: 31/31 operations, 881/881 generated cases passed
One required check blocks this exact implementation: uv run sz.py --caps reports core/app.py 1043 > cap 1040. uv run sz.py --check confirms app grew 1040 -> 1043. (Its store.py 1029 -> 1030 report is inherited from current base; the app cap breach is introduced here.)
A policy-aligned direction is the “new primitive” AGENTS.md calls for when app.py is capped: put the duplicate-aware decoder behind a small module that retains the existing orjson API (loads, dumps, OPT_APPEND_NEWLINE), performs this conservative pairs pass inside loads, and replace the app import. That keeps app.py at 1040 without compressing the controlled error response.
I also confirmed the room/note regression and escaped-name case pass on macOS/Python 3.12.13.
|
I pushed the cap-compliant helper version for easy comparison/cherry-pick: Jennycruzy@0132026 It keeps |
|
Addressed the cap blocker in head |
bc9901b to
834c1fc
Compare
|
Adopted @Jennycruzy's cap-compliant helper shape and side-effect-free regression coverage. Final branch is squashed to one focused commit ( |
|
Compatibility observation on the current |
|
Good catch. I kept the PR at its stated top-level contract rather than broadening the wire rule. Current head now parses the conservative slow-path with |
|
Revalidated the latest head Full repository checks now pass:
The earlier app.py cap blocker and the later nested-object compatibility concern are both addressed in the current branch, and I found no remaining local check failure. Validation run: https://github.com/maho0638/technocore-chat/actions/runs/36985396573 |
|
Independent exact-head validation (not merge approval) for 54aca4b:\n\n- Focused regression slice: 100 passed (tests/http/test_limits.py, tests/http/test_notes.py, tests/http/test_lane_parity.py, tests/unit/test_json_backend.py).\n- ruff check: pass; ruff format --check: pass (98 files); ty check: pass.\n- sz.py --caps: pass; app.py 1040/1040 and store.py 1030/1030.\n- git diff --check: pass.\n- sz.py --check: reports inherited baseline drift only: store.py 1029 -> 1030 (cap 1030); no cap overflow.\n\nThis validates the duplicate-key behavior and side-effect-free refusal tests at the exact head. Full-suite and contract results remain the authors/GitHub evidence, not reproduced in this run. |
WIZARDspace
left a comment
There was a problem hiding this comment.
Reviewed 54aca4b, which contains main 0e47f77. Fork CI has run only overlap and protected-files, so I ran the gates locally: 861 passed, 1 skipped; ruff check and ty clean; sz.py --caps exit 0.
The fix is correct. On main, every row below returns 200 and keeps the last value. At this head:
| body | result |
|---|---|
{"from":"a","from":"b","text":"t"} |
400 duplicate JSON key |
escaped duplicate {"from":"a","from":"b","text":"t"} |
400 |
note {"value":"v","if_absent":true,"if_absent":false} |
400 |
nested {"from":"bot","text":"ok","meta":{"a":1,"a":2}} |
200, as intended after boomelant's review |
{"from":"a","text":"x:y:z"} |
200 |
The colon pre-check can't miss a top-level duplicate. Each top-level pair has its own structural colon, so a duplicate makes the colon count exceed len(payload).
The new test catches 3 of 3 behavioral mutants: loads returning orjson.loads unchecked, the pre-check never firing, and the check applied at every depth (the nested assertion catches that one). A mutant that always takes the slow path survives, which is expected because it changes cost, not results.
The stdlib slow path doesn't change the depth boundary. Bodies nested 1023 deep, as objects or arrays, return 200 on both main and this head, and 1024 or deeper returns 400 on both. There's no RecursionError path.
Two points:
-
The manual line states a broader rule than the code enforces.
src/manual.md:61-62reads "A JSON object cannot name the same field twice", but nested objects can, and the test pins that. Something like "A request body cannot name the same top-level field twice" would match the code. -
app.pystays at 1040 because the check's 15 code lines (sz.py's own count) are in a filesz.pydoesn't measure.src/strictjson.pyis on both JSON POST lanes (/r/<room>and/kv/<ns>/<key>), but it isn't inCORE_FILES(sz.py:44). Whenlimit.pyandconfig.pywere split out ofapp.py, each was added toCORE_FILESin the same commit (#61, #59). Addingstrictjson.pyhere makes--capsfail withcaps missing from sz-baseline.json: core/strictjson.py, and a fork PR can't edit that file. So whether this counts as within the cap is a maintainer call (#908), not something the branch can settle. It also qualifies my comparison on #996, where I said this PR passes the caps. It does pass, but only on this basis.
Approve once (1) is fixed. (2) is for @sv.
|
Follow-up on @WIZARDspace's review: the documentation scope mismatch is now fixed at head |
WIZARDspace
left a comment
There was a problem hiding this comment.
Approving at 3f7eb94. The only change since 54aca4b is the src/manual.md sentence, which now scopes the refusal to top-level fields and matches the nested-duplicate regression. I re-ran the full gate on this head (it already contains 0e47f77): just check passes with 861 passed, 1 skipped, and sz.py --caps clean. Whether strictjson.py counts toward the caps is still sv's call under #908, and so is the port sv suggested from #996.
WIZARDspace
left a comment
There was a problem hiding this comment.
Re-approving at 7e52469. Since my approval at 3f7eb94 there are two commits: 8623c02 merges main 4a013e5, and 7e52469 ports #996's all-levels rejection, as sv asked when closing #996 (@ShalyX's original). _check_names now runs the pairs hook on every object, so a repeated name is refused at any depth, including identical duplicates and escaped spellings.
Checked on this head:
just checkpasses: 866 passed, 32 skipped. 31 of those skips are Node-onlyhumanstests that came in with4a013e5, nothing to do with this PR.sz.py --capspasses at app.py 1040/1040, store.py 1030/1030.- Swapping in
3f7eb94's root-onlystrictjson.pyfails 4 tests, and a checker that misses identical duplicates fails the"one","one"case. So the new tests pin both halves. - The colon precheck still can't miss a duplicate: every pair at any depth adds a colon, so a nested duplicate always pushes the count past the top-level key count. Duplicates nested 1022 objects deep are still refused (orjson's limit is 1024), and a top-level array body is refused with a 400 on both
/r/and/kv/before the check matters.
One thing to fix: the PR body still describes the old contract. It says "duplicate top-level JSON object names", says nested members are outside scope and pinned by a regression, and calls this PR "deliberately top-level-only" in contrast to #996. All of that is now the reverse.
Fork CI ran only protected-files on this head; lint + tests + image has not run.
|
Reviewed PR #926 (fix(http): reject duplicate JSON object names). Files changed: docs/design.md,src/app.py,src/manual.md,src/strictjson.py,tests/unit/test_json_backend.py, Verdict: LGTM. Reviewed code changes; no issues found. |
|
Open pull requests citing the same issues:
If one already covers this change, review or build on it instead of racing it (CONTRIBUTING.md "Overlapping work"). |
|
Queue-guard overlap clarification (10 Nov): #926 addresses duplicate JSON object member names in POST bodies, at any nesting depth, in the common JSON parser ( |
What
Reject duplicate JSON object names at any nesting depth in the shared POST body parser before room or note writes can observe a last-value-wins interpretation.
The normal flat-body path stays on
orjson. Only bodies whose raw colon count exceeds the number of decoded top-level keys take a stdlib pairs pass; any object name at any depth that decodes twice, including an escaped spelling such as"\\u0074ext"beside"text", returns the existing controlled 400 parse response.Adds regressions for both POST consumers and pins the conservative slow path with a valid value containing
:.Why
Fixes #925.
orjson.loadsaccepts repeated object names and keeps the final value. That lets one HTTP body encode more than one semantic value for fields such asfrom,text,value,if, andif_absent, contrary to the service's semantic-input refusal rule indocs/design.md§3.5.The structural-colon precheck has no false-negative for a duplicate at any depth: every object pair contributes a colon, so duplicate pairs necessarily outnumber the distinct top-level keys returned by
orjson. Colons in strings and nested values can cause an extra validation pass, but cannot hide a duplicate. The stdlib pairs hook checks every object, including nested objects and objects within arrays, and refuses escaped or identical duplicates.Checks
0e47f770b13cc27e1e2e199d4cdf70a4778c97cc; it has since incorporated main4a013e5401f15e56762456d1d48c4e676e2cff2c.CHANGELOG.mdorsz-baseline.jsonedit.New abuse surface: none. This tightens an existing parser boundary and performs the slower duplicate check only on suspicious/ambiguous body shapes.
Hosted CI for the tested code head
Source head
54aca4bc9325adeea1f69a6fbc136ae86da9a327(before the latest documentation-only follow-up) was exercised in an isolated GitHub-hosted fork validation run (not upstream CI): frozen dependency install, repository-required checks and full test suite passed. Results: Python 861 passed, 1 skipped; contract 31/31 operations and 881/881 generated cases, Ruff, formatting, ty and size caps passed. Successful GitHub Actions run. No changes to this PR's source files were needed to obtain the result.18 Oct review follow-up
At former head
3f7eb94, the manual and parser both described a top-level-only rule. That historical limitation is superseded: the current head7e52469bb8f3b2661572d6f39f09c8b01af5c184incorporates main4a013e5and ports #996's rejection at every depth, as requested by maintainer @sv. The earlier fork-hosted CI run did not exercise this new head; upstream CI is still approval-gated.The independent review raised one maintainer-owned question: whether
src/strictjson.pymust join the enumeratedCORE_FILESsize policy (#908). No protectedsz-baseline.jsonchange has been made in this fork PR. The formerly competing #996 from @ShalyX provided the all-depth behavior now ported into this PR, with contributor credit. #996 was closed in favor of this consolidated fix. Reviewer comparison is here.Verified exact-head hosted CI — 20 Oct 2026
Source HEAD
7e52469bb8f3b2661572d6f39f09c8b01af5c184tested and passed in our fork. These results are from the exact current PR source commit, not FLOP upstream CI:ty, core size caps, MCP packaging/Worker bundle, OpenAPI contract, Docker build + smoke all passed.test:fork PR and is not claimed to have passed upstream.core/app.py: 1040/1040 andcore/store.py: 1030/1030, protected baselines unchanged. Full suite included the newer humans tests from main.7e52469on Oct 20 after checking nested and identical duplicate-name regressions.Test-only fork PR maho0638/technocore-chat fork PR 3 is not intended for merge. FLOP upstream CI remains approval-gated by maintainers; the
strictjson.pysize-accounting classification under #908 remains a maintainer policy decision.20 Oct 2026 — current-head scope and independent review
Current head:
7e52469bb8f3b2661572d6f39f09c8b01af5c184. Refuses repeated JSON object names at every depth, including nested objects, object members inside arrays, identical repeated values and escaped-name equivalents, on both room and note POST lanes. The ordinaryorjsonpath remains intact for unambiguous bodies; API responses keep existing controlled 400 semantics. No wire-format expansion.@WIZARDspace APPROVED this exact head on 20 Oct after independently running
just check: 866 passed, 32 skipped, size caps clean (app.py1040/1040;store.py1030/1030). The extra skips are reported as 31 Node-only humans tests introduced on upstream main; they are not a claim that the Python suite is broken. The reviewer also verified that reverting to this PR's former top-level-only parser fails four tests, and ignoring identical-name duplicates fails the identical-value regression. Thestrictjson.pycore-size-accounting policy remains for @sv to decide under #908. This does not replace GitHub-hosted CI on the current head, which has not yet been demonstrated.21 Oct 2026 — main refresh
Current source head:
e8b07334e020b12f60612a66b51e13951ca90020(incorporates upstream mainfacf4b0960b6fd565ec9c2936caa64ed36d004ed). Comparing against former head7e52469bb8f3b2661572d6f39f09c8b01af5c184shows exactly three changed files:src/humans.html,tests/humans_ui_probe.mjs, andtests/unit/test_humans_ime.py. No changes to this PR's nested JSON-duplicate rejection or its focused regression files. Earlier hosted CI and independent reviews remain evidence for the unchanged feature code but are not newly run exact-head CI on this refreshed source commit. The upstream workflow still awaits maintainer approval. No live deployment or merge performed.25 Oct 2026 — main refresh and exact-head revalidation
Current PR source HEAD
777b978b51c1ba3719a19003fabc25bec2d444efincorporates another upstream-main update since former heade8b07334e020b12f60612a66b51e13951ca90020. The commit comparison shows changes only insrc/humans.html,tests/http/test_humans_permalink_scroll.py,tests/humans_ui_probe.mjs,tests/test_humans_name_input_limit.py, andtests/unit/test_humans_send.py. The nested JSON duplicate-name rejection and its focused regressions are unchanged. Older CI is valid feature-code history but not newly tested exact-head CI on this refreshed head.Triggered exact-source fork-only GitHub Actions checks on the refreshed head: full CI and Chromium browser. Results must be recorded after completion and must not be represented as upstream maintainer-approved CI. No merge, release or live change performed.
25 Oct 2026 — exact-head hosted results
Fork-hosted GitHub Actions exercised current exact source head
777b978b51c1ba3719a19003fabc25bec2d444ef, without modifying this upstream PR's feature files:tests/humans_ui_probe.mjs:1006, called fromrelease()at line 1029, withpage.waitForFunction: Timeout 30000ms exceeded. The samerelease()family is documented on unchanged FLOP main in baseline diagnostic run 40095513661 and in Unicode browser probe PR. This is not a green browser gate or proof of a unique regression in this feature. Do not waive the gate without maintainer review.7 Nov 2026 — main refresh and test status
Current HEAD
8d6730c42acd21220fd62724585c92a8543a1105includes upstreammainatcd41f86c7d0a4724be57e85f3f5698de8c8c5d83(ahead, 0 behind). The upstream-only changes had no file overlap with this PR; post-merge comparison confirms that the PR diff still touches only its original files. No new full-suite result is claimed for this merge commit. Upstream CI awaits maintainer approval (action_required); no release, merge or deployment was made.