Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(grants): keep the F3 token grant columns migration-only, like permissions

garrytan9bcebb49b1cd
diff --git a/scripts/build-schema.ts b/scripts/build-schema.ts
index 83d3fa0dcc..649d7c3287 100644
--- a/scripts/build-schema.ts
+++ b/scripts/build-schema.ts
@@ -30,7 +30,6 @@ import { dirname, join, resolve } from 'node:path';
import { SOURCE_INGESTION_RECEIPTS_SCHEMA_SQL } from '../src/core/company-brain/receipt-schema.ts';
import { FACT_WITHDRAWAL_SCHEMA_STATEMENTS } from '../src/core/facts/withdrawal-schema.ts';
import { GRANT_AUDIT_SCHEMA_SQL } from '../src/core/grants/schema.ts';
-import { ACCESS_TOKEN_GRANT_SCHEMA_SQL } from '../src/core/grants/access-token-schema.ts';
import { LEASE_TOKEN_SCHEMA_SQL } from '../src/core/lease-schema.ts';
import { PAGE_PROJECTION_SCHEMA_SQL } from '../src/core/page-state/projection-schema.ts';
import { PAGE_STATE_SCHEMA_SQL } from '../src/core/page-state/schema.ts';
@@ -69,7 +68,6 @@ export interface Fragment {
const persistenceSql = (statements: readonly string[]) => `${statements.join(';\n')};`;
export const FRAGMENTS: readonly Fragment[] = [
- { source: 'src/core/grants/access-token-schema.ts', expr: 'ACCESS_TOKEN_GRANT_SCHEMA_SQL', postgres: ACCESS_TOKEN_GRANT_SCHEMA_SQL, pglite: ACCESS_TOKEN_GRANT_SCHEMA_SQL },
{ source: 'src/core/grants/schema.ts', expr: 'GRANT_AUDIT_SCHEMA_SQL', postgres: GRANT_AUDIT_SCHEMA_SQL, pglite: GRANT_AUDIT_SCHEMA_SQL },
{
source: 'src/core/facts/withdrawal-schema.ts',
diff --git a/src/core/grants/access-token-schema.ts b/src/core/grants/access-token-schema.ts
index 543094b20e..2ee074d34e 100644
--- a/src/core/grants/access-token-schema.ts
+++ b/src/core/grants/access-token-schema.ts
@@ -5,6 +5,10 @@
* parsers until its next write (`auth rescope`, `auth create`, rotation, or
* `auth rescope --migrate-legacy`). No foreign key on `source_id`: the client
* FK is ON DELETE RESTRICT, and tokens must not start blocking source removal.
+ *
+ * Migration-only, like `permissions` (v038): the schema blob's access_tokens
+ * has neither, so fresh installs and upgrades both add the columns in the same
+ * order (pinned by test/pglite-upgrade-replay.test.ts).
*/
export const ACCESS_TOKEN_GRANT_SCHEMA_SQL = `
ALTER TABLE access_tokens ADD COLUMN IF NOT EXISTS source_grant TEXT
diff --git a/src/core/pglite-schema.generated.ts b/src/core/pglite-schema.generated.ts
index 77ca982794..24451f0f17 100644
--- a/src/core/pglite-schema.generated.ts
+++ b/src/core/pglite-schema.generated.ts
@@ -284,14 +284,6 @@ CREATE TABLE IF NOT EXISTS access_tokens (
CREATE INDEX IF NOT EXISTS idx_access_tokens_hash ON access_tokens (token_hash) WHERE revoked_at IS NULL;
-ALTER TABLE access_tokens ADD COLUMN IF NOT EXISTS source_grant TEXT
- CHECK (source_grant IN ('default', 'scalar', 'federated', 'none'));
-ALTER TABLE access_tokens ADD COLUMN IF NOT EXISTS source_id TEXT;
-ALTER TABLE access_tokens ADD COLUMN IF NOT EXISTS federated_read TEXT[];
-ALTER TABLE access_tokens ADD COLUMN IF NOT EXISTS allowed_operations TEXT[];
-ALTER TABLE access_tokens ADD COLUMN IF NOT EXISTS takes_holders TEXT[];
-ALTER TABLE access_tokens ADD COLUMN IF NOT EXISTS grant_revision INTEGER NOT NULL DEFAULT 0;
-
CREATE TABLE IF NOT EXISTS mcp_request_log (
id SERIAL PRIMARY KEY,
token_name TEXT,
diff --git a/src/core/schema-embedded.generated.ts b/src/core/schema-embedded.generated.ts
index 49f6fc97cd..278e3da555 100644
--- a/src/core/schema-embedded.generated.ts
+++ b/src/core/schema-embedded.generated.ts
@@ -644,16 +644,6 @@ CREATE TABLE IF NOT EXISTS access_tokens (
CREATE INDEX IF NOT EXISTS idx_access_tokens_hash ON access_tokens (token_hash) WHERE revoked_at IS NULL;
--- BEGIN GENERATED from src/core/grants/access-token-schema.ts (ACCESS_TOKEN_GRANT_SCHEMA_SQL). Edit that file, then run: bun run build:schema
-ALTER TABLE access_tokens ADD COLUMN IF NOT EXISTS source_grant TEXT
- CHECK (source_grant IN ('default', 'scalar', 'federated', 'none'));
-ALTER TABLE access_tokens ADD COLUMN IF NOT EXISTS source_id TEXT;
-ALTER TABLE access_tokens ADD COLUMN IF NOT EXISTS federated_read TEXT[];
-ALTER TABLE access_tokens ADD COLUMN IF NOT EXISTS allowed_operations TEXT[];
-ALTER TABLE access_tokens ADD COLUMN IF NOT EXISTS takes_holders TEXT[];
-ALTER TABLE access_tokens ADD COLUMN IF NOT EXISTS grant_revision INTEGER NOT NULL DEFAULT 0;
--- END GENERATED from src/core/grants/access-token-schema.ts (ACCESS_TOKEN_GRANT_SCHEMA_SQL)
-
-- ============================================================
-- mcp_request_log: usage logging for remote MCP requests
-- ============================================================
diff --git a/src/schema.sql b/src/schema.sql
index eeb10dd898..a557d8d739 100644
--- a/src/schema.sql
+++ b/src/schema.sql
@@ -640,16 +640,6 @@ CREATE TABLE IF NOT EXISTS access_tokens (
CREATE INDEX IF NOT EXISTS idx_access_tokens_hash ON access_tokens (token_hash) WHERE revoked_at IS NULL;
--- BEGIN GENERATED from src/core/grants/access-token-schema.ts (ACCESS_TOKEN_GRANT_SCHEMA_SQL). Edit that file, then run: bun run build:schema
-ALTER TABLE access_tokens ADD COLUMN IF NOT EXISTS source_grant TEXT
- CHECK (source_grant IN ('default', 'scalar', 'federated', 'none'));
-ALTER TABLE access_tokens ADD COLUMN IF NOT EXISTS source_id TEXT;
-ALTER TABLE access_tokens ADD COLUMN IF NOT EXISTS federated_read TEXT[];
-ALTER TABLE access_tokens ADD COLUMN IF NOT EXISTS allowed_operations TEXT[];
-ALTER TABLE access_tokens ADD COLUMN IF NOT EXISTS takes_holders TEXT[];
-ALTER TABLE access_tokens ADD COLUMN IF NOT EXISTS grant_revision INTEGER NOT NULL DEFAULT 0;
--- END GENERATED from src/core/grants/access-token-schema.ts (ACCESS_TOKEN_GRANT_SCHEMA_SQL)
-
-- ============================================================
-- mcp_request_log: usage logging for remote MCP requests
-- ============================================================
diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-default.json b/test/fixtures/goldens/catalog/pglite-engine-init-default.json
index 5ed432ec0f..c08b253f5b 100644
--- a/test/fixtures/goldens/catalog/pglite-engine-init-default.json
+++ b/test/fixtures/goldens/catalog/pglite-engine-init-default.json
@@ -999,13 +999,13 @@
"5 created_at timestamp with time zone/timestamptz NULL DEFAULT now()",
"6 last_used_at timestamp with time zone/timestamptz NULL",
"7 revoked_at timestamp with time zone/timestamptz NULL",
- "8 source_grant text/text NULL",
- "9 source_id text/text NULL",
- "10 federated_read ARRAY/_text NULL",
- "11 allowed_operations ARRAY/_text NULL",
- "12 takes_holders ARRAY/_text NULL",
- "13 grant_revision integer/int4 NOT NULL DEFAULT 0",
- "14 permissions jsonb/jsonb NOT NULL DEFAULT '{\"takes_holders\": [\"world\"]}'::jsonb"
+ "8 permissions jsonb/jsonb NOT NULL DEFAULT '{\"takes_holders\": [\"world\"]}'::jsonb",
+ "9 source_grant text/text NULL",
+ "10 source_id text/text NULL",
+ "11 federated_read ARRAY/_text NULL",
+ "12 allowed_operations ARRAY/_text NULL",
+ "13 takes_holders ARRAY/_text NULL",
+ "14 grant_revision integer/int4 NOT NULL DEFAULT 0"
],
"flags": "relkind=r rls=false force_rls=false"
},
diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json
index 69ce2ed945..48c5cf4615 100644
--- a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json
+++ b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json
@@ -999,13 +999,13 @@
"5 created_at timestamp with time zone/timestamptz NULL DEFAULT now()",
"6 last_used_at timestamp with time zone/timestamptz NULL",
"7 revoked_at timestamp with time zone/timestamptz NULL",
- "8 source_grant text/text NULL",
- "9 source_id text/text NULL",
- "10 federated_read ARRAY/_text NULL",
- "11 allowed_operations ARRAY/_text NULL",
- "12 takes_holders ARRAY/_text NULL",
- "13 grant_revision integer/int4 NOT NULL DEFAULT 0",
- "14 permissions jsonb/jsonb NOT NULL DEFAULT '{\"takes_holders\": [\"world\"]}'::jsonb"
+ "8 permissions jsonb/jsonb NOT NULL DEFAULT '{\"takes_holders\": [\"world\"]}'::jsonb",
+ "9 source_grant text/text NULL",
+ "10 source_id text/text NULL",
+ "11 federated_read ARRAY/_text NULL",
+ "12 allowed_operations ARRAY/_text NULL",
+ "13 takes_holders ARRAY/_text NULL",
+ "14 grant_revision integer/int4 NOT NULL DEFAULT 0"
],
"flags": "relkind=r rls=false force_rls=false"
},
diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json
index 649470899d..ae9a5c6eab 100644
--- a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json
+++ b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json
@@ -995,13 +995,13 @@
"5 created_at timestamp with time zone/timestamptz NULL DEFAULT now()",
"6 last_used_at timestamp with time zone/timestamptz NULL",
"7 revoked_at timestamp with time zone/timestamptz NULL",
- "8 source_grant text/text NULL",
- "9 source_id text/text NULL",
- "10 federated_read ARRAY/_text NULL",
- "11 allowed_operations ARRAY/_text NULL",
- "12 takes_holders ARRAY/_text NULL",
- "13 grant_revision integer/int4 NOT NULL DEFAULT 0",
- "14 permissions jsonb/jsonb NOT NULL DEFAULT '{\"takes_holders\": [\"world\"]}'::jsonb"
+ "8 permissions jsonb/jsonb NOT NULL DEFAULT '{\"takes_holders\": [\"world\"]}'::jsonb",
+ "9 source_grant text/text NULL",
+ "10 source_id text/text NULL",
+ "11 federated_read ARRAY/_text NULL",
+ "12 allowed_operations ARRAY/_text NULL",
+ "13 takes_holders ARRAY/_text NULL",
+ "14 grant_revision integer/int4 NOT NULL DEFAULT 0"
],
"flags": "relkind=r rls=false force_rls=false"
},
diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-default.json b/test/fixtures/goldens/catalog/pglite-schema-blob-default.json
index 30f3bbc135..5713375a5c 100644
--- a/test/fixtures/goldens/catalog/pglite-schema-blob-default.json
+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-default.json
@@ -2,7 +2,6 @@
"golden": {
"constraints": {
"access_tokens.access_tokens_pkey": "p PRIMARY KEY (id)",
- "access_tokens.access_tokens_source_grant_check": "c CHECK ((source_grant = ANY (ARRAY['default'::text, 'scalar'::text, 'federated'::text, 'none'::text])))",
"access_tokens.access_tokens_token_hash_key": "u UNIQUE (token_hash)",
"calibration_profiles.calibration_profiles_pkey": "p PRIMARY KEY (id)",
"calibration_profiles.calibration_profiles_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",
@@ -758,13 +757,7 @@
"4 scopes ARRAY/_text NULL",
"5 created_at timestamp with time zone/timestamptz NULL DEFAULT now()",
"6 last_used_at timestamp with time zone/timestamptz NULL",
- "7 revoked_at timestamp with time zone/timestamptz NULL",
- "8 source_grant text/text NULL",
- "9 source_id text/text NULL",
- "10 federated_read ARRAY/_text NULL",
- "11 allowed_operations ARRAY/_text NULL",
- "12 takes_holders ARRAY/_text NULL",
- "13 grant_revision integer/int4 NOT NULL DEFAULT 0"
+ "7 revoked_at timestamp with time zone/timestamptz NULL"
],
"flags": "relkind=r rls=false force_rls=false"
},
diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json b/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json
index f4232fc23f..df29c05ed7 100644
--- a/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json
+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json
@@ -2,7 +2,6 @@
"golden": {
"constraints": {
"access_tokens.access_tokens_pkey": "p PRIMARY KEY (id)",
- "access_tokens.access_tokens_source_grant_check": "c CHECK ((source_grant = ANY (ARRAY['default'::text, 'scalar'::text, 'federated'::text, 'none'::text])))",
"access_tokens.access_tokens_token_hash_key": "u UNIQUE (token_hash)",
"calibration_profiles.calibration_profiles_pkey": "p PRIMARY KEY (id)",
"calibration_profiles.calibration_profiles_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",
@@ -758,13 +757,7 @@
"4 scopes ARRAY/_text NULL",
"5 created_at timestamp with time zone/timestamptz NULL DEFAULT now()",
"6 last_used_at timestamp with time zone/timestamptz NULL",
- "7 revoked_at timestamp with time zone/timestamptz NULL",
- "8 source_grant text/text NULL",
- "9 source_id text/text NULL",
- "10 federated_read ARRAY/_text NULL",
- "11 allowed_operations ARRAY/_text NULL",
- "12 takes_holders ARRAY/_text NULL",
- "13 grant_revision integer/int4 NOT NULL DEFAULT 0"
+ "7 revoked_at timestamp with time zone/timestamptz NULL"
],
"flags": "relkind=r rls=false force_rls=false"
},
diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json b/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json
index 64c1bbf0d2..3a97f0e912 100644
--- a/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json
+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json
@@ -2,7 +2,6 @@
"golden": {
"constraints": {
"access_tokens.access_tokens_pkey": "p PRIMARY KEY (id)",
- "access_tokens.access_tokens_source_grant_check": "c CHECK ((source_grant = ANY (ARRAY['default'::text, 'scalar'::text, 'federated'::text, 'none'::text])))",
"access_tokens.access_tokens_token_hash_key": "u UNIQUE (token_hash)",
"calibration_profiles.calibration_profiles_pkey": "p PRIMARY KEY (id)",
"calibration_profiles.calibration_profiles_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE",
@@ -757,13 +756,7 @@
"4 scopes ARRAY/_text NULL",
"5 created_at timestamp with time zone/timestamptz NULL DEFAULT now()",
"6 last_used_at timestamp with time zone/timestamptz NULL",
- "7 revoked_at timestamp with time zone/timestamptz NULL",
- "8 source_grant text/text NULL",
- "9 source_id text/text NULL",
- "10 federated_read ARRAY/_text NULL",
- "11 allowed_operations ARRAY/_text NULL",
- "12 takes_holders ARRAY/_text NULL",
- "13 grant_revision integer/int4 NOT NULL DEFAULT 0"
+ "7 revoked_at timestamp with time zone/timestamptz NULL"
],
"flags": "relkind=r rls=false force_rls=false"
},
diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-default.json b/test/fixtures/goldens/catalog/postgres-engine-init-default.json
index 0b77769c01..d4cda68440 100644
--- a/test/fixtures/goldens/catalog/postgres-engine-init-default.json
+++ b/test/fixtures/goldens/catalog/postgres-engine-init-default.json
@@ -2,6 +2,7 @@
"golden": {
"constraints": {
"access_tokens.access_tokens_pkey": "p PRIMARY KEY (id)",
+ "access_tokens.access_tokens_source_grant_check": "c CHECK ((source_grant = ANY (ARRAY['default'::text, 'scalar'::text, 'federated'::text, 'none'::text])))",
"access_tokens.access_tokens_token_hash_key": "u UNIQUE (token_hash)",
"budget_ledger.budget_ledger_pkey": "p PRIMARY KEY (scope, resolver_id, local_date)",
"budget_reservations.budget_reservations_pkey": "p PRIMARY KEY (reservation_id)",
@@ -1011,7 +1012,13 @@
"5 created_at timestamp with time zone/timestamptz NULL DEFAULT now()",
"6 last_used_at timestamp with time zone/timestamptz NULL",
"7 revoked_at timestamp with time zone/timestamptz NULL",
- "8 permissions jsonb/jsonb NOT NULL DEFAULT '{\"takes_holders\": [\"world\"]}'::jsonb"
+ "8 permissions jsonb/jsonb NOT NULL DEFAULT '{\"takes_holders\": [\"world\"]}'::jsonb",
+ "9 source_grant text/text NULL",
+ "10 source_id text/text NULL",
+ "11 federated_read ARRAY/_text NULL",
+ "12 allowed_operations ARRAY/_text NULL",
+ "13 takes_holders ARRAY/_text NULL",
+ "14 grant_revision integer/int4 NOT NULL DEFAULT 0"
],
"flags": "relkind=r rls=true force_rls=false"
},
diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json b/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json
index 0dce91a16e..e304bbf0d6 100644
--- a/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json
+++ b/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json
@@ -2,6 +2,7 @@
"golden": {
"constraints": {
"access_tokens.access_tokens_pkey": "p PRIMARY KEY (id)",
+ "access_tokens.access_tokens_source_grant_check": "c CHECK ((source_grant = ANY (ARRAY['default'::text, 'scalar'::text, 'federated'::text, 'none'::text])))",
"access_tokens.access_tokens_token_hash_key": "u UNIQUE (token_hash)",
"budget_ledger.budget_ledger_pkey": "p PRIMARY KEY (scope, resolver_id, local_date)",
"budget_reservations.budget_reservations_pkey": "p PRIMARY KEY (reservation_id)",
@@ -1011,7 +1012,13 @@
"5 created_at timestamp with time zone/timestamptz NULL DEFAULT now()",
"6 last_used_at timestamp with time zone/timestamptz NULL",
"7 revoked_at timestamp with time zone/timestamptz NULL",
- "8 permissions jsonb/jsonb NOT NULL DEFAULT '{\"takes_holders\": [\"world\"]}'::jsonb"
+ "8 permissions jsonb/jsonb NOT NULL DEFAULT '{\"takes_holders\": [\"world\"]}'::jsonb",
+ "9 source_grant text/text NULL",
+ "10 source_id text/text NULL",
+ "11 federated_read ARRAY/_text NULL",
+ "12 allowed_operations ARRAY/_text NULL",
+ "13 takes_holders ARRAY/_text NULL",
+ "14 grant_revision integer/int4 NOT NULL DEFAULT 0"
],
"flags": "relkind=r rls=true force_rls=false"
},
diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json b/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json
index 118e639ee7..89918bf8e1 100644
--- a/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json
+++ b/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json
@@ -2,6 +2,7 @@
"golden": {
"constraints": {
"access_tokens.access_tokens_pkey": "p PRIMARY KEY (id)",
+ "access_tokens.access_tokens_source_grant_check": "c CHECK ((source_grant = ANY (ARRAY['default'::text, 'scalar'::text, 'federated'::text, 'none'::text])))",
"access_tokens.access_tokens_token_hash_key": "u UNIQUE (token_hash)",
"budget_ledger.budget_ledger_pkey": "p PRIMARY KEY (scope, resolver_id, local_date)",
"budget_reservations.budget_reservations_pkey": "p PRIMARY KEY (reservation_id)",
@@ -1007,7 +1008,13 @@
"5 created_at timestamp with time zone/timestamptz NULL DEFAULT now()",
"6 last_used_at timestamp with time zone/timestamptz NULL",
"7 revoked_at timestamp with time zone/timestamptz NULL",
- "8 permissions jsonb/jsonb NOT NULL DEFAULT '{\"takes_holders\": [\"world\"]}'::jsonb"
+ "8 permissions jsonb/jsonb NOT NULL DEFAULT '{\"takes_holders\": [\"world\"]}'::jsonb",
+ "9 source_grant text/text NULL",
+ "10 source_id text/text NULL",
+ "11 federated_read ARRAY/_text NULL",
+ "12 allowed_operations ARRAY/_text NULL",
+ "13 takes_holders ARRAY/_text NULL",
+ "14 grant_revision integer/int4 NOT NULL DEFAULT 0"
],
"flags": "relkind=r rls=true force_rls=false"
},
diff --git a/test/fixtures/goldens/doctor/json-pglite-degraded.json b/test/fixtures/goldens/doctor/json-pglite-degraded.json
index 7ed1c100e5..569a43d07b 100644
--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json
+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json
@@ -389,7 +389,7 @@
},
{
"category": "meta",
- "message": "819 column(s) verified against live schema",
+ "message": "813 column(s) verified against live schema",
"name": "schema_columns",
"status": "ok"
},
diff --git a/test/fixtures/goldens/doctor/json-pglite-fresh.json b/test/fixtures/goldens/doctor/json-pglite-fresh.json
index 7b7513b83b..8c1ab3e8cb 100644
--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json
+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json
@@ -389,7 +389,7 @@
},
{
"category": "meta",
- "message": "819 column(s) verified against live schema",
+ "message": "813 column(s) verified against live schema",
"name": "schema_columns",
"status": "ok"
},
diff --git a/test/fixtures/goldens/doctor/json-postgres-fresh.json b/test/fixtures/goldens/doctor/json-postgres-fresh.json
index 9a259010fd..9b425f2dd5 100644
--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json
+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json
@@ -389,7 +389,7 @@
},
{
"category": "meta",
- "message": "Version 192 (latest: 192)",
+ "message": "Version 193 (latest: 193)",
"name": "schema_version",
"status": "ok"
},
@@ -940,6 +940,27 @@
"name": "legacy_job_authority",
"status": "ok"
},
+ {
+ "category": "ops",
+ "details": {
+ "docs": "docs/mcp/ADMIN.md#legacy-token-grants",
+ "legacy_shape_count": 0,
+ "malformed": []
+ },
+ "message": "Every active legacy token uses the unified grant columns.",
+ "name": "legacy_token_grant_shape",
+ "status": "ok"
+ },
+ {
+ "category": "ops",
+ "details": {
+ "docs": "docs/mcp/ADMIN.md#legacy-token-grants",
+ "drift": []
+ },
+ "message": "No legacy token grant has drifted from its permissions mirror.",
+ "name": "legacy_token_grant_drift",
+ "status": "ok"
+ },
{
"category": "brain",
"message": "No image assets indexed yet",
diff --git a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json
index 9d2f29e0c0..16fd0170c4 100644
--- a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json
+++ b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json
@@ -2,6 +2,7 @@
"golden": {
"constraints": {
"access_tokens.access_tokens_pkey": "p PRIMARY KEY (id)",
+ "access_tokens.access_tokens_source_grant_check": "c CHECK ((source_grant = ANY (ARRAY['default'::text, 'scalar'::text, 'federated'::text, 'none'::text])))",
"access_tokens.access_tokens_token_hash_key": "u UNIQUE (token_hash)",
"budget_ledger.budget_ledger_pkey": "p PRIMARY KEY (scope, resolver_id, local_date)",
"budget_reservations.budget_reservations_pkey": "p PRIMARY KEY (reservation_id)",
@@ -998,7 +999,13 @@
"5 created_at timestamp with time zone/timestamptz NULL DEFAULT now()",
"6 last_used_at timestamp with time zone/timestamptz NULL",
"7 revoked_at timestamp with time zone/timestamptz NULL",
- "8 permissions jsonb/jsonb NOT NULL DEFAULT '{\"takes_holders\": [\"world\"]}'::jsonb"
+ "8 permissions jsonb/jsonb NOT NULL DEFAULT '{\"takes_holders\": [\"world\"]}'::jsonb",
+ "9 source_grant text/text NULL",
+ "10 source_id text/text NULL",
+ "11 federated_read ARRAY/_text NULL",
+ "12 allowed_operations ARRAY/_text NULL",
+ "13 takes_holders ARRAY/_text NULL",
+ "14 grant_revision integer/int4 NOT NULL DEFAULT 0"
],
"flags": "relkind=r rls=false force_rls=false"
},