You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(core): add adapter compliance test harness (#288)
* feat(core): add adapter compliance test harness
Introduce a reusable behavioural-contract test suite that every `Adapter`
must satisfy: schema consistency, CRUD round-trip, list / filter, search,
optional links, and standard error cases.
The harness is exposed via the `test-utils` feature for out-of-tree
adapters and is always available inside the crate's own tests. The
`adapter_compliance_tests!` macro emits one `#[test]` per category so each
case shows up individually in `cargo test` output; `run_compliance_suite`
runs every case sequentially against a single adapter instance.
`MarkdownAdapter` wires the full suite via a fresh-tempdir factory; all
six categories pass. `GitHubAdapter` wires `check_schema_consistency` into
its mock unit tests and `run_compliance_suite` into its (feature-gated,
`#[ignore]`d) real-API integration tests.
Two markdown adapter bugs surfaced and were fixed in the process:
`update()` and `delete()` on a nonexistent id now return
`AdapterError::NotFound` instead of `AdapterError::IoError`, matching the
contract every adapter is now held to.
Closes#260https://claude.ai/code/session_01CZJP9d8gzWqQHgz2UJKyhu
* refactor(core): tighten compliance harness from review feedback
- `check_schema_consistency` now cross-checks `ComplianceOptions` against
the schema (status_key, content_key, and link_type when
`supports_links`) so a misconfigured adapter fails here with a clear
diagnostic instead of deep inside CRUD.
- `check_crud_roundtrip` now requires the content field to be present on
`get()` after a `create()` that set it — silent absence no longer
passes.
- `check_list_filter`, `check_search`, and `check_links` always delete
the items they create so persistent backends (real GitHub API in
particular) don't accumulate fixtures across runs. Archive-specific
post-delete assertions remain gated on `delete_is_archive`.
- The `adapter_compliance_tests!` macro binds `let opts = $opts;` once
per generated test so a `$opts` expression like a function call is
evaluated once and the reference is to a named local, not a temporary.
https://claude.ai/code/session_01CZJP9d8gzWqQHgz2UJKyhu
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments