@kici-dev/orchestrator 0.14.2 → 0.16.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/dist/__test-helpers__/peer-mutual-auth.d.ts +42 -0
- package/dist/__test-helpers__/scratch-db.d.ts +16 -0
- package/dist/agent/host-roster.d.ts +100 -37
- package/dist/agent/registry.d.ts +1 -8
- package/dist/app-on-error.d.ts +1 -1
- package/dist/app.d.ts +4 -2
- package/dist/artifacts/artifact-store.d.ts +0 -2
- package/dist/audit/access-log.d.ts +1 -1
- package/dist/cache/source-cache.d.ts +1 -1
- package/dist/cache/user-cache.d.ts +0 -28
- package/dist/cli/api-client.d.ts +27 -1
- package/dist/cli/commands/access-log.d.ts +1 -1
- package/dist/cli/commands/cold-store-impl.d.ts +7 -84
- package/dist/cli/commands/db.d.ts +1 -0
- package/dist/cli/commands/host.d.ts +3 -0
- package/dist/cli/commands/orchestrator-service/status.d.ts +2 -0
- package/dist/cli/commands/org.d.ts +12 -0
- package/dist/cli/commands/scaler.d.ts +14 -0
- package/dist/cli/commands/secret.d.ts +1 -45
- package/dist/cli/commands/service-health.d.ts +21 -13
- package/dist/cli/commands/shared/cli-action.d.ts +17 -0
- package/dist/cli/commands/shared/db.d.ts +5 -5
- package/dist/cli/commands/shared/org-id.d.ts +5 -0
- package/dist/cli/commands/shared/service-verbs.d.ts +19 -0
- package/dist/cli/commands/shared/table.d.ts +3 -0
- package/dist/cli/commands/shared/unbound-context-warning.d.ts +2 -22
- package/dist/cli/commands/source-manifest.d.ts +3 -3
- package/dist/cli/commands/source.d.ts +23 -0
- package/dist/cli/commands/trust-policy.d.ts +7 -31
- package/dist/cli/join.d.ts +2 -2
- package/dist/cli/kici-admin.d.ts +6 -1
- package/dist/cli/local-github-ingress-url.d.ts +6 -0
- package/dist/cli/root-option-routing.d.ts +46 -0
- package/dist/cli/webhook-url-notes.d.ts +15 -0
- package/dist/cli.js +10667 -8461
- package/dist/cluster/coordinator-credential.d.ts +21 -0
- package/dist/cluster/coordinator.d.ts +2 -2
- package/dist/cluster/index.d.ts +4 -4
- package/dist/cluster/join-client.d.ts +23 -21
- package/dist/cluster/join-handler.d.ts +24 -16
- package/dist/cluster/join-protocol-v2.d.ts +84 -0
- package/dist/cluster/join-token.d.ts +78 -56
- package/dist/cluster/peer-auth-coordinator.d.ts +16 -2
- package/dist/cluster/peer-client.d.ts +99 -5
- package/dist/cluster/peer-crypto.d.ts +60 -3
- package/dist/cluster/peer-discovery.d.ts +67 -0
- package/dist/cluster/peer-forget.d.ts +4 -9
- package/dist/cluster/peer-handler.d.ts +28 -6
- package/dist/cluster/peer-registry.d.ts +15 -1
- package/dist/cluster/peer-request-waiters.d.ts +26 -0
- package/dist/cluster/scaler-orphans-peer.d.ts +4 -9
- package/dist/cluster/scaler-reload-fanout.d.ts +29 -0
- package/dist/cluster/scaler-reload-peer.d.ts +16 -0
- package/dist/cluster/worker-cluster-settings.d.ts +1 -0
- package/dist/cold-store/load-access-log-range.d.ts +3 -3
- package/dist/cold-store/tables/access-log.d.ts +4 -12
- package/dist/cold-store/tables/event-log.d.ts +8 -19
- package/dist/cold-store/tables/execution-jobs.d.ts +7 -24
- package/dist/cold-store/tables/execution-runs.d.ts +6 -20
- package/dist/cold-store/tables/execution-steps.d.ts +8 -26
- package/dist/cold-store/tables/secret-audit-log.d.ts +4 -11
- package/dist/config/env-overlay.d.ts +3 -8
- package/dist/config/reload.d.ts +9 -2
- package/dist/config/schema.d.ts +16 -2
- package/dist/config/types.d.ts +6 -2
- package/dist/config.d.ts +22 -17
- package/dist/contexts/held-runs.d.ts +3 -6
- package/dist/dashboard/cursor.d.ts +12 -0
- package/dist/dashboard/handler.d.ts +5 -12
- package/dist/db/deferred-index-build.d.ts +42 -0
- package/dist/db/deferred-indexes.d.ts +3 -37
- package/dist/db/migrations/100_held_runs_hold_type_vocabulary.d.ts +3 -5
- package/dist/db/migrations/157_host_roster_identity_source.d.ts +21 -0
- package/dist/db/migrations/158_normalize_legacy_values.d.ts +4 -0
- package/dist/db/repos/org-ids-repo.d.ts +87 -0
- package/dist/db/schema-snapshot.generated.d.ts +3 -0
- package/dist/db/types.d.ts +21 -24
- package/dist/fault-injection-types.d.ts +0 -6
- package/dist/git/dispatch-git-auth.d.ts +6 -12
- package/dist/github-app-name-refresher/github-app-name-refresher.d.ts +25 -13
- package/dist/helpers/json.d.ts +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +357 -216
- package/dist/metrics/prometheus.d.ts +0 -5
- package/dist/oidc/id-token-claims.d.ts +1 -1
- package/dist/oidc/resolve-signer.d.ts +2 -4
- package/dist/orchestrator-core.d.ts +10 -3
- package/dist/pipeline/global-eval-round.d.ts +2 -26
- package/dist/pipeline/install-secrets-resolver.d.ts +0 -3
- package/dist/pipeline/manual-schedule.d.ts +1 -7
- package/dist/provenance/dispatch-context.d.ts +5 -7
- package/dist/provenance/pending-attestations-repo.d.ts +1 -1
- package/dist/provenance/trust-root.d.ts +4 -5
- package/dist/provenance/verify-deferred-capture.d.ts +3 -3
- package/dist/provider-registry.d.ts +13 -40
- package/dist/providers/github/manifest.d.ts +58 -7
- package/dist/providers/universal-git/ssh-auth.d.ts +0 -5
- package/dist/reporting/check-run-reporter.d.ts +8 -21
- package/dist/reporting/check-run-summary.d.ts +2 -2
- package/dist/reporting/execution-tracker.d.ts +1 -1
- package/dist/reporting/log-chunk-sink.d.ts +1 -1
- package/dist/reporting/run-summary-fields.d.ts +25 -0
- package/dist/reporting/s3-log-storage.d.ts +2 -2
- package/dist/routes/admin-access-log.d.ts +2 -9
- package/dist/routes/admin-backends.d.ts +2 -9
- package/dist/routes/admin-cluster-name.d.ts +2 -8
- package/dist/routes/admin-cluster-settings.d.ts +2 -8
- package/dist/routes/admin-config.d.ts +0 -3
- package/dist/routes/admin-contexts.d.ts +3 -11
- package/dist/routes/admin-db.d.ts +2 -9
- package/dist/routes/admin-env.d.ts +33 -0
- package/dist/routes/admin-event-dlq.d.ts +2 -9
- package/dist/routes/admin-event-inspect.d.ts +2 -9
- package/dist/routes/admin-event-log.d.ts +2 -9
- package/dist/routes/admin-events.d.ts +3 -13
- package/dist/routes/admin-held-runs.d.ts +2 -8
- package/dist/routes/admin-list-limit.d.ts +3 -0
- package/dist/routes/admin-maintenance.d.ts +2 -9
- package/dist/routes/admin-orchestrator-drain.d.ts +2 -9
- package/dist/routes/admin-org-settings.d.ts +2 -8
- package/dist/routes/admin-orgs.d.ts +27 -0
- package/dist/routes/admin-peer-forget.d.ts +2 -9
- package/dist/routes/admin-queue-execution.d.ts +3 -10
- package/dist/routes/admin-registrations.d.ts +3 -14
- package/dist/routes/admin-runs.d.ts +3 -14
- package/dist/routes/admin-scaler-orphans.d.ts +2 -9
- package/dist/routes/admin-scaler-reload.d.ts +41 -0
- package/dist/routes/admin-scheduled-jobs.d.ts +2 -9
- package/dist/routes/admin-signing-keys.d.ts +2 -9
- package/dist/routes/admin-sources.d.ts +28 -32
- package/dist/routes/admin-trust-policy.d.ts +2 -8
- package/dist/routes/admin.d.ts +29 -30
- package/dist/routes/cluster-join.d.ts +13 -0
- package/dist/routes/github-webhook.d.ts +13 -11
- package/dist/scaler/bare-metal-backend.d.ts +42 -1
- package/dist/scaler/config.d.ts +12 -84
- package/dist/scaler/file-reload.d.ts +48 -0
- package/dist/scaler/manager.d.ts +47 -33
- package/dist/scaler/scaler-state-store.d.ts +5 -0
- package/dist/scaler/types.d.ts +8 -9
- package/dist/secrets/job-secret-gate.d.ts +2 -5
- package/dist/secrets/secret-resolver.d.ts +2 -4
- package/dist/security/trust-policy-gate.d.ts +0 -4
- package/dist/server.d.ts +6 -17
- package/dist/server.js +10933 -10836
- package/dist/sources/source-manager.d.ts +0 -24
- package/dist/sources/webhook-url-resolvers.d.ts +60 -0
- package/dist/standalone.js +10457 -10060
- package/dist/worker/reroute-dispatch.d.ts +1 -0
- package/dist/worker/reroute-spawn-control.d.ts +1 -3
- package/dist/worker-core.d.ts +9 -2
- package/dist/ws/agent-handler.d.ts +3 -3
- package/dist/ws/dashboard-access.d.ts +57 -0
- package/dist/ws/dashboard-backends-handler.d.ts +1 -6
- package/dist/ws/dashboard-context-handler.d.ts +10 -15
- package/dist/ws/dashboard-fleet-handler.d.ts +4 -3
- package/dist/ws/dashboard-fleet-write-handler.d.ts +6 -5
- package/dist/ws/dashboard-global-workflows-handler.d.ts +1 -6
- package/dist/ws/dashboard-registrations-handler.d.ts +1 -7
- package/dist/ws/platform-client.d.ts +94 -327
- package/installer-image-digests.json +3 -3
- package/package.json +4 -4
- package/sbom.spdx.json +53 -53
- package/dist/cache/legacy-prefixes.d.ts +0 -19
- package/dist/cli/commands/agent-service/logs.d.ts +0 -14
- package/dist/cli/commands/agent-service/restart.d.ts +0 -12
- package/dist/cli/commands/agent-service/start.d.ts +0 -12
- package/dist/cli/commands/agent-service/stop.d.ts +0 -12
- package/dist/cli/commands/agent-service/uninstall.d.ts +0 -13
- package/dist/cli/commands/cache.d.ts +0 -51
- package/dist/cli/commands/orchestrator-service/logs.d.ts +0 -14
- package/dist/cli/commands/orchestrator-service/restart.d.ts +0 -12
- package/dist/cli/commands/orchestrator-service/start.d.ts +0 -12
- package/dist/cli/commands/orchestrator-service/stop.d.ts +0 -12
- package/dist/cli/commands/orchestrator-service/uninstall.d.ts +0 -13
- package/dist/git/inherited-secret.d.ts +0 -29
|
@@ -7,34 +7,27 @@
|
|
|
7
7
|
* - partition column: `received_at`
|
|
8
8
|
* - warm TTL: 30 days (rows are archived, not hard-deleted)
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* S3 indefinitely so the dashboard delivery-detail page resolves
|
|
15
|
-
* payload reads identically for hot and cold rows. Nothing deletes the
|
|
16
|
-
* row and the payload blob in lock-step.
|
|
10
|
+
* Each row's `payload_key` points at a gzipped webhook body in object
|
|
11
|
+
* storage. Archiving moves the row, `payload_key` included, and leaves the
|
|
12
|
+
* body where it is, so the delivery-detail page reads payloads the same way
|
|
13
|
+
* for hot and cold rows.
|
|
17
14
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* access_log rows themselves get archived in a later cycle by the
|
|
21
|
-
* AccessLogAdapter, bounded.
|
|
15
|
+
* Each archived chunk writes one `access_log` audit row, which the
|
|
16
|
+
* AccessLogAdapter archives in a later cycle.
|
|
22
17
|
*/
|
|
23
18
|
import { type Kysely, type Selectable } from 'kysely';
|
|
24
|
-
import { type ChunkCommitMetadata, type ColdStoreTableConfig, type EligiblePartition, type TableAdapter } from '@kici-dev/shared';
|
|
19
|
+
import { type ChunkCommitMetadata, type ColdStoreTableConfig, type EligiblePartition, type TableAdapter, PgTableAdapterBase } from '@kici-dev/shared';
|
|
25
20
|
import type { Database, EventLogTable } from '../../db/types.js';
|
|
26
21
|
export type EventLogColdStoreRow = Selectable<EventLogTable>;
|
|
27
22
|
export interface EventLogAdapterOptions {
|
|
28
23
|
overrides?: Partial<ColdStoreTableConfig>;
|
|
29
24
|
}
|
|
30
|
-
export declare class EventLogAdapter implements TableAdapter<EventLogColdStoreRow> {
|
|
31
|
-
private readonly kdb;
|
|
25
|
+
export declare class EventLogAdapter extends PgTableAdapterBase<Database> implements TableAdapter<EventLogColdStoreRow> {
|
|
32
26
|
private readonly instanceId;
|
|
33
27
|
readonly db: 'orchestrator';
|
|
34
28
|
readonly table = "event_log";
|
|
35
29
|
readonly tenantColumn = "routing_key";
|
|
36
30
|
readonly partitionColumn = "received_at";
|
|
37
|
-
readonly config: ColdStoreTableConfig;
|
|
38
31
|
constructor(kdb: Kysely<Database>, instanceId: string, opts?: EventLogAdapterOptions);
|
|
39
32
|
listEligiblePartitions(args: {
|
|
40
33
|
warmCutoff: Date;
|
|
@@ -43,10 +36,6 @@ export declare class EventLogAdapter implements TableAdapter<EventLogColdStoreRo
|
|
|
43
36
|
tenantId: string;
|
|
44
37
|
warmCutoff: Date;
|
|
45
38
|
}): Promise<number>;
|
|
46
|
-
withPartitionLock<T>(args: {
|
|
47
|
-
tenantId: string;
|
|
48
|
-
partitionDate: string;
|
|
49
|
-
}, fn: () => Promise<T>): Promise<T | null>;
|
|
50
39
|
selectEligible(args: {
|
|
51
40
|
tenantId: string;
|
|
52
41
|
partitionDate: string;
|
|
@@ -1,39 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `execution_jobs` cold-store adapter (Orchestrator side).
|
|
3
3
|
*
|
|
4
|
+
* Tenant column `routing_key`, partition column `created_at`, warm TTL 30
|
|
5
|
+
* days. Eligible: a terminal job with no live step rows for its (run, job).
|
|
4
6
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - warm TTL: 30 days
|
|
9
|
-
* - eligibility: terminal job status AND no live steps remain for this
|
|
10
|
-
* (run, job)
|
|
11
|
-
*
|
|
12
|
-
* Order: registered AFTER `ExecutionStepsAdapter`, BEFORE
|
|
13
|
-
* `ExecutionRunsAdapter` (within one cycle: steps → jobs → runs). The
|
|
14
|
-
* "no live steps" predicate makes the ordering self-correcting across
|
|
15
|
-
* cycle interruptions.
|
|
16
|
-
*
|
|
17
|
-
* FK ordering on the orchestrator side: `execution_jobs.run_id` is a
|
|
18
|
-
* FK to `execution_runs(run_id)`. Deleting a job is safe from the FK's
|
|
19
|
-
* perspective (the FK only constrains job → run direction). The runs
|
|
20
|
-
* adapter's eligibility predicate handles the dependent-rows check.
|
|
7
|
+
* Registered between the steps and runs adapters (steps → jobs → runs).
|
|
8
|
+
* Deleting a job never trips the `execution_jobs.run_id → execution_runs`
|
|
9
|
+
* FK; the runs adapter skips runs that still have jobs.
|
|
21
10
|
*/
|
|
22
11
|
import { type Kysely, type Selectable } from 'kysely';
|
|
23
|
-
import { type ChunkCommitMetadata, type ColdStoreTableConfig, type EligiblePartition, type TableAdapter } from '@kici-dev/shared';
|
|
12
|
+
import { type ChunkCommitMetadata, type ColdStoreTableConfig, type EligiblePartition, type TableAdapter, PgTableAdapterBase } from '@kici-dev/shared';
|
|
24
13
|
import type { Database, ExecutionJobTable } from '../../db/types.js';
|
|
25
14
|
export type ExecutionJobRow = Selectable<ExecutionJobTable>;
|
|
26
15
|
export interface ExecutionJobsAdapterOptions {
|
|
27
16
|
overrides?: Partial<ColdStoreTableConfig>;
|
|
28
17
|
}
|
|
29
|
-
export declare class ExecutionJobsAdapter implements TableAdapter<ExecutionJobRow> {
|
|
30
|
-
private readonly kdb;
|
|
18
|
+
export declare class ExecutionJobsAdapter extends PgTableAdapterBase<Database> implements TableAdapter<ExecutionJobRow> {
|
|
31
19
|
private readonly instanceId;
|
|
32
20
|
readonly db: 'orchestrator';
|
|
33
21
|
readonly table = "execution_jobs";
|
|
34
22
|
readonly tenantColumn = "routing_key";
|
|
35
23
|
readonly partitionColumn = "created_at";
|
|
36
|
-
readonly config: ColdStoreTableConfig;
|
|
37
24
|
constructor(kdb: Kysely<Database>, instanceId: string, opts?: ExecutionJobsAdapterOptions);
|
|
38
25
|
listEligiblePartitions(args: {
|
|
39
26
|
warmCutoff: Date;
|
|
@@ -42,10 +29,6 @@ export declare class ExecutionJobsAdapter implements TableAdapter<ExecutionJobRo
|
|
|
42
29
|
tenantId: string;
|
|
43
30
|
warmCutoff: Date;
|
|
44
31
|
}): Promise<number>;
|
|
45
|
-
withPartitionLock<T>(args: {
|
|
46
|
-
tenantId: string;
|
|
47
|
-
partitionDate: string;
|
|
48
|
-
}, fn: () => Promise<T>): Promise<T | null>;
|
|
49
32
|
selectEligible(args: {
|
|
50
33
|
tenantId: string;
|
|
51
34
|
partitionDate: string;
|
|
@@ -1,34 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `execution_runs` cold-store adapter (Orchestrator side).
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - warm TTL: 30 days
|
|
9
|
-
* - eligibility: terminal run status AND no live jobs reference this run
|
|
10
|
-
*
|
|
11
|
-
* Order: registered LAST in the orchestrator cold-store. Within one
|
|
12
|
-
* cycle the framework iterates adapters steps → jobs → runs; this
|
|
13
|
-
* adapter goes last so the FK `execution_jobs.run_id →
|
|
14
|
-
* execution_runs(run_id)` doesn't fire on DELETE. The "no live jobs"
|
|
15
|
-
* predicate enforces the same invariant across cycle interruptions.
|
|
4
|
+
* Tenant column `routing_key`, partition column `created_at`, warm TTL 30
|
|
5
|
+
* days. Eligible: a terminal run that no live job references. Registered
|
|
6
|
+
* last (steps → jobs → runs) so the `execution_jobs.run_id` FK never fires
|
|
7
|
+
* on DELETE.
|
|
16
8
|
*/
|
|
17
9
|
import { type Kysely, type Selectable } from 'kysely';
|
|
18
|
-
import { type ChunkCommitMetadata, type ColdStoreTableConfig, type EligiblePartition, type TableAdapter } from '@kici-dev/shared';
|
|
10
|
+
import { type ChunkCommitMetadata, type ColdStoreTableConfig, type EligiblePartition, type TableAdapter, PgTableAdapterBase } from '@kici-dev/shared';
|
|
19
11
|
import type { Database, ExecutionRunTable } from '../../db/types.js';
|
|
20
12
|
export type ExecutionRunRow = Selectable<ExecutionRunTable>;
|
|
21
13
|
export interface ExecutionRunsAdapterOptions {
|
|
22
14
|
overrides?: Partial<ColdStoreTableConfig>;
|
|
23
15
|
}
|
|
24
|
-
export declare class ExecutionRunsAdapter implements TableAdapter<ExecutionRunRow> {
|
|
25
|
-
private readonly kdb;
|
|
16
|
+
export declare class ExecutionRunsAdapter extends PgTableAdapterBase<Database> implements TableAdapter<ExecutionRunRow> {
|
|
26
17
|
private readonly instanceId;
|
|
27
18
|
readonly db: 'orchestrator';
|
|
28
19
|
readonly table = "execution_runs";
|
|
29
20
|
readonly tenantColumn = "routing_key";
|
|
30
21
|
readonly partitionColumn = "created_at";
|
|
31
|
-
readonly config: ColdStoreTableConfig;
|
|
32
22
|
constructor(kdb: Kysely<Database>, instanceId: string, opts?: ExecutionRunsAdapterOptions);
|
|
33
23
|
listEligiblePartitions(args: {
|
|
34
24
|
warmCutoff: Date;
|
|
@@ -37,10 +27,6 @@ export declare class ExecutionRunsAdapter implements TableAdapter<ExecutionRunRo
|
|
|
37
27
|
tenantId: string;
|
|
38
28
|
warmCutoff: Date;
|
|
39
29
|
}): Promise<number>;
|
|
40
|
-
withPartitionLock<T>(args: {
|
|
41
|
-
tenantId: string;
|
|
42
|
-
partitionDate: string;
|
|
43
|
-
}, fn: () => Promise<T>): Promise<T | null>;
|
|
44
30
|
selectEligible(args: {
|
|
45
31
|
tenantId: string;
|
|
46
32
|
partitionDate: string;
|
|
@@ -1,41 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `execution_steps` cold-store adapter (Orchestrator side).
|
|
3
3
|
*
|
|
4
|
+
* Tenant column `routing_key`, partition column `created_at`, warm TTL 30
|
|
5
|
+
* days. Steps are append-only, so age alone makes a row eligible.
|
|
4
6
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - eligibility: created_at < cutoff (steps are append-only and have no
|
|
10
|
-
* terminal-status predicate — there is no UPDATE statement against
|
|
11
|
-
* `execution_steps` in the orchestrator codebase, so age alone is
|
|
12
|
-
* sufficient)
|
|
13
|
-
*
|
|
14
|
-
* Order: registered FIRST in the orchestrator cold-store. Within one
|
|
15
|
-
* cycle the framework iterates adapters in registration order
|
|
16
|
-
* (steps → jobs → runs); steps go first so the FK chain
|
|
17
|
-
* (execution_jobs.run_id → execution_runs.run_id) doesn't break when
|
|
18
|
-
* jobs and runs are archived later.
|
|
19
|
-
*
|
|
20
|
-
* Audit emission: orchestrator-side adapters write to `access_log`
|
|
21
|
-
* (the orchestrator's audit surface; `audit_log` is Platform-side only).
|
|
22
|
-
* The row uses actor_type='system', actor_id='cold-store-archive:<id>'.
|
|
7
|
+
* Registered first: the framework archives in registration order (steps →
|
|
8
|
+
* jobs → runs), which keeps the `execution_jobs.run_id → execution_runs` FK
|
|
9
|
+
* chain intact. The archive audit row goes to `access_log`, the
|
|
10
|
+
* orchestrator's audit surface, as actor `cold-store-archive:<instanceId>`.
|
|
23
11
|
*/
|
|
24
12
|
import { type Kysely, type Selectable } from 'kysely';
|
|
25
|
-
import { type ChunkCommitMetadata, type ColdStoreTableConfig, type EligiblePartition, type TableAdapter } from '@kici-dev/shared';
|
|
13
|
+
import { type ChunkCommitMetadata, type ColdStoreTableConfig, type EligiblePartition, type TableAdapter, PgTableAdapterBase } from '@kici-dev/shared';
|
|
26
14
|
import type { Database, ExecutionStepTable } from '../../db/types.js';
|
|
27
15
|
export type ExecutionStepRow = Selectable<ExecutionStepTable>;
|
|
28
16
|
export interface ExecutionStepsAdapterOptions {
|
|
29
17
|
overrides?: Partial<ColdStoreTableConfig>;
|
|
30
18
|
}
|
|
31
|
-
export declare class ExecutionStepsAdapter implements TableAdapter<ExecutionStepRow> {
|
|
32
|
-
private readonly kdb;
|
|
19
|
+
export declare class ExecutionStepsAdapter extends PgTableAdapterBase<Database> implements TableAdapter<ExecutionStepRow> {
|
|
33
20
|
private readonly instanceId;
|
|
34
21
|
readonly db: 'orchestrator';
|
|
35
22
|
readonly table = "execution_steps";
|
|
36
23
|
readonly tenantColumn = "routing_key";
|
|
37
24
|
readonly partitionColumn = "created_at";
|
|
38
|
-
readonly config: ColdStoreTableConfig;
|
|
39
25
|
constructor(kdb: Kysely<Database>, instanceId: string, opts?: ExecutionStepsAdapterOptions);
|
|
40
26
|
listEligiblePartitions(args: {
|
|
41
27
|
warmCutoff: Date;
|
|
@@ -44,10 +30,6 @@ export declare class ExecutionStepsAdapter implements TableAdapter<ExecutionStep
|
|
|
44
30
|
tenantId: string;
|
|
45
31
|
warmCutoff: Date;
|
|
46
32
|
}): Promise<number>;
|
|
47
|
-
withPartitionLock<T>(args: {
|
|
48
|
-
tenantId: string;
|
|
49
|
-
partitionDate: string;
|
|
50
|
-
}, fn: () => Promise<T>): Promise<T | null>;
|
|
51
33
|
selectEligible(args: {
|
|
52
34
|
tenantId: string;
|
|
53
35
|
partitionDate: string;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `secret_audit_log` cold-store adapter (Orchestrator side).
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
4
|
* Contract:
|
|
6
5
|
* - tenant column: `routing_key` (NULL → synthetic `__orchestrator__`)
|
|
7
6
|
* - partition column: `timestamp`
|
|
8
|
-
* - warm TTL:
|
|
9
|
-
*
|
|
7
|
+
* - warm TTL: `minSecretAuditLogWarmDays()` table-wide, tightened per row
|
|
8
|
+
* by `secretAuditLogWarmSqlCase()`
|
|
10
9
|
*
|
|
11
10
|
* Synthetic tenant: rows without `routing_key` (e.g. orchestrator-level
|
|
12
11
|
* key rotations done before any source is bound) collapse to a single
|
|
@@ -14,21 +13,19 @@
|
|
|
14
13
|
* used for `event_log` payload keys when the routing key is missing.
|
|
15
14
|
*/
|
|
16
15
|
import { type Kysely } from 'kysely';
|
|
17
|
-
import { type ChunkCommitMetadata, type ColdRetention, type ColdStoreTableConfig, type EligiblePartition, type TableAdapter } from '@kici-dev/shared';
|
|
16
|
+
import { type ChunkCommitMetadata, type ColdRetention, type ColdStoreTableConfig, type EligiblePartition, type TableAdapter, PgTableAdapterBase } from '@kici-dev/shared';
|
|
18
17
|
import type { Database, SecretAuditLogRow } from '../../db/types.js';
|
|
19
18
|
/** Re-exported rather than re-declared — see the note in `load-event-log-range`. */
|
|
20
19
|
export type { SecretAuditLogRow };
|
|
21
20
|
export interface SecretAuditLogAdapterOptions {
|
|
22
21
|
overrides?: Partial<ColdStoreTableConfig>;
|
|
23
22
|
}
|
|
24
|
-
export declare class SecretAuditLogAdapter implements TableAdapter<SecretAuditLogRow> {
|
|
25
|
-
private readonly kdb;
|
|
23
|
+
export declare class SecretAuditLogAdapter extends PgTableAdapterBase<Database> implements TableAdapter<SecretAuditLogRow> {
|
|
26
24
|
private readonly instanceId;
|
|
27
25
|
readonly db: 'orchestrator';
|
|
28
26
|
readonly table = "secret_audit_log";
|
|
29
27
|
readonly tenantColumn = "routing_key";
|
|
30
28
|
readonly partitionColumn = "timestamp";
|
|
31
|
-
readonly config: ColdStoreTableConfig;
|
|
32
29
|
constructor(kdb: Kysely<Database>, instanceId: string, opts?: SecretAuditLogAdapterOptions);
|
|
33
30
|
listEligiblePartitions(args: {
|
|
34
31
|
warmCutoff: Date;
|
|
@@ -37,10 +34,6 @@ export declare class SecretAuditLogAdapter implements TableAdapter<SecretAuditLo
|
|
|
37
34
|
tenantId: string;
|
|
38
35
|
warmCutoff: Date;
|
|
39
36
|
}): Promise<number>;
|
|
40
|
-
withPartitionLock<T>(args: {
|
|
41
|
-
tenantId: string;
|
|
42
|
-
partitionDate: string;
|
|
43
|
-
}, fn: () => Promise<T>): Promise<T | null>;
|
|
44
37
|
selectEligible(args: {
|
|
45
38
|
tenantId: string;
|
|
46
39
|
partitionDate: string;
|
|
@@ -3,20 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Converts KICI_-prefixed env vars to nested config paths and applies
|
|
5
5
|
* them as overrides on top of a config object.
|
|
6
|
-
*
|
|
7
|
-
* Multi-app env var convention:
|
|
8
|
-
* - App name in YAML: `main-org` -> env segment: `MAIN_ORG` (hyphen to underscore, uppercased)
|
|
9
|
-
* - Example: KICI_PROVIDERS_GITHUB_MAIN_ORG_APP_ID -> providers.github[name=main-org].appId
|
|
10
6
|
*/
|
|
11
7
|
/**
|
|
12
8
|
* Convert a KICI_ env var key to a config path array.
|
|
13
9
|
* Returns null for non-KICI_ keys or unknown mappings.
|
|
14
10
|
*
|
|
15
11
|
* Handles three patterns:
|
|
16
|
-
* 1.
|
|
17
|
-
* 2.
|
|
18
|
-
* 3.
|
|
19
|
-
* ['providers', 'github', '<name-lowered>', '<camelField>'])
|
|
12
|
+
* 1. Unprefixed names the startup loader reads (NODE_ENV -> ['nodeEnv'])
|
|
13
|
+
* 2. Direct mappings (KICI_DATABASE_URL -> ['database', 'url'])
|
|
14
|
+
* 3. Startup names whose overlay spelling differs (KICI_PORT -> ['server', 'port'])
|
|
20
15
|
*/
|
|
21
16
|
export declare function envKeyToConfigPath(key: string): string[] | null;
|
|
22
17
|
/**
|
package/dist/config/reload.d.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import type { Logger } from '@kici-dev/shared';
|
|
15
15
|
import type { AppConfig, SharedConfig } from './types.js';
|
|
16
16
|
import type { SharedConfigStore } from './shared-store.js';
|
|
17
|
+
import type { ScalerFileReloadResult } from '../scaler/file-reload.js';
|
|
17
18
|
/**
|
|
18
19
|
* Source of a reload trigger.
|
|
19
20
|
*/
|
|
@@ -29,6 +30,12 @@ export interface ReloadResult {
|
|
|
29
30
|
restartRequired?: string[];
|
|
30
31
|
/** Fields that were hot-reloaded */
|
|
31
32
|
fieldsChanged?: string[];
|
|
33
|
+
/**
|
|
34
|
+
* The scaler config's own reload outcome, when this orchestrator runs one.
|
|
35
|
+
* `success` describes the orchestrator config only: a refused scaler file
|
|
36
|
+
* shows here as `rejected` while `success` stays true.
|
|
37
|
+
*/
|
|
38
|
+
scaler?: ScalerFileReloadResult;
|
|
32
39
|
}
|
|
33
40
|
/**
|
|
34
41
|
* Options for executeReload.
|
|
@@ -53,8 +60,8 @@ export interface ConfigReloaderDeps {
|
|
|
53
60
|
sharedStore: SharedConfigStore | null;
|
|
54
61
|
/** Called after successful reload when provider config changed */
|
|
55
62
|
onProviderChange?: (newConfig: AppConfig, oldConfig: AppConfig) => Promise<void>;
|
|
56
|
-
/** Called to reload scaler configuration */
|
|
57
|
-
onScalerReload?: () => Promise<void>;
|
|
63
|
+
/** Called to reload scaler configuration; its outcome is returned as `ReloadResult.scaler`. */
|
|
64
|
+
onScalerReload?: () => Promise<ScalerFileReloadResult | void>;
|
|
58
65
|
/** Called when Platform connection settings changed */
|
|
59
66
|
onPlatformReconnect?: (newConfig: AppConfig) => Promise<void>;
|
|
60
67
|
/** Atomic swap callback -- replaces the config reference */
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
* and PgSecretStore, not through config schemas.
|
|
11
11
|
*/
|
|
12
12
|
import { z } from 'zod';
|
|
13
|
+
/** Whether a coordinator dials the peers the Platform announces. */
|
|
14
|
+
export declare const PeerDiscoveryMode: z.ZodEnum<{
|
|
15
|
+
platform: "platform";
|
|
16
|
+
static: "static";
|
|
17
|
+
}>;
|
|
18
|
+
export type PeerDiscoveryMode = z.infer<typeof PeerDiscoveryMode>;
|
|
13
19
|
/**
|
|
14
20
|
* Schema for the local YAML configuration file.
|
|
15
21
|
* All fields optional except database.url.
|
|
@@ -103,8 +109,12 @@ export declare const sharedConfigSchema: z.ZodObject<{
|
|
|
103
109
|
coordinator: "coordinator";
|
|
104
110
|
worker: "worker";
|
|
105
111
|
}>>;
|
|
106
|
-
|
|
112
|
+
coordinatorUrls: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodString]>>;
|
|
107
113
|
peerStaleTimeoutMs: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
114
|
+
peerDiscovery: z.ZodOptional<z.ZodEnum<{
|
|
115
|
+
platform: "platform";
|
|
116
|
+
static: "static";
|
|
117
|
+
}>>;
|
|
108
118
|
}, z.core.$strip>>;
|
|
109
119
|
webhookPayloadDir: z.ZodOptional<z.ZodString>;
|
|
110
120
|
cacheTtlDays: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
@@ -191,8 +201,12 @@ export declare const appConfigSchema: z.ZodObject<{
|
|
|
191
201
|
coordinator: "coordinator";
|
|
192
202
|
worker: "worker";
|
|
193
203
|
}>>;
|
|
194
|
-
|
|
204
|
+
coordinatorUrls: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>>;
|
|
195
205
|
peerStaleTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
206
|
+
peerDiscovery: z.ZodDefault<z.ZodEnum<{
|
|
207
|
+
platform: "platform";
|
|
208
|
+
static: "static";
|
|
209
|
+
}>>;
|
|
196
210
|
}, z.core.$strip>>;
|
|
197
211
|
webhookPayloadDir: z.ZodOptional<z.ZodString>;
|
|
198
212
|
cacheTtlDays: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
package/dist/config/types.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* - AppConfig: merged result type used throughout the codebase
|
|
8
8
|
*/
|
|
9
9
|
import type { OrchestratorMode } from '@kici-dev/engine';
|
|
10
|
+
import type { PeerDiscoveryMode } from './schema.js';
|
|
10
11
|
/**
|
|
11
12
|
* Per-orchestrator settings loaded from YAML file.
|
|
12
13
|
* These are instance-specific and never shared across orchestrators.
|
|
@@ -85,6 +86,7 @@ export interface SharedConfig {
|
|
|
85
86
|
raftHeartbeatMs?: number;
|
|
86
87
|
peerHeartbeatIntervalMs?: number;
|
|
87
88
|
peerMaxReconnectDelayMs?: number;
|
|
89
|
+
peerDiscovery?: PeerDiscoveryMode;
|
|
88
90
|
};
|
|
89
91
|
webhookPayloadDir?: string;
|
|
90
92
|
cacheTtlDays?: number;
|
|
@@ -185,10 +187,12 @@ export interface AppConfig {
|
|
|
185
187
|
peerMaxReconnectDelayMs: number;
|
|
186
188
|
/** Cluster role: coordinator (full orchestrator) or worker (delegated execution). */
|
|
187
189
|
role: 'coordinator' | 'worker';
|
|
188
|
-
/**
|
|
189
|
-
|
|
190
|
+
/** URLs of every coordinator to connect to when role=worker. */
|
|
191
|
+
coordinatorUrls: string[];
|
|
190
192
|
/** Stale peer timeout in ms. */
|
|
191
193
|
peerStaleTimeoutMs: number;
|
|
194
|
+
/** Whether this coordinator dials Platform-announced peers. */
|
|
195
|
+
peerDiscovery: PeerDiscoveryMode;
|
|
192
196
|
};
|
|
193
197
|
/** Webhook payload storage directory */
|
|
194
198
|
webhookPayloadDir?: string;
|
package/dist/config.d.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Orchestrator configuration.
|
|
2
|
+
* Orchestrator startup configuration, read from `KICI_*` environment variables.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* The new config system lives in config/ and supports:
|
|
9
|
-
* - YAML config files (config/loader.ts)
|
|
10
|
-
* - Shared DB config store (config/shared-store.ts)
|
|
11
|
-
* - 4-layer resolution: env > YAML > DB > defaults (config/resolver.ts)
|
|
12
|
-
* - KICI_ env var mapping (config/env-overlay.ts)
|
|
4
|
+
* The runtime config reloader lives in config/: YAML files (config/loader.ts),
|
|
5
|
+
* the shared DB config store (config/shared-store.ts), the env overlay
|
|
6
|
+
* (config/env-overlay.ts) and the resolution chain (config/resolver.ts).
|
|
13
7
|
*
|
|
14
8
|
* Provider configuration (GitHub Apps, etc.) is managed via the `sources` table
|
|
15
9
|
* and PgSecretStore, not through config. See SourceStore and SourceManager.
|
|
@@ -122,7 +116,6 @@ declare const configSchema: z.ZodObject<{
|
|
|
122
116
|
filesystem: "filesystem";
|
|
123
117
|
s3: "s3";
|
|
124
118
|
}>>;
|
|
125
|
-
cacheStoragePath: z.ZodOptional<z.ZodString>;
|
|
126
119
|
cacheStorageS3Bucket: z.ZodOptional<z.ZodString>;
|
|
127
120
|
cacheStorageS3Prefix: z.ZodDefault<z.ZodString>;
|
|
128
121
|
cacheStorageS3Region: z.ZodOptional<z.ZodString>;
|
|
@@ -240,11 +233,14 @@ declare const configSchema: z.ZodObject<{
|
|
|
240
233
|
coordinator: "coordinator";
|
|
241
234
|
worker: "worker";
|
|
242
235
|
}>>;
|
|
243
|
-
coordinatorUrl: z.ZodOptional<z.ZodString>;
|
|
244
236
|
coordinatorUrls: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string[], string | undefined>>;
|
|
245
237
|
peerStaleTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
246
238
|
electionGracePeriodMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
247
239
|
singleNode: z.ZodPipe<z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>, z.ZodTransform<boolean, string | boolean>>;
|
|
240
|
+
peerDiscovery: z.ZodDefault<z.ZodEnum<{
|
|
241
|
+
platform: "platform";
|
|
242
|
+
static: "static";
|
|
243
|
+
}>>;
|
|
248
244
|
trustedProxies: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<string[], string>>;
|
|
249
245
|
}, z.core.$strip>>;
|
|
250
246
|
}, z.core.$strip>;
|
|
@@ -336,7 +332,6 @@ export declare const packagingConfigSchema: z.ZodObject<{
|
|
|
336
332
|
filesystem: "filesystem";
|
|
337
333
|
s3: "s3";
|
|
338
334
|
}>>;
|
|
339
|
-
cacheStoragePath: z.ZodOptional<z.ZodString>;
|
|
340
335
|
cacheStorageS3Bucket: z.ZodOptional<z.ZodString>;
|
|
341
336
|
cacheStorageS3Prefix: z.ZodDefault<z.ZodString>;
|
|
342
337
|
cacheStorageS3Region: z.ZodOptional<z.ZodString>;
|
|
@@ -454,11 +449,14 @@ export declare const packagingConfigSchema: z.ZodObject<{
|
|
|
454
449
|
coordinator: "coordinator";
|
|
455
450
|
worker: "worker";
|
|
456
451
|
}>>;
|
|
457
|
-
coordinatorUrl: z.ZodOptional<z.ZodString>;
|
|
458
452
|
coordinatorUrls: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string[], string | undefined>>;
|
|
459
453
|
peerStaleTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
460
454
|
electionGracePeriodMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
461
455
|
singleNode: z.ZodPipe<z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>, z.ZodTransform<boolean, string | boolean>>;
|
|
456
|
+
peerDiscovery: z.ZodDefault<z.ZodEnum<{
|
|
457
|
+
platform: "platform";
|
|
458
|
+
static: "static";
|
|
459
|
+
}>>;
|
|
462
460
|
trustedProxies: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<string[], string>>;
|
|
463
461
|
}, z.core.$strip>>;
|
|
464
462
|
}, z.core.$strip>;
|
|
@@ -471,7 +469,7 @@ export declare const packagingConfigSchema: z.ZodObject<{
|
|
|
471
469
|
export type AppConfig = z.infer<typeof configSchema> & {
|
|
472
470
|
/** Unique identifier for this orchestrator instance, generated at startup */
|
|
473
471
|
instanceId: string;
|
|
474
|
-
/** Object storage settings (populated from
|
|
472
|
+
/** Object storage settings (populated from the KICI_STORAGE_* env vars or SharedConfig) */
|
|
475
473
|
storage?: {
|
|
476
474
|
type?: 's3' | 'filesystem';
|
|
477
475
|
bucket?: string;
|
|
@@ -577,7 +575,6 @@ export declare const envDef: import("@kici-dev/shared/env").DefineEnvResult<{
|
|
|
577
575
|
scalerProvisionBackoffMaxMs: number;
|
|
578
576
|
scalerProvisionMaxConsecutiveFailures: number;
|
|
579
577
|
cacheStorageType?: "filesystem" | "s3" | undefined;
|
|
580
|
-
cacheStoragePath?: string | undefined;
|
|
581
578
|
cacheStorageS3Bucket?: string | undefined;
|
|
582
579
|
cacheStorageS3Prefix: string;
|
|
583
580
|
cacheStorageS3Region?: string | undefined;
|
|
@@ -668,14 +665,22 @@ export declare const envDef: import("@kici-dev/shared/env").DefineEnvResult<{
|
|
|
668
665
|
peerHeartbeatIntervalMs: number;
|
|
669
666
|
peerMaxReconnectDelayMs: number;
|
|
670
667
|
role: "coordinator" | "worker";
|
|
671
|
-
coordinatorUrl?: string | undefined;
|
|
672
668
|
coordinatorUrls: string[];
|
|
673
669
|
peerStaleTimeoutMs: number;
|
|
674
670
|
electionGracePeriodMs: number;
|
|
675
671
|
singleNode: boolean;
|
|
672
|
+
peerDiscovery: "platform" | "static";
|
|
676
673
|
trustedProxies: string[];
|
|
677
674
|
};
|
|
678
675
|
}>;
|
|
676
|
+
/**
|
|
677
|
+
* Load the startup orchestrator configuration from environment variables.
|
|
678
|
+
*
|
|
679
|
+
* It reads `process.env` through the names declared in `envDef`
|
|
680
|
+
* (KICI_DATABASE_URL, KICI_PORT, …) and refuses unknown `KICI_*` names. The
|
|
681
|
+
* config reloader (`config/resolver.ts`) layers the YAML file and the shared
|
|
682
|
+
* DB config store on top at runtime.
|
|
683
|
+
*/
|
|
679
684
|
export declare function loadConfig(scope?: ConfigScope): AppConfig;
|
|
680
685
|
export {};
|
|
681
686
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -279,12 +279,9 @@ export declare class HeldRunStore {
|
|
|
279
279
|
* incidental: `expireOverdue` is not scope-filtered, so a released-but-not-yet-
|
|
280
280
|
* resumed row would otherwise be expired out from under its resume.
|
|
281
281
|
*
|
|
282
|
-
* The filter
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
* filter on `hold_scope`: a job-scoped timer hold used to be excluded here,
|
|
286
|
-
* which left it with no release path at all — created, never released,
|
|
287
|
-
* eventually expired, its job never dispatched.
|
|
282
|
+
* The filter deliberately does NOT filter on `hold_scope`: a job-scoped timer
|
|
283
|
+
* hold used to be excluded here, which left it with no release path at all —
|
|
284
|
+
* created, never released, eventually expired, its job never dispatched.
|
|
288
285
|
*/
|
|
289
286
|
releaseDueWaitHolds(): Promise<ReleaseSignal[]>;
|
|
290
287
|
/**
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opaque pagination cursors for the dashboard list handlers:
|
|
3
|
+
* base64url(JSON(fields)), every field a string.
|
|
4
|
+
*/
|
|
5
|
+
/** Encode `fields` as a cursor. Key order follows the object literal. */
|
|
6
|
+
export declare function encodeCursor(fields: Record<string, string>): string;
|
|
7
|
+
/**
|
|
8
|
+
* Decode a cursor into exactly `keys`. Returns null when the cursor is not
|
|
9
|
+
* base64url JSON or any key is missing or not a string; other keys are dropped.
|
|
10
|
+
*/
|
|
11
|
+
export declare function decodeCursor<K extends string>(raw: string, keys: readonly K[]): Record<K, string> | null;
|
|
12
|
+
//# sourceMappingURL=cursor.d.ts.map
|
|
@@ -14,7 +14,7 @@ interface DashboardHandlerDeps {
|
|
|
14
14
|
* The orchestrator's own provenance issuer (`KICI_ORCHESTRATOR_PROVENANCE_ISSUER`)
|
|
15
15
|
* when it owns signing. Surfaced on attestations-list responses so the Platform
|
|
16
16
|
* returns it as `trustedIssuer` — the dashboard / CLI verify against the
|
|
17
|
-
* orchestrator that
|
|
17
|
+
* orchestrator that signed the bundles.
|
|
18
18
|
*/
|
|
19
19
|
provenanceSigningIssuer?: string | null;
|
|
20
20
|
/**
|
|
@@ -127,6 +127,7 @@ export declare class DashboardHandler {
|
|
|
127
127
|
private readonly send;
|
|
128
128
|
private readonly orchestratorId;
|
|
129
129
|
private readonly accessLog;
|
|
130
|
+
private readonly access;
|
|
130
131
|
private orgId;
|
|
131
132
|
private routingKey;
|
|
132
133
|
private readonly onRerun;
|
|
@@ -142,7 +143,7 @@ export declare class DashboardHandler {
|
|
|
142
143
|
* Update the bound orgId + routingKey. Called from server.ts after resolving
|
|
143
144
|
* the single tenant org from the `sources` / `generic_webhook_sources` table.
|
|
144
145
|
*
|
|
145
|
-
* NOTE: this binding is the **fallback**
|
|
146
|
+
* NOTE: this binding is the **fallback** access_log scope. Run-targeted
|
|
146
147
|
* handlers resolve the run-owning org per-request via `resolveOrgForRun`;
|
|
147
148
|
* the bound pair is consulted only when the per-target lookup yields no
|
|
148
149
|
* result (e.g. cold-archived run, deleted source). On a multi-tenant
|
|
@@ -190,14 +191,6 @@ export declare class DashboardHandler {
|
|
|
190
191
|
* has the operation switched off.
|
|
191
192
|
*/
|
|
192
193
|
private enforcePolicy;
|
|
193
|
-
/**
|
|
194
|
-
* Write an access_log row for a handler invocation. The caller resolves
|
|
195
|
-
* the run-owning org via `resolveOrgForRun` (or the registration / event-
|
|
196
|
-
* log equivalents) and threads it in here so each row carries the org
|
|
197
|
-
* that owns the target — not the handler-bound (multi-tenant: non-
|
|
198
|
-
* deterministic) pair. Best-effort; the writer swallows failures.
|
|
199
|
-
*/
|
|
200
|
-
private recordAccess;
|
|
201
194
|
/**
|
|
202
195
|
* Handle a dashboard.run.detail request.
|
|
203
196
|
* Queries execution_jobs and execution_steps for the given runId,
|
|
@@ -337,14 +330,14 @@ export declare class DashboardHandler {
|
|
|
337
330
|
* Handle a dashboard.attestations.list request: list the run's provenance
|
|
338
331
|
* attestations, inlining each stored bundle from object storage so the
|
|
339
332
|
* dashboard verifies it client-side. Mirrors `handleStepLogs` (per-run org
|
|
340
|
-
* resolution + `
|
|
333
|
+
* resolution + `access.recordIn` + `send`). Rows whose bundle can't be read are
|
|
341
334
|
* skipped (best-effort) rather than failing the whole list.
|
|
342
335
|
*/
|
|
343
336
|
handleAttestationsList(msg: DashboardAttestationsListRequest): Promise<void>;
|
|
344
337
|
/**
|
|
345
338
|
* Handle a dashboard.artifacts.list request: list the run's named artifacts
|
|
346
339
|
* with a presigned GET per entry. Mirrors `handleAttestationsList` (per-run
|
|
347
|
-
* org resolution + `
|
|
340
|
+
* org resolution + `access.recordIn` + `send`). Org is resolved server-side from
|
|
348
341
|
* the run row, never the wire, so the listing cannot cross tenants.
|
|
349
342
|
*/
|
|
350
343
|
handleArtifactsList(msg: DashboardArtifactsListRequest): Promise<void>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the deferred indexes (`deferred-indexes.ts`) after boot, each one
|
|
3
|
+
* `CONCURRENTLY` on its own connection.
|
|
4
|
+
*/
|
|
5
|
+
import type pg from 'pg';
|
|
6
|
+
import { type Logger } from '@kici-dev/shared';
|
|
7
|
+
import { type DeferredIndex } from './deferred-indexes.js';
|
|
8
|
+
/**
|
|
9
|
+
* Distinct from the migrator's `543210001`: an index build must not block, or
|
|
10
|
+
* be blocked by, a peer applying migrations.
|
|
11
|
+
*/
|
|
12
|
+
export declare const DEFERRED_INDEX_LOCK_KEY = 543210002;
|
|
13
|
+
/**
|
|
14
|
+
* Drop a leftover invalid index before rebuilding it.
|
|
15
|
+
*
|
|
16
|
+
* An interrupted `CREATE INDEX CONCURRENTLY` leaves the index in place marked
|
|
17
|
+
* invalid: it is not used by the planner, and `IF NOT EXISTS` sees it and
|
|
18
|
+
* skips. Without this, the very first failed build would make the retry a
|
|
19
|
+
* permanent no-op — the opposite of the "retries on the next boot" contract.
|
|
20
|
+
*/
|
|
21
|
+
export declare function dropIfInvalid(client: Pick<pg.Client, 'query'>, name: string, logger: Logger): Promise<void>;
|
|
22
|
+
export interface BuildDeferredIndexesResult {
|
|
23
|
+
built: string[];
|
|
24
|
+
failed: string[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Build every deferred index on one dedicated connection.
|
|
28
|
+
*
|
|
29
|
+
* The connection is taken straight from `pg` rather than from the serving
|
|
30
|
+
* pool: `CREATE INDEX CONCURRENTLY` must run outside a transaction and must
|
|
31
|
+
* not inherit a statement timeout, and a concurrent build on a large table
|
|
32
|
+
* would otherwise hold a serving connection for its whole duration.
|
|
33
|
+
*
|
|
34
|
+
* The advisory lock is `pg_try_advisory_lock`, not the blocking form: when a
|
|
35
|
+
* peer is already building, this instance has nothing to wait for.
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildDeferredIndexes(databaseUrl: string, opts?: {
|
|
38
|
+
logger?: Logger;
|
|
39
|
+
indexes?: ReadonlyArray<DeferredIndex>;
|
|
40
|
+
pg?: typeof import('pg');
|
|
41
|
+
}): Promise<BuildDeferredIndexesResult>;
|
|
42
|
+
//# sourceMappingURL=deferred-index-build.d.ts.map
|