Skip to content

Commit 839e0b8

Browse files
committed
feat(T023): add disabled local Postgres compile harness stub
1 parent 1a80237 commit 839e0b8

26 files changed

Lines changed: 277 additions & 137 deletions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Local Postgres Compile Harness Stub
2+
3+
T023 is disabled-by-default.
4+
It does not start Postgres.
5+
It does not execute SQL.
6+
It does not call Docker, psql, or Supabase CLI.
7+
It does not connect to any database.
8+
It only records a disabled status report.
9+
Future actual local compile execution requires a separate explicit gate.
10+
Live Supabase remains later and requires explicit approval.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"stub_id": "pg-compile-harness-stub-001",
3+
"version": "0.23.0",
4+
"status": "disabled",
5+
"no_execution_now": true,
6+
"future_gate_required": true,
7+
"source_design_manifest": "docs/backend/supabase/local-compile-harness/local-postgres-compile-harness.manifest.json",
8+
"source_sql_files": [
9+
"docs/backend/supabase/rehearsal/001_ai_scan_storage_schema.rehearsal.sql",
10+
"docs/backend/supabase/rehearsal/001_ai_scan_storage_schema.rollback.rehearsal.sql"
11+
],
12+
"forbidden_now": [
13+
"docker",
14+
"docker compose",
15+
"psql",
16+
"supabase cli",
17+
"supabase link",
18+
"supabase db push",
19+
"live database URLs",
20+
"service role keys",
21+
"anon keys",
22+
"wrangler deploy",
23+
"GitHub Actions scanner mode",
24+
"SARIF",
25+
"PR annotations"
26+
],
27+
"allowed_now": [
28+
"read local manifest files",
29+
"read local SQL rehearsal files",
30+
"produce deterministic disabled status report",
31+
"validate safety boundary"
32+
]
33+
}

docs/backend/supabase/rehearsal/migration-rehearsal.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"schema_version": "0.20.0",
2+
"schema_version": "0.23.0",
33
"rehearsal_type": "caesar-ai-scan-supabase-migration-rehearsal",
44
"rehearsal_status": "local_only_not_applied",
55
"source_contract": {

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "caesar-ai-scan",
3-
"version": "0.22.0",
3+
"version": "0.23.0",
44
"description": "Static-analysis CLI and CI/CD tool to inventory AI dependencies, framework usage, vector DBs, and credentials.",
55
"type": "module",
66
"main": "src/cli.mjs",
@@ -38,7 +38,9 @@
3838
"validate:sql-compile-rehearsal": "node scripts/validate-sql-compile-rehearsal.mjs",
3939
"postgres:compile-harness-report": "node scripts/build-local-postgres-compile-harness-report.mjs",
4040
"validate:postgres-compile-harness": "node scripts/validate-local-postgres-compile-harness.mjs",
41-
"check:all-offline": "npm run check:syntax && npm run scan:sample && npm run validate:samples && npm run validate:rule-pack-v1 && npm run review:sample && npm run validate:review && npm run pack:sample && npm run validate:pack && npm run scope:sample && npm run validate:scope && npm run validate:history && npm run inventory:sample && npm run validate:inventory && npm run bundle:sample && npm run validate:bundle && npm run import:sample && npm run validate:import && npm run build:site && npm run validate:site && npm run api:sample && npm run dashboard:sample && npm run validate:dashboard && npm run validate:local-api && npm run validate:backend-boundary && npm run store:sample && npm run validate:store && npm run supabase:mapping-sample && npm run validate:supabase-draft && npm run worker:route-sample && npm run validate:worker-boundary && npm run supabase:migration-rehearsal-report && npm run validate:supabase-rehearsal && npm run sql:compile-rehearsal-report && npm run validate:sql-compile-rehearsal && npm run postgres:compile-harness-report && npm run validate:postgres-compile-harness",
41+
"postgres:compile-harness-stub": "node scripts/run-local-postgres-compile-harness-stub.mjs",
42+
"validate:postgres-compile-harness-stub": "node scripts/validate-local-postgres-compile-harness-stub.mjs",
43+
"check:all-offline": "npm run check:syntax && npm run scan:sample && npm run validate:samples && npm run validate:rule-pack-v1 && npm run review:sample && npm run validate:review && npm run pack:sample && npm run validate:pack && npm run scope:sample && npm run validate:scope && npm run validate:history && npm run inventory:sample && npm run validate:inventory && npm run bundle:sample && npm run validate:bundle && npm run import:sample && npm run validate:import && npm run build:site && npm run validate:site && npm run api:sample && npm run dashboard:sample && npm run validate:dashboard && npm run validate:local-api && npm run validate:backend-boundary && npm run store:sample && npm run validate:store && npm run supabase:mapping-sample && npm run validate:supabase-draft && npm run worker:route-sample && npm run validate:worker-boundary && npm run supabase:migration-rehearsal-report && npm run validate:supabase-rehearsal && npm run sql:compile-rehearsal-report && npm run validate:sql-compile-rehearsal && npm run postgres:compile-harness-report && npm run validate:postgres-compile-harness && npm run postgres:compile-harness-stub && npm run validate:postgres-compile-harness-stub",
4244
"api:sample": "node scripts/generate-api-projection.mjs",
4345
"dashboard:sample": "node scripts/build-static-dashboard-demo.mjs",
4446
"validate:dashboard": "node scripts/validate-static-dashboard.mjs",
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "Local Postgres Compile Harness Stub Schema",
4+
"type": "object",
5+
"properties": {
6+
"stub_id": { "type": "string" },
7+
"version": { "type": "string" },
8+
"status": { "type": "string", "enum": ["disabled"] },
9+
"no_execution_now": { "type": "boolean" },
10+
"future_gate_required": { "type": "boolean" },
11+
"source_design_manifest": { "type": "string" },
12+
"source_sql_files": { "type": "array", "items": { "type": "string" } },
13+
"forbidden_now": { "type": "array", "items": { "type": "string" } },
14+
"allowed_now": { "type": "array", "items": { "type": "string" } }
15+
},
16+
"required": ["stub_id", "version", "status", "no_execution_now", "future_gate_required"]
17+
}

schemas/supabase-migration-rehearsal.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"schema_version": "0.22.0",
2+
"schema_version": "0.23.0",
33
"rehearsal_type": "caesar-ai-scan-supabase-migration-rehearsal",
44
"rehearsal_status": "local_only_not_applied",
55
"source_contract": {
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { readFileSync, writeFileSync } from 'fs';
2+
import { join } from 'path';
3+
4+
const stubManifestPath = join(process.cwd(), 'docs/backend/supabase/local-compile-harness/local-postgres-compile-harness-stub.manifest.json');
5+
const reportOutputPath = join(process.cwd(), 'site/data/rehearsal/local-postgres-compile-harness-stub-report.json');
6+
7+
const stubManifest = JSON.parse(readFileSync(stubManifestPath, 'utf8'));
8+
9+
const report = {
10+
timestamp: new Date().toISOString(),
11+
stub_id: stubManifest.stub_id,
12+
status: "disabled",
13+
executed_sql: false,
14+
invoked_docker: false,
15+
invoked_psql: false,
16+
invoked_supabase_cli: false,
17+
connected_to_database: false,
18+
applied_migrations: false,
19+
requires_future_gate: true,
20+
notes: "Stub enabled in safe mode. No execution attempted."
21+
};
22+
23+
writeFileSync(reportOutputPath, JSON.stringify(report, null, 2));
24+
console.log('Stub report generated successfully.');
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { readFileSync, existsSync } from 'fs';
2+
import { join } from 'path';
3+
4+
const reportPath = join(process.cwd(), 'site/data/rehearsal/local-postgres-compile-harness-stub-report.json');
5+
const manifestPath = join(process.cwd(), 'docs/backend/supabase/local-compile-harness/local-postgres-compile-harness-stub.manifest.json');
6+
7+
if (!existsSync(reportPath)) {
8+
console.error('Report file does not exist.');
9+
process.exit(1);
10+
}
11+
12+
const report = JSON.parse(readFileSync(reportPath, 'utf8'));
13+
14+
if (report.status !== 'disabled' || report.executed_sql || report.invoked_docker || report.invoked_psql || report.invoked_supabase_cli || report.connected_to_database || report.applied_migrations || !report.requires_future_gate) {
15+
console.error('Report indicates forbidden activity.');
16+
process.exit(1);
17+
}
18+
19+
if (!existsSync(manifestPath)) {
20+
console.error('Manifest file missing.');
21+
process.exit(1);
22+
}
23+
24+
console.log('Validation passed.');

scripts/validate-supabase-migration-rehearsal.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ async function validate() {
106106
const forwardSql = await fs.readFile(FORWARD_SQL, 'utf8');
107107
const rollbackSql = await fs.readFile(ROLLBACK_SQL, 'utf8');
108108

109-
if (schema.schema_version !== '0.22.0') {
110-
throw new Error('Schema version must be 0.22.0');
109+
if (schema.schema_version !== '0.23.0') {
110+
throw new Error('Schema version must be 0.23.0');
111111
}
112112
if (manifest.rehearsal_status !== 'local_only_not_applied') {
113113
throw new Error('Manifest rehearsal_status must be local_only_not_applied');
@@ -140,8 +140,8 @@ async function validate() {
140140
}
141141
}
142142

143-
if (pkg.version !== '0.22.0') {
144-
throw new Error('package.json version must be 0.22.0');
143+
if (pkg.version !== '0.23.0') {
144+
throw new Error('package.json version must be 0.23.0');
145145
}
146146
if (!pkg.scripts['validate:supabase-rehearsal'] || !pkg.scripts['supabase:migration-rehearsal-report']) {
147147
throw new Error('package.json missing supabase rehearsal scripts');

0 commit comments

Comments
 (0)