Skip to content

polytag/backends: the default backends, and app.open(el) (refs #2, #4) - #43

Merged
thorwhalen merged 2 commits into
mainfrom
feat/2-backend-catalog
Dec 1, 2026
Merged

thorwhalen merged 2 commits into
mainfrom
feat/2-backend-catalog

Conversation

@thorwhalen

@thorwhalen thorwhalen commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Part of #2 and #4. A backend is a document store (load / save of one JSON document), so the catalog stays tag-agnostic. defaultBackends() has inMemory, localStorage (a Storage) and http (GET and PUT of one URL): http refuses credentials or secret-looking keys in the url (they go in headers, marked secret), plain http with headers unless local, scrubs the url, query and header values from every error, keeps the timeout over the body, counts bytes, keeps the ETag and sends If-Match (a 412 is a conflict); localStorage notices a change made elsewhere and refuses to overwrite it. listBackends(catalog, env, { runtime }) and createBackend(catalog, name, options, env) validate options and name every problem; the environment is passed in. app.open(el) loads the collection from the configured backend (the metadata one for bifurcated), mounts it, and saves after each change to the DATA (not a selection), coalesced; a document that cannot be used (not a collection, wrong space, too many records, unreadable) is reported through onError and the view opens read-only so nothing of theirs is overwritten (onInvalidStored: 'replace' to overwrite); a failed or conflicting save is reported, not thrown; destroy() saves the last change. Not built: content backends, fs, S3, Supabase. Independent adversarial review: 14 findings fixed test-first.

…e, http) with option fields and secrets; app.open(el) loads from and saves to the backend (refs #2, #4)
…nt, save only on a data change, ETag and changed-elsewhere conflicts, scrubbed errors, no credentials in urls, body inside the timeout, byte sizes, guarded storage, maxRecords, stronger seed check)
@thorwhalen
thorwhalen merged commit a1a6ff3 into main Dec 1, 2026
3 checks passed
@thorwhalen
thorwhalen deleted the feat/2-backend-catalog branch December 1, 2026 19:45
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