Repository navigation
Conversation
On a conflict, the follow-up write now re-reads the row and re-plans against it once instead of dropping its results. The re-plan sees every write since, so lookups superseded by a newer opt-out are discarded and a withdrawn row is never revived. A conflicting write lands nothing, so commit_after_response hands the AfterResponseWrite permit back on Conflict only. At most one follow-up write lands per navigation. The outcome log line moves into core and adds conflicts=<n> so the conflict rate can be measured. Closes #1553
The permit for the follow-up write used to leave KvIdentityGraph on a conflict, inside a rejection whose Option field said whether a retry was allowed. KvIdentityGraph::commit_after_response now spends the permit once and runs the bounded retry itself: it reads the row, asks a re-plan closure for the update, and after a conflict reads and re-plans again, for at most MAX_AFTER_RESPONSE_ATTEMPTS attempts. At most one write lands. The rejection is now an enum (Skipped, Conflict, ReadFailed, WriteFailed), so a conflict cannot be mistaken for a store failure. Fastly KV is eventually consistent, so a re-read can return the generation that just lost the CAS. That re-read now ends with outcome conflict and no second write. A failed read of the row now reports failed instead of no_row, so no_row means only a missing or withdrawn row. ConflictInjectingEcKv moves to kv_backend::test_support. Its race closure writes through serialize_entry, so the raced row carries real metadata. kv.rs and after_response.rs both use it, and RacingEcKv is removed. The retry tests now assert the conflict count, and new tests cover a stale re-read, failed reads and an unretried store error. The CHANGELOG and spec no longer say the retry honours every withdrawal recorded since dispatch. A row withdrawn and given consent again before the read is not detected, which is now tracked in #1664. Refs #1553
A lost CAS proves the row exists at a newer generation, so a re-read that returns the generation that just lost, or no row at all, is a stale read of an eventually consistent store. Reporting it as `conflict` hid it among real second-attempt conflicts, and a stale Missing row was reported as `no_row`. Both now stop without a second write as `stale_read`, so the two can be measured apart and `no_row` keeps meaning a missing or withdrawn row. Fastly generations are unique but not ordered, so an older generation cannot be detected and is not faked. Also describe the permit as spent before the first read, run the scenario 23 tombstone test through the real planner with an exact outcome, and keep MAX_AFTER_RESPONSE_ATTEMPTS and serialize_entry from widening production visibility (a cfg(test) accessor serves the test stores). Refs #1553
EcKvStore gains update, which RecordEcKvStore implements with EdgeZero's RecordHandle::update (IABTechLab/edgezero#536). KvIdentityGraph keeps the permit and the identity plan and makes one bounded update; a store without it reports Unsupported and the write falls back to last-write-wins. EdgeZero is pinned to the rc/identity commit 9d02d7b3 with #536 merged. Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
This brings in 1f054c6 from #1488, which forwards ortb2.user.ext.eids from the Prebid config into the auction EIDs, and a99dd66, a62601b, d1eb75f and 394892b from #1489, which cap mirrored UID expiry at 30 days from the UTC day start and pass the request time into finalize. They arrive through the chain's merges into #1639, #1640, #1612, #1628, #1623, #1531, #1532, #1533, #1534, #1536, #1535, #1537, #1539, #1538, #1540, #1566, #1624, #1641, #1642 and #1646, with #1646's move of the request time into IdentityApp::finalize. It also brings d5276ee, which publishes the native AWS runtime files without GNU mv -T, and Christian's merge 5597d3e of #1538 into #1540, through #1566's merge. The base now also carries the Axum serving line (#1613, #1616, #1617, #1615, #1635, #1637 and #1627), which #1533 merged, and #1627's b958107, which decodes the Spin discovery document with Response::json, and #1627's merge of #1625 (006b45e), which pins Wrangler for the Cloudflare smoke and CI. The merge also brings the 12 #1646 commits this PR lacked, from 48a43ae to 461aa0d: dhruv8sh's page-phase lookup and /auction EID work (48a43ae, 82fe088, 1d0a74f, 838586e and his chain merges a061c01, ecf16e8, e1d23a0, edcf4c5 and 9a020e1), the merge 9cad928 of #1641 into #1642, and prk-Jr's "Merge providers-awaited into shared identity" (4ffbaf8) and "Restore Fastly auction browser gating" (461aa0d). It also brings b2d4bfd from #1488, which records the known UID hashes on lookup results with a setter, so the provider IDs the write planner logs are not derived from them. The base now also carries #1506's repin of EdgeZero to rc/identity at d063a8e7 and its merge of main's Fastly SDK 0.13.3 upgrade (#1671): fastly 0.13.3, url 2.5.9 and Viceroy 0.22.0. The base now also carries #1627's 4d0c1a2, which renames the generic runtime KV store to trusted_server_runtime_kv, #1488's a610152 and 9104fd3, which add hashed-email intake for the LiveRamp and ID5 identity providers, and #1646's aa31559, which gates identity writes for rejected clients. This PR's head moves to 8478372, which releases every paused request-time write during drain, through be48eef, its clean merge of #1646's aa31559. Taken as the change from the old head b8addd3, the new head would replay #1646 commits the base already carries in rebuilt form and conflicts in six files. be48eef is a clean merge of aa31559, which the base has, so the merge takes the change from be48eef: 8478372's scripts/test-native-ec-image.mjs edit, which applies cleanly. The base now also carries #1646's 4f4c036, which expects the failure router in the native container startup test, and #1488's f063a76, which lets the hashed-email status call use POST, a body and extra headers. scripts/test-native-container.mjs conflicts in the invalid-input check: 4f4c036 lets readiness follow the initialization failure, since the process keeps serving the failure router, and asserts each input's own diagnostic, while this PR asserts the missing-secret store message and matches only a lifecycle ready event. The merge keeps 4f4c036's diagnostic and ordering checks and this PR's missing-secret check, and the ordering check finds the ready event with this PR's lifecycle pattern.
This PR now stacks on #1662 instead of #1641, so rc/identity can take both as plain merges. #1662's new head (9df0101) sits on #1661, #1656, #1626, #1636, #1646 and #1642, which sit on #1641, so the merge brings #1642 (awaited identity lookups and /auction body EIDs), #1646 (Axum identity through the shared application), #1636 (Axum's after-response drain on #1646's runner), #1626 (provider opt-outs and legacy EID expiry), #1656 (the configurable Edge Cookie browser gate), #1661 (refusing EC creation when a trusted JA4 contradicts the User-Agent) and #1662 (EC route acceptance on Fastly and the mirrored expiry cap), and the identity chain below #1641. EdgeZero pin: this PR pinned e9a22a70, a preview that merges EdgeZero 536 (RecordHandle::update) into the older rc/identity commit 9d02d7b3. The base carries #1506's repin to rc/identity at 459bd27d (42e0c46), which merges EdgeZero 536 itself, so the workspace and Axum manifests, Cargo.lock, the EdgeZero guide and the native RC guide take the base's pin and text. This PR's CHANGELOG entry keeps its description of the retry and names the 459bd27d pin. After-response write: #1646 moved the after-response lookup run from the Fastly adapter into core's IdentityApp::run_after_response_lookups, so post_delivery.rs takes the base's call into the identity app. The shared runner calls this PR's commit_after_response_lookups without logging the outcome itself, since this PR moves that log line into commit_after_response_lookups, where it also reports the conflict count. Each follow-up write still logs one outcome line. Core test support: #1613 compiles kv_backend's test_support module for the test-utils feature as well as tests, with each test-only store gated #[cfg(test)]. This PR's EcKvRecords, RecordBackedEcKv and ConflictInjectingEcKv doubles, its Race type and the imports only they use are gated the same way, since test-utils builds lack KvIdentityGraph::serialize_entry_for_test and use none of them. Axum drain tests: #1636's after_response_drain_tests fixture store implements insert but not update. This PR sends the follow-up write through EcKvStore::update, so the fixture's write fell back to last-write-wins, skipped the guarded insert that records and holds the write, and four drain tests failed. The fixture now implements update over its own lookup and insert with EdgeZero's RecordHandle::update contract: read, plan, write under the read generation, and re-read after a lost precondition, ending as StaleRead when the re-read returns the rejected generation or no row. The follow-up write is guarded again and the drain tests pass. EC KV store: the imports take this PR's AfterResponseCommit and AfterResponseRejection and the base's PartnerRegistry and write plan; Generation is no longer used there. Page-load write docs: the module comment keeps this PR's sentence that the graph spends the follow-up permit once, so at most one follow-up update lands, and #1646's sentence on the auction body EID update. CHANGELOG: this PR's compare-and-swap retry entry stays first under Changed, followed by #1661's JA4 entry, #1617's health and readiness entry and #1506's pin entry. S2S design logging: this PR adds the `stale_read` outcome and the `conflicts` count to the after-response write log, and #1488 adds that the hashed-email call logs one debug line with the reply status or transport error only. The paragraph keeps both.
|
Round 12 identity realignment:
Each merge message says what it carries and how any conflict was resolved. |
PR #1646's new head brings #1535's owner fix that keeps mirrored GPP consent through transient CMP not-ready states (#1678), #1535's move of the consent-update test host to publisher.example.com for the URL-host lint and #1540's allow-domain marks on the deployment guide's reference links. The merge is clean.
PR #1662's new head brings #1535's owner fix that keeps mirrored GPP consent through transient CMP not-ready states (#1678), #1535's move of the consent-update test host to publisher.example.com for the URL-host lint and #1540's allow-domain marks on the deployment guide's reference links. The merge is clean.
It brings #1535's owner fix that keeps mirrored GPP consent through transient CMP not-ready states (#1678), #1535's and #1540's URL-host lint fixes, and #1622's move of the new GPP bridge tests into its split test file, carried up to every tip: #1653, #1654, #1655, #1622, #1660, #1666, #1659, #1709, #1710, #1713 and #1557. #1503 is already contained. The octopus tree is the conflict-free union of the tips.
prk-Jr
left a comment
There was a problem hiding this comment.
Summary
The bounded retry is correct and well protected. EdgeZero's RecordHandle::update at the pinned 8a73c097 reads, plans, writes under the read generation, and re-reads after a lost precondition. The graph's planner runs against each snapshot, and the permit is spent once. Forcing MAX_AFTER_RESPONSE_ATTEMPTS to 1 fails seven of the new retry tests. Approving. R1 and R2 are real, but this PR's retry does not cause them; details below.
Non-blocking
🤔 thinking
- The spec says a newer opt-out always supersedes the results. A server opt-out that clears nothing does not. See inline at
docs/superpowers/specs/2026-10-30-s2s-eid-collection-design.md:231.
Cross-cutting / body-level findings
- 📝 R1 and R2 are planner behaviour that predates this PR. The retry only adds the short gap between its read and its CAS.
write_plan.rsand the coordinator are unchanged here. Before this PR, the follow-up write already read the row only after the lookups finished. A competing write that lands while the lookups are in flight, which is the long window, is read and merged by the single plan with no conflict at all.- R1 without any race: I ran a probe at
33c7a7ab. The row already holds a server opt-out remembered forexample-providerwith no revocation. The after-response lookup for that provider carriesOptOutMemory::Forgetand a found UID.write_lookupsreturnswritten conflicts=0, stores the UID and removes the opt-out memory. The racing variant gives the same row withconflicts=1. - R2:
apply_lookupsinserts each found record unconditionally (write_plan.rs:184-188). A server refresh that lands during dispatch is therefore overwritten on the first plan as well. - Where the fix goes: the fix Christian asks for belongs in
plan_write, where it covers both the first plan and the retry. Its tests should include the no-race ordering, where the competing write lands before the first read. A test that only injects the competing write at the CAS would pass while the longer window stays open. - Merge condition: I don't think this PR needs to carry that fix. A tracked follow-up is enough, or it can land here if you prefer.
- R1 without any race: I ran a probe at
- 📝 R3 (fallback overwrite) cannot be reached from a built-in adapter. Every production
EcKvStoreisRecordEcKvStoreorLazyRecordEcKvStore. Each maps EdgeZero'sKvError::UnsupportedtoEcKvUpdateError::Unsupported, and EdgeZero returns that only when the record binding is absent, as atedgezero-adapter-axum/src/key_value_store_records.rs:40. Without a binding, the fallback's ownread_snapshotfails the same way, so the outcome isfailedwith no overwrite. I agree it is a trait-contract concern for third-party stores and is non-blocking. - 📝 The PR description is out of date with the head.
- It says EdgeZero is pinned to
e9a22a70and listsCargo.toml,post_delivery.rsand the EdgeZero guides as changed. At this head the pin comes from the base (8a73c097), and none of those files differ fromfeat/1598-ec-route-fastly. - It still says "Stacked on #1641" and "Stays a draft until IABTechLab/edgezero#536 merges". The CHANGELOG entry is already correct.
- It says EdgeZero is pinned to
CI Status
At 33c7a7ab: 32 checks pass, including cargo test, cargo test (axum native), cargo test (cross-adapter parity), cargo fmt and format-docs. Two are pending: integration tests and integration tests (Fastly EC lifecycle). None fail.
| conflict the results are dropped; the source stays due and is retried on the | ||
| next navigation. | ||
| conflict the row is read again and the update re-planned against it once, | ||
| never resending the stale plan: results superseded by a provider opt-out |
There was a problem hiding this comment.
🤔 thinking: "results superseded by a provider opt-out recorded since dispatch are discarded" holds only for an opt-out that records a revocation. A server opt-out that cleared no UID only installs opt-out memory (write_plan.rs:192-210). A lookup carrying OptOutMemory::Forget then passes both the opted-out check and the revocation check, and it removes that memory.
I reproduced this with no race at all: written conflicts=0, the UID is stored and the opt-out is forgotten. So it is not specific to the retry; see the review body.
Once the planner records a revocation for a newly installed opt-out (Christian's R1), this sentence becomes true. Until then, it and the matching CHANGELOG sentence overstate the guarantee.
PR #1646's new head brings #1506's repin of EdgeZero to rc/identity ef5cbf30, which renames Fastly backends to ez_b31v2_* and moves the yanked pin-project-lite, chacha20 and spin, #1625's shared Wrangler installer for CI, #1639's pull reserve boundary check and wording, #1613's conformance doc alignment, #1616's certificate policy and pull-sync fixture corrections, #1617's preserved startup diagnostics and hardened runtime checks, #1635's complete startup evidence in native fixtures, #1637's shared readable non-Unicode Geo fixture, #1627's Spin store reads and retained runtime coverage and #1535's Sourcepoint consent mirror deduplication and consent update coverage. The merge is clean. Cargo.lock changes only the EdgeZero package sources (now ef5cbf30) and the yanked pin-project-lite, chacha20 and spin; the codegen crate's nested Cargo.lock is unchanged.
PR #1662's new head brings #1662's consent-string comment on the EC route fixture, plus #1506's repin of EdgeZero to rc/identity ef5cbf30, which renames Fastly backends to ez_b31v2_* and moves the yanked pin-project-lite, chacha20 and spin, #1625's shared Wrangler installer for CI, #1639's pull reserve boundary check and wording, #1613's conformance doc alignment, #1616's certificate policy and pull-sync fixture corrections, #1617's preserved startup diagnostics and hardened runtime checks, #1635's complete startup evidence in native fixtures, #1637's shared readable non-Unicode Geo fixture, #1627's Spin store reads and retained runtime coverage, #1535's Sourcepoint consent mirror deduplication and consent update coverage, #1636's stronger after-response body and drain checks, #1626's enforcement of stored and carried provider opt-outs, #1656's strict browser gate wording and #1661's grouped QUIC JA4 fixture. CHANGELOG.md: #1506's repin moved the EdgeZero pin entry to ef5cbf30 with EdgeZero pull request 275 at a3c5f3dd, and #1660 added its after-response retry entry after that line. The resolution keeps #1506's pin entry followed by #1660's entry, whose note that the pinned rc/identity commit carries EdgeZero pull request 536 now names ef5cbf30, which still contains it, in place of 8a73c097. Cargo.lock changes only the EdgeZero package sources (now ef5cbf30) and the yanked pin-project-lite, chacha20 and spin; the codegen crate's nested Cargo.lock is unchanged.
PR #1503 at 1d51b78: Add ts ec show and ts ec eids admin diagnostic commands PR #1653 at f217902: Clarify and verify the Axum local config handoff PR #1654 at e4e68bb: Verify pending record writes drain within shutdown grace PR #1655 at 7d0cdb2: Configure EC lifetime and renew it on eligible visits (DEC-13) PR #1659 at bd707f2: Verify geo consent paths on Axum and Fastly PR #1660 at 87c52cd: Retry an after-response write that loses its CAS PR #1666 at b1d7062: Verify identity gates and provider deadlines on Axum PR #1710 at 3d33359: Apply pull-sync consent checks to identify PR #1557 at 3982143: Carry Sourcepoint TCF consent to Trusted Server PR #1667 at f9ac6bb: Present a client certificate on auction providers that set mtls PR #1607 at b3a0b09: Send the resolved client IP to the publisher origin PR #1709 at 635f06a: Keep the EC out of bid request IDs and gate user.id on EID consent PR #1713 at e5f4d05: Apply consent rules to first-party click redirects PR #1622 at dd2ee39: Report CMP consent to the EC route and merge its answer into Prebid
|
Round 15 identity realignment:
Each merge message says what it carries and how any conflict was resolved. |
Require the existing application completion log during drain so a durable row cannot conceal a lost SDK acknowledgement. Centralize payload, UID and deadline checks and align startup documentation with the accepted failure-router policy. Refs #1579
|
Cascade of #1533's Axum startup-test port fix ( |
…tegration chain
…tegration chain
|
Merged #1627's runtime KV removal ( At the maintainer's request, that commit removes the generic runtime KV store Only that commit was merged, not the base branch's new head. Conflicts were resolved in Checks on this head: no reference to the removed store remains and |
PR #1503 at 6a8797e: Add ts ec show and ts ec eids admin diagnostic commands PR #1557 at a435778: Carry Sourcepoint TCF consent to Trusted Server PR #1607 at 07086f2: Send the resolved client IP to the publisher origin PR #1627 at 5b7fc3d: Wire declared stores and document unsupported Axum KV PR #1636 at d838931: Drain Axum after-response identity tasks on SIGTERM PR #1653 at 5b86d9b: Clarify and verify the Axum local config handoff PR #1654 at be495b3: Verify pending record writes drain within shutdown grace PR #1655 at 888c5f1: Configure EC lifetime and renew it on eligible visits (DEC-13) PR #1659 at 7b1d4a7: Verify geo consent paths on Axum and Fastly PR #1660 at 64a1baa: Retry an after-response write that loses its CAS PR #1667 at 1359722: Present a client certificate on auction providers that set mtls PR #1709 at bc43a3e: Keep the EC out of bid request IDs and gate user.id on EID consent PR #1710 at dc728a1: Apply pull-sync consent checks to identify PR #1713 at ffa7597: Apply consent rules to first-party click redirects PR #1722 at 070e2b0: Use applicable GPP sections from the CMP instead of header sections PR #1666 at 4720b0b (Verify identity gates and provider deadlines on Axum) arrives through #1659, and PR #1622 at c878e6e (Report CMP consent to the EC route and merge its answer into Prebid) arrives through #1722. Every other chain PR arrives through the tips above. The tree is the conflict-free union of these tips and carries no resolution of its own.
|
Round 17 identity realignment:
Each merge message says what it carries and how any conflict was resolved. |
The head of #1654 brings its record-write drain proof, which also requires the application's INFO after-response write completion between the native draining and stopped lifecycle records. #1660 merges it directly because the two PRs only meet in rc/identity, and the release candidate never carries a fix of its own. The merge is clean. Semantic fix: #1660 moves the after-response outcome log into commit_after_response_lookups, so the line now comes from trusted_server_core::ec::after_response and reads "After-response lookups: write outcome=written conflicts=<n>". #1654's verifier still expected the ec::app::lookups target and the message without the conflict count, so rc/identity's native container check failed with "after-response application must report INFO written completion during drain". scripts/native-record-verification.mjs now matches the moved line, its unit test fixture uses it, and docs/guide/native-container.md quotes it. The verifier still rejects a failed or no-op write, a wrong target and a wrong level.
PR #1660 at 3693ce9 now merges #1654 and points #1654's native record drain verifier at the after-response outcome line #1660 moved into ec::after_response. At 0ed8626 the native container check failed with "after-response application must report INFO written completion during drain". The merge is clean.
|
Round 17 follow-up: This branch fast-forwarded from
The merge is clean apart from the fix: |
…ntegration chain
|
Merged #1614's Trusted Server owns the This merge takes #1662's new head ( Checks on this head: no conflict markers; |
Summary
Conflictthe row is now read again and the update re-planned against it once. The re-plan discards lookups superseded by a provider opt-out recorded since dispatch and skips a row that is missing or withdrawn when re-read. A row withdrawn and re-consented before that read is not detected (follow-up Discard after-response lookup results when the row was withdrawn and revived during the lookups #1664). At most one follow-up write lands.RecordHandle::update(Add a bounded re-read and re-plan update for records edgezero#536).EcKvStoregainsupdate, whichRecordEcKvStoreimplements with it.KvIdentityGraphkeeps theAfterResponseWritepermit and the identity planner, as Add server-side identity on every adapter spec and plan #1559 has the graph own the identity policy. A store without the operation reportsUnsupported, and the write falls back to last-write-wins: one read, one plan and one unconditional overwrite.stale_readoutcome instead of a second write.conflictnow means the second CAS also lost. A store error reportsfailedand is not retried.conflicts=<n>, so the conflict rate can be measured.e9a22a70onpreview/1553-record-update: therc/identitycommit this stack already uses (9d02d7b3) with KV identity graph #536 merged, and nothing else.feat/record-backend-edgezero), next to Skip invalid stored EID values alone instead of failing the row #1657.Changes
Cargo.toml,crates/trusted-server-adapter-axum/Cargo.toml,Cargo.lock9d02d7b3→e9a22a70(#536 merged onto it).crates/trusted-server-core/src/ec/kv_backend.rsEcKvStore::update(defaultUnsupported) withEcKvReplacement,EcKvPlan,EcKvUpdate,EcKvUpdateOutcomeandEcKvUpdateError. Test support:RecordBackedEcKvruns EdgeZero's realRecordHandle::updateover any test double through a recordKvStorebridge;ConflictInjectingEcKvmoves here with a race closure;WriteFailingEcKvcounts inserts.crates/trusted-server-core/src/ec/record_backend.rsRecordEcKvStore::updateandLazyRecordEcKvStore::updateoverRecordHandle::update; EdgeZeroUnsupportedmaps toEcKvUpdateError::Unsupported.crates/trusted-server-core/src/ec/kv.rscommit_after_responsespends the permit, makes oneEcKvStore::updatewithMAX_AFTER_RESPONSE_ATTEMPTS = 2and maps its outcome; onUnsupportedit overwrites last-write-wins. Test constructors build graphs with the record update.crates/trusted-server-core/src/ec/page_load.rsAfterResponseRejection:Skipped,Conflict,StaleRead,StoreFailed,WriteFailed.crates/trusted-server-core/src/ec/after_response.rsAfter-response lookups: write outcome=<outcome> conflicts=<n>. Tests: retry against a fresh read, second conflict gives up, opt-out supersedes, withdrawn row not revived, stale re-read, missing re-read, failed re-read, failed first read, store error not retried, last-write-wins fallback writes and still skips a withdrawn row; each asserts the conflict count.crates/trusted-server-adapter-fastly/src/post_delivery.rsdocs/guide/edgezero.md,docs/guide/native-rc-demo.mddocs/superpowers/specs/2026-10-30-s2s-eid-collection-design.mdCHANGELOG.mdCloses
Closes #1553
Depends on IABTechLab/edgezero#536.
Spec
Spec: not a new feature. It is the follow-up the s2s EID collection spec deferred to #1553, and that spec is updated.
Test plan
cargo test-fastly && cargo test-fastly-reuse(4451 passed) andcargo test-axum && cargo test-cloudflare && cargo test-spincargo clippy-fastly && cargo clippy-axum && cargo clippy-cloudflare && cargo clippy-cloudflare-wasm && cargo clippy-spin-native && cargo clippy-spin-wasm && cargo clippy-cli && cargo clippy-codegencargo fmt --all -- --checkcargo test --manifest-path crates/trusted-server-integration-tests/Cargo.toml --test parityscripts/lint-wasm-clock.shCHANGELOG.mdfastly compute servestale_readasconflict, fails named tests. EdgeZero's own tests cover the loop (KV identity graph #536).Notes for review
Conflictretries. Store errors reportfailedand drop the results; the source stays due, so the next navigation asks again. Read and write failures inside the update are no longer told apart in the log, since EdgeZero returns one error.EcKvStorewithoutupdate; every production store isRecordEcKvStore, which has it. Its overwrite can replace a withdrawal tombstone written between its read and its write.rc/identity.Checklist
unwrap()in production code — useexpect("should ...")logmacros (notprintln!)