mirror of
https://github.com/morluto/rea.git
synced 2026-11-09 16:26:36 +00:00
* feat(browser): record when scenario requests were observed and how long they took Request events carry observed_at, the wall-clock time the provider observed the request start, and finished or failed events carry the browser's elapsed_ms when it reports one. Both are optional, so earlier captures still parse, and scenario comparisons leave them out as a committed built-in rule. The real-Chrome network lane checks every request and finished response is timed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(environment): time browser scenario records so their state learns a write clock Scenario records take startedDateTime from when each request was observed and time from the browser's duration, as HAR entries are timed. A timed scenario of the book session learns the same clock and serves the same writes as its HAR; an untimed one keeps record order and learns no clock, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(environment): document scenario request times and timed scenario records Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(environment): start scenario records at the browser's own request start The provider observes a request up to tens of milliseconds after the browser starts it while it reads other responses, so a record starting then and ending after the browser's duration mixed two clocks. Finished and failed events now carry the browser's started_at, records prefer it and fall back to observed_at, and comparisons drop it too. Tests cover the fallback for a request that never ended or ended twice, a partly untimed capture keeping record order, comparing an untimed capture with a timed one, and the real-Chrome lane checks every finished request carries the browser's start and duration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(environment): document the browser start time, its fallback lag and older readers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(environment): record the scenario timing verification Gates, the real-Chrome lane, prompt-recorded and re-recorded published scenario captures built with and without their times, the stale published environments left unrepublished, and the review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(browser): compare timed completion events in the request-time comparison test The comparison test's captures had no finished or failed events, so dropping started_at and elapsed_ms from them went untested. The captures now end one request and fail the other, the test asserts both carry times, compares them shifted by seven seconds and against an untimed capture, and a control shows a changed failure on a timed completion is still reported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2.2 KiB
2.2 KiB
Time browser scenario records
Outcome
Browser scenario network events record no times, so every record a scenario
projects is untimed. The environment-state view then orders records by
position, detects no overlapping requests and learns no write clock: an update
whose response carries a modification time the application sets is withheld as
unexplained-change however it is recorded, while a HAR of the same session
serves it with a clock rule.
Scenario network events now record when each request was observed and how long the browser took, and scenario records carry them as HAR entries do, so a scenario capture learns the clock a HAR does.
Requirements
- Each
requestevent carriesobserved_at, the ISO wall-clock time the provider observed the request start; Playwright reports the browser's start only once a request ends. - Each
request-finishedandrequest-failedevent carriesstarted_at, the browser's wall-clock start (timing().startTime > 0), andelapsed_ms, its time from that start to the end of the response (timing().responseEnd >= 0), when the browser reports them. - The fields are optional in the schema, so Evidence captured before them still parses and is read exactly as before. REA versions before them refuse Evidence that carries them.
- Scenario records take
startedDateTimefrom the transaction's single finished or failed event'sstarted_at, else fromobserved_at, andtimefrom itselapsed_ms(0 without one), and say so in a limitation; a capture whose requests are all timed gets the recorded-start-time timeline and a write clock. - Scenario comparisons ignore both fields, as a committed built-in rule
(
ignore_network_request_timing). - The added metadata is charged to the event budgets as other metadata is.
Non-goals
- No change to HAR captures, to how the state uses times, or to what a record's timing means for overlap or clock rules.
- No retroactive timing of captures made before this change.
- No browser start for a request that never ended: its record starts at
observed_at, which can trail the browser's start by tens of milliseconds while the provider reads other responses, with no duration.