Skip to content

impl(039): the paid live Bedrock rank smoke, recorded - #448

Merged
bartekus merged 1 commit into
mainfrom
impl/039-rank-smoke
Nov 2, 2026
Merged

bartekus merged 1 commit into
mainfrom
impl/039-rank-smoke

Conversation

@bartekus

@bartekus bartekus commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Records the paid live Bedrock rank smoke that spec 039 Decision 18 allows, outside declared verification.

Change

  • rustev-bedrock evidence::probe_projection builds a listwise rank projection over three synthetic candidates (spec 039 3.15 item 4) when the bound operation is rank. Other operations are unchanged.
  • Two recorded exchanges of 2026-11-02, one per wire, are added to fixtures/recorded/ with the bindings they were recorded under:
    • Responses: us.openai.gpt-5.6-luna with json_schema
    • Converse: us.anthropic.claude-haiku-5-5 with tool_use
      The policies are the existing ones. Redaction follows the existing fixtures: the AWS request id, the provider response and item ids, and the encrypted reasoning content.
  • tests/recorded.rs replays all seven recorded exchanges offline and expects the ranking apple, pear, plum for the two rank ones.
  • Spec 039 gains a record of the smoke with its journal totals. The README is updated. status: and implementation: are unchanged.

Spend

Both calls were reserved against the shared R-29 testing journal:

Wire Charge
Responses 97,020 nano-USD
Converse 103,730 nano-USD

Headroom after both calls is 4,976,780,968 nano-USD of the USD 5 cap. The smoke shows reachability and the mapping on live bytes only. It makes no quality claim.

Checks

  • make gate
  • make code
  • bash scripts/check-authored-content.sh
  • cargo test -p rustev-bedrock --locked --test recorded --test ranking --test rank_swap --test environment
  • The recorded bytes were checked for account ids, ARNs, credentials, emails and request ids before commit.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

AI review (findings)

Reviewing the changes: new rank smoke fixtures and replay test for the Bedrock integration (spec 039, Decision 18), plus a probe_projection implementation for the rank operation.

Cost arithmetic check (spec.md narrative):

  • Converse (Haiku 5-5, 0.11/0.55 USD/Mtok): 713 × 110 + 46 × 550 = 78,430 + 25,300 = 103,730 nano-USD ✓
  • Responses (GPT-5.6-luna, 0.22/1.32 USD/Mtok): 153 × 220 + 48 × 1,320 = 33,660 + 63,360 = 97,020 nano-USD ✓

Fixture consistency check – truncated field:

converse-rank-smoke-0.json (line ~24): "truncated": false
responses-rank-smoke-0.json (line 24): "truncated": true

The Responses fixture's response_body shows "status": "completed" and a full, well-formed ranking result (["apple","pear","plum"]). The only content modification was post-hoc redaction of the reasoning item's encrypted bytes ("encrypted_content": "redacted:encrypted-reasoning", with "content": [] left empty). There is no API-level indication that the model response was cut off.

The integration likely derives truncated: true from the empty content array in the reasoning item — a side-effect of fixture redaction, not a property of the live call. However, the exchange record field truncated is what the replay test consumes. If the output mapping treats truncated: true in the exchange record as evidence that the model's response was incomplete (per principle VIII, incomplete evidence → Unresolved), report.result for the responses-rank-smoke-0 replay will not be Ok, and report.result.unwrap() at recorded.rs:181 will panic. The Converse rank fixture for the same operation does not set this field, so the asymmetry is not explained by the operation type.

{"head": "b3e54aa8c93a13c8ea8e0f7aaf4581fb31a7f086", "verdict": "findings", "findings": [{"path": "integrations/rustev-bedrock/fixtures/recorded/responses-rank-smoke-0.json", "line": 24, "summary": "exchange_record sets `truncated: true` while response_body shows status `completed` with a full ranking; the field was likely set as a side-effect of redacting the reasoning item's content to an empty array, but if the integration treats it as a signal of an incomplete model response the replay assertion at recorded.rs:181 will panic."}]}

Subject: 3dc1e1c...b3e54aa, diff digest e0755acb5f61fb8a047c464a4572e3ff5eb3078649b3c5809334156ff3bbecb0, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception November 2, 2026 09:53 — with GitHub Actions Inactive
@bartekus
bartekus force-pushed the impl/039-rank-smoke branch from b3e54aa to fac68ec Compare November 2, 2026 19:23
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

AI review (findings)

Reviewing the PR, which extends the Bedrock integration's recorded smoke tests to cover rank operations on both wires.

Projection structure doesn't match the recorded request body

In integrations/rustev-bedrock/src/evidence.rs (lines 13–22), probe_projection("rank") builds a JSON object that includes the fields "operation", "candidates", "task", and "question" alongside "presented", "mode", "instance", and "values".

However, the serialized user-message content in the recorded Converse fixture (converse-rank-smoke-0.json, messages[0].content[0].text) is:

{"instance":{"text":"apple"},"mode":"listwise","presented":[...],"values":{}}

The extra fields ("operation", "candidates", "task") are entirely absent from the body that was actually sent during the live call. "question" was used by the mapping layer for the system prompt, but "candidates" and "task" have no apparent role in either the system prompt or the message body.

If the mapping layer serialises the full projection as the message content (rather than extracting a strict subset of keys), the bytes sent during replay will differ from those sent live, the request digest won't match converse-rank-smoke-0.json's request_digest, and recorded_exchanges_replay_offline will fail. Even if the mapping layer strips unrecognised keys, "candidates" duplicates the IDs already present in "presented", and its presence creates a latent risk that a future change to the mapping layer could pick up the wrong field.

{
  "head": "fac68ec4e4dfbe82ab172a6d5c47685957b5b798",
  "verdict": "findings",
  "findings": [
    {
      "path": "integrations/rustev-bedrock/src/evidence.rs",
      "line": 13,
      "summary": "probe_projection(\"rank\") emits \"candidates\", \"task\", and \"operation\" fields absent from the recorded request body; if the mapping layer does not strip these, the replayed request bytes will not match the recorded digest and the offline replay test will fail."
    }
  ]
}

Subject: 50ca9ad...fac68ec, diff digest b47a4a4c653aeb0b8b0988c1e64704268dc5535c9d65df36302225776bda2e2a, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception November 2, 2026 19:30 — with GitHub Actions Inactive
One listwise rank call on each wire under Decision 18 with synthetic content, reserved against the R-29 testing journal. The smoke's synthetic projection gains rank; both exchanges are recorded, redacted, and replay offline; spec 039 records the result and the journal totals.
@bartekus
bartekus force-pushed the impl/039-rank-smoke branch from fac68ec to 958d21b Compare November 2, 2026 19:31
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

AI review (no-findings)

I reviewed the full diff, checking the new fixture consistency, evidence code, test updates, and spec change.

integrations/rustev-bedrock/src/evidence.rs — The rank branch of probe_projection is internally consistent: presented is built from ids (three synthetic fruits), the question text matches what appears in the recorded system prompt, and the values: {} / options: [] agree with both fixture request bodies.

converse-rank-smoke-0.json / responses-rank-smoke-0.json — Both fixture exchange records are internally consistent (bindings referenced by SHA-256 in exchange_record.binding, usage totals sum correctly, charge estimates at declared pricing are arithmetically plausible). The provider.answer_annotations in both records agree with the asserted RawOutput::Ranking in the test. The "type": "tool_use" field nested inside the toolUse object in the Converse response body is an atypical field position, but because this is a declared live recording the parsing code evidently handles it; I cannot call this a defect without seeing the serialization of existing recorded exchanges.

recorded.rs — Adding "truncated" to the member-compare list applies to all seven entries, not just the new rank records. The new Converse rank fixture has "truncated": false and the Responses rank fixture has "truncated": true (for the documented MAX_ENTRIES reason). If any pre-existing Converse fixture omits the truncated field entirely, recorded["truncated"] would be Value::Null and so would replayed["truncated"], so they'd still match; no breakage from that path. No logic errors in the if operation == "rank" branch selecting RawOutput::Ranking vs RawOutput::Label.

specs/039-model-backed-rank/spec.md — The journal totals, token counts, and charge values recorded in the spec text are internally consistent with the fixture data. The smoke is correctly described as outside declared verification and not a quality claim.

No concrete defects found.

{"head": "958d21bea9eed37b9005246734fcd4fba7bae6de", "verdict": "no-findings", "findings": []}

Subject: 50ca9ad...958d21b, diff digest 62027f25f99192d9e05d119035a6cfa650167d3b6bb19df780503ec77b615557, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus enabled auto-merge November 2, 2026 19:41
@bartekus
bartekus added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit d82dc35 Nov 2, 2026
30 checks passed
@bartekus
bartekus deleted the impl/039-rank-smoke branch November 2, 2026 23:51
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