Repository navigation
refactor(reporting): run every report publish through one shared owner - #182
Conversation
There was a problem hiding this comment.
This review found 1 issue(s), including 1 blocking issue(s).
| boundary_prefix="----" + namespace, | ||
| filename=namespace + ".zip", |
There was a problem hiding this comment.
P1: Preserve multipart bytes when resuming pre-refactor receipt operations. Web Search and public WebArena previously used ----webfetch and webfetch.zip, but their journal identities and keys are unchanged here. An existing journal therefore passes operations.pending(), and when operation recovery returns retryable, this code resends a different body under the original Idempotency-Key. That breaks the interrupted-upload compatibility contract and can leave the release unable to complete due to an idempotency payload conflict. The PR warning to finish uploads first does not protect existing journals at runtime. Preserve the legacy multipart encoding for those pending operations (with an explicit encoding marker for new operations), and cover resuming a pre-refactor journal against a retryable operation; do not simply allocate a fresh key for an uncertain upload.
There was a problem hiding this comment.
✅ Re-review complete · c9fa416
No findings in this incremental review.
There was a problem hiding this comment.
Independent review, round 1
Reviewed head c9fa4161 against main f877f6a6. No correctness bug or rule violation found. Four test and PR-text findings below, none blocking on behaviour.
Findings
P2. tests/test_reporting_publish_client.py:370: the Web Search and public WebArena identity test bypasses both adapters.
test_receipt_tracks_send_their_own_identity_and_keep_replayable_upload_bytes builds its own ReceiptRelease from owner.CLIENT and owner.UPLOAD_NAME, so web_search.publish and public_webarena.publish_current never run. The PR lists this as coverage of those tracks sending their own identity with byte-identical uploads.
I checked with two mutations. Changing the wiring at src/harness/web_search/publication.py:163 and src/harness/trajectory_replay/public_webarena/publication.py:452 to upload_name="search" / "public-webarena" and a WebFetch-Report-Publisher client passes all 12 publish test files. That wiring is what keeps an interrupted operation replayable.
Fix: drive the real publish and publish_current entry points behind the wire fixture with no transport, then assert the user agent and body.
P2. src/harness/reporting/publish.py:632: no test covers token stripping on the bound lifecycle any more, while replay now stores raw service responses.
The PR deletes test_track_receipts_use_the_shared_writer. Replay previously wrote fixed fields only; it now persists the creation response at this line and keeps response fields in settled. The code is correct today because every write uses write_receipt.
Replacing this write_receipt with atomic_write(track.receipt, json_bytes(result)) passes the same 12 files, so a service-returned editToken could reach the pending receipt unnoticed. test_receipt_is_private_and_drops_service_credentials_at_every_depth only exercises the writer directly.
Fix: parametrize a Browser Use and replay create flow whose response carries editToken and claimToken, and assert neither reaches the receipt in the pending or final state.
P2. src/harness/reporting/publish.py:502, :633, :667-668, :119: most behaviour changes listed in the PR have no test.
Each of these mutations passes the 12 publish test files:
- A resumed create never reuses the share URL in its receipt (
share_url = ""at:633). The PR says it reuses it. settled = {}at:667, which drops the replay and Browser Use response fields the PR says are kept.if key not in {"phase"}at:668, which keeps staleversion/versionIdkeys, so "one key per track" is not enforced.- Removing the title guard at
:118-119. The PR says creating a site without a title now fails. pending_created_sitereturning""wheneververifiedis notFalse(:502), which restores the old Browser Use behaviour the PR says changed.
The bound replay profile with no share URL also has no test; the code reads correctly.
Fix: add one synthetic flow per item. These are recovery paths that run after an interrupted release, so they are unlikely to get exercised otherwise.
P3. PR body, "Behavior changes": the verified entry is imprecise and one change is missing.
- The body says a pending create whose receipt has no
verifiedfield "now raises". It raises only when base URL, archive or slug differ. A matching receipt resumes the create (pending_created_sitereturned the slug when I called it directly). Resuming looks safe becauseverify_exportstill proves the bytes, but the text should say so. - Not listed:
src/harness/reporting/publish.py:617makes Browser Use prefer the profile'sshare_urlover the receipt's. Before, it used the receipt's and created a new share if the receipt had none. If the two disagree, it now verifies and re-binds the profile's URL. The mutation that ignores the profile's URL also passes all tests.
Fix: correct the text, and add a test for the precedence.
Verified, no defect
- Moved helpers: an AST comparison against
web_fetch/publication.pyshowsupdated_receiptandput_fileare identical.upload_large_archivediffers only by its title default and the new guard. - Receipt lifecycle: read line by line against the old
publish. It differs only in renames and the removal of a redundant check.validate_releasestays Web Fetch only, in the adapter. Journal schemas and key prefixes are unchanged. - Bound lifecycle: identity fields, staged idempotency keys, version fields, preview checks and binding match both old copies, apart from the changes listed in the PR. Public requests stay unauthenticated.
- WCXB: the staged update is a parameterized move. Binding still happens inside the snapshot.
- Targets and tokens: the owner has no default site.
publication_target.pyis a pure rename, and credential loading is untouched. - Repository inventory: no references remain to removed paths or helpers, including in
evaluation/,research/andconfigs/. Each affected module imports on its own in a fresh interpreter, so no import cycle. - Scope:
Closes #178holds. No other module runs a publish;rename_mainandpublication_verifyare not publish orchestration.
Test and CI results
- Lint gate: passes.
- Local tests with
PYTHONPATHon this checkout: 235 passed (publish and golden targets), 433 passed (15 further files that touch publication).tests/test_golden_reports.pypasses with no snapshot changes. - CI on
c9fa4161: Tests and static checks, Installation and packaging, Rendered reference and report checks all succeed. The PR is mergeable and main has not moved. - I did not run the full local suite, and nothing was published.
|
Round 1 review findings. All four are addressed with no change to P2, Web Search and public WebArena identity test (0c563e5). The test now runs the real P2, tokens in receipts (5bbe47e, extended in 28eb032). A parametrized Browser Use and replay create flow has a service response carrying P2, untested behaviour changes (28eb032). Added one synthetic flow per listed behaviour, for both bound tracks:
P3, PR text and share URL precedence (c39aa25). The Behavior changes section is corrected:
c39aa25 tests the order of profile, then receipt, then create. How this was checked. I ran 22 source mutations one at a time, covering each mutation named in the findings. All 22 fail the new tests. Local results: lint passes, and 329 tests pass across the 15 publish and golden test files with no snapshot changes. Nothing was published and no real Artifact Site was called. |
There was a problem hiding this comment.
ℹ️ Review skipped · c39aa25
No reviewable content was selected for this run.
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 2
Reviewed head c39aa25e. CI passes on this head: Tests and static checks, Installation and packaging, and Rendered reference and report checks. The four round 1 findings are resolved. This round found three P2 and two P3 items. None of them changes rendered output or touches evidence.
Findings
P2: src/harness/reporting/publish.py:576-581: replay creates a new site without --create when the archive is large.
- Problem:
upload()takesallow_createbut returns from the staged branch before using it. A single-request create without--createstops with "no bound site or matching pending creation operation". An archive over 23 MB skips that check. I ranreplay.main(create=False)on an unbound profile with the threshold set to 0, behind a fakedurlopen. It sentPOST /api/uploads,POST /api/uploads/stage_one/commitandPOST /api/sites/site-new/shares. - Origin: the base code has the same gap in its large-archive branch, so this is not a regression. The merged helper now makes the ignored parameter look enforced.
- Fix: in the staged branch, raise when
slug is None and not allow_create, and add a test next totest_browser_use_requires_its_receipt_and_replay_stages_large_archives. If this should stay out of this PR, open a follow-up issue and link it.
P2: src/harness/web_fetch/report_publish.py:53 and src/harness/reporting/publish.py:264: the data attachment target check has no test.
- Problem: this PR moved the check that attachments match the publication authority and its service into an optional
check_targetcallback. The code is correct, but removing the call atpublish.py:264-265passes all 22 publish-related test files. No test in the repository mentionsparts_manifestor this error, at base or at head. Issue #178 requires each report to keep its own target. - Fix: add one Web Fetch publish test with a
parts_manifest, covering mismatcheddata_publicationsand a mismatchedbase_url. Both should fail before any request.
P2: src/harness/reporting/publish.py:563-566: nothing pins the journal identity of a bound update.
- Problem: the PR's reason for keeping three lifecycles is that an interrupted release must still resume from its persisted journal. Removing
slugandexpected_versionfrom the identity passes all 22 files, even though it changeskindtocreate. It also lets a journal written for one expected version match another. The current code matches the old field values, but only the schema string is protected. - Fix: assert the exact journal written by a Browser Use and a replay update, as a literal dict. Then resume from a literal journal in the pre-PR format and check that it replays its key.
P3: src/harness/reporting/publish.py:667-668: settled can keep a second version key.
- Problem: it drops
versionandversionId, but the old Browser Use code also readversion_idandcurrentVersionId. If a response carries either one, it stays in the receipt and is carried into later receipts, where it can go stale. The PR says the version stays under one key per track. No current code reads these keys, so the harm is a misleading receipt. - Fix: drop those two keys as well, and extend
test_bound_update_settles_one_version_key_from_the_lookup_and_keeps_response_fields.
P3: src/harness/reporting/publish.py:640, 647, 654, 713: four failure gates have no negative test.
- Problem: each of these can be removed with all 22 files still passing: the
https://check on a created share URL, the title PATCH failure check, the public share non-200 check, and the WCXB check that the expected version matches its pending operation. - Fix: add one failing-response case for each.
What I verified
- Compared the Browser Use, replay, Web Fetch, Web Search, public WebArena and WCXB flows against base
f877f6a6. The PR's Behavior changes list matches the code. I found only trivial unlisted differences, such as error types and messages, and Web Fetch validating the release before rejecting an unknown mode. - Idempotency keys, staged key seeds, multipart names, client identities and timeouts are preserved, apart from the listed user agent change.
put_fileandupload_large_archivemoved unchanged apart from the listed title guard. - Each adapter still names its own target and client, and the owner holds no default site. Token handling in
artifact_auth.pyis unchanged apart from an import path. - No references to removed modules or helpers remain in
src,scripts,tests,docsor.agents. Each changed publisher module imports cleanly in a fresh interpreter. - Lint gate passes. 265 tests passed across the publish, recovery, upload, token, WCXB, Web Search, Browser Use, replay and golden test files, with no snapshot changes. A wider set of 22 publish-related files passed 620.
- New tests use only reserved example hosts, and I found no local paths or credentials in the diff.
Mutation check
I ran 38 of my own local mutations, none committed: 22 were killed and 16 survived. Six of the survivors were rerun against the 22-file set and still survived; those are the ones cited above. The other survivors ran only against a narrower 12-file set and are not reported. Several are redundant with a later check, such as release.check() or the final export, or are outside this PR's changes.
Nothing was published and no real Artifact Site was called.
|
Round 2 review findings. All five are fixed and none are disputed. New head: d57ad18. P2, staged create ignored P2, data attachment target check (d57ad18). A Web Fetch P2, journal identity of a bound update (c62ffdc).
P3, stale version keys (641bd62). P3, failure gates (ff8b9c0).
Each failure case also asserts the release stays unbound. How this was checked. I ran 15 source mutations one at a time, covering each gate above and each identity field. All 15 fail the new tests, and the mutations were not committed. Local results: lint passes. Across the 30 test files that reference the publish modules, plus golden routes: 829 passed, 3 failed, with no snapshot changes. The 3 failures are in |
There was a problem hiding this comment.
✅ Re-review complete · d57ad18
No findings in this incremental review.
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 3
Reviewed head d57ad188 against base f877f6a6. Main has not moved and the PR is mergeable.
Findings
P3, src/harness/web_fetch/report_publish.py:42: dead validation_inputs parameter.
- Problem: Web Search and public WebArena were the only reasons
publish()tookvalidation_inputs. Both now callpublish_receipt_releasedirectly, so no code insrc,scriptsortestspasses it. The parameter stays only as a default that lines 46 and 51 extend. AGENTS.md asks for superseded code to be removed in the same change. - Fix: remove the parameter and start from a local
validation_inputs = ().package_checkcan stay, since the tests use it to replace the package check.
No other defects found.
What I verified
- CI on this head: Tests and static checks, Installation and packaging, Rendered reference and report checks, and Python 3.11 all pass.
- Local checks: both lint gates pass. All 27 test files that reference the publish modules pass (836 tests), including
tests/test_golden_reports.py, with no snapshot changes. - Old and new code: I compared the old Browser Use and replay
_publish, Web Fetchpublishand WCXBpublishwith the new lifecycles, line by line. Every difference I found in requests, receipts and journals is listed under the PR's Behavior changes. Journal identity, idempotency keys, multipart boundary and filename are unchanged for each track, and resuming from a receipt or journal written before this PR still works by code reading. - Round 2 fixes: the staged create gate, the data attachment target check, the journal identity, the settled version keys and the four failure gates are all present in the code. I re-ran mutations only for the attachment target check and the journal identity, and both fail the tests. I did not repeat the author's mutations for the others.
- Scope of
Closes #178: every publisher usingPublicationClientfor orchestration goes throughreporting/publish.py, andweb_fetch/publication_verify.pyonly verifies. Each adapter names its own target and the owner holds no default site. Token handling stays behindPublicationClient, and no references to the removed helpers or the oldpublication_targetpath remain. - Imports: each moved or changed module imports on its own in a fresh interpreter, so there is no import cycle between
artifact_authandreporting. - Repository rules: no aliases, evidence or profiles changed. Added test URLs use only
.exampleand.invalidhosts, and I found no private paths in the diff.
Existing test gaps (not findings)
I ran 63 further source mutations against those 27 test files. 26 survive on this head, for example:
- the frozen release check before each bound request
- the final
validate_package - the incomplete binding check
- the replay preview marker
- the WCXB profile guard
- the adapter
inputsfor replay, Web Search and public WebArena
I applied the equivalent mutations to base f877f6a6, and they survive there too, so this PR did not cause the gaps. The test files were not the full suite. These could be a separate follow-up, but they do not need to block this PR.
Nothing was published and no real Artifact Site was called.
|
Review round 3: fixed the P3 finding in 22016d1. |
There was a problem hiding this comment.
✅ Re-review complete · 22016d1
No findings in this incremental review.
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 4
Reviewed head 22016d14 against base f877f6a6. Main has not moved. No defects found.
What I verified
- CI: Tests and static checks, Installation and packaging, Rendered reference and report checks, and Python 3.11 all pass on this head.
- Local run: both lint gates pass. All 30 test files that reference the publish modules, plus
tests/test_golden_reports.py, gave 849 passed. No golden snapshot changed. - Round 3 fix:
22016d14touches onlyweb_fetch/report_publish.py. No caller passesvalidation_inputsany more, andpublish()builds the same inputs in the same order as base. - Receipt lifecycle: I compared it line by line with base
publish.- The Web Fetch release validation still runs, and only for Web Fetch.
- Web Search and public WebArena keep their namespaces,
----webfetchboundary,webfetch.zipfilename and boundary seed, so a pending operation replays the same bytes. - Their new clients have the same timeouts and error behaviour as the Web Fetch client; only the user agent differs.
- Bound lifecycle: I compared it with both base
_publishfunctions.- Replay's operation identity, staged keys, request order and public checks match base.
- Browser Use differs only in the ways the PR lists, and I found no unlisted request-level change.
- The interrupted paths still recover: a crash after upload, before binding, and after binding but before the final receipt.
- WCXB: the journal name, idempotency keys, frozen inputs and failure checks match base.
- Targets and tokens: the shared owner holds no default site or title. Token loading stays behind
PublicationClient, and public share requests stay unauthenticated in both bound tracks. - Repository inventory: nothing still refers to
web_fetch/publication_targetor the moved helpers. URLs in added lines all use example domains, and the diff adds no local paths or credentials. - Scope:
web_fetch/report_publish.pyno longer holds the orchestration, and the only remaining site request outside the owner is the separate rename command.publication_verify.pystill makes its own read-only site requests for verification.Closes #178is accurate. Nothing was published, and no real Artifact Site was called.
Mutation check
I ran 14 new local mutations on the adapters and publish.py against those 30 test files plus the golden tests; none was committed. Eight failed the tests and six survived:
| Surviving mutation | Assessment |
|---|---|
Web Fetch inputs not frozen |
Same gap on base |
Replay REVIEW not frozen |
Same gap on base; the final validate_package also checks its hash |
Final validate_package removed from the bound lifecycle |
Same gap on base, on both tracks |
| WCXB profile guard off | The snapshot also freezes the profile, so this check overlaps |
| Receipt lifecycle share URL check removed | Code moved unchanged; not re-run on base |
Sharing moderation check removed |
Code moved unchanged; not re-run on base |
The wiring is correct by inspection in all six, so I am not raising them as findings against this PR. They could go in a separate test-coverage issue if the owner wants them pinned.
The PR's Test plan does not list the round 3 run or this head's CI result. Its CI line says to see the checks, so it is not misleading.
Move the publication lifecycles to harness/reporting/publish.py and reduce Web Fetch, Web Search, public WebArena, WCXB, Browser Use and trajectory replay to adapters that name their own target, client and journals. Merge the Browser Use and replay copies into one bound lifecycle, and move the target rules beside the other shared publication primitives.
…h their real publish entry points
…response spellings
… and resume from a saved journal
22016d1 to
f327411
Compare
Issues
Closes #178
Summary
src/harness/reporting/publish.pynow owns publish orchestration. Every track is an adapter that names its own target, version, client and journals. The owner has no default site. CLI flags and profile fields are unchanged, and nothing was published.publish_receipt_releasepublish_bound_releasepublish_staged_updateI kept three lifecycles rather than one because they differ in what they prove and where they store state. Forcing them together would change persisted journal and receipt formats, which an interrupted release must still be able to resume from.
_publishcopies in Browser Use and replay are merged. Their differences are now explicitBoundTrackfields.web_fetch/report_publish.py.upload_large_archive,put_fileandupdated_receiptmoved fromweb_fetch/publication.pyto the owner.publication_target.pymoved toharness/reporting/. Superseded helpers are removed with no aliases.artifact_auth.pyandweb_fetch/safety.pystay where they are, asreporting/publication.pyalready imported them.Behavior changes
No rendered output changed. These request-level changes came from the merge, so please check them:
verifiedfield: Browser Use previously started a new create. It now treats the receipt as pending, as replay already did: a matching receipt resumes without a second create, and a receipt for another base URL or package raises before any request. A receipt withverified: trueis still not pending.versionfor replay,versionIdfor Browser Use). Other version keys (version,versionId,version_id,currentVersionId) andphaseare dropped when a release settles, and tokens are still stripped.--create, as a smaller archive already did. Previously the staged path ignored the flag and created the site. It now stops before any request with the same error.Web-Search-Report-Publisher/1.0,Public-WebArena-Report-Publisher/1.0). Their multipart upload bytes stay identical, including thewebfetchboundary and filename, so an interrupted operation still replays the same body under its idempotency key.upload_large_archiveno longer defaults to the Web Fetch title. Creating a site without a title now fails before any request.Test plan
ruff check --config 'include=["*.py"]' --select F,TID252 .andruff checkboth pass.tests/test_golden_reports.pypasses with no snapshot changes.urlopenfaked: Web Searchpublishand public WebArenapublish_currentidentity and multipart bytes; Browser Use and replay create and update receipts holding no service token in the pending, binding or final state; one version key taken from the post-upload lookup; share URL precedence and share creation for a bound profile; resuming a create after an interrupted binding; matching and mismatching receipts with noverifiedfield; a verified receipt not counting as pending; own and foreign operation journals; a moved remote version accepted only when the export proves the same bytes; and the upload title guard.publish.py(upload name, client, namespace, raw receipt writes, the share URL, settled fields, the title guard, theverifiedcheck, export check, version source, journal check), run one at a time againsttests/test_reporting_publish_client.pyandtests/test_reporting_upload.py. All 22 fail the tests. The mutations were not committed.tests/test_optional_reports.py(Dataset revision is not recorded in data-lock.json) and fail the same way on base f877f6a. No golden snapshot changed.tests/test_reporting_publish_client.py,tests/test_wcxb_publication.pyandtests/test_webfetch_report_publish.py. They covered the staged create gate, the data attachment target checks, the journal identity fields, the settled keys and the four failure gates. All 15 fail the tests. The mutations were not committed.pythonpathoption rather than thePYTHONPATHenvironment variable, so subprocess tests imported the shared environment's installed checkout instead of this branch. I did not triage the 79 failures individually, so CI is the gate for them.urlopen.