Skip to content

Deduplicate the request layer and make dynamicPageRegex additive - #173

Merged
DavertMik merged 11 commits into
mainfrom
advisor/030-request-layer-provider-hygiene
Sep 2, 2026
Merged

Deduplicate the request layer and make dynamicPageRegex additive#173
DavertMik merged 11 commits into
mainfrom
advisor/030-request-layer-provider-hygiene

Conversation

@DavertMik

Copy link
Copy Markdown
Contributor

Stacked on #169 (plan 028) — merge that first; GitHub will retarget this to main.

Path generalization had two copies of the same split/classify/replace walk — normalizePathPattern in the request store and generalizeUrl in the URL matcher. Now one implementation: generalizeUrl(path, replaceSegment) with the store passing () => '{id}'. Outputs byte-identical (endpoint dedup keys and captured-request matching unchanged, pinned by the existing suites).

Config fix — dynamicPageRegex now EXTENDS the built-in dynamic-segment heuristics instead of silently replacing them, matching what docs/reference/configuration.md has promised all along ("Built-in patterns … are always active"). The extended unit test proves built-ins stay active alongside a custom regex.

Request-store pruning — RequestResult.isWrite is the single "write method" definition (the local Set in getWriteRequestsForScope is gone); three never-called query methods deleted (getRequestsByEndpoint/ByMethod/ByStatus); the addRequest/getRequests aliases collapsed into the explicit addMadeRequest/getMadeRequests (call sites updated across src, boat, tests — the remaining mock.getRequests() calls in integration tests are aimock's Journal API, unrelated).

Provider residue — withExecutedSteps used as a builder at both call sites; dead AI-SDK v4/v5 usage-field fallbacks removed (promptTokens/completionTokens/cachedInputTokens/raw.*), so token accounting reads only the fields ai@7 actually emits.

Follow-up noted: src/api/xhr-capture.ts holds a pre-existing third write-method Set operating on raw Playwright request methods before any RequestResult exists — left untouched, recorded as a possible future consolidation.

Testing: bun test tests/unit 1244 pass / 0 fail, bun test boat/prima/tests 135 pass / 0 fail, bun test tests/integration 89 pass / 1 skip / 0 fail, biome format + lint clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Jz7wTcYsy68jUUjcWttd1B

DavertMik and others added 10 commits September 1, 2026 21:51
One `Haul` now owns "the requests this run made": it captures the start mark
once, after `refreshAuth()`, and both the stuck-detector and the tools read
their run views from it. The failure predicate lives once, as
`isFailedRequest` in the data tier, and `finish` delegates its verification
to `verifyFinish` instead of judging inline. `src/utils/request-map.ts` is
gone — `Haul.byId()` replaces it, so `src/utils/` no longer depends on
`src/api/`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B46vQvvc47LJeCmqQxAhme
The class is used by Fisherman alone, so it belongs beside the agent
rather than in the shared request data tier: `src/ai/fisherman/request-haul.ts`,
matching how other agents keep their utility classes (`ai/researcher/*`).

`isFailedRequest` stays in `request-store.ts` — it is still the one shared
failure predicate, called by both `RequestHaul.failed()` and Fisherman's
`isStuckOnEndpoint`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BYfsBh3TXThD5XLxa23X5d
…second walk

Co-Authored-By: Claude <noreply@anthropic.com>
…instead of replacing them

Co-Authored-By: Claude <noreply@anthropic.com>
… request store

Co-Authored-By: Claude <noreply@anthropic.com>
…Request aliases in RequestStore

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…provider cleanup

Co-Authored-By: Claude <noreply@anthropic.com>
@DavertMik DavertMik added refactoring regression Run the LLM regression suite (one run per label add) labels Sep 1, 2026
Base automatically changed from advisor/028-fisherman-haul to main September 2, 2026 18:58
@DavertMik
DavertMik merged commit 0ee43ac into main Sep 2, 2026
2 checks passed
@DavertMik
DavertMik deleted the advisor/030-request-layer-provider-hygiene branch September 2, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring regression Run the LLM regression suite (one run per label add)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants