Skip to content

test(site): prove GuestbookStore with a fake and a real D1 under one suite - #95

Open
systemfsoftware-maker wants to merge 1 commit into
feat/site-cells-composition-rootfrom
test/guestbook-store-laws
Open

systemfsoftware-maker wants to merge 1 commit into
feat/site-cells-composition-rootfrom
test/guestbook-store-laws

Conversation

@systemfsoftware-maker

@systemfsoftware-maker systemfsoftware-maker commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

GuestbookStore was a port with a D1 adapter and no contract. It now ships
its in-memory fake beside the service (guestbook-store.memory.ts, a Ref
that mirrors the adapter's ids, filters, cap and compare-and-set) and one
law suite, tests/features/guestbook/guestbook-store.integration.test.ts,
that runs the same fixed histories against the fake and a real local D1
(Miniflare, migrated from the repo's own migrations/*.sql per build):
read-after-write, stable repeated reads, commuting different-id writes,
newest-first latest that hides Hidden and caps at twenty, stale move
refused with the state unchanged, unknown id refused, and a non-enum
stored state read back verbatim. Expected values come from each history,
never from an adapter. Sabotage: LATEST_ENTRIES 19 fails the D1 cap law;
a broken fake compare-and-set fails the fake's stale-move law.

miniflare is pinned at the version the lockfile already resolved.
Judgment surfaces: apps/site/tsconfig.json includes tests; apps/site/
package.json gains a #guestbook/* import map and two devDependencies.
Owner-directed (CONST-W3 declaration). Follows the boundary-testing pack.

Verification

Gates exit 0; site test 21. Sabotage: LATEST_ENTRIES=19 fails the D1 cap law; broken fake compare-and-set fails the fake's stale-move law.

Layer of stack #100 (trunk main), merge bottom-up.

…suite

GuestbookStore was a port with a D1 adapter and no contract. It now ships
its in-memory fake beside the service (guestbook-store.memory.ts, a Ref
that mirrors the adapter's ids, filters, cap and compare-and-set) and one
law suite, tests/features/guestbook/guestbook-store.integration.test.ts,
that runs the same fixed histories against the fake and a real local D1
(Miniflare, migrated from the repo's own migrations/*.sql per build):
read-after-write, stable repeated reads, commuting different-id writes,
newest-first latest that hides Hidden and caps at twenty, stale move
refused with the state unchanged, unknown id refused, and a non-enum
stored state read back verbatim. Expected values come from each history,
never from an adapter. Sabotage: LATEST_ENTRIES 19 fails the D1 cap law;
a broken fake compare-and-set fails the fake's stale-move law.

miniflare is pinned at the version the lockfile already resolved.
Judgment surfaces: apps/site/tsconfig.json includes tests; apps/site/
package.json gains a #guestbook/* import map and two devDependencies.
Owner-directed (CONST-W3 declaration). Follows the boundary-testing pack.
@systemfsoftware-maker
systemfsoftware-maker added this pull request to stack #100 October 16, 2026 04:17
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