Skip to content

Design: a value cannot act on the terminal — one format-character (Cf) contract for pkgs/id plain output #3455

Closed
4 of 4 issues completed

Description

@dezren39

Design (design-architect pass 31, 2026-11-01). Full design doc: files/designs/code-id-plain-output-rendering.md in the keep-the-four-repos-healthy goal workspace. Audited at origin/main 70c20625. No user/review: every origin carries explicit acceptance with a verified probe, and the judgment calls below (one shared character set; escape vs strip by surface kind) are the architect's recorded decisions.

Summary

pkgs/id's plain-text ruling (#1613, recorded in src/commands/text.rs's module doc) is a printer never lets a value break row structure — but every guard in the family tests char::is_control() (category Cc only), so Unicode format characters (category Cf) reach the terminal raw and act on the rendering: bidi overrides/isolates (U+202A–U+202E, U+2066–U+2069) visually reorder the fields after them, and zero-width characters (U+200B, U+FEFF, U+00AD) make look-alike rows with different bytes — the Trojan-Source class applied to live CLI output. Three surfaces, one class:

The character set already exists in-tree, stated once: petname.rs:237-262 is_format_char is the complete Unicode 16 Cf range set, with the doc ruling that Cf characters "are invisible or reorder the text around them" — petnames refuse them at ingest (#1674), but the definition is a private fn the renderers never saw. world/util.rs:69-84's sanitizers (sanitize_display_name/sanitize_chat) share the is_control-only blind spot one layer down.

The contract (recorded decisions)

A plain-text field is row-safe only if it contains no character that can act on the terminal: no structure character (Cc controls, U+2028/U+2029) and no format character (category Cf, the crate's one shared set). Every plain renderer in pkgs/id accounts for both classes; the disposition differs by surface kind — row renderers escape, stripping sanitizers strip, ingest validators refuse — and no surface re-derives the character set.

  1. One set: the petname set, shared. is_format_char is promoted to a single pub(crate) definition all phases use. It includes the zero-width characters id(peers): plain_field passes bidi/format controls raw — a gossip peer name with U+202E reaches the terminal unescaped and visually reorders the row's columns #2839 left to triage (U+200B–U+200D, U+FEFF, U+00AD, U+2060): id(group/doc/claim): the shared key=value renderer passes bidi/format controls (Cf) raw — a claim value with U+202E reaches the terminal unescaped in both the unquoted and quoted paths and visually reorders the row's author=/event= fields #3111's look-alike argument covers them, and a renderer-specific subset is the per-site re-derivation this design stops. Recorded cost: a ZWJ-emoji or ZWNJ-joined name renders quoted-with-escapes in row renderers — content preserved in full, JSON-parseable — and petnames already refuse these characters outright. Reversible in one place if fleet evidence shows real names harmed.
  2. Escape, don't strip, at row renderers; the two renderers stay distinct. Their trigger asymmetries are deliberate (space quotes in key=value, never in TSV). Cf joins each trigger and is rendered \uXXXX inside quotes (plain_field's existing form). For group::text the quoted path must escape Cf itself — serde_json's to_string() alone never will; that escaping is Phase 2's real work, not the trigger widening. Ordinary values render byte-identically; --json unchanged everywhere.
  3. The printer, not ingest. No new ingest validation for peer names, claim values or world names — id(peers): a peer's announced name is printed raw — a newline in a gossip announcement forges extra TSV rows in id peers and the REPL #1613's ruling and id(world): world list plain output renders host-supplied names raw — a newline in a world name forges extra rows, and a tab forges columns #3089's non-conforming-host model make rendering the only total gate. Existing ingest checks stay as they are; the closing audit dispositions them separately.

Alternatives rejected in the doc: fixing the three sites independently as filed (the pattern that produced the family — #3111 exists because #2839's fix wouldn't touch its code); one unified renderer (trigger semantics genuinely differ; the shared artefact is the set + contract); stripping at renderers (destroys the printed-in-full, JSON-recoverable property and makes different values print identically); refusing at ingest as the primary fix (cannot clean stored values or non-conforming hosts; refusing other nodes' signed claim events is a federation decision); a bidi-only subset (misses the look-alike half, creates a second drifting set).

Phases (adopted origins — no parallel issues)

Open questions stay in the design doc (ingest-side Cf refusal as defence in depth — federation decision, evidence-gated; sanitize_chat's final disposition if ZWJ-stripping would corrupt legitimate chat text; shared-set placement; ANSI/OSC terminal sequences — no filed instance).

Standing-candidate note: passes 28–30 named this family the standing candidate for this pass (displaced once at pass 30 by #3352's cluster, under its stated terms). Same-day clusters assessed and not taken: the aggregator impossible-date family is #2576's already-stated strict-date rule applied per site; the new operator value-option filings #3449/#3415/#3419 are #3352's contract — provider-catalog-sync is already a named candidate in #3353's closing inventory.

Activity

  1. added
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    epicMeta-issue grouping multiple items (org Project Type=Epic)
    kind/designA design proposal (design-architect): multi-step, phased, decision-bearing
    on Nov 1, 2026
  2. developing-today commented on Nov 1, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    Design filed this pass (2026-11-01, audit at origin/main 70c20625). Phases linked as sub-issues (verified count=4): Phase 1 = #2839 (adopted), Phase 2 = #3111 (adopted, status/blocked on Phase 1 for the shared set), Phase 3a = #3089 (adopted, not gated), Phase 3b = #3456 (new closing audit, status/blocked on Phases 1–2, triage packet → pilot task 5376 queued). Register entry added in files/potential-projects.md (status: proposed). No user/review — origins carry explicit acceptance with verified probes; the set/sharing decisions are recorded in the design doc.

  4. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    Agent note (program tending, 2026-11-01): child progress — sub-issue #3089 (id(world): world list plain output renders host-supplied names raw) CLOSED 2026-11-01T14:25:41Z (parent link REST-verified this run). This epic's last comment (2026-11-01T09:35Z) predates the closure, so the landing is recorded here. Progress note only — not a completion proposal.

  5. 3 remaining items

  6. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    Agent note (task 5751, lane E): triage DONE. Design record posted above (#3455 (comment)). Phase packets verified already enqueued — task 5439 (#2839, queued), task 5635 (#3111, parked on Phase 1), task 5380 (#3456, parked on Phases 1–2); #3089 closed. No blocking questions for Drew. Claim labels removed; the epic stays open until its phases land.

  7. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    Decision-ready record: design note; PR #3861.

  8. added a commit that references this issue on Nov 1, 2026
  9. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    Program tending — sub-issue progress (2026-11-02)

    Closed since this thread's last activity: #2839 (closed 2026-11-02T11:25Z).

    Recorded for the parent rollup; this is a progress note, not a completion proposal — the parent stays open on its remaining children.

  10. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    Phase 3b closing evidence (from #3456, queue task 5380)

    Gates verified closed this run before starting: #2839 and #3111 both CLOSED; #3089 (Phase 3a) already closed. Full inventory table is posted on #3456 (#3456 (comment)). Summary for the design record:

    Sibling-audit evidence for the world/util.rs surfaces (#2839 acceptance)

    #2839 requires the sibling surfaces (world/util.rs sanitizers) audited and either fixed in the same pass or explicitly filed. Phase 3b record:

    • sanitize_display_name (world/util.rs:69-76): already strips the full shared Cf set — the filter is !ch.is_control() && !crate::petname::is_format_char(*ch), and crate::petname::is_format_char is verified to be the same function as the shared predicate (id-core/petname.rs:16 re-exports crate::is_format_char = unicode.rs Cf set). No per-site re-derivation. Fixed-point property relied on by the id(world): journal restore never sanitizes Issued display names — empty, control-bearing, and over-length names restore verbatim, though mint refuses or strips all three #2960 restore check in world/core.rs is preserved. No change needed; no follow-up.
    • sanitize_chat (world/util.rs:95-103): already strips Cc (keeping LF/TAB) + all Cf except U+200C/U+200D, so legitimate joined-emoji text survives while bidi/zero-width actors are removed. This settles the design doc's recorded fallback question on the strict side (full strip minus joiners rather than bidi-subset), with the corruption rationale documented in the table. Downstream rendering decision: stored text is re-validated by ChatMessage::check and terminal display passes through terminal_text, now full-Cf. No change needed; no follow-up.

    Remaining Phase 3b acceptance (checkbox 5) is this comment. PR #4458 carries the doc + fix for review; task 5380 parks on the PR.

  11. added
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 3, 2026
  12. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    Program tending — completion proposal (2026-11-03, via #1352)

    All 4 sub-issues of this epic are now closed: #2839, #3111, #3089, #3456 (verified this run via the REST sub_issues read, cross-checked in a separate call). The Phase 3b closing evidence is already recorded on this thread (2026-11-02).

    Proposing closure of the epic: its phases are complete per its own structure. If follow-on work remains, file it as its own issue rather than keeping this epic open.

  13. developing-today commented on Nov 3, 2026

    @developing-today
    Contributor

    agent-note:v1
    state: triaged (coverage pass)
    Coverage pass 2026-11-03: reviewed in the fleet-wide per-issue pass (drift / overlap / already-handled / stale / blockers / ordering). Verdict: still live; queued in repo-health-code-pilot as triage at priority 30 (priority/none). If this is already handled at current main, the triage closes it with evidence; if it needs splitting, the triage files the split.
    Found via: coverage pass 2026-11-03

  14. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    Amendment record — issue #5616 (task 10089)

    Decision: no design-scope extension. The bare --no-default-features build failure was a pre-existing package configuration issue tracked independently by #4159; it was not a requirement for #5530 to absorb the unrelated chat.rs feature-boundary refactor. #4159 was fixed separately by PR #5662 (merged as 25e509304152e3da54e48127811eaeae8a8b76bc on 2026-11-05) and then closed.

    Fresh verification on current main b830347c2a5398ef5a1846e6ee4a424e9793bd93 (which contains that merge): cargo check --manifest-path pkgs/id/Cargo.toml --no-default-features --lib passes. The no-default blocker is therefore resolved; the Cf contract, renderer behavior, and no-new-ingest-rejection decisions remain unchanged. PR #5618 remains scoped to the invite Cf helper and was not modified. #3455 remains closed with its phases complete.

    Resolution recorded on #5616: #5616

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

Metadata

Metadata

Assignees

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)epicMeta-issue grouping multiple items (org Project Type=Epic)kind/designA design proposal (design-architect): multi-step, phased, decision-bearingqueue/queuedHas a queued queue tasksource/design-architectFiled by the repo design architect jobstatus/needs-triageNot yet triaged; needs a first looktask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions