Repository navigation
Replay entry point, cache hit through replay, profile-aware path tests (#790 #788 #787) - #821
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Continues #816 (replayable snapshot), #818 (support matrix) and #787 (measurement profile).
What changed
--reuse-cacheanswers throughartifacts::cached_report→replay_report_as(snapshot, "cache"). The lossyto_audit_reportfallback is gone from the CLI path. Every non-hit is aCacheMisswith a printed reason: unreadable, incomplete, version-mismatched snapshot, or different audit configuration (signature, which already contains session policy,state_idand storage-state digest).load_artifactskeeps its API.auditmysite replay <snapshot.json | cache dir | URL>. A subcommand rather than a flag on the single-URL run: it takes no URL to fetch, starts no browser and does no reachability check, and its inputs and refusals differ from an audit. It yields a verdict exit code like an audit (source: replay).--session(only when given explicitly),--state-id,--storage-statemust match the stored measurement profile, elseReplayError::OtherMeasurement(field, stored, asserted). Flags go before the subcommand (auditmysite --state-id x replay URL), as for every other top-level flag.Replayis now a real mode: all four extra-check flags areRejectedfor it (a replay shows what the stored run recorded; it cannot measure), validated inArgs::validate.tests/replay_paths_test.rs(Chrome, local fixture, throw-away$HOME, added to the CI browser job): fresh vs cache hit vs replay give one model excepttimestamp,duration_ms,environment.source, with the server stopped before cache/replay. SPA fixture (content changes afterpushStatewithout reload, driven by the declared storage state): same profile twice → same content hash; other state → other content, andaudit::profile_differencesnamesstate_idandstorage_state; the plain run does not get the in-state cache entry; replay asserting another profile is refused. Unit tests for the profile check and the matrix;unchecked_normalize.txtbaseline lowered (cache path now usesnormalize_checked).Checks
cargo test,cargo clippy --all-features --all-targets -- -D warnings,cargo check --all-features,cargo test --test replay_paths_test -- --ignored(local Chrome) green; manual CLI run of hit/replay/refusals. (Onecargo testrun showed 7 failures in one suite while I was editing in parallel; two reruns were clean, I did not reproduce it.)Open
to_audit_reportis unused by the CLI now; kept because it is public API.replay; covered by library tests and a manual run.../auditmysite_studio, not touched): needssession,storage_state(Option<StorageState>fromStorageState::load) andstate_idin itsPipelineConfigliterals, a UI/setting for them, and should include them in any cache key it keeps; it can useaudit::cached_report/CacheMissto show why a stored result was not reused.