Skip to content

atlas-search(pyjson): dumps_compact emits U+007F (DEL) raw — CPython ensure_ascii escapes it as \u007f, breaking --text byte parity #5404

Closed

Description

@dezren39

Problem

atlas-search's CPython-parity JSON writer emits U+007F (DEL) raw in the
ensure_ascii mode, where CPython escapes it as \u007f. The module's stated
contract is byte-identical output to the Python's (json.dumps with default
separators and ensure_ascii=True for the --text fragments).

Evidence (verified this run, main 8854bf748)

  • pkgs/atlas-search/crates/atlas-search/src/pyjson.rs:107 — the escape arm is
    c if ensure_ascii && (c as u32) > 0x7f. CPython's ASCII encoder escapes
    every character outside 0x20..=0x7e (its escape regex is [^\ -~]), so
    0x7f itself is escaped: json.dumps("\x7f") → "\u007f" (checked against
    CPython 3.14 / Unicode 16 on the laptop).
  • Laptop probe ~/git/fleet/probe-pyjson-del (compiles the real pyjson.rs,
    comment-stripped copy, code identical):
    • py_string("\u{7f}", true) → "␡" (raw DEL) — CPython: "\u007f" ✗
    • py_string("a\u{7f}b", true) → raw DEL — CPython: "a\u007fb" ✗
    • dumps_compact({"k": "x\u{7f}y"}) → raw DEL — CPython: {"k": "x\u007fy"} ✗
    • Neighbouring cases all match CPython: U+0080 → \u0080, U+001F → \u001f,
      café → caf\u00e9, plain ASCII unchanged.
  • Reachable output: dumps_compact renders the --text fragments in
    crates/atlas-search/src/render.rs:36,72,103 (including filters_applied,
    whose values are user-supplied filter strings), so a filter value containing
    DEL renders differently from the Python CLI this binary replaces.

Why it matters

The atlas Rust port's acceptance bar is byte-parity with the Python surface
(steps 1–4 of the Atlas port). A raw DEL byte in --text output is a silent
parity break in exactly the hand-rolled writer built to prevent parity breaks,
and DEL in terminal output is a control character the escaping exists to keep
out of rendered text.

Acceptance criteria

  • py_string with ensure_ascii=true escapes U+007F as \u007f; the
    ensure_ascii=false (envelope) path keeps emitting it raw, as CPython does
    with ensure_ascii=False.
  • A unit test pins DEL (and the neighbouring boundary characters U+007E raw,
    U+0080 escaped) in both modes.
  • cargo test -p atlas-search pyjson (or the crate's targeted test filter)
    passes; no other rendering changes.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    source/creatorFiled by the new-issue-creator job
    priority/lowNice to have; do when convenient
    work/self-assignedAn agent grabbed this item directly, outside the queue
    app/atlas-searchpkgs/atlas-search (Atlas search service + atlas-embed)
    on Nov 4, 2026
  2. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · state: filed

    • Agent: new-issue-creator job (new-issue-creator-code-b)
    • Session / ID: cron new-issue-creator-code-b, run 2026-11-04 04:50 CST
    • Found via: filed this run
    • Task: Filed after verifying against CPython and the real pyjson.rs via laptop probe ~/git/fleet/probe-pyjson-del; taking it as a guarded self-solve this run (one-character escape-boundary fix + pinning test).
    • Expectation: effort xs — PR opened and merged this run when the targeted atlas-search tests pass on the laptop.
    • Links: probe ~/git/fleet/probe-pyjson-del (laptop)
  3. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · state: done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/atlas-searchpkgs/atlas-search (Atlas search service + atlas-embed)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions