@urateam/core 0.1.54 → 0.1.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/auth-monitor.test.js +119 -20
- package/dist/__tests__/auth-monitor.test.js.map +1 -1
- package/dist/__tests__/bec-238-repro.test.d.ts +2 -0
- package/dist/__tests__/bec-238-repro.test.d.ts.map +1 -0
- package/dist/__tests__/bec-238-repro.test.js +116 -0
- package/dist/__tests__/bec-238-repro.test.js.map +1 -0
- package/dist/__tests__/bec146-repro.test.d.ts +2 -0
- package/dist/__tests__/bec146-repro.test.d.ts.map +1 -0
- package/dist/__tests__/bec146-repro.test.js +153 -0
- package/dist/__tests__/bec146-repro.test.js.map +1 -0
- package/dist/__tests__/db-migrations.test.js +7 -3
- package/dist/__tests__/db-migrations.test.js.map +1 -1
- package/dist/__tests__/decision-artifact-schema.test.d.ts +2 -0
- package/dist/__tests__/decision-artifact-schema.test.d.ts.map +1 -0
- package/dist/__tests__/decision-artifact-schema.test.js +45 -0
- package/dist/__tests__/decision-artifact-schema.test.js.map +1 -0
- package/dist/__tests__/decisions-parser.test.d.ts +2 -0
- package/dist/__tests__/decisions-parser.test.d.ts.map +1 -0
- package/dist/__tests__/decisions-parser.test.js +59 -0
- package/dist/__tests__/decisions-parser.test.js.map +1 -0
- package/dist/__tests__/decisions-store.test.d.ts +2 -0
- package/dist/__tests__/decisions-store.test.d.ts.map +1 -0
- package/dist/__tests__/decisions-store.test.js +68 -0
- package/dist/__tests__/decisions-store.test.js.map +1 -0
- package/dist/__tests__/decisions-table-migration.test.d.ts +2 -0
- package/dist/__tests__/decisions-table-migration.test.d.ts.map +1 -0
- package/dist/__tests__/decisions-table-migration.test.js +56 -0
- package/dist/__tests__/decisions-table-migration.test.js.map +1 -0
- package/dist/__tests__/execute-stage-session-opts.test.js +1 -0
- package/dist/__tests__/execute-stage-session-opts.test.js.map +1 -1
- package/dist/__tests__/executor-issue-id.test.js +1 -0
- package/dist/__tests__/executor-issue-id.test.js.map +1 -1
- package/dist/__tests__/extract-handoff-decisions.test.d.ts +2 -0
- package/dist/__tests__/extract-handoff-decisions.test.d.ts.map +1 -0
- package/dist/__tests__/extract-handoff-decisions.test.js +26 -0
- package/dist/__tests__/extract-handoff-decisions.test.js.map +1 -0
- package/dist/__tests__/force-push-agent-branches.test.js +38 -15
- package/dist/__tests__/force-push-agent-branches.test.js.map +1 -1
- package/dist/__tests__/github-webhook.test.js +117 -0
- package/dist/__tests__/github-webhook.test.js.map +1 -1
- package/dist/__tests__/implement-template-decisions.test.d.ts +2 -0
- package/dist/__tests__/implement-template-decisions.test.d.ts.map +1 -0
- package/dist/__tests__/implement-template-decisions.test.js +41 -0
- package/dist/__tests__/implement-template-decisions.test.js.map +1 -0
- package/dist/__tests__/migrator.test.js +137 -39
- package/dist/__tests__/migrator.test.js.map +1 -1
- package/dist/__tests__/pipeline-runner.test.js +118 -0
- package/dist/__tests__/pipeline-runner.test.js.map +1 -1
- package/dist/__tests__/pm-conflict.test.js +145 -5
- package/dist/__tests__/pm-conflict.test.js.map +1 -1
- package/dist/__tests__/preflight-claude-auth.test.js +3 -2
- package/dist/__tests__/preflight-claude-auth.test.js.map +1 -1
- package/dist/__tests__/ralph-review-fix-regression.test.js +1 -0
- package/dist/__tests__/ralph-review-fix-regression.test.js.map +1 -1
- package/dist/__tests__/ralph.test.js +1 -0
- package/dist/__tests__/ralph.test.js.map +1 -1
- package/dist/__tests__/release-manager-qarun-query.test.d.ts +2 -0
- package/dist/__tests__/release-manager-qarun-query.test.d.ts.map +1 -0
- package/dist/__tests__/release-manager-qarun-query.test.js +233 -0
- package/dist/__tests__/release-manager-qarun-query.test.js.map +1 -0
- package/dist/__tests__/release-manager-scheduler.test.js +62 -0
- package/dist/__tests__/release-manager-scheduler.test.js.map +1 -1
- package/dist/__tests__/session-lazy-creation.test.js +1 -0
- package/dist/__tests__/session-lazy-creation.test.js.map +1 -1
- package/dist/__tests__/session-resolver.test.d.ts +13 -0
- package/dist/__tests__/session-resolver.test.d.ts.map +1 -0
- package/dist/__tests__/session-resolver.test.js +152 -0
- package/dist/__tests__/session-resolver.test.js.map +1 -0
- package/dist/__tests__/session-resume-fallback.test.js +1 -0
- package/dist/__tests__/session-resume-fallback.test.js.map +1 -1
- package/dist/__tests__/stage-models.test.js +1 -0
- package/dist/__tests__/stage-models.test.js.map +1 -1
- package/dist/__tests__/surgical-review-fix-prompt.test.d.ts +2 -0
- package/dist/__tests__/surgical-review-fix-prompt.test.d.ts.map +1 -0
- package/dist/__tests__/surgical-review-fix-prompt.test.js +71 -0
- package/dist/__tests__/surgical-review-fix-prompt.test.js.map +1 -0
- package/dist/__tests__/surgical-review-fix-runner.test.d.ts +2 -0
- package/dist/__tests__/surgical-review-fix-runner.test.d.ts.map +1 -0
- package/dist/__tests__/surgical-review-fix-runner.test.js +171 -0
- package/dist/__tests__/surgical-review-fix-runner.test.js.map +1 -0
- package/dist/__tests__/validate-run-mode.test.js +1 -0
- package/dist/__tests__/validate-run-mode.test.js.map +1 -1
- package/dist/__tests__/validate.test.js +1 -0
- package/dist/__tests__/validate.test.js.map +1 -1
- package/dist/audit/auth-error-messages.d.ts +6 -0
- package/dist/audit/auth-error-messages.d.ts.map +1 -0
- package/dist/audit/auth-error-messages.js +18 -0
- package/dist/audit/auth-error-messages.js.map +1 -0
- package/dist/audit/events.d.ts +22 -4
- package/dist/audit/events.d.ts.map +1 -1
- package/dist/audit/events.js +34 -5
- package/dist/audit/events.js.map +1 -1
- package/dist/audit/index.d.ts +1 -0
- package/dist/audit/index.d.ts.map +1 -1
- package/dist/audit/index.js +1 -0
- package/dist/audit/index.js.map +1 -1
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +10 -0
- package/dist/db/client.js.map +1 -1
- package/dist/db/decisions-store.d.ts +25 -0
- package/dist/db/decisions-store.d.ts.map +1 -0
- package/dist/db/decisions-store.js +56 -0
- package/dist/db/decisions-store.js.map +1 -0
- package/dist/db/index.d.ts +1 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +1 -1
- package/dist/db/index.js.map +1 -1
- package/dist/db/migrations/postgres/008_sso.sql +9 -20
- package/dist/db/migrations/postgres/009_review_model_runs.sql +9 -18
- package/dist/db/migrations/postgres/009_sso.sql +20 -0
- package/dist/db/migrations/postgres/010_release_manager.sql +9 -38
- package/dist/db/migrations/postgres/010_review_model_runs.sql +18 -0
- package/dist/db/migrations/postgres/011_qa_run_columns.sql +9 -8
- package/dist/db/migrations/postgres/011_release_manager.sql +38 -0
- package/dist/db/migrations/postgres/012_qa_gap_issues.sql +9 -18
- package/dist/db/migrations/postgres/012_qa_run_columns.sql +8 -0
- package/dist/db/migrations/postgres/013_qa_gap_issues.sql +18 -0
- package/dist/db/migrations/postgres/013_stage_runs_cache_tokens.sql +11 -6
- package/dist/db/migrations/postgres/014_missing_indexes.sql +9 -28
- package/dist/db/migrations/postgres/014_stage_runs_cache_tokens.sql +6 -0
- package/dist/db/migrations/postgres/015_missing_indexes.sql +28 -0
- package/dist/db/migrations/postgres/015_triage_results.sql +9 -11
- package/dist/db/migrations/postgres/016_triage_results.sql +11 -0
- package/dist/db/migrations/sqlite/007_sso.sql +9 -20
- package/dist/db/migrations/sqlite/008_review_model_runs.sql +9 -18
- package/dist/db/migrations/sqlite/008_sso.sql +20 -0
- package/dist/db/migrations/sqlite/009_release_manager.sql +9 -43
- package/dist/db/migrations/sqlite/009_review_model_runs.sql +18 -0
- package/dist/db/migrations/sqlite/010_qa_run_columns.sql +9 -9
- package/dist/db/migrations/sqlite/010_release_manager.sql +43 -0
- package/dist/db/migrations/sqlite/011_qa_gap_issues.sql +9 -22
- package/dist/db/migrations/sqlite/011_qa_run_columns.sql +9 -0
- package/dist/db/migrations/sqlite/012_qa_gap_issues.sql +22 -0
- package/dist/db/migrations/sqlite/012_stage_runs_cache_tokens.sql +11 -6
- package/dist/db/migrations/sqlite/013_missing_indexes.sql +10 -28
- package/dist/db/migrations/sqlite/013_stage_runs_cache_tokens.sql +6 -0
- package/dist/db/migrations/sqlite/013_triage_results.sql +10 -11
- package/dist/db/migrations/sqlite/014_missing_indexes.sql +28 -0
- package/dist/db/migrations/sqlite/015_triage_results.sql +11 -0
- package/dist/db/migrator.d.ts +45 -2
- package/dist/db/migrator.d.ts.map +1 -1
- package/dist/db/migrator.js +113 -29
- package/dist/db/migrator.js.map +1 -1
- package/dist/db/schema.d.ts +125 -0
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +13 -0
- package/dist/db/schema.js.map +1 -1
- package/dist/executor/auth-monitor.d.ts.map +1 -1
- package/dist/executor/auth-monitor.js +39 -30
- package/dist/executor/auth-monitor.js.map +1 -1
- package/dist/executor/deep-review.d.ts.map +1 -1
- package/dist/executor/deep-review.js +14 -79
- package/dist/executor/deep-review.js.map +1 -1
- package/dist/executor/executor.d.ts +21 -0
- package/dist/executor/executor.d.ts.map +1 -1
- package/dist/executor/executor.js +41 -90
- package/dist/executor/executor.js.map +1 -1
- package/dist/executor/extract-handoff.d.ts +9 -0
- package/dist/executor/extract-handoff.d.ts.map +1 -1
- package/dist/executor/extract-handoff.js +48 -0
- package/dist/executor/extract-handoff.js.map +1 -1
- package/dist/executor/handoff.d.ts +10 -1
- package/dist/executor/handoff.d.ts.map +1 -1
- package/dist/executor/handoff.js +7 -1
- package/dist/executor/handoff.js.map +1 -1
- package/dist/executor/index.d.ts +1 -0
- package/dist/executor/index.d.ts.map +1 -1
- package/dist/executor/index.js +1 -0
- package/dist/executor/index.js.map +1 -1
- package/dist/executor/prompt/templates.d.ts +12 -1
- package/dist/executor/prompt/templates.d.ts.map +1 -1
- package/dist/executor/prompt/templates.js +64 -0
- package/dist/executor/prompt/templates.js.map +1 -1
- package/dist/executor/session-resolver.d.ts +51 -0
- package/dist/executor/session-resolver.d.ts.map +1 -0
- package/dist/executor/session-resolver.js +83 -0
- package/dist/executor/session-resolver.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/notifier/composite.js +1 -1
- package/dist/notifier/composite.js.map +1 -1
- package/dist/notifier/linear.d.ts +1 -1
- package/dist/notifier/linear.d.ts.map +1 -1
- package/dist/notifier/linear.js +49 -9
- package/dist/notifier/linear.js.map +1 -1
- package/dist/pipeline/run-surgical-review-fix.d.ts +29 -0
- package/dist/pipeline/run-surgical-review-fix.d.ts.map +1 -0
- package/dist/pipeline/run-surgical-review-fix.js +48 -0
- package/dist/pipeline/run-surgical-review-fix.js.map +1 -0
- package/dist/pipeline/runner.d.ts.map +1 -1
- package/dist/pipeline/runner.js +132 -36
- package/dist/pipeline/runner.js.map +1 -1
- package/dist/pm/conflict.d.ts +2 -0
- package/dist/pm/conflict.d.ts.map +1 -1
- package/dist/pm/conflict.js +59 -9
- package/dist/pm/conflict.js.map +1 -1
- package/dist/pm/scheduler.d.ts +2 -0
- package/dist/pm/scheduler.d.ts.map +1 -1
- package/dist/pm/scheduler.js +51 -43
- package/dist/pm/scheduler.js.map +1 -1
- package/dist/pm/slack.d.ts +11 -0
- package/dist/pm/slack.d.ts.map +1 -1
- package/dist/pm/slack.js +48 -5
- package/dist/pm/slack.js.map +1 -1
- package/dist/release-manager/release-helpers.d.ts +19 -2
- package/dist/release-manager/release-helpers.d.ts.map +1 -1
- package/dist/release-manager/release-helpers.js +22 -3
- package/dist/release-manager/release-helpers.js.map +1 -1
- package/dist/release-manager/release-tick.d.ts.map +1 -1
- package/dist/release-manager/release-tick.js +20 -8
- package/dist/release-manager/release-tick.js.map +1 -1
- package/dist/release-manager/state.d.ts.map +1 -1
- package/dist/release-manager/state.js +25 -18
- package/dist/release-manager/state.js.map +1 -1
- package/dist/types.d.ts +232 -13
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +52 -0
- package/dist/types.js.map +1 -1
- package/dist/webhook/github-handler.d.ts +2 -2
- package/dist/webhook/github-handler.d.ts.map +1 -1
- package/dist/webhook/github-handler.js +18 -6
- package/dist/webhook/github-handler.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
--
|
|
2
|
-
--
|
|
3
|
-
--
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
-- BEC-149: This migration was renumbered to 014_stage_runs_cache_tokens to fix
|
|
2
|
+
-- a duplicate prefix (013_qa_gap_issues and 013_stage_runs_cache_tokens shared
|
|
3
|
+
-- prefix 013 after the initial BEC-149 rename pass).
|
|
4
|
+
--
|
|
5
|
+
-- This file is retained for git history only. The migrator skips it based on
|
|
6
|
+
-- the POSTGRES_MIGRATION_RENAMES map in migrator.ts, which also renames any
|
|
7
|
+
-- existing "013_stage_runs_cache_tokens" entries in schema_migrations to
|
|
8
|
+
-- "014_stage_runs_cache_tokens" so existing deployments do not re-run this
|
|
9
|
+
-- migration.
|
|
10
|
+
--
|
|
11
|
+
-- Active migration: packages/core/src/db/migrations/postgres/014_stage_runs_cache_tokens.sql
|
|
@@ -1,28 +1,9 @@
|
|
|
1
|
-
--
|
|
2
|
-
--
|
|
3
|
-
|
|
4
|
-
--
|
|
5
|
-
--
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
--
|
|
10
|
-
-- to find runs by branch name on push/CI events.
|
|
11
|
-
CREATE INDEX IF NOT EXISTS idx_pipeline_runs_branch
|
|
12
|
-
ON pipeline_runs(branch);
|
|
13
|
-
|
|
14
|
-
-- pipeline_runs.started_at: range-scanned by pm/actions/db-queries.ts,
|
|
15
|
-
-- pm/budget.ts, audit/reader.ts, cost/csv.ts, and runner.ts on every PM tick
|
|
16
|
-
-- (60s cadence) and dashboard page load.
|
|
17
|
-
CREATE INDEX IF NOT EXISTS idx_pipeline_runs_started_at
|
|
18
|
-
ON pipeline_runs(started_at);
|
|
19
|
-
|
|
20
|
-
-- pipeline_runs.completed_at: range-scanned by pm/actions/db-queries.ts and
|
|
21
|
-
-- cost/aggregate.ts for active-run detection and cost rollup windows.
|
|
22
|
-
CREATE INDEX IF NOT EXISTS idx_pipeline_runs_completed_at
|
|
23
|
-
ON pipeline_runs(completed_at);
|
|
24
|
-
|
|
25
|
-
-- pm_approvals.issue_id: queried by approval-helpers.ts:batchFetchPendingApprovals
|
|
26
|
-
-- on every PM tick to find pending approvals for a batch of issue IDs.
|
|
27
|
-
CREATE INDEX IF NOT EXISTS idx_pm_approvals_issue_id
|
|
28
|
-
ON pm_approvals(issue_id);
|
|
1
|
+
-- BEC-149: This migration was renumbered to 015_missing_indexes to follow the
|
|
2
|
+
-- 014_stage_runs_cache_tokens renumbering (preserves monotonic prefix order).
|
|
3
|
+
--
|
|
4
|
+
-- This file is retained for git history only. The migrator skips it based on
|
|
5
|
+
-- the POSTGRES_MIGRATION_RENAMES map in migrator.ts, which also renames any
|
|
6
|
+
-- existing "014_missing_indexes" entries in schema_migrations to
|
|
7
|
+
-- "015_missing_indexes" so existing deployments do not re-run this migration.
|
|
8
|
+
--
|
|
9
|
+
-- Active migration: packages/core/src/db/migrations/postgres/015_missing_indexes.sql
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
-- 013_stage_runs_cache_tokens.sql
|
|
2
|
+
-- BEC: cache telemetry — capture prompt-cache token usage from the
|
|
3
|
+
-- Anthropic Agent SDK so we can measure hit-rate per stage.
|
|
4
|
+
|
|
5
|
+
ALTER TABLE stage_runs ADD COLUMN cache_creation_input_tokens INTEGER NOT NULL DEFAULT 0;
|
|
6
|
+
ALTER TABLE stage_runs ADD COLUMN cache_read_input_tokens INTEGER NOT NULL DEFAULT 0;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
-- Migration: BEC-187 — Add 5 missing hot-path indexes to pipeline_runs + pm_approvals
|
|
2
|
+
-- Idempotent: all statements use CREATE INDEX IF NOT EXISTS (supported since Postgres 9.5).
|
|
3
|
+
|
|
4
|
+
-- pipeline_runs.pr_url: queried on every check_suite, pull_request, and review
|
|
5
|
+
-- event in webhook/github-handler.ts to look up the run by PR URL.
|
|
6
|
+
CREATE INDEX IF NOT EXISTS idx_pipeline_runs_pr_url
|
|
7
|
+
ON pipeline_runs(pr_url);
|
|
8
|
+
|
|
9
|
+
-- pipeline_runs.branch: queried alongside pr_url in webhook/github-handler.ts
|
|
10
|
+
-- to find runs by branch name on push/CI events.
|
|
11
|
+
CREATE INDEX IF NOT EXISTS idx_pipeline_runs_branch
|
|
12
|
+
ON pipeline_runs(branch);
|
|
13
|
+
|
|
14
|
+
-- pipeline_runs.started_at: range-scanned by pm/actions/db-queries.ts,
|
|
15
|
+
-- pm/budget.ts, audit/reader.ts, cost/csv.ts, and runner.ts on every PM tick
|
|
16
|
+
-- (60s cadence) and dashboard page load.
|
|
17
|
+
CREATE INDEX IF NOT EXISTS idx_pipeline_runs_started_at
|
|
18
|
+
ON pipeline_runs(started_at);
|
|
19
|
+
|
|
20
|
+
-- pipeline_runs.completed_at: range-scanned by pm/actions/db-queries.ts and
|
|
21
|
+
-- cost/aggregate.ts for active-run detection and cost rollup windows.
|
|
22
|
+
CREATE INDEX IF NOT EXISTS idx_pipeline_runs_completed_at
|
|
23
|
+
ON pipeline_runs(completed_at);
|
|
24
|
+
|
|
25
|
+
-- pm_approvals.issue_id: queried by approval-helpers.ts:batchFetchPendingApprovals
|
|
26
|
+
-- on every PM tick to find pending approvals for a batch of issue IDs.
|
|
27
|
+
CREATE INDEX IF NOT EXISTS idx_pm_approvals_issue_id
|
|
28
|
+
ON pm_approvals(issue_id);
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
--
|
|
2
|
-
--
|
|
3
|
-
--
|
|
4
|
-
--
|
|
5
|
-
--
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
triaged_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
11
|
-
);
|
|
1
|
+
-- BEC-149: This migration was renumbered to 016_triage_results to follow the
|
|
2
|
+
-- 014_stage_runs_cache_tokens and 015_missing_indexes renumberings.
|
|
3
|
+
--
|
|
4
|
+
-- This file is retained for git history only. The migrator skips it based on
|
|
5
|
+
-- the POSTGRES_MIGRATION_RENAMES map in migrator.ts, which also renames any
|
|
6
|
+
-- existing "015_triage_results" entries in schema_migrations to
|
|
7
|
+
-- "016_triage_results" so existing deployments do not re-run this migration.
|
|
8
|
+
--
|
|
9
|
+
-- Active migration: packages/core/src/db/migrations/postgres/016_triage_results.sql
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
-- 015_triage_results.sql
|
|
2
|
+
-- BEC-223: persist triage v2 prediction at triage time so the runner Tier 6e
|
|
3
|
+
-- hook reads from DB instead of parsing the description (which gets truncated
|
|
4
|
+
-- by mapIssueToSchema at 4000 chars, slicing off the appended v2 sections for
|
|
5
|
+
-- realistic issues).
|
|
6
|
+
|
|
7
|
+
CREATE TABLE IF NOT EXISTS triage_results (
|
|
8
|
+
issue_id TEXT PRIMARY KEY,
|
|
9
|
+
v2_prediction TEXT NOT NULL DEFAULT '{}',
|
|
10
|
+
triaged_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
11
|
+
);
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
--
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
CREATE TABLE IF NOT EXISTS dashboard_sessions (
|
|
12
|
-
id TEXT PRIMARY KEY,
|
|
13
|
-
user_id TEXT NOT NULL REFERENCES dashboard_users(id),
|
|
14
|
-
created_at INTEGER NOT NULL,
|
|
15
|
-
expires_at INTEGER NOT NULL,
|
|
16
|
-
last_seen_at INTEGER NOT NULL
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
CREATE INDEX IF NOT EXISTS idx_dashboard_sessions_user_id ON dashboard_sessions(user_id);
|
|
20
|
-
CREATE INDEX IF NOT EXISTS idx_dashboard_sessions_expires_at ON dashboard_sessions(expires_at);
|
|
1
|
+
-- BEC-149: This migration was renumbered to 008_sso to fix a duplicate prefix
|
|
2
|
+
-- (007_cost_rollups and 007_sso shared prefix 007).
|
|
3
|
+
--
|
|
4
|
+
-- This file is retained for git history only. The migrator skips it based on
|
|
5
|
+
-- the SQLITE_MIGRATION_RENAMES map in migrator.ts, which also renames any
|
|
6
|
+
-- existing "007_sso" entries in schema_migrations to "008_sso" so that
|
|
7
|
+
-- existing deployments do not re-run this migration.
|
|
8
|
+
--
|
|
9
|
+
-- Active migration: packages/core/src/db/migrations/sqlite/008_sso.sql
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
-- BEC-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
duration_ms INTEGER NOT NULL DEFAULT 0,
|
|
11
|
-
error_message TEXT,
|
|
12
|
-
truncated_files INTEGER NOT NULL DEFAULT 0,
|
|
13
|
-
started_at INTEGER,
|
|
14
|
-
completed_at INTEGER
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
CREATE INDEX IF NOT EXISTS idx_review_model_runs_stage_run_id
|
|
18
|
-
ON review_model_runs(stage_run_id);
|
|
1
|
+
-- BEC-149: This migration was renumbered to 009_review_model_runs to fix cascading
|
|
2
|
+
-- prefix collision introduced when 007_sso was renumbered to 008_sso.
|
|
3
|
+
--
|
|
4
|
+
-- This file is retained for git history only. The migrator skips it based on
|
|
5
|
+
-- the SQLITE_MIGRATION_RENAMES map in migrator.ts, which also renames any
|
|
6
|
+
-- existing "008_review_model_runs" entries in schema_migrations to
|
|
7
|
+
-- "009_review_model_runs" so that existing deployments do not re-run this migration.
|
|
8
|
+
--
|
|
9
|
+
-- Active migration: packages/core/src/db/migrations/sqlite/009_review_model_runs.sql
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- Enterprise feature 4.1: SSO via WorkOS
|
|
2
|
+
CREATE TABLE IF NOT EXISTS dashboard_users (
|
|
3
|
+
id TEXT PRIMARY KEY,
|
|
4
|
+
email TEXT NOT NULL UNIQUE,
|
|
5
|
+
name TEXT,
|
|
6
|
+
workos_user_id TEXT,
|
|
7
|
+
created_at INTEGER NOT NULL,
|
|
8
|
+
last_login_at INTEGER
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
CREATE TABLE IF NOT EXISTS dashboard_sessions (
|
|
12
|
+
id TEXT PRIMARY KEY,
|
|
13
|
+
user_id TEXT NOT NULL REFERENCES dashboard_users(id),
|
|
14
|
+
created_at INTEGER NOT NULL,
|
|
15
|
+
expires_at INTEGER NOT NULL,
|
|
16
|
+
last_seen_at INTEGER NOT NULL
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
CREATE INDEX IF NOT EXISTS idx_dashboard_sessions_user_id ON dashboard_sessions(user_id);
|
|
20
|
+
CREATE INDEX IF NOT EXISTS idx_dashboard_sessions_expires_at ON dashboard_sessions(expires_at);
|
|
@@ -1,43 +1,9 @@
|
|
|
1
|
-
-- BEC-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
trigger_state_json TEXT NOT NULL,
|
|
11
|
-
proposed_version TEXT,
|
|
12
|
-
fired_tag TEXT,
|
|
13
|
-
fired_sha TEXT,
|
|
14
|
-
attempt_count INTEGER NOT NULL DEFAULT 0
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
-- Index for /release status: fast lookup of the most recent N decisions per (repo, branch).
|
|
18
|
-
CREATE INDEX IF NOT EXISTS idx_release_decisions_repo_branch_decided
|
|
19
|
-
ON release_decisions(repo_url, branch, decided_at DESC);
|
|
20
|
-
|
|
21
|
-
-- Index for retry sweep: find fire-pending rows.
|
|
22
|
-
CREATE INDEX IF NOT EXISTS idx_release_decisions_decision_decided
|
|
23
|
-
ON release_decisions(decision, decided_at);
|
|
24
|
-
|
|
25
|
-
CREATE TABLE IF NOT EXISTS release_approvals (
|
|
26
|
-
id TEXT PRIMARY KEY,
|
|
27
|
-
repo_url TEXT NOT NULL,
|
|
28
|
-
branch TEXT NOT NULL,
|
|
29
|
-
approved_at INTEGER NOT NULL,
|
|
30
|
-
approved_by TEXT NOT NULL,
|
|
31
|
-
consumed_at INTEGER,
|
|
32
|
-
consumed_by_decision_id TEXT
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
-- Partial UNIQUE: one fresh (un-consumed) approval per (repo, branch, user).
|
|
36
|
-
-- Once consumed, the row stays for audit but no longer blocks new approves.
|
|
37
|
-
CREATE UNIQUE INDEX IF NOT EXISTS idx_release_approvals_unique_fresh
|
|
38
|
-
ON release_approvals(repo_url, branch, approved_by)
|
|
39
|
-
WHERE consumed_at IS NULL;
|
|
40
|
-
|
|
41
|
-
-- Lookup index for fresh-approval check at decision time.
|
|
42
|
-
CREATE INDEX IF NOT EXISTS idx_release_approvals_repo_branch_consumed
|
|
43
|
-
ON release_approvals(repo_url, branch, consumed_at);
|
|
1
|
+
-- BEC-149: This migration was renumbered to 010_release_manager to fix cascading
|
|
2
|
+
-- prefix collision introduced when 007_sso was renumbered to 008_sso.
|
|
3
|
+
--
|
|
4
|
+
-- This file is retained for git history only. The migrator skips it based on
|
|
5
|
+
-- the SQLITE_MIGRATION_RENAMES map in migrator.ts, which also renames any
|
|
6
|
+
-- existing "009_release_manager" entries in schema_migrations to
|
|
7
|
+
-- "010_release_manager" so that existing deployments do not re-run this migration.
|
|
8
|
+
--
|
|
9
|
+
-- Active migration: packages/core/src/db/migrations/sqlite/010_release_manager.sql
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
-- BEC-134: per-model results from review-stage fanout.
|
|
2
|
+
CREATE TABLE IF NOT EXISTS review_model_runs (
|
|
3
|
+
id TEXT PRIMARY KEY,
|
|
4
|
+
stage_run_id TEXT NOT NULL REFERENCES stage_runs(id),
|
|
5
|
+
provider_id TEXT NOT NULL,
|
|
6
|
+
model_id TEXT NOT NULL,
|
|
7
|
+
status TEXT NOT NULL,
|
|
8
|
+
input_tokens INTEGER NOT NULL DEFAULT 0,
|
|
9
|
+
output_tokens INTEGER NOT NULL DEFAULT 0,
|
|
10
|
+
duration_ms INTEGER NOT NULL DEFAULT 0,
|
|
11
|
+
error_message TEXT,
|
|
12
|
+
truncated_files INTEGER NOT NULL DEFAULT 0,
|
|
13
|
+
started_at INTEGER,
|
|
14
|
+
completed_at INTEGER
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
CREATE INDEX IF NOT EXISTS idx_review_model_runs_stage_run_id
|
|
18
|
+
ON review_model_runs(stage_run_id);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
-- BEC-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
--
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
-- BEC-149: This migration was renumbered to 011_qa_run_columns to fix cascading
|
|
2
|
+
-- prefix collision introduced when 007_sso was renumbered to 008_sso.
|
|
3
|
+
--
|
|
4
|
+
-- This file is retained for git history only. The migrator skips it based on
|
|
5
|
+
-- the SQLITE_MIGRATION_RENAMES map in migrator.ts, which also renames any
|
|
6
|
+
-- existing "010_qa_run_columns" entries in schema_migrations to
|
|
7
|
+
-- "011_qa_run_columns" so that existing deployments do not re-run this migration.
|
|
8
|
+
--
|
|
9
|
+
-- Active migration: packages/core/src/db/migrations/sqlite/011_qa_run_columns.sql
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
-- BEC-135: Release Manager agent — decision log + one-shot approvals.
|
|
2
|
+
|
|
3
|
+
CREATE TABLE IF NOT EXISTS release_decisions (
|
|
4
|
+
id TEXT PRIMARY KEY,
|
|
5
|
+
repo_url TEXT NOT NULL,
|
|
6
|
+
branch TEXT NOT NULL,
|
|
7
|
+
decided_at INTEGER NOT NULL,
|
|
8
|
+
decision TEXT NOT NULL,
|
|
9
|
+
reason TEXT NOT NULL,
|
|
10
|
+
trigger_state_json TEXT NOT NULL,
|
|
11
|
+
proposed_version TEXT,
|
|
12
|
+
fired_tag TEXT,
|
|
13
|
+
fired_sha TEXT,
|
|
14
|
+
attempt_count INTEGER NOT NULL DEFAULT 0
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
-- Index for /release status: fast lookup of the most recent N decisions per (repo, branch).
|
|
18
|
+
CREATE INDEX IF NOT EXISTS idx_release_decisions_repo_branch_decided
|
|
19
|
+
ON release_decisions(repo_url, branch, decided_at DESC);
|
|
20
|
+
|
|
21
|
+
-- Index for retry sweep: find fire-pending rows.
|
|
22
|
+
CREATE INDEX IF NOT EXISTS idx_release_decisions_decision_decided
|
|
23
|
+
ON release_decisions(decision, decided_at);
|
|
24
|
+
|
|
25
|
+
CREATE TABLE IF NOT EXISTS release_approvals (
|
|
26
|
+
id TEXT PRIMARY KEY,
|
|
27
|
+
repo_url TEXT NOT NULL,
|
|
28
|
+
branch TEXT NOT NULL,
|
|
29
|
+
approved_at INTEGER NOT NULL,
|
|
30
|
+
approved_by TEXT NOT NULL,
|
|
31
|
+
consumed_at INTEGER,
|
|
32
|
+
consumed_by_decision_id TEXT
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
-- Partial UNIQUE: one fresh (un-consumed) approval per (repo, branch, user).
|
|
36
|
+
-- Once consumed, the row stays for audit but no longer blocks new approves.
|
|
37
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_release_approvals_unique_fresh
|
|
38
|
+
ON release_approvals(repo_url, branch, approved_by)
|
|
39
|
+
WHERE consumed_at IS NULL;
|
|
40
|
+
|
|
41
|
+
-- Lookup index for fresh-approval check at decision time.
|
|
42
|
+
CREATE INDEX IF NOT EXISTS idx_release_approvals_repo_branch_consumed
|
|
43
|
+
ON release_approvals(repo_url, branch, consumed_at);
|
|
@@ -1,22 +1,9 @@
|
|
|
1
|
-
-- BEC-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
resolved_at INTEGER
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
-- Partial UNIQUE: at most one open gap issue per (repo, branch, workflow) at a time.
|
|
14
|
-
-- Once resolved (resolved_at IS NOT NULL), the row is preserved for audit but a new
|
|
15
|
-
-- issue can be filed for the same gap in the future.
|
|
16
|
-
CREATE UNIQUE INDEX IF NOT EXISTS idx_qa_gap_issues_unique_open
|
|
17
|
-
ON qa_gap_issues(repo_url, branch, workflow_path)
|
|
18
|
-
WHERE resolved_at IS NULL;
|
|
19
|
-
|
|
20
|
-
-- Lookup index for "is there an open gap for this (repo, branch, workflow)?" — partial too.
|
|
21
|
-
CREATE INDEX IF NOT EXISTS idx_qa_gap_issues_lookup
|
|
22
|
-
ON qa_gap_issues(repo_url, branch, workflow_path, resolved_at);
|
|
1
|
+
-- BEC-149: This migration was renumbered to 012_qa_gap_issues to fix cascading
|
|
2
|
+
-- prefix collision introduced when 007_sso was renumbered to 008_sso.
|
|
3
|
+
--
|
|
4
|
+
-- This file is retained for git history only. The migrator skips it based on
|
|
5
|
+
-- the SQLITE_MIGRATION_RENAMES map in migrator.ts, which also renames any
|
|
6
|
+
-- existing "011_qa_gap_issues" entries in schema_migrations to
|
|
7
|
+
-- "012_qa_gap_issues" so that existing deployments do not re-run this migration.
|
|
8
|
+
--
|
|
9
|
+
-- Active migration: packages/core/src/db/migrations/sqlite/012_qa_gap_issues.sql
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
-- BEC-136: QA agent — track in-flight workflow runs on the release_decisions table.
|
|
2
|
+
|
|
3
|
+
ALTER TABLE release_decisions ADD COLUMN qa_run_id INTEGER;
|
|
4
|
+
ALTER TABLE release_decisions ADD COLUMN qa_run_sha TEXT;
|
|
5
|
+
|
|
6
|
+
-- Index for collectState's qaRun lookup: fastest path for "most recent decision with non-null qa_run_id"
|
|
7
|
+
CREATE INDEX IF NOT EXISTS idx_release_decisions_qa_run_id
|
|
8
|
+
ON release_decisions(repo_url, branch, qa_run_id, decided_at DESC)
|
|
9
|
+
WHERE qa_run_id IS NOT NULL;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
-- BEC-136: QA agent — Linear issue idempotency for missing QA workflows.
|
|
2
|
+
|
|
3
|
+
CREATE TABLE IF NOT EXISTS qa_gap_issues (
|
|
4
|
+
id TEXT PRIMARY KEY,
|
|
5
|
+
repo_url TEXT NOT NULL,
|
|
6
|
+
branch TEXT NOT NULL,
|
|
7
|
+
workflow_path TEXT NOT NULL,
|
|
8
|
+
linear_issue_id TEXT NOT NULL,
|
|
9
|
+
filed_at INTEGER NOT NULL,
|
|
10
|
+
resolved_at INTEGER
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
-- Partial UNIQUE: at most one open gap issue per (repo, branch, workflow) at a time.
|
|
14
|
+
-- Once resolved (resolved_at IS NOT NULL), the row is preserved for audit but a new
|
|
15
|
+
-- issue can be filed for the same gap in the future.
|
|
16
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_qa_gap_issues_unique_open
|
|
17
|
+
ON qa_gap_issues(repo_url, branch, workflow_path)
|
|
18
|
+
WHERE resolved_at IS NULL;
|
|
19
|
+
|
|
20
|
+
-- Lookup index for "is there an open gap for this (repo, branch, workflow)?" — partial too.
|
|
21
|
+
CREATE INDEX IF NOT EXISTS idx_qa_gap_issues_lookup
|
|
22
|
+
ON qa_gap_issues(repo_url, branch, workflow_path, resolved_at);
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
--
|
|
2
|
-
--
|
|
3
|
-
--
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
-- BEC-149: This migration was renumbered to 013_stage_runs_cache_tokens to fix
|
|
2
|
+
-- a duplicate prefix (012_qa_gap_issues and 012_stage_runs_cache_tokens shared
|
|
3
|
+
-- prefix 012 after the initial BEC-149 rename pass).
|
|
4
|
+
--
|
|
5
|
+
-- This file is retained for git history only. The migrator skips it based on
|
|
6
|
+
-- the SQLITE_MIGRATION_RENAMES map in migrator.ts, which also renames any
|
|
7
|
+
-- existing "012_stage_runs_cache_tokens" entries in schema_migrations to
|
|
8
|
+
-- "013_stage_runs_cache_tokens" so existing deployments do not re-run this
|
|
9
|
+
-- migration.
|
|
10
|
+
--
|
|
11
|
+
-- Active migration: packages/core/src/db/migrations/sqlite/013_stage_runs_cache_tokens.sql
|
|
@@ -1,28 +1,10 @@
|
|
|
1
|
-
--
|
|
2
|
-
--
|
|
3
|
-
|
|
4
|
-
--
|
|
5
|
-
--
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
--
|
|
10
|
-
--
|
|
11
|
-
CREATE INDEX IF NOT EXISTS idx_pipeline_runs_branch
|
|
12
|
-
ON pipeline_runs(branch);
|
|
13
|
-
|
|
14
|
-
-- pipeline_runs.started_at: range-scanned by pm/actions/db-queries.ts,
|
|
15
|
-
-- pm/budget.ts, audit/reader.ts, cost/csv.ts, and runner.ts on every PM tick
|
|
16
|
-
-- (60s cadence) and dashboard page load.
|
|
17
|
-
CREATE INDEX IF NOT EXISTS idx_pipeline_runs_started_at
|
|
18
|
-
ON pipeline_runs(started_at);
|
|
19
|
-
|
|
20
|
-
-- pipeline_runs.completed_at: range-scanned by pm/actions/db-queries.ts and
|
|
21
|
-
-- cost/aggregate.ts for active-run detection and cost rollup windows.
|
|
22
|
-
CREATE INDEX IF NOT EXISTS idx_pipeline_runs_completed_at
|
|
23
|
-
ON pipeline_runs(completed_at);
|
|
24
|
-
|
|
25
|
-
-- pm_approvals.issue_id: queried by approval-helpers.ts:batchFetchPendingApprovals
|
|
26
|
-
-- on every PM tick to find pending approvals for a batch of issue IDs.
|
|
27
|
-
CREATE INDEX IF NOT EXISTS idx_pm_approvals_issue_id
|
|
28
|
-
ON pm_approvals(issue_id);
|
|
1
|
+
-- BEC-149: This migration was renumbered to 014_missing_indexes to fix a
|
|
2
|
+
-- duplicate prefix (013_missing_indexes and 013_triage_results shared
|
|
3
|
+
-- prefix 013).
|
|
4
|
+
--
|
|
5
|
+
-- This file is retained for git history only. The migrator skips it based on
|
|
6
|
+
-- the SQLITE_MIGRATION_RENAMES map in migrator.ts, which also renames any
|
|
7
|
+
-- existing "013_missing_indexes" entries in schema_migrations to
|
|
8
|
+
-- "014_missing_indexes" so existing deployments do not re-run this migration.
|
|
9
|
+
--
|
|
10
|
+
-- Active migration: packages/core/src/db/migrations/sqlite/014_missing_indexes.sql
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
-- 012_stage_runs_cache_tokens.sql
|
|
2
|
+
-- BEC: cache telemetry — capture prompt-cache token usage from the
|
|
3
|
+
-- Anthropic Agent SDK so we can measure hit-rate per stage.
|
|
4
|
+
|
|
5
|
+
ALTER TABLE stage_runs ADD COLUMN cache_creation_input_tokens INTEGER NOT NULL DEFAULT 0;
|
|
6
|
+
ALTER TABLE stage_runs ADD COLUMN cache_read_input_tokens INTEGER NOT NULL DEFAULT 0;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
--
|
|
2
|
-
--
|
|
3
|
-
--
|
|
4
|
-
--
|
|
5
|
-
--
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
);
|
|
1
|
+
-- BEC-149: This migration was renumbered to 015_triage_results to fix a
|
|
2
|
+
-- duplicate prefix (013_missing_indexes and 013_triage_results shared
|
|
3
|
+
-- prefix 013).
|
|
4
|
+
--
|
|
5
|
+
-- This file is retained for git history only. The migrator skips it based on
|
|
6
|
+
-- the SQLITE_MIGRATION_RENAMES map in migrator.ts, which also renames any
|
|
7
|
+
-- existing "013_triage_results" entries in schema_migrations to
|
|
8
|
+
-- "015_triage_results" so existing deployments do not re-run this migration.
|
|
9
|
+
--
|
|
10
|
+
-- Active migration: packages/core/src/db/migrations/sqlite/015_triage_results.sql
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
-- Migration: BEC-187 — Add 5 missing hot-path indexes to pipeline_runs + pm_approvals
|
|
2
|
+
-- Idempotent: all statements use CREATE INDEX IF NOT EXISTS.
|
|
3
|
+
|
|
4
|
+
-- pipeline_runs.pr_url: queried on every check_suite, pull_request, and review
|
|
5
|
+
-- event in webhook/github-handler.ts to look up the run by PR URL.
|
|
6
|
+
CREATE INDEX IF NOT EXISTS idx_pipeline_runs_pr_url
|
|
7
|
+
ON pipeline_runs(pr_url);
|
|
8
|
+
|
|
9
|
+
-- pipeline_runs.branch: queried alongside pr_url in webhook/github-handler.ts
|
|
10
|
+
-- to find runs by branch name on push/CI events.
|
|
11
|
+
CREATE INDEX IF NOT EXISTS idx_pipeline_runs_branch
|
|
12
|
+
ON pipeline_runs(branch);
|
|
13
|
+
|
|
14
|
+
-- pipeline_runs.started_at: range-scanned by pm/actions/db-queries.ts,
|
|
15
|
+
-- pm/budget.ts, audit/reader.ts, cost/csv.ts, and runner.ts on every PM tick
|
|
16
|
+
-- (60s cadence) and dashboard page load.
|
|
17
|
+
CREATE INDEX IF NOT EXISTS idx_pipeline_runs_started_at
|
|
18
|
+
ON pipeline_runs(started_at);
|
|
19
|
+
|
|
20
|
+
-- pipeline_runs.completed_at: range-scanned by pm/actions/db-queries.ts and
|
|
21
|
+
-- cost/aggregate.ts for active-run detection and cost rollup windows.
|
|
22
|
+
CREATE INDEX IF NOT EXISTS idx_pipeline_runs_completed_at
|
|
23
|
+
ON pipeline_runs(completed_at);
|
|
24
|
+
|
|
25
|
+
-- pm_approvals.issue_id: queried by approval-helpers.ts:batchFetchPendingApprovals
|
|
26
|
+
-- on every PM tick to find pending approvals for a batch of issue IDs.
|
|
27
|
+
CREATE INDEX IF NOT EXISTS idx_pm_approvals_issue_id
|
|
28
|
+
ON pm_approvals(issue_id);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
-- 013_triage_results.sql
|
|
2
|
+
-- BEC-223: persist triage v2 prediction at triage time so the runner Tier 6e
|
|
3
|
+
-- hook reads from DB instead of parsing the description (which gets truncated
|
|
4
|
+
-- by mapIssueToSchema at 4000 chars, slicing off the appended v2 sections for
|
|
5
|
+
-- realistic issues).
|
|
6
|
+
|
|
7
|
+
CREATE TABLE IF NOT EXISTS triage_results (
|
|
8
|
+
issue_id TEXT PRIMARY KEY,
|
|
9
|
+
v2_prediction TEXT NOT NULL DEFAULT '{}',
|
|
10
|
+
triaged_at INTEGER NOT NULL DEFAULT (unixepoch())
|
|
11
|
+
);
|
package/dist/db/migrator.d.ts
CHANGED
|
@@ -11,6 +11,20 @@
|
|
|
11
11
|
* - SQLite ALTER TABLE does not support IF NOT EXISTS, so duplicate-column errors are
|
|
12
12
|
* caught and treated as a no-op (idempotent re-run safety).
|
|
13
13
|
* - Postgres migrations use DO $$ IF NOT EXISTS $$ guards for native idempotency.
|
|
14
|
+
*
|
|
15
|
+
* Numbering policy (enforced as of BEC-149):
|
|
16
|
+
* - Every migration file must have a unique NNN_ numeric prefix.
|
|
17
|
+
* - When adding a new migration, use max(existing prefix) + 1.
|
|
18
|
+
* - Never reuse or duplicate a prefix number — the migrator sorts files alphabetically
|
|
19
|
+
* so duplicate prefixes produce non-deterministic ordering.
|
|
20
|
+
*
|
|
21
|
+
* Tombstone files (BEC-149 rename history):
|
|
22
|
+
* - Files listed as keys in SQLITE_MIGRATION_RENAMES / POSTGRES_MIGRATION_RENAMES are
|
|
23
|
+
* "tombstones": their content has moved to the canonical new name.
|
|
24
|
+
* - Tombstones are SKIPPED during migration processing (no SQL is run, nothing recorded).
|
|
25
|
+
* - Before running any migration, the migrator renames schema_migrations rows from the
|
|
26
|
+
* old name to the new name so existing deployments automatically adopt the canonical
|
|
27
|
+
* numbering without re-running the migration content.
|
|
14
28
|
*/
|
|
15
29
|
import type Database from "better-sqlite3";
|
|
16
30
|
import type { Sql } from "postgres";
|
|
@@ -25,18 +39,46 @@ export interface MigrationStatus {
|
|
|
25
39
|
applied: boolean;
|
|
26
40
|
appliedAt?: Date;
|
|
27
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* BEC-149: Rename map for SQLite migrations.
|
|
44
|
+
*
|
|
45
|
+
* Keys are the old (duplicate-prefix) migration names that were renumbered.
|
|
46
|
+
* Values are the canonical new names.
|
|
47
|
+
*
|
|
48
|
+
* On startup the migrator updates schema_migrations rows from old → new so that
|
|
49
|
+
* existing deployments recognise the renamed files without re-running them.
|
|
50
|
+
* The old files are kept as tombstones (comment-only) and are SKIPPED by the
|
|
51
|
+
* migration runner; only the canonical-named files are processed.
|
|
52
|
+
*/
|
|
53
|
+
export declare const SQLITE_MIGRATION_RENAMES: Record<string, string>;
|
|
54
|
+
/**
|
|
55
|
+
* BEC-149: Rename map for Postgres migrations.
|
|
56
|
+
*
|
|
57
|
+
* Same semantics as SQLITE_MIGRATION_RENAMES above.
|
|
58
|
+
*/
|
|
59
|
+
export declare const POSTGRES_MIGRATION_RENAMES: Record<string, string>;
|
|
28
60
|
/**
|
|
29
61
|
* Read all .sql migration files for a driver from the migrations subdirectory,
|
|
30
62
|
* sorted by filename (ascending, so NNN prefix determines order).
|
|
63
|
+
*
|
|
64
|
+
* Tombstone files (those whose names appear as keys in the driver's rename map)
|
|
65
|
+
* are included in the returned list so callers can distinguish them; the migration
|
|
66
|
+
* runners skip them automatically.
|
|
31
67
|
*/
|
|
32
68
|
export declare function loadMigrationFiles(driver: "sqlite" | "postgres"): Migration[];
|
|
69
|
+
/**
|
|
70
|
+
* Return the active (non-tombstone) migrations for a driver.
|
|
71
|
+
* These are the migrations that the runner will actually process.
|
|
72
|
+
*/
|
|
73
|
+
export declare function loadActiveMigrationFiles(driver: "sqlite" | "postgres"): Migration[];
|
|
33
74
|
/**
|
|
34
75
|
* Run all pending migrations against a better-sqlite3 Database instance.
|
|
35
76
|
* Creates schema_migrations table if it does not exist.
|
|
36
77
|
*/
|
|
37
78
|
export declare function runMigrationsSqlite(db: Database.Database): void;
|
|
38
79
|
/**
|
|
39
|
-
* Return the status of every migration file for SQLite.
|
|
80
|
+
* Return the status of every active migration file for SQLite.
|
|
81
|
+
* Tombstone files (renamed migrations) are excluded from the status list.
|
|
40
82
|
*/
|
|
41
83
|
export declare function getMigrationStatusSqlite(db: Database.Database): MigrationStatus[];
|
|
42
84
|
/**
|
|
@@ -45,7 +87,8 @@ export declare function getMigrationStatusSqlite(db: Database.Database): Migrati
|
|
|
45
87
|
*/
|
|
46
88
|
export declare function runMigrationsPostgres(client: Sql): Promise<void>;
|
|
47
89
|
/**
|
|
48
|
-
* Return the status of every migration file for Postgres.
|
|
90
|
+
* Return the status of every active migration file for Postgres.
|
|
91
|
+
* Tombstone files (renamed migrations) are excluded from the status list.
|
|
49
92
|
*/
|
|
50
93
|
export declare function getMigrationStatusPostgres(client: Sql): Promise<MigrationStatus[]>;
|
|
51
94
|
//# sourceMappingURL=migrator.d.ts.map
|