fleetd#201 Unit 1: typed backend-error classification #240

Closed
agent wants to merge 0 commits from worker/cb201-unit1-classifier-91b9b1-4 into main
Member

Part of fleetd#201/#227 (unit 1 of 5, disjoint files with 3 parallel workers). Replaces the hardcoded (?i)\bAPI Error\s*: check inside CompletionResolver with a target-keyed BackendErrorPatternLookup + BackendErrorSink pair, mirroring the existing ExhaustedPatternLookup/ExhaustionSink. Classifies in all three paths: the normal assistant block, the #211 raw-scrape fallback, and the #164 MIN_TURN_NANOS floor. The sink fires only after Rendezvous.resolveFailure wins the exact waiter (mutation-proven). Public send result is unchanged (still Kind.FAILED) -- the typed sink is the seam Unit 5 wires up. A target with no configured pattern keeps using the built-in compatibility pattern. Existing constructors keep compiling via legacy()/none() defaults.

Build: mvn clean install -> BUILD SUCCESS, Tests run: 1130, Failures: 0, Errors: 0, Skipped: 0 (48 in CompletionResolverTest, up from 40).

Part of fleetd#201/#227 (unit 1 of 5, disjoint files with 3 parallel workers). Replaces the hardcoded `(?i)\bAPI Error\s*:` check inside CompletionResolver with a target-keyed BackendErrorPatternLookup + BackendErrorSink pair, mirroring the existing ExhaustedPatternLookup/ExhaustionSink. Classifies in all three paths: the normal assistant block, the #211 raw-scrape fallback, and the #164 MIN_TURN_NANOS floor. The sink fires only after Rendezvous.resolveFailure wins the exact waiter (mutation-proven). Public send result is unchanged (still Kind.FAILED) -- the typed sink is the seam Unit 5 wires up. A target with no configured pattern keeps using the built-in compatibility pattern. Existing constructors keep compiling via legacy()/none() defaults. Build: mvn clean install -> BUILD SUCCESS, Tests run: 1130, Failures: 0, Errors: 0, Skipped: 0 (48 in CompletionResolverTest, up from 40).
agent added 1 commit 2026-09-03 05:34:24 +02:00
fleetd#201 Unit 1: typed backend-error classification in CompletionResolver
CI / build (pull_request) Successful in 1m19s
CI / contract (pull_request) Successful in 1m45s
776743cbe2
Replace the hardcoded API-Error check with a target-keyed BackendErrorPatternLookup
plus a BackendErrorSink, mirroring the existing ExhaustedPatternLookup/ExhaustionSink
pair. Classifies in all three paths (normal block, #211 raw-scrape fallback, and the
fleetd#164 MIN_TURN_NANOS floor). The sink fires only after Rendezvous.resolveFailure
wins for the exact waiter. A target with no configured pattern still falls back to the
narrow (?i)\bAPI Error\s*: compatibility pattern. Existing constructors keep compiling
via BackendErrorPatternLookup.legacy() / BackendErrorSink.none() defaults.

Public send result is unchanged (still a failed send) — the typed sink event is the
internal seam Unit 5 will consume.
Owner

Merged to main in 26bafe8.

Verified by the lead on the integrated main (all of Units 1-4 plus #234): 1163 tests, 0 failures, 0 compile errors, BUILD SUCCESS.

Three mutations of production code, each run to completion with a compile-error count checked first:

Mutation Result
failTooFast never classifies (backendError = null) 1 red — aMatchingErrorInsideTheFloorIsTypedAndNotifiesTheSink
the fresh scrape is dropped (scrape = "") 2 reds, including the floor test
no legacy fallback pattern (return configured;) 3 failures + 16 errors across CompletionResolverTest and MessageServiceTest

All three killed, so the tests hold the real production object rather than a rebuilt copy.

One merge fix was needed and is folded into the merge commit: CompletionResolverTest line 874 had a two-argument ExhaustionSink lambda, which #234's interface inversion now rejects. That is the guard working as intended — the compiler caught it instead of the fix going dead at runtime. The fix was one mechanical third parameter, matching the five sibling lambdas.

Note for Unit 5: BackendErrorPatternLookup.legacy() is load-bearing right now. Mutation C shows 19 tests depend on the built-in API Error: fallback, so wiring a real profile-driven lookup must keep the fallback for a target whose profile configures no pattern.

Merged to main in `26bafe8`. Verified by the lead on the integrated main (all of Units 1-4 plus #234): **1163 tests, 0 failures, 0 compile errors, BUILD SUCCESS**. Three mutations of production code, each run to completion with a compile-error count checked first: | Mutation | Result | |---|---| | `failTooFast` never classifies (`backendError = null`) | 1 red — `aMatchingErrorInsideTheFloorIsTypedAndNotifiesTheSink` | | the fresh scrape is dropped (`scrape = ""`) | 2 reds, including the floor test | | no legacy fallback pattern (`return configured;`) | 3 failures + 16 errors across `CompletionResolverTest` and `MessageServiceTest` | All three killed, so the tests hold the real production object rather than a rebuilt copy. One merge fix was needed and is folded into the merge commit: `CompletionResolverTest` line 874 had a two-argument `ExhaustionSink` lambda, which #234's interface inversion now rejects. That is the guard working as intended — the compiler caught it instead of the fix going dead at runtime. The fix was one mechanical third parameter, matching the five sibling lambdas. Note for Unit 5: `BackendErrorPatternLookup.legacy()` is load-bearing right now. Mutation C shows 19 tests depend on the built-in `API Error:` fallback, so wiring a real profile-driven lookup must keep the fallback for a target whose profile configures no pattern.
ltms closed this pull request 2026-09-03 05:58:00 +02:00
Some checks are pending
CI / build (pull_request) Successful in 1m19s
CI / contract (pull_request) Successful in 1m45s

Pull request closed

Sign in to join this conversation.