Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
# nothing user-facing may publish them (reports go to security@).
- name: Reserved mailbox regression tests
run: node --test scripts/reserved-mailboxes.test.mjs
- name: Supabase adapter clean consumer acceptance (synthetic delivery)
run: node scripts/check-supabase-consumer.mjs
- name: Design and truthfulness audit
run: pnpm exec tsx scripts/design-audit.ts
# Cheap and fast, so it runs before the build: a placeholder link is a
Expand Down
12 changes: 10 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ the industry's founding lie, in our own product.

## Current production checkpoint (October 26, 2026)

Acceptance follow-up (27 October): the iPhone Simulator's normal sign-in request
succeeded through an authorized opt-in Xcode UI test, but default Supabase delivery
produced a link-only email while Sprout expects a code. Free-plan template editing
is locked without SMTP or Pro. This fallback is incompatible, not merely untested.
The clean consumer packaging fixture passes; independent customer setup and actual
two-client sync remain open. See `docs/supabase-rollout-acceptance-2026-10-27.md`.

API and worker run `effd2bdbe3fe5f52b2f960c3a6075817c7e2cc4a` (PR #59),
released through exact-main CI/image publishing and the guarded canary path.
Two labelled owner-inbox canaries have provider delivery evidence. Dashboard
Expand All @@ -75,8 +82,9 @@ restoration after restart. Five of eight approved emails were used. The Supabase
hook is now Disabled, the temporary QA key is revoked (HTTP 401 verified), auth
admission is disabled, and the optional hook/vault runtime and temporary secrets
are removed. The limited ledger login is disabled; replay tombstones remain.
No ongoing Rootmail auth sending is enabled. Supabase default fallback delivery,
actual two-device sync and an independent customer installation remain unverified.
No ongoing Rootmail auth sending is enabled. Default fallback delivery is
incompatible with native OTP. Actual two-device sync and an independent customer
installation remain unverified.
See `docs/sprout-pilot-validation-2026-10-25.md` for exact scope and evidence.
SES sandbox limits remain; no unrestricted sending or public auth rollout is
claimed. The application host, managed database and managed queue sizes are
Expand Down
12 changes: 10 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## Current production checkpoint (October 26, 2026)

Acceptance follow-up (27 October): the iPhone Simulator's normal sign-in request
succeeded through an authorized opt-in Xcode UI test, but default Supabase delivery
produced a link-only email while Sprout expects a code. Free-plan template editing
is locked without SMTP or Pro. This fallback is incompatible, not merely untested.
The clean consumer packaging fixture passes; independent customer setup and actual
two-client sync remain open. See `docs/supabase-rollout-acceptance-2026-10-27.md`.

API and worker run `effd2bdbe3fe5f52b2f960c3a6075817c7e2cc4a` (PR #59),
released through exact-main CI/image publishing and the guarded canary path.
Two labelled owner-inbox canaries have provider delivery evidence. Dashboard
Expand All @@ -13,8 +20,9 @@ restoration after restart. Five of eight approved emails were used. The Supabase
hook is now Disabled, the temporary QA key is revoked (HTTP 401 verified), auth
admission is disabled, and the optional hook/vault runtime and temporary secrets
are removed. The limited ledger login is disabled; replay tombstones remain.
No ongoing Rootmail auth sending is enabled. Supabase default fallback delivery,
actual two-device sync and an independent customer installation remain unverified.
No ongoing Rootmail auth sending is enabled. Default fallback delivery is
incompatible with native OTP. Actual two-device sync and an independent customer
installation remain unverified.
See `docs/sprout-pilot-validation-2026-10-25.md` for exact scope and evidence.
SES sandbox limits remain; no unrestricted sending or public auth rollout is
claimed. The application host, managed database and managed queue sizes are
Expand Down
14 changes: 14 additions & 0 deletions docs/COLLAB.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,3 +391,17 @@ login disabled and replay metadata preserved. No extra paid AWS resource was
added. Rootmail auth sending is not left enabled; default Supabase fallback is
untested. An independent customer setup and broader live acceptance remain gates.
See docs/sprout-pilot-validation-2026-10-25.md for evidence and local native build fix.

## 27 October 2026 — default email fallback is incompatible with native OTP

The opt-in Xcode UI test requested an actual iPhone Simulator sign-in email.
Supabase's default sender delivered a link-only message, while Sprout requires a
code. Free-plan template editing is locked without SMTP or Pro. The retired
Rootmail pilot is still successful historical evidence, but its removal did not
leave a working native sign-in path for new sessions. Broader beta remains gated.

A clean consumer fixture now verifies installation and public imports outside the
monorepo with all six action types and synthetic retry/signature checks. This is
automated packaging evidence, not an independently onboarded second customer.
Real two-client sync is still pending. See
docs/supabase-rollout-acceptance-2026-10-27.md; do not mark the broad tasks Done.
8 changes: 5 additions & 3 deletions docs/supabase-auth-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ in this increment.

Task: [Rootmail / Sprout pilot](https://app.notion.com/p/4032db0e8691818496f5c235840c351c).

Latest operational evidence: [25 October production and Sprout configuration
validation](sprout-pilot-validation-2026-10-25.md). The checks are read-only;
the integration is not deployed and the native pilot has not run.
Latest operational evidence: [configuration, release and controlled pilot
validation](sprout-pilot-validation-2026-10-25.md). API/worker `effd2bd` is deployed;
native Mac sign-in and session restoration passed on 26 October. The temporary
pilot was then retired. [Broader acceptance](supabase-rollout-acceptance-2026-10-27.md)
remains open. The dated implementation increments below are historical.

## First increment — signed planner

Expand Down
35 changes: 22 additions & 13 deletions docs/supabase-hook-setup.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Supabase → Rootmail hook setup reference

Unreleased reference, 25 October 2026. This has passed synthetic/local tests,
not an independently followed customer installation or live Sprout sign-in.
Keep the Supabase hook disabled until the production release/pilot gates below
are explicitly cleared. No SMTP fallback is invoked by this adapter.
Private reference, updated 27 October 2026. The controlled Sprout pilot passed
live code delivery, native Mac sign-in and session restoration on release
`effd2bd`; its temporary hook/key/runtime were subsequently retired. An independent
customer installation and broader live acceptance remain open. Enable only the
reviewed scope after operational checks. No SMTP fallback is invoked by this adapter.

## Prerequisites and cost

Expand Down Expand Up @@ -173,17 +174,25 @@ pilot, not public Sprout email availability.
restoring that tested configuration. A disabled hook does not prove SMTP works.
Roll Rootmail back only after disabling admission and draining/expiring auth jobs.

## Pilot gates (not yet observed)
## Acceptance and remaining rollout gates

Confirm the deployed version/configuration and exact sender/inboxes; authorize
one live Sprout test; request the code, observe provider acceptance and delivery
separately, enter the code and verify the native Supabase session. Test wrong and
expired codes, resend invalidation and two-recipient change. Record IDs/timestamps
and latency, never codes or links. Then have a second customer follow this guide.
The [controlled pilot report](sprout-pilot-validation-2026-10-25.md) records the
observed sender/scope, delivery, native Mac sign-in, restart and cleanup. Wrong
codes and a code beyond the expiry window were rejected. Exact expiry boundaries,
immediate resend invalidation and live two-recipient changes remain unverified.
Record IDs/timestamps and latency, never codes or links. Have a second customer
follow this guide; the clean consumer fixture is automated packaging evidence,
not that human acceptance.

**Fallback finding, 27 October:** disabling the hook in `sprout-dev-us` returned
to Supabase's Free-plan default link-only email. Sprout's native UI expects an
eight-digit code, so receipt did not complete sign-in. The dashboard locks template
editing without custom SMTP or Pro; a Send Email Hook is the existing chosen
integration. Do not call the default sender a working native OTP fallback or
disable a working hook without an explicitly tested replacement configuration.

Sources: [Supabase email hook and recipient mapping](https://supabase.com/docs/guides/auth/auth-hooks/send-email-hook),
[hook errors and five-second budget](https://supabase.com/docs/guides/auth/auth-hooks).

Configs touched: reference hook-host environment, server-only PostgreSQL schema
and pool settings; no settings were applied to a customer or production host.
Prod behaviour preserved: auth remains disabled and no live emails were sent.
Current rollout evidence and remaining gates:
[27 October acceptance](supabase-rollout-acceptance-2026-10-27.md).
74 changes: 74 additions & 0 deletions docs/supabase-rollout-acceptance-2026-10-27.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Supabase rollout and Sprout sync acceptance

Status: **In progress. Do not close broader rollout or HT-005.**
This continues the [successful controlled pilot](sprout-pilot-validation-2026-10-25.md).
It distinguishes local fixtures, hosted observations and open acceptance gates.

## Observed on 27 October

| Check | Evidence and limits |
| --- | --- |
| Adapter regressions | 40/40 package tests passed; synthetic delivery. |
| Clean consumer | Public `@rootmail/supabase` imports worked after installation outside the monorepo. Six action types, two-recipient mapping, signature denial and reconstructed-handler retry passed. Transport and ledger query results are fixtures. |
| Sprout model | Four cloud-sync XCTest cases and 12 core Swift Testing cases passed in a fresh scratch directory. |
| Database invariants | Disposable PostgreSQL tests passed for ownership, anonymous denial, idempotency, conflicts, validation and rollback. This is not hosted Data API acceptance. |
| Deletion cascade | Extended disposable SQL tests passed: deleting a fixture auth user removes its account, habits, check-ins and replay receipt, preserves the other owner, and rejects recreation by a stale identity. This does not implement or prove an end-user account-deletion flow. |
| Hosted anonymous access | Using only the app's publishable key, all four table reads and `habit_snapshot` returned HTTP 401 / PostgreSQL 42501. No signed-in session was copied or user records returned. This does not prove authenticated cross-owner isolation through the Data API. |
| iPhone app | Fresh arm64 build and build-for-testing passed. Installed on the iPhone 17 Pro / iOS 26.2 simulator; UI rendered. No physical iPhone acceptance is claimed. |
| Hosted code request | Explicitly authorized Xcode UI test used the normal native form, without copying a session or resetting data. One test passed, zero skipped. |
| Default email | Supabase sent “Your sign-in link” to the owner inbox at 08:05:24 UTC (09:05 WAT). It was link-only; native Sprout expects an eight-digit code. Sign-in did not complete. |
| Default template edit | Dashboard requires custom SMTP or Pro for template customization; source editing and saving are disabled. No upgrade or provider change was made. |
| Mac data | Created the disposable habit “QA sync 27 Oct — disposable,” cue “Mac to iPhone acceptance.” Mac displayed Up to date. This alone does not prove remote persistence or a second-client read. |
| Provider access | SES reports sending enabled, HEALTHY, production access false, 200/day and one/second. Unrestricted sending remains blocked. |

## Reproducible automated checks

```sh
pnpm --filter @rootmail/supabase test
node scripts/check-supabase-consumer.mjs
```

The clean consumer uses only vendored source/metadata and a pinned package-manager
version, does not read Rootmail `.env`, forbids default runtime fetch and removes
its temporary directory. Dependency installation may use the package registry.
It is included in CI. An independent customer still needs to follow the setup
guide with their own workspace and server secrets.

Sprout checks live in its separate repository: `swift test --package-path
apple/SproutCore --scratch-path <fresh-directory>`, `supabase/tests/run-postgres.sh`,
and the opt-in `HabitFlowTests/testOpenHostedAccountSignIn` UI test. Normal UI
test execution skips the hosted test unless explicitly enabled with an email.
The UI test never reads or supplies a code. Its first invocation skipped because
the runner lacked the opt-in environment; only the later enabled invocation is
the successful request evidence.

## Open acceptance

- Restore a bounded, authorized code-delivery path for the independent iPhone
sign-in; keep server credentials out of the native app. Retire temporary access
after acceptance and document whether ongoing sign-in remains available.
- Observe Mac → iPhone and iPhone → Mac habit/check-in changes through hosted
storage, then restart, retry and conflict behavior. Do not reuse the Mac session
as a shortcut to a second independent session.
- Verify immediate resend invalidation and controlled expiry behavior; do not
infer them from email arrival or an old-code rejection hours later.
- Complete account deletion/retention acceptance using disposable data/accounts,
including ownership and prevention of resurrection. Never delete the owner account.
- Have an independent customer complete installation, and obtain applicable
delivery access before unrestricted onboarding. No SES appeal is filed here.

## Current operational boundary

API/worker remain on `effd2bd`; the prior pilot key is revoked and its hook/runtime
are retired. Supabase's default email path now has an observed incompatibility
with the native code UI. A prepared new temporary QA key is awaiting action-time
approval; it has not been created. No additional paid resource has been created.

Local evidence: `/tmp/rootmail-consumer-acceptance-20261027.log`,
`/tmp/rootmail-supabase-acceptance-20261027.log`,
`/tmp/sprout-core-acceptance-20261027.log`,
`/tmp/sprout-sql-acceptance-20261027.log`,
`/tmp/sprout-anonymous-acceptance-20261027.log`,
`/tmp/sprout-rollout-ios-build.log`,
`/tmp/sprout-live-signin-enabled-20261027.xcresult`.
These local artifacts are not durable CI or independent-review evidence.
34 changes: 21 additions & 13 deletions packages/supabase/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Supabase email adapter — unreleased reference
# Supabase email adapter — private reference

**Unreleased and private. Do not enable this as a production Supabase hook yet.**
The package now includes both a transport-free planner and an opt-in Web Request
handler that uses the auth-only Rootmail HTTPS endpoint. No running application
installs it automatically. Local transport tests use fake delivery; no real
Supabase session has been completed. Never use ordinary `/v1/messages` for codes.
**Private and unpublished; broader rollout remains gated.** API/worker release
`effd2bd` includes the disabled-by-default auth endpoint. The controlled Sprout
pilot on 26 October passed real code delivery, native Mac sign-in and session
restoration. Its temporary hook/key/runtime were retired after acceptance;
ongoing Rootmail auth sending is not enabled by that pilot.

Update: the draft branch now includes a separate, disabled-by-default
`POST /v1/auth-messages` server contract. It has encrypted ephemeral content,
expiry enforcement and a restricted SES path with tracking checks. This planner
now has an explicit HTTP wrapper, capability preflight and PostgreSQL replay
ledger. See the [customer setup reference](../../docs/supabase-hook-setup.md) and
integration notes for rollout gates and remaining limitations.
The package includes a signed planner, bounded HTTPS handler, capability preflight
and PostgreSQL replay ledger. No application installs it automatically. Local
tests use synthetic delivery. Never use ordinary `/v1/messages` for codes.
See the [pilot evidence](../../docs/sprout-pilot-validation-2026-10-25.md),
[setup guide](../../docs/supabase-hook-setup.md) and
[broader acceptance](../../docs/supabase-rollout-acceptance-2026-10-27.md).

Tracking task: [Supabase authentication emails — Sprout pilot](https://app.notion.com/p/4032db0e8691818496f5c235840c351c).
Release gates and implementation sequence: [integration notes](../../docs/supabase-auth-integration.md).
Expand Down Expand Up @@ -53,16 +53,24 @@ credentials; this package never mints a token or declares a session valid.
For link actions the verification host comes from trusted `supabaseUrl`, never
payload `site_url`. `redirect_to` must exactly match a server allowlist entry;
an absent/empty value uses the configured default. Explicit native-app callbacks
are supported as strings, but native app session completion is not tested here.
are supported as strings, but link-based native callback completion is untested.
The controlled Sprout pilot used code-only verification instead.
Plain HTTP callbacks are deliberately not supported in this first increment.

## Local development (synthetic fixtures only)

```sh
pnpm --filter @rootmail/supabase typecheck
pnpm --filter @rootmail/supabase test
node scripts/check-supabase-consumer.mjs
```

The last command installs the vendored package into a temporary consumer outside
the monorepo and exercises its public imports with synthetic transport and ledger
fixtures. It checks six action types, both secure-change recipients, invalid
signatures and retry after handler reconstruction. It does not establish a real
PostgreSQL connection, live delivery or an independent customer's installation.

Package tests use an independent HMAC signer, synthetic secrets, a fake ledger and
injected fetch; they never make real network/mail calls. Separate API tests use
the real local database, queue, worker and PostgreSQL ledger with fake delivery.
Expand Down
28 changes: 28 additions & 0 deletions scripts/check-supabase-consumer.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env node
// Clean consumer install; synthetic mail only, never reads Rootmail .env.
import { mkdtemp, mkdir, cp, writeFile, readFile, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { spawnSync } from 'node:child_process';
const root = dirname(dirname(fileURLToPath(import.meta.url)));
const directory = await mkdtemp(join(tmpdir(), 'rootmail-supabase-consumer-'));
const run = (command, args) => {
const result = spawnSync(command, args, { cwd: directory, stdio: 'inherit',
env: { PATH: process.env.PATH, HOME: process.env.HOME, CI: 'true' } });
if (result.error || result.status !== 0) throw new Error('Consumer acceptance failed');
};
try {
await mkdir(join(directory, 'vendor/supabase'), { recursive: true });
// Copy only installable source/metadata, never local credentials or build state.
for (const path of ['package.json', 'src']) {
await cp(join(root, 'packages/supabase', path), join(directory, 'vendor/supabase', path), { recursive: true });
}
const tsx = JSON.parse(await readFile(join(root, 'node_modules/tsx/package.json'), 'utf8')).version;
const { packageManager } = JSON.parse(await readFile(join(root, 'package.json'), 'utf8'));
await writeFile(join(directory, 'package.json'), JSON.stringify({ private: true, type: 'module',
packageManager, dependencies: { '@rootmail/supabase': 'file:./vendor/supabase', tsx } }));
await cp(join(root, 'scripts/fixtures/supabase-consumer/acceptance.ts'), join(directory, 'acceptance.ts'));
run('pnpm', ['install', '--prefer-offline', '--ignore-scripts']);
run(process.execPath, ['--import', 'tsx', 'acceptance.ts']);
} finally { await rm(directory, { recursive: true, force: true }); }
Loading
Loading