Skip to content

Provider malformed-response corpus + era-jump migration; fix usage accounting on dirty payloads (#105) - #107

Merged
hsliuustc0106 merged 1 commit into
mainfrom
feature/provider-corpus
Oct 4, 2026
Merged

hsliuustc0106 merged 1 commit into
mainfrom
feature/provider-corpus

Conversation

@hsliuustc0106

Copy link
Copy Markdown
Contributor

Implements #105. 27 new offline tests: an 11-row dirty-body corpus (truncated JSON, empty bodies, HTML error pages, null/array top level, wrong inner shapes, non-string text blocks, empty output) parametrized over both adapters — each row asserts ProviderError, no crash, and no credential in the error text — plus parse_intent garbage rejection, an anti-overfit row proving ideal shapes still pass, and a v0.1-era database jumping to the current schema with every newer dimension off and idempotent migrations.

The corpus caught a real defect on its first run (exactly what the strict-acceptance discipline is for): #77's usage accounting executed payload.get("usage") before any dict check, so a null or array body raised a bare AttributeError — violating the every-failure-is-ProviderError contract in both adapters. Fixed with an isinstance guard: accounting degrades silently on non-dict payloads, the content parse below raises the proper ProviderError.

745 tests pass (+27), demo 8/8.

…counting on non-dict payloads (#105)

Corpus: 11 protocol-agnostic dirty bodies (truncated JSON, empty, HTML
error pages, null/array top level, wrong inner shapes, non-string text,
empty output) parametrized over BOTH adapters, each row asserting
ProviderError (fail closed), no crash, and no credential material in the
error text; plus parse_intent never returns garbage, and the ideal
shapes keep passing (no overfit).

The corpus caught a real regression from #77 on its first run: the usage
accounting block ran payload.get("usage") before any dict check, so a
null or array body raised a bare AttributeError instead of
ProviderError. Both adapters now degrade accounting on non-dict payloads
(isinstance guard); the content parse below owns the ProviderError.

Migration: a database created at the v0.1-era schema (no digest/stale/
flaky columns; permissions without content_hash or capabilities) opens
under current TaskStore + PermissionCenter with every newer dimension
off, round-trips an update, and the additive migrations are idempotent
on reopen.

745 tests pass (+27); demo 8/8.
@hsliuustc0106
hsliuustc0106 merged commit f8aff69 into main Oct 4, 2026
4 checks passed
@hsliuustc0106
hsliuustc0106 deleted the feature/provider-corpus branch October 4, 2026 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant