Skip to content
14 changes: 14 additions & 0 deletions lib/applications/proposedRegistration/__tests__/operations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,20 @@ describe("unwired create/read transaction binding", () => {
create(request(), input, { policy, storage: {} } as ProposedDependencies),
).rejects.toThrow("unavailable");
});
it.each(["df7be4c65b98924373b38c7d257f4b1c1820d6b7", "wrong"])(
"rejects incompatible database descriptor %s before either storage port",
async databaseHead => {
const deps = dependencies();
const incompatible = {
...deps,
policy: { ...policy, databaseHead },
} as ProposedDependencies;
await expect(create(request(), input, incompatible)).rejects.toThrow();
await expect(read(request(), selected, incompatible)).rejects.toThrow();
expect(deps.storage.create).not.toHaveBeenCalled();
expect(deps.storage.read).not.toHaveBeenCalled();
},
);
it("uses bytewise canonical ordering and preserves development loopback eligibility", async () => {
const body = {
name: "字",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const proposedPolicySchema = z
.object({
status: z.literal("proposed_unadopted"),
version: z.literal("proposed-personal-v1"),
databaseHead: z.literal("df7be4c65b98924373b38c7d257f4b1c1820d6b7"),
databaseHead: z.literal("f507a77696f20429f977df9885d6c8c11a5f304b"),
})
.strict();
const revision = z.number().int().min(1).max(Number.MAX_SAFE_INTEGER);
Expand Down
14 changes: 9 additions & 5 deletions scripts/application-registration-proposal/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Inactive application registration adapter

This domain-only candidate binds proposed create/read calls to the existing nonprovisioning REST authentication path. It is not registered as a route or MCP tool and has no concrete database caller or production factory. The injected policy descriptor identifies an unadopted contract; it grants no authority. SQL personal enrollment and named entitlements remain required in the proposed storage boundary.
This inactive candidate binds proposed create/read calls to the existing nonprovisioning REST authentication path. It is not registered as a route or MCP tool and has no concrete database caller or production factory. The injected policy descriptor identifies an unadopted contract; it grants no authority. SQL personal enrollment and named entitlements remain required in the proposed storage boundary.

`node scripts/application-registration-proposal/run.mjs` executes the dedicated suite. The ordinary Vitest configuration deliberately excludes it. `.github/workflows/application-registration-proposal.yml` runs this command on every PR to main, including changes to any shared auth, validator, compiler or dependency input. CI checks the exact PR head with read-only permissions and no retained checkout credentials. A local pass is not a CI result.

The launcher creates a synthetic environment and temporary home, preloads network denial before Vitest/config/auth imports, disables Vite dotenv discovery and stops its owned process group before deleting temporary files. An uncertain process inventory preserves the directory and fails. Installed Vite 7.3.0 implements `envDir: false` by returning an empty dotenv filename list; the separately retained local qualification controls also used synthetic poison values in all four dotenv filenames and the ambient environment. Those poison controls are recorded in the sealed local review packet and are not injected by the ordinary CI launcher. Provider fetch, SDK verification, Supabase database access, Stripe and email are substituted leaves. Auth orchestration, API-key hashing/expiry handling, existing-account selection, evidence validation and canonical registration validation are real source calls. These tests do not establish cryptographic verification, hosted entitlement enforcement or real MCP authentication parity.
The launcher creates a synthetic environment and temporary home, preloads network denial before Vitest/config/auth imports, disables Vite dotenv discovery and stops its owned process group before deleting temporary files. An uncertain process inventory preserves the directory and fails. Installed Vite 7.3.0 implements `envDir: false` by returning an empty dotenv filename list; the separately retained local qualification controls also used synthetic poison values in all four dotenv filenames and the ambient environment. Those poison controls are recorded in the sealed local review packet and are not injected by the ordinary CI launcher. Provider fetch, SDK verification, Supabase database access, Stripe and email are substituted leaves. Auth orchestration, API-key hashing/expiry handling, existing-account selection, evidence validation and canonical registration validation are real source calls. These tests do not establish provider cryptographic verification, hosted entitlement enforcement or authenticated deployed MCP acceptance. The accepted unregistered direct-SDK transport is described in [the MCP composition contract](../../docs/internal/mcp-existing-application-actor.md#inactive-direct-sdk-transport-composition).

## Transaction and recovery contract

Expand All @@ -14,12 +14,16 @@ Read input resource UUIDs accept uppercase aliases and are lowered after UUID va

## SQL evidence and source pins

`source-bindings.json` records immutable API/SQL source heads and hashes. Before loading tests, the launcher recomputes every locally available `apiInputs` hash and the golden file hash and checks its database head. A mismatch fails qualification and requires a reviewed evidence refresh. External database source and local capture-driver/log hashes are provenance references verified in the sealed source-review packet; those external files are not present in this API checkout and are not reverified by API CI. `receipt-golden.json` contains actual create/read outputs from disposable PostgreSQL 15.10 with UTF8 encoding, using database proposal commit `df7be4c65b98924373b38c7d257f4b1c1820d6b7`. The capture used the proposal's existing supervised fixture runner, explicitly enrolled a synthetic UUID actor, granted create authority, invoked SQL create, explicitly granted named read authority and invoked SQL read. Create and read receipts were equal. The fixture reported worker group, postmaster and socket absence. No hosted database was contacted and no production migration or entitlement was applied. The capture driver and execution logs are retained in the coordinator's local audit packet; the golden file is synthetic evidence, not a receipt for a deployed application.
`source-bindings.json` records immutable API/SQL source heads and hashes. Before loading tests, the launcher recomputes every locally available `apiInputs` hash and the golden file hash and checks its database head. A mismatch fails qualification and requires a reviewed evidence refresh. External database source and local capture-driver/log hashes are provenance references verified in the sealed source-review packet; those external files are not present in this API checkout and are not reverified by API CI. `receipt-golden.json` contains actual create/read outputs from disposable PostgreSQL 15.10 with UTF8 encoding, using accepted local database proposal commit `f507a77696f20429f977df9885d6c8c11a5f304b`. The capture used the proposal's existing supervised fixture runner, explicitly enrolled a synthetic UUID actor, granted create authority, invoked SQL create, explicitly granted named read authority and invoked SQL read. Create and read receipts were equal. The fixture reported worker group, postmaster and socket absence. No hosted database was contacted and no production migration or entitlement was applied. The capture driver and execution logs are retained in the coordinator's local audit packet; the golden file is synthetic evidence, not a receipt for a deployed application.

The original API baseline was `1fff6b55b8c1b98826c375f99b4f4f66a5ba201c`; this candidate now composes the accepted OAuth PR1268 merge `5605ee143afc4ebcdba9ba33dc7b48378c70a47f`. Its shared REST expiry resolver repairs the former MCP API-key expiry omission. That omission is historical after this source merge; it does not establish original-actor evidence, nonprovisioning Privy behavior or runtime acceptance. The fixture named “HTTP-shaped JSON and MCP-shaped argument” tests input projection only; fresh nonprovisioning MCP handoff remains unresolved. Database PR138 is a separate unmerged/unapplied proposal. All runtime activation and publication remain gated by coordinator review.
The original API baseline and OAuth PR1268 merge remain historical provenance in the manifest. This compatibility candidate preserves accepted transport source `2606c9104dff3731f59d56d00bba121d2a8e47ba` and normally composes its accepted API1272 main merge `f8ec0bee58726b16f7e42b86169c6a7307a4b1b4`, whose tree equals that source. Its existing 128 controlled domain/verifier/transport cases are preserved, with explicit old-head/mismatched-descriptor rejection added for create and read before either storage port.

The previous golden was captured from `df7be4c65b98924373b38c7d257f4b1c1820d6b7`. The current golden is a new SQL capture from the accepted local successor, with new generated IDs and timestamp, not a relabeling of that historical fixture. The capture used PostgreSQL15.10 UTF8 and Python3.12.4; driver and log hashes refer to that new capture. Database PR138 remains draft, unmerged and unapplied; accepting a local successor is not publication or migration approval.

The successor reserves `P2101` for changed retry fingerprints and stale entitlement revisions on new requests. `42501` remains denial. Both definite conflicts use the existing proposed domain `conflict` kind; no raw SQL error text or broad SQLSTATE family may classify an error. Unknown transport outcomes retain the original operation/key/input without automatic retry. The compatibility portion updates the strict descriptor and actual receipt evidence. The included disposable `sql-composition/` suite now pins this Database successor and the accepted API compatibility source, and qualifies create-only P2101 mapping through the actual domain against local PostgreSQL15/17. It preserves denied and unknown outcomes, including read P2101, and separately labels synthetic error controls. This is test-only joined evidence, not a production SQL adapter or public registration availability. See [the joined qualification contract](./sql-composition/README.md) for source and runtime boundaries.

## Authentication qualifications

The independent source review at API baseline 1fff6b55 identified boundaries retained here: Privy existing-account lookup still requires an external authenticated profile GET; `self` observes the absence of an override and does not prove personal enrollment. Existing REST API-key expiry rejects parseable elapsed timestamps but treats missing or malformed timestamps as non-expiring; the tests explicitly preserve that inherited behavior without adding a second verifier. Evidence contains no expiry epoch. Verification can race with credential revocation or profile/email remapping before the storage call; SQL does not receive a credential for atomic revalidation.

`executionResources` remains exactly unresolved. Guard-unit forged-evidence negatives establish structural rejection only, not cryptographic delegated-token rejection. Existing OAuth wrappers perform separate grant revalidation; that does not provide this adapter's original-actor evidence or personal enrollment. No MCP accountId/authInfo is adapted into an invented request credential. The separately owned OAuth expiry repair is included unchanged through the accepted merge. The MCP Privy fallback can still provision accounts and the MCP handoff still does not supply this strict verifier-produced original-actor evidence.
`executionResources` remains exactly unresolved. Guard-unit forged-evidence negatives establish structural rejection only, not cryptographic delegated-token rejection. Existing OAuth wrappers perform separate grant revalidation; that does not provide this adapter's original-actor evidence or personal enrollment. No MCP accountId/authInfo is adapted into an invented request credential. The separately owned OAuth expiry repair is included unchanged through the accepted merge. The legacy public MCP Privy fallback can still provision accounts. The separately accepted opt-in existing-account verifier and unregistered transport provide controlled original-actor handoff evidence, as described in the MCP composition contract; the public route is unchanged and no deployed handoff is claimed.
18 changes: 9 additions & 9 deletions scripts/application-registration-proposal/receipt-golden.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"databaseHead": "df7be4c65b98924373b38c7d257f4b1c1820d6b7",
"databaseHead": "f507a77696f20429f977df9885d6c8c11a5f304b",
"serverVersion": "15.10 (Homebrew)",
"serverEncoding": "UTF8",
"input": {
Expand Down Expand Up @@ -51,19 +51,19 @@
"https://music.example/return"
],
"workspace_id": "11111111-1111-4111-8111-111111111111",
"application_id": "cbbb51b5-aca4-405c-9a97-aee7612b0cd4",
"application_id": "1dec8fc0-2cec-4653-859b-53e0a83fc9a1",
"allowed_origins": [
"https://music.example",
"https://preview.example"
]
},
"receipt_id": "c5ac9418-b749-4e6b-966b-6d5a3314c73d",
"receipt_id": "989252ef-7470-475c-9527-fb64c2619e94",
"environment": "production",
"recorded_at": "2026-11-18T02:41:27.506401+00:00",
"recorded_at": "2026-11-18T05:12:41.526502+00:00",
"workspace_id": "11111111-1111-4111-8111-111111111111",
"evidence_kind": "disposable_parent_assertion",
"policy_status": "proposed_unadopted",
"application_id": "cbbb51b5-aca4-405c-9a97-aee7612b0cd4",
"application_id": "1dec8fc0-2cec-4653-859b-53e0a83fc9a1",
"policy_version": "proposed-personal-v1",
"runtime_enabled": false,
"access_activated": false,
Expand Down Expand Up @@ -98,19 +98,19 @@
"https://music.example/return"
],
"workspace_id": "11111111-1111-4111-8111-111111111111",
"application_id": "cbbb51b5-aca4-405c-9a97-aee7612b0cd4",
"application_id": "1dec8fc0-2cec-4653-859b-53e0a83fc9a1",
"allowed_origins": [
"https://music.example",
"https://preview.example"
]
},
"receipt_id": "c5ac9418-b749-4e6b-966b-6d5a3314c73d",
"receipt_id": "989252ef-7470-475c-9527-fb64c2619e94",
"environment": "production",
"recorded_at": "2026-11-18T02:41:27.506401+00:00",
"recorded_at": "2026-11-18T05:12:41.526502+00:00",
"workspace_id": "11111111-1111-4111-8111-111111111111",
"evidence_kind": "disposable_parent_assertion",
"policy_status": "proposed_unadopted",
"application_id": "cbbb51b5-aca4-405c-9a97-aee7612b0cd4",
"application_id": "1dec8fc0-2cec-4653-859b-53e0a83fc9a1",
"policy_version": "proposed-personal-v1",
"runtime_enabled": false,
"access_activated": false,
Expand Down
17 changes: 10 additions & 7 deletions scripts/application-registration-proposal/source-bindings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"apiBaseline": "5605ee143afc4ebcdba9ba33dc7b48378c70a47f",
"databaseHead": "df7be4c65b98924373b38c7d257f4b1c1820d6b7",
"databaseHead": "f507a77696f20429f977df9885d6c8c11a5f304b",
"policyStatus": "proposed_unadopted",
"apiInputs": {
"lib/auth/validateAuthContext.ts": "055ac2965db8487c8f67d74c549101d866968ed507d295498ed4485d62867c28",
Expand All @@ -15,10 +15,10 @@
},
"databaseInputs": {
"proposals/application-registration-2104/protocol-composition.py": "377791d3ef4a26103bd046609d4b8dbf8f63a3d475aa2c72faeba68b553aada5",
"proposals/application-registration-2104/registration.sql": "472440d1540a79eb34255efcbc7a6286bb394e1f3779e7ed6a6b7ace33cd9074",
"proposals/application-registration-2104/registration.sql": "3377dd6f86bdf3052a2dd00b66380540764e07a763003f6a1c46192c336e6409",
"proposals/application-registration-2104/parents.sql": "2a1096eadf1ee947f2b1d6bb88f5750e26436ee8ea82ae1f306a279da8b41c2d",
"proposals/application-registration-2104/qualification-bootstrap.sql": "6c318540735e46c8ace40cd686bf7cc1851fb3296b5a123d29e287f94be35c05",
"proposals/application-registration-2104/test_registration.py": "ca498687ee4983767f2cf592dfd424a954fe17d0acaa04e18ae9960ed62f3a16",
"proposals/application-registration-2104/test_registration.py": "4051b2581646cea5ac2d36a23d5d5e6271dd02cbf0997e0792623289914d230c",
"proposals/application-proof-2104/proposal.sql": "2cf96399422cfc1e68b0578b7aeb7b58a97c56303d85b91ee6cf862329f6c86c",
"proposals/application-proof-2104/fixture.sql": "b4435b1c5546d471c33b758f1ac8a7fd8ca199071b08cc541f4cb199e6412668",
"proposals/application-proof-2104/test_configuration.py": "43b686a33660dfb8bfd7b26c4827a74527cc430466567311726cb54881406cad",
Expand All @@ -27,11 +27,14 @@
"proposals/application-proof-2104/fixture-authority.sql": "0a2715a5a4f93c349df06d25a6334d513350f225a36af71ae8694fe1914c4c99",
"proposals/application-proof-2104/configuration.sql": "148819c1363929e990bf2cfd67bae02f7567c2e2e2a05732cb17ea2248bad3b1"
},
"goldenSha256": "357e2c82f6b9473d024cf6472bdec8d670de64531c0a51fa0843b94f1e70c1fe",
"captureDriverSha256": "86f6b0de4d43aadec92154a8fd9e51407eb4837f081f0e6d6ffae75455da595f",
"goldenCaptureLogSha256": "0eb40678c48643d87d2515c68236e62b23f2faf874f6794053b418378e071d6f",
"goldenSha256": "4b386f6dd38d689e08bb7f230ed2873a9764a3bc6f3038ca36cfc2442e1fb129",
"captureDriverSha256": "b9f4342e278704c8767f0a738f35b3c8f92ff84a6b0cedc49074d9602cdfa2dd",
"goldenCaptureLogSha256": "56cc23432ad600743f07d5d2b04f7b7e08c8c677e100293bbd975334002f1135",
"scope": "No route, MCP registration, concrete Supabase adapter, factory, hosted execution, deployment or policy adoption",
"originalApiBaseline": "1fff6b55b8c1b98826c375f99b4f4f66a5ba201c",
"acceptedOAuthMerge": "5605ee143afc4ebcdba9ba33dc7b48378c70a47f",
"adapterBeforeComposition": "ce271f4be5570cb0774d582a5e1b832e406aec7f"
"adapterBeforeComposition": "ce271f4be5570cb0774d582a5e1b832e406aec7f",
"acceptedTransportSource": "2606c9104dff3731f59d56d00bba121d2a8e47ba",
"previousDatabaseHead": "df7be4c65b98924373b38c7d257f4b1c1820d6b7",
"acceptedTransportMerge": "f8ec0bee58726b16f7e42b86169c6a7307a4b1b4"
}
Loading
Loading