Skip to content

impl(012): the smoke harness reads the transport's key from --key-file, with a direct transport - #400

Merged
bartekus merged 1 commit into
mainfrom
impl/012-smoke-key
Oct 30, 2026
Merged

bartekus merged 1 commit into
mainfrom
impl/012-smoke-key

Conversation

@bartekus

Copy link
Copy Markdown
Contributor

Implements spec 012 3.2 as amended by #393 (A-66) in integrations/rustev-jev/examples/smoke.rs, the stage 2 smoke harness. No library code changes.

  • --key-file <path> is required. The harness reads the selected transport's variable from it: AI_GATEWAY_API_KEY for gateway and gateway_typesafe_base, and TYPESAFE_API_KEY for direct. It never reads the key from the environment. The hard-coded R-27 path is gone.
  • --transport gateway|gateway_typesafe_base|direct, gateway by default.
    • direct needs --pin (spec 022 3.2) and takes --endpoint, https://api.typesafe.ai by default.
    • --pin and --endpoint are refused on the Gateway transports.
    • R-30's omission of zero data retention stays Gateway-only; direct requests carry no Gateway provider options.
  • Backend id jev-direct for direct, and a per-transport provenance string in each written exchange.
  • --out must be absent or empty. Every exchange is checked for the key before any file is written, so a refusal writes nothing.

Each refusal (no RUSTEV_JEV_LIVE=1, direct without --pin, --pin on the Gateway, an unknown transport, the variable missing from the key file, a non-empty --out, no --key-file) was exercised locally. Every one exits before the journal is opened or any call is sent. No live call was made by this change, and none runs in tests or CI.

Spec 012's implementation record note for A-66 is updated, with the refreshed shards.

@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing both changed files for correctness, security, and spec consistency.

integrations/rustev-jev/examples/smoke.rs

Key ordering in run():

  1. RUSTEV_JEV_LIVE guard
  2. Parse --journal / --out paths
  3. Check --out is absent or empty
  4. binding() - validates transport/pin/endpoint combos
  5. read_key(&arg("--key-file")?, ...) - reads key from file
  6. SpendJournal::open(...) - journal opens here

All refusals (bad transport, missing --pin, non-empty --out, missing --key-file) occur before the journal opens and before any call is dispatched. The spec claim "Each refusal happens before the journal is opened or any call is sent" is accurate.

Key-check / write ordering: The new code accumulates serialised docs in Vec<String>, checks each for key_bytes before pushing, and only calls create_dir_all + the write loop after all docs pass. An early return on a credential hit leaves the output directory uncreated and no files on disk. This is the correct "atomically safe" behaviour described in the spec note.

zero_data_retention = false (R-30): The assignment is placed after the match arm for gateway/gateway_typesafe_base, but the direct arm does an early return, so R-30's flag is never applied to direct. Matches the spec: "R-30's omission applies only to the Gateway."

key_name() mapping: Gateway and GatewayTypesafeBase → AI_GATEWAY_API_KEY; Direct → TYPESAFE_API_KEY. Consistent with the spec and with the updated --transport documentation.

--pin / --endpoint rejected for Gateway transports: enforced in binding() before any side effects.

Argument parsing (opt() rescans std::env::args() each call): harmless for a smoke example; first match wins.

specs/012-jev-integration/spec.md

The updated prose accurately reflects the implementation: --key-file required, variable follows transport, direct requires --pin, --endpoint defaults to https://api.typesafe.ai, --out must be absent or empty, all files checked for the key before any are written. No contradictions with the code.

No concrete defects found.

{"head": "01670e3931fed4db853559d0baf7a42549b4ee26", "verdict": "no-findings", "findings": []}

Subject: 3084c8d...01670e3, diff digest 3787fbb16d5656034fc168a909aa51f354ec5b38cc9b98fa310fe27ef356691e, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus enabled auto-merge October 30, 2026 01:21
@bartekus
bartekus added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 6ce5d1d Oct 30, 2026
30 checks passed
@bartekus
bartekus deleted the impl/012-smoke-key branch October 30, 2026 02:09
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