fix(wire): close five wire-protocol gaps from design review (#56)#102
Merged
Conversation
- relatedTo.label now reaches the wire on the GET /records fallback path (relatedToLabel param) instead of being silently dropped. - APIAdapter throws APIAdapterCapabilityError for filter.content or filter.search against a server lacking the matching capability, instead of degrading to an unfiltered superset with no signal. - dissociate() moves off DELETE-with-body to POST /records/:id/associations/delete — DELETE bodies have no defined wire semantics and are a portability landmine. - AdapterCapabilities gains maxAttachmentBytes (discovery-exposed), so apps can pre-check upload limits instead of learning them from a 413 after the fact. - Stack now caches Types by versioned id, populated by getType(), defineType(), and listTypes(); create()/update()/restoreVersion() validate against the cache instead of paying a getType() round trip on every write. Spec, conformance fixtures, and tests updated to match.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #56 — a batch of wire-level gaps where the adapter or spec quietly delivers less than the query/API surface promises.
relatedTo.labelwas silently dropped.buildQueryParamsnow sendsrelatedToLabelalongsiderelatedToon theGET /recordsfallback path (thePOST /records/querypath already carried it, since it forwards the full filter object). Added to the spec's query param list.content/searchfilters were silently dropped on incapable servers.APIAdapter.queryRecords()now throws a newAPIAdapterCapabilityError— naming the missing capability — whenfilter.contentis used withoutcontentFieldQuery, orfilter.searchwithoutfullTextSearch, before any request is sent. Previously the filter evaporated and the server returned an unfiltered superset presented as the filtered result.DELETE /records/:id/associationstook its payload in the body. DELETE bodies have no defined wire semantics (RFC 9110 §9.3.5) and are a portability landmine behind arbitrary proxies/gateways.dissociate()now sendsPOST /records/:id/associations/delete. Updated in the spec, the shared conformance fixtures, and adapter-api tests.maxAttachmentBytes: number | nulltoAdapterCapabilitiesand the discovery response, so apps can pre-check upload limits instead of learning the ceiling only after a 413. Local/embedded adapters (JSON, sql.js, native SQLite) declarenull(unbounded) since nothing at the storage layer imposes a limit; only a server behind the API adapter enforces one.create()/update()cost an extragetType()round trip.Stacknow caches Types by versioned id, populated bygetType(),defineType(), andlistTypes()(never invalidated — a Type's schema is immutable once defined;listTypes()refreshes the cache wholesale as the explicit way to pick up a name-only rename from another writer).create(),update(), andrestoreVersion()validate against the cached entry instead of a fresh adapter round trip.Test plan
pnpm -r build— all packages buildpnpm -r typecheck— cleanpnpm -r lint— cleanpnpm -r test— full suite green (458 tests incore, 97 inadapter-api, etc.)relatedToLabelGET-param serialization, capability-guard throws forfilter.content/filter.searchwithout a request being sent,dissociate()'s new verb/path, discoverymaxAttachmentBytesround trip, and a spy-based test provingcreate()× N hitsadapter.getType()exactly once after the type is cacheddocs/spec.mdand@haverstack/conformance-fixturesupdated to match the new wire shapesGenerated by Claude Code