Skip to content

fix(qsearch): refuse duplicate JSON members in lifecycle client (#86, 2/3) - #92

Merged
AetherAI3 merged 2 commits into
mainfrom
claude/nano86-python-duplicate-keys
Nov 8, 2026
Merged

AetherAI3 merged 2 commits into
mainfrom
claude/nano86-python-duplicate-keys

Conversation

@AetherAI3

Copy link
Copy Markdown
Owner

Summary

The Python LifecycleClient silently kept the last of duplicate JSON members, so two clients could read different values from one response. It now refuses them as INVALID_RESPONSE, matching wire contract v1 §2.1. This also corrects two false contract statements found in review. PR 2 of 3 for #86; based on PR 1.

Key Changes

  • Duplicate members refused — An object_pairs_hook on the client's only parse path covers success and error bodies, at any depth.
  • Contract §4 corrected — The service does not cap magnitudes itself; strict clients fail closed on values above 2^53-1 rather than rounding.
  • Encoding gap recorded — Python accepts UTF-8 BOM, UTF-16 and UTF-32 bodies, recorded as three new strict-xfail negatives.

Verification

  • Reproduced first: new unit test 3/3 red before the fix, green after.
  • Strict xfails went from 26 to 23 for exactly the 3 duplicate-key cases; 3 new encoding gaps bring them back to 26.
  • Client + wire-contract tests: 161 passed, 26 xfailed, 0 skipped.
  • Independent review found no CRITICAL or HIGH issues; its MEDIUM findings are fixed here.

Risk / Follow-ups

  • Remaining Python looseness (closed envelope, 2^53-1, encoding) is documented and tracked by strict xfails, not fixed in this lane.
Hashes

CONTRACT.md be60cd4a786b79fe · negative.v1.json 0dc5ac0e08908cc9 · SHA256SUMS b988622065113bcf. Head 7ea82b6.

🤖 Generated with Claude Code

AetherAI3 and others added 2 commits November 7, 2026 18:45
…nses

LifecycleClient parsed responses with json.loads, which silently keeps the
last of duplicate member names, so two clients could read different values
from one body. Wire contract v1 section 2.1 requires INVALID_RESPONSE.
Reproduced first by three strict-xfail compatibility cases and a new unit
test (RED 3/3); fixed with an object_pairs_hook that refuses duplicates in
success and error bodies. Fixture python_client metadata regenerated
(accepts -> agrees for the three cases) and CONTRACT section 4 updated to
list the remaining, still-recorded discrepancies.

Refs #86

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Independent review follow-ups:
- CONTRACT section 4 claimed the service never emits numbers above 2^53-1;
  job_state projects any finite non-negative record value, so state the real
  bound and the fail-closed client behaviour instead.
- The Python client accepts UTF-8 BOM, UTF-16 and UTF-32 bodies via
  json.loads encoding detection; section 2.1 requires UTF-8. Recorded as
  three new negative fixtures that the Python client 'accepts' (strict xfail).
- Drop the stale duplicate-key xfail reason.

Refs #86

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AetherAI3
AetherAI3 changed the base branch from claude/nano86-lifecycle-wire-contract to main November 8, 2026 02:16
@AetherAI3
AetherAI3 merged commit 3452591 into main Nov 8, 2026
0 of 2 checks passed
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