Skip to content

Freeze the trios-chat behaviour baseline at 8b229e9: test names, e2e PASS list, falsifier output, golden vectors, pin test #1825

Open

Description

@dmitrii-f-t27

Part of #1812. Needs #1814 first (shim added to the workspace members; PR #1820).

Why

Every later swap replaces hand-written logic with generated code. The only proof that behaviour did not change is a frozen record of what the crate does today, checked again after each swap. t27c gen-rust does not lower tests, so the original tests and these golden files are the oracle.

Add under crates/trios-chat/

  1. golden/test-names/<package>.txt - the output of cargo test -p <package> -- --list 2>/dev/null | grep ': test$' | sort for each of the 12 ring packages and the shim trios-chat, plus a golden/test-names/counts.txt with pass counts. Package names: trios-chat-cr-chat-00 ... trios-chat-cr-chat-07, trios-chat-cr-chat-laws, trios-chat-br-output, trios-chat-br-io-chat-05, trios-chat-br-io-chat-07, trios-chat.
  2. golden/e2e_pass.txt - the PASS/FAIL lines of cargo run -p trios-chat --bin e2e_chat_25 (25 checks). The bin uses OsRng, so only the PASS/FAIL lines are compared, not bytes.
  3. golden/falsifier.stdout, golden/falsifier.skips (count of skip bad line on stderr) and golden/falsifier.exit for cargo run -p trios-chat --bin falsifier_runner.
  4. src/bin/golden_vectors.rs and golden/vectors.txt. The bin prints, deterministically:
    • laws_hash();
    • pad_class / unpad for payload lengths 0, 1, 252, 253, 1020, 4093, 16380, 16381;
    • dest_hash of a fixed X25519 public key;
    • a sealed envelope built with fixed secrets and nonce [1; 12] (exact bytes);
    • Chain::from_root(RootKey([7; 32]), b"send") and the first N send_next() keys, nonces and counters; dh_step and dh_kem_step outputs; recv_accept sequences that cover replay, rollback and skipped paths;
    • PrekeyBundleBody::canonical_bytes, CapabilityToken and ToolManifest signing bytes;
    • the validate_output verdict and matched pattern for every line of corpus/prompt_injection.jsonl plus a few benign strings.
  5. T27_PIN - empty table with columns: file, spec path, t27 SHA, t27c built_by, sha256 (always), seal file (or unsealed on master, a separate column).
  6. tests/t27_pin.rs - for every row of T27_PIN, computes sha256 of the vendored file with the sha2 crate and compares. With an empty table it passes trivially. Adds sha2 = "0.10" under [dev-dependencies] of crates/trios-chat/Cargo.toml (the rings already use 0.10).
    6a. tests/laws_hash.rs - asserts that trios_chat::r_chat::laws_hash() equals d8c962d0cfe111bf72f9d59f2296baf015ff5c9f0390cf807b7cc08c706f3a98, so the later LAWS swap does not add a test to the frozen test list.
  7. T27_EXCEPTIONS.md - the files that stay hand-written Rust, each with category, reason and what would lift it. Proposed list, marked "proposed, pending owner decision D11" until it is approved: rings/BR-IO-CHAT-05/src/entities/chat_envelope.rs, rings/BR-IO-CHAT-05/src/entities/mod.rs, rings/BR-IO-CHAT-05/src/lib.rs, rings/BR-IO-CHAT-05/src/migrations/m2026_05_09_000001_create_chat_envelope.rs, rings/BR-IO-CHAT-05/src/migrations/mod.rs, src/lib.rs, rings/CR-CHAT-06/src/lib.rs, src/bin/e2e_chat_25.rs.

No .sh files: ROADMAP operational invariant L1 forbids them, so the pin check is a Rust test.

Numbers measured in a scratch workspace (to be replaced by the lockfile run)

The scratch run used a copy of crates/trios-chat at 8b229e9, a minimal workspace manifest, rustc 1.94.0 and fresh crates.io resolution, not this repository's Cargo.lock. Do not quote these numbers until the lockfile run confirms them.

Package Tests passed (scratch)
CR-CHAT-00 9
CR-CHAT-01 476
CR-CHAT-02 431
CR-CHAT-03 520
CR-CHAT-04 395
CR-CHAT-05 436
CR-CHAT-06 404
CR-CHAT-07 381
CR-CHAT-LAWS 4
BR-OUTPUT-CHAT 4
BR-IO-CHAT-07 6 (tokio tests, paused clock)
BR-IO-CHAT-05 1 (returns early without DATABASE_URL, so it checks nothing; owner decision D12)
trios-chat r_chat_guard 3
Total 3,070
  • e2e_chat_25: 25/25 PASS, exit 0.
  • falsifier_runner: 3147/3200 blocked, 400 lines skipped (prompt/expected keys instead of payload/expected_block), exit 1. Categories below 95%: confirmation_tag_chain 44/50, sender_data_header_encryption 36/50, group_context_extensions_consistency 36/50, leaf_node_signature_validation 31/50.
  • laws_hash: d8c962d0cfe111bf72f9d59f2296baf015ff5c9f0390cf807b7cc08c706f3a98 (recomputed 2026-10-10).

Acceptance criteria

  1. cargo run -p trios-chat --bin golden_vectors | diff - crates/trios-chat/golden/vectors.txt prints nothing, and a second run prints nothing too (deterministic).
  2. For every package, cargo test -p <pkg> -- --list 2>/dev/null | grep ': test$' | sort | diff - crates/trios-chat/golden/test-names/<pkg>.txt prints nothing.
  3. cargo run -p trios-chat --bin e2e_chat_25 | grep -E 'PASS|FAIL' | diff - crates/trios-chat/golden/e2e_pass.txt prints nothing.
  4. cargo run -p trios-chat --bin falsifier_runner > "$OUT/f.out" 2> "$OUT/f.err"; echo $? prints the code in golden/falsifier.exit; diff "$OUT/f.out" crates/trios-chat/golden/falsifier.stdout prints nothing; grep -c 'skip bad line' "$OUT/f.err" equals golden/falsifier.skips.
  5. cargo test -p trios-chat --test t27_pin passes; cargo test -p trios-chat --test laws_hash passes.
  6. find crates/trios-chat -name '*.sh' | wc -l prints 0.
  7. The required checks no-js-check, Test, Constitutional Enforcement and guard are green on the latest SHA. The PR body starts with a Closes line for this issue and carries an "L16 rationale:" line for clippy (trios LAWS L3, L16).

Out of scope

Fixing any behaviour. Each quirk found is recorded in a separate behaviour-quirks issue under the epic (not filed yet) and fixed, if the owner decides so, in its own earlier PR.

Dmitrii Fedorov (@dmitrii-f-t27)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions