@checkstack/automation-backend 0.2.0 → 0.3.0
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/CHANGELOG.md +544 -0
- package/drizzle/0003_sparkling_xorn.sql +17 -0
- package/drizzle/0004_cultured_spyke.sql +2 -0
- package/drizzle/0005_classy_the_hand.sql +19 -0
- package/drizzle/0006_burly_wallop.sql +10 -0
- package/drizzle/0007_nappy_jackal.sql +1 -0
- package/drizzle/0008_remove_seeded_auto_incident_automations.sql +13 -0
- package/drizzle/0009_steady_liz_osborn.sql +12 -0
- package/drizzle/0010_chunky_changeling.sql +2 -0
- package/drizzle/meta/0003_snapshot.json +1007 -0
- package/drizzle/meta/0004_snapshot.json +1028 -0
- package/drizzle/meta/0005_snapshot.json +1164 -0
- package/drizzle/meta/0006_snapshot.json +1261 -0
- package/drizzle/meta/0007_snapshot.json +1215 -0
- package/drizzle/meta/0008_snapshot.json +1215 -0
- package/drizzle/meta/0009_snapshot.json +1328 -0
- package/drizzle/meta/0010_snapshot.json +1349 -0
- package/drizzle/meta/_journal.json +56 -0
- package/package.json +23 -12
- package/src/action-types.ts +23 -0
- package/src/artifact-store.ts +16 -1
- package/src/automation-store.test.ts +143 -0
- package/src/automation-store.ts +30 -8
- package/src/builtin-triggers.test.ts +77 -74
- package/src/builtin-triggers.ts +105 -108
- package/src/dispatch/action-kind.ts +2 -0
- package/src/dispatch/assemble-get-service.ts +31 -0
- package/src/dispatch/cancel-resurrect.test.ts +147 -0
- package/src/dispatch/concurrency-race.test.ts +255 -0
- package/src/dispatch/concurrency-scope.test.ts +166 -0
- package/src/dispatch/condition.ts +24 -5
- package/src/dispatch/dwell-queue.ts +65 -0
- package/src/dispatch/dwell-store.ts +154 -0
- package/src/dispatch/dwell.it.test.ts +142 -0
- package/src/dispatch/dwell.test.ts +799 -0
- package/src/dispatch/dwell.ts +257 -0
- package/src/dispatch/engine.test.ts +189 -2
- package/src/dispatch/engine.ts +555 -9
- package/src/dispatch/entity-scope.test.ts +176 -0
- package/src/dispatch/get-service-wiring.test.ts +318 -0
- package/src/dispatch/numeric.test.ts +71 -0
- package/src/dispatch/numeric.ts +96 -0
- package/src/dispatch/render.test.ts +34 -0
- package/src/dispatch/render.ts +31 -11
- package/src/dispatch/reseed-run-secrets.ts +230 -0
- package/src/dispatch/run-secret-registry.test.ts +189 -0
- package/src/dispatch/run-secret-registry.ts +247 -0
- package/src/dispatch/run-state-masking.test.ts +376 -0
- package/src/dispatch/run-state-store.ts +95 -38
- package/src/dispatch/run-state.ts +226 -59
- package/src/dispatch/scope-artifact-masking.test.ts +138 -0
- package/src/dispatch/secret-ref-ids.test.ts +19 -0
- package/src/dispatch/secret-ref-ids.ts +17 -0
- package/src/dispatch/snapshots.test.ts +86 -0
- package/src/dispatch/snapshots.ts +79 -0
- package/src/dispatch/stage1-router.test.ts +324 -0
- package/src/dispatch/stage1-router.ts +152 -0
- package/src/dispatch/stage1.it.test.ts +84 -0
- package/src/dispatch/stage2-dispatch.test.ts +285 -0
- package/src/dispatch/stage2-dispatch.ts +207 -0
- package/src/dispatch/stage2-stalled.it.test.ts +132 -0
- package/src/dispatch/stalled-sweeper.test.ts +197 -0
- package/src/dispatch/stalled-sweeper.ts +112 -5
- package/src/dispatch/state-scope.test.ts +234 -0
- package/src/dispatch/state-scope.ts +322 -0
- package/src/dispatch/structured-conditions.test.ts +246 -0
- package/src/dispatch/structured-conditions.ts +146 -0
- package/src/dispatch/test-fixtures.ts +306 -38
- package/src/dispatch/trigger-fanin.test.ts +111 -0
- package/src/dispatch/trigger-subscriber.ts +316 -14
- package/src/dispatch/types.ts +263 -8
- package/src/dispatch/wait-timeout-queue.ts +89 -0
- package/src/dispatch/wait-until-entity-wake.test.ts +544 -0
- package/src/dispatch/wait-until.test.ts +540 -0
- package/src/dispatch/wake-refs.test.ts +158 -0
- package/src/dispatch/wake-refs.ts +348 -0
- package/src/dispatch/window-gate.test.ts +513 -0
- package/src/dispatch/window-store.test.ts +162 -0
- package/src/dispatch/window-store.ts +102 -0
- package/src/entity/change-derivers.test.ts +148 -0
- package/src/entity/change-derivers.ts +143 -0
- package/src/entity/change-emitter.test.ts +66 -0
- package/src/entity/change-emitter.ts +76 -0
- package/src/entity/create-handle.ts +344 -0
- package/src/entity/cross-pod-read-consistency.it.test.ts +281 -0
- package/src/entity/define-entity.ts +157 -0
- package/src/entity/diff.test.ts +57 -0
- package/src/entity/diff.ts +54 -0
- package/src/entity/entity-store.test.ts +30 -0
- package/src/entity/entity-store.ts +171 -0
- package/src/entity/extension-point.ts +56 -0
- package/src/entity/fake-entity-store.ts +130 -0
- package/src/entity/hook.ts +19 -0
- package/src/entity/index.ts +50 -0
- package/src/entity/mutate-handle.test.ts +517 -0
- package/src/entity/on-entity-changed.test.ts +189 -0
- package/src/entity/on-entity-changed.ts +214 -0
- package/src/entity/registry.test.ts +181 -0
- package/src/entity/registry.ts +200 -0
- package/src/entity/stable-stringify.test.ts +55 -0
- package/src/entity/stable-stringify.ts +49 -0
- package/src/entity/wake-index.it.test.ts +251 -0
- package/src/entity/with-entity-write.test.ts +100 -0
- package/src/entity/with-entity-write.ts +69 -0
- package/src/entity-driven-trigger.ts +46 -0
- package/src/extension-points.ts +35 -0
- package/src/gitops-docs.test.ts +215 -0
- package/src/gitops-docs.ts +151 -0
- package/src/gitops-kinds.test.ts +174 -0
- package/src/gitops-kinds.ts +137 -0
- package/src/index.ts +355 -11
- package/src/migration/flapping-to-window.test.ts +123 -0
- package/src/migration/flapping-to-window.ts +205 -0
- package/src/router.test.ts +182 -1
- package/src/router.ts +73 -2
- package/src/schema.ts +236 -3
- package/src/script-test-replay.test.ts +88 -0
- package/src/script-test-replay.ts +100 -0
- package/src/script-test-shell-env.test.ts +41 -0
- package/src/script-test-shell-env.ts +89 -0
- package/src/script-test.test.ts +386 -0
- package/src/script-test.ts +258 -0
- package/src/trigger-registry.ts +2 -0
- package/src/validate-definition.test.ts +1 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
CREATE TABLE "entity_state" (
|
|
2
|
+
"kind" text NOT NULL,
|
|
3
|
+
"entity_id" text NOT NULL,
|
|
4
|
+
"state" jsonb NOT NULL,
|
|
5
|
+
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
6
|
+
CONSTRAINT "entity_state_kind_entity_id_pk" PRIMARY KEY("kind","entity_id")
|
|
7
|
+
);
|
|
8
|
+
--> statement-breakpoint
|
|
9
|
+
CREATE TABLE "entity_transitions" (
|
|
10
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
11
|
+
"kind" text NOT NULL,
|
|
12
|
+
"entity_id" text NOT NULL,
|
|
13
|
+
"field" text NOT NULL,
|
|
14
|
+
"from_value" text,
|
|
15
|
+
"to_value" text NOT NULL,
|
|
16
|
+
"transitioned_at" timestamp DEFAULT now() NOT NULL
|
|
17
|
+
);
|
|
18
|
+
--> statement-breakpoint
|
|
19
|
+
CREATE INDEX "entity_transitions_lookup_idx" ON "entity_transitions" USING btree ("kind","entity_id","field","transitioned_at");
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
CREATE TABLE "automation_wake_index" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"wait_lock_id" text NOT NULL,
|
|
4
|
+
"ref" text NOT NULL
|
|
5
|
+
);
|
|
6
|
+
--> statement-breakpoint
|
|
7
|
+
ALTER TABLE "automation_wake_index" ADD CONSTRAINT "automation_wake_index_wait_lock_id_automation_wait_locks_id_fk" FOREIGN KEY ("wait_lock_id") REFERENCES "automation_wait_locks"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
8
|
+
CREATE INDEX "automation_wake_index_ref_idx" ON "automation_wake_index" USING btree ("ref");--> statement-breakpoint
|
|
9
|
+
CREATE INDEX "automation_wake_index_lock_idx" ON "automation_wake_index" USING btree ("wait_lock_id");--> statement-breakpoint
|
|
10
|
+
CREATE UNIQUE INDEX "automation_wake_index_lock_ref_unique" ON "automation_wake_index" USING btree ("wait_lock_id","ref");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
DROP TABLE "entity_state" CASCADE;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
-- Custom SQL migration file, put your code below! --
|
|
2
|
+
|
|
3
|
+
-- Remove the deprecated auto-seeded incident automations.
|
|
4
|
+
--
|
|
5
|
+
-- These were historically seeded one-time from each health-check
|
|
6
|
+
-- assignment's notification policy (sustained-unhealthy / flapping ->
|
|
7
|
+
-- incident.create) and tagged `managed_by = 'auto-incident:<...>'`. The
|
|
8
|
+
-- seeder has been removed; auto-incidents are now built entirely by
|
|
9
|
+
-- user-authored automations. This deletes the orphaned seeded rows.
|
|
10
|
+
--
|
|
11
|
+
-- Destructive and intentional: a fresh install never created these, and
|
|
12
|
+
-- on upgraded installs they are no longer managed by anything.
|
|
13
|
+
DELETE FROM "automations" WHERE "managed_by" LIKE 'auto-incident:%';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
CREATE TABLE "automation_window_events" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"automation_id" text NOT NULL,
|
|
4
|
+
"trigger_id" text NOT NULL,
|
|
5
|
+
"event_id" text NOT NULL,
|
|
6
|
+
"context_key" text,
|
|
7
|
+
"occurred_at" timestamp DEFAULT now() NOT NULL
|
|
8
|
+
);
|
|
9
|
+
--> statement-breakpoint
|
|
10
|
+
ALTER TABLE "automation_window_events" ADD CONSTRAINT "automation_window_events_automation_id_automations_id_fk" FOREIGN KEY ("automation_id") REFERENCES "automations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
11
|
+
CREATE INDEX "automation_window_events_count_idx" ON "automation_window_events" USING btree ("automation_id","trigger_id","context_key","occurred_at");--> statement-breakpoint
|
|
12
|
+
CREATE INDEX "automation_window_events_prune_idx" ON "automation_window_events" USING btree ("occurred_at");
|