@intentius/chant 0.46.0 → 0.50.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/audit/catalog.d.ts +13 -3
- package/dist/audit/catalog.d.ts.map +1 -1
- package/dist/audit/core.d.ts +30 -3
- package/dist/audit/core.d.ts.map +1 -1
- package/dist/audit/discover.d.ts +9 -2
- package/dist/audit/discover.d.ts.map +1 -1
- package/dist/audit/fetch.d.ts.map +1 -1
- package/dist/audit/report-html.d.ts.map +1 -1
- package/dist/audit/report-model.d.ts +6 -0
- package/dist/audit/report-model.d.ts.map +1 -1
- package/dist/audit/report.d.ts.map +1 -1
- package/dist/audit/rules-doc.d.ts.map +1 -1
- package/dist/audit/secrets.d.ts +95 -0
- package/dist/audit/secrets.d.ts.map +1 -0
- package/dist/audit/wrangler.d.ts +33 -0
- package/dist/audit/wrangler.d.ts.map +1 -0
- package/dist/build.d.ts +3 -3
- package/dist/build.d.ts.map +1 -1
- package/dist/cli/commands/audit.d.ts +7 -0
- package/dist/cli/commands/audit.d.ts.map +1 -1
- package/dist/cli/commands/build.d.ts +23 -0
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/lint.d.ts.map +1 -1
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/components.d.ts +31 -0
- package/dist/cli/handlers/components.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle.d.ts +12 -1
- package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
- package/dist/cli/handlers/operator.d.ts +32 -0
- package/dist/cli/handlers/operator.d.ts.map +1 -0
- package/dist/cli/handlers/scenario.d.ts +39 -0
- package/dist/cli/handlers/scenario.d.ts.map +1 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/mcp/resource-handlers.d.ts.map +1 -1
- package/dist/cli/mcp/server.d.ts +35 -2
- package/dist/cli/mcp/server.d.ts.map +1 -1
- package/dist/cli/mcp/tools/explain.d.ts +6 -0
- package/dist/cli/mcp/tools/explain.d.ts.map +1 -1
- package/dist/cli/mcp/types.d.ts +29 -1
- package/dist/cli/mcp/types.d.ts.map +1 -1
- package/dist/cli/plugins.d.ts +1 -1
- package/dist/cli/plugins.d.ts.map +1 -1
- package/dist/cli/registry.d.ts +14 -2
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/cli/reporters/stylish.d.ts +15 -1
- package/dist/cli/reporters/stylish.d.ts.map +1 -1
- package/dist/codegen/docs-rule-scanning.d.ts.map +1 -1
- package/dist/components/auto-release.d.ts +4 -0
- package/dist/components/auto-release.d.ts.map +1 -1
- package/dist/components/capability.d.ts +17 -2
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/cli-support.d.ts +7 -0
- package/dist/components/cli-support.d.ts.map +1 -1
- package/dist/components/component.d.ts +15 -0
- package/dist/components/component.d.ts.map +1 -1
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/starter-plugin.d.ts +2 -0
- package/dist/components/starter-plugin.d.ts.map +1 -1
- package/dist/components/verbs/ensure-secret.d.ts +50 -0
- package/dist/components/verbs/ensure-secret.d.ts.map +1 -0
- package/dist/components/verbs/index.d.ts +13 -0
- package/dist/components/verbs/index.d.ts.map +1 -1
- package/dist/components/verbs/r2-sync.d.ts +76 -0
- package/dist/components/verbs/r2-sync.d.ts.map +1 -0
- package/dist/components/verbs/run-agent.d.ts +499 -0
- package/dist/components/verbs/run-agent.d.ts.map +1 -0
- package/dist/components/verbs/sign.d.ts +30 -0
- package/dist/components/verbs/sign.d.ts.map +1 -1
- package/dist/components/verbs/wrangler.d.ts +108 -0
- package/dist/components/verbs/wrangler.d.ts.map +1 -0
- package/dist/composite.d.ts +6 -1
- package/dist/composite.d.ts.map +1 -1
- package/dist/config.d.ts +26 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/deep-observation.d.ts +14 -0
- package/dist/deep-observation.d.ts.map +1 -1
- package/dist/discovery/collect.d.ts.map +1 -1
- package/dist/discovery/fold-import.d.ts +15 -1
- package/dist/discovery/fold-import.d.ts.map +1 -1
- package/dist/discovery/fold-rank.d.ts +66 -0
- package/dist/discovery/fold-rank.d.ts.map +1 -0
- package/dist/discovery/index.d.ts +15 -0
- package/dist/discovery/index.d.ts.map +1 -1
- package/dist/discovery/param-deps.d.ts +17 -0
- package/dist/discovery/param-deps.d.ts.map +1 -0
- package/dist/effect-receipt.d.ts +177 -0
- package/dist/effect-receipt.d.ts.map +1 -0
- package/dist/fold/fold.d.ts +55 -2
- package/dist/fold/fold.d.ts.map +1 -1
- package/dist/fold/subset.d.ts +20 -0
- package/dist/fold/subset.d.ts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/lexicon-schema.d.ts +2 -0
- package/dist/lexicon-schema.d.ts.map +1 -1
- package/dist/lexicon.d.ts +137 -3
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/change-set.d.ts +33 -5
- package/dist/lifecycle/change-set.d.ts.map +1 -1
- package/dist/lifecycle/converge-ledger.d.ts +90 -0
- package/dist/lifecycle/converge-ledger.d.ts.map +1 -0
- package/dist/lifecycle/deep-diff.d.ts +18 -0
- package/dist/lifecycle/deep-diff.d.ts.map +1 -1
- package/dist/lifecycle/deep-observe.d.ts +9 -1
- package/dist/lifecycle/deep-observe.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.d.ts +33 -0
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -0
- package/dist/lifecycle/git.d.ts +145 -21
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/index.d.ts +6 -0
- package/dist/lifecycle/index.d.ts.map +1 -1
- package/dist/lifecycle/lease.d.ts +113 -0
- package/dist/lifecycle/lease.d.ts.map +1 -0
- package/dist/lifecycle/observation-baseline.d.ts +21 -3
- package/dist/lifecycle/observation-baseline.d.ts.map +1 -1
- package/dist/lifecycle/receipt-plan.d.ts +62 -0
- package/dist/lifecycle/receipt-plan.d.ts.map +1 -0
- package/dist/lifecycle/release-ledger.d.ts +20 -0
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/scenario-eval.d.ts +42 -0
- package/dist/lifecycle/scenario-eval.d.ts.map +1 -0
- package/dist/lifecycle/scenario.d.ts +163 -0
- package/dist/lifecycle/scenario.d.ts.map +1 -0
- package/dist/lifecycle/symptoms.d.ts +63 -0
- package/dist/lifecycle/symptoms.d.ts.map +1 -0
- package/dist/lifecycle/teardown.d.ts +6 -4
- package/dist/lifecycle/teardown.d.ts.map +1 -1
- package/dist/lifecycle/unobserved-gate.d.ts +67 -0
- package/dist/lifecycle/unobserved-gate.d.ts.map +1 -0
- package/dist/lint/knowledge-checks.d.ts +48 -0
- package/dist/lint/knowledge-checks.d.ts.map +1 -0
- package/dist/lint/output-checks.d.ts +5 -0
- package/dist/lint/output-checks.d.ts.map +1 -0
- package/dist/lint/output-docs.d.ts +94 -0
- package/dist/lint/output-docs.d.ts.map +1 -0
- package/dist/lint/pipeline-change-gate.d.ts +101 -0
- package/dist/lint/pipeline-change-gate.d.ts.map +1 -0
- package/dist/lint/post-synth.d.ts +41 -0
- package/dist/lint/post-synth.d.ts.map +1 -1
- package/dist/lint/receipt-checks.d.ts +9 -0
- package/dist/lint/receipt-checks.d.ts.map +1 -0
- package/dist/lint/rules/__fixtures__/comp/comp003/pass/agent-turn.component.d.ts +11 -0
- package/dist/lint/rules/__fixtures__/comp/comp003/pass/agent-turn.component.d.ts.map +1 -0
- package/dist/lint/rules/cor022-receipt-leaf.d.ts +13 -0
- package/dist/lint/rules/cor022-receipt-leaf.d.ts.map +1 -0
- package/dist/lint/rules/cor024-receipt-secret-pointer.d.ts +3 -0
- package/dist/lint/rules/cor024-receipt-secret-pointer.d.ts.map +1 -0
- package/dist/lint/rules/evl001-non-literal-expression.d.ts.map +1 -1
- package/dist/lint/rules/index.d.ts +3 -1
- package/dist/lint/rules/index.d.ts.map +1 -1
- package/dist/lsp/lexicon-providers.d.ts +7 -0
- package/dist/lsp/lexicon-providers.d.ts.map +1 -1
- package/dist/okf-read.d.ts +78 -0
- package/dist/okf-read.d.ts.map +1 -0
- package/dist/op/activity-contract.d.ts +139 -0
- package/dist/op/activity-contract.d.ts.map +1 -0
- package/dist/op/builders.d.ts +140 -3
- package/dist/op/builders.d.ts.map +1 -1
- package/dist/op/converge-rule.d.ts +161 -0
- package/dist/op/converge-rule.d.ts.map +1 -0
- package/dist/op/generate-pipeline.d.ts +39 -0
- package/dist/op/generate-pipeline.d.ts.map +1 -0
- package/dist/op/index.d.ts +18 -2
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/local-executor.d.ts +2 -1
- package/dist/op/local-executor.d.ts.map +1 -1
- package/dist/op/op-verb-class.d.ts +42 -0
- package/dist/op/op-verb-class.d.ts.map +1 -0
- package/dist/op/operator.d.ts +128 -0
- package/dist/op/operator.d.ts.map +1 -0
- package/dist/op/receipt-store.d.ts +138 -0
- package/dist/op/receipt-store.d.ts.map +1 -0
- package/dist/op/step-output-ref.d.ts +187 -0
- package/dist/op/step-output-ref.d.ts.map +1 -0
- package/dist/op/types.d.ts +49 -2
- package/dist/op/types.d.ts.map +1 -1
- package/dist/provenance.d.ts +73 -3
- package/dist/provenance.d.ts.map +1 -1
- package/dist/runtime-adapter.d.ts +7 -1
- package/dist/runtime-adapter.d.ts.map +1 -1
- package/dist/secret-materialization.d.ts +138 -0
- package/dist/secret-materialization.d.ts.map +1 -0
- package/dist/secret-provenance.d.ts +218 -0
- package/dist/secret-provenance.d.ts.map +1 -0
- package/dist/serializer.d.ts +29 -0
- package/dist/serializer.d.ts.map +1 -1
- package/dist/toml.d.ts +40 -5
- package/dist/toml.d.ts.map +1 -1
- package/dist/yaml.d.ts.map +1 -1
- package/package.json +4 -1
- package/src/audit/catalog.test.ts +1 -1
- package/src/audit/catalog.ts +75 -3
- package/src/audit/core.test.ts +57 -0
- package/src/audit/core.ts +0 -0
- package/src/audit/detect-bundle.test.ts +1 -1
- package/src/audit/discover.test.ts +24 -0
- package/src/audit/discover.ts +40 -4
- package/src/audit/fetch.test.ts +216 -3
- package/src/audit/fetch.ts +270 -59
- package/src/audit/report-html.ts +5 -2
- package/src/audit/report-model.ts +9 -0
- package/src/audit/report.test.ts +22 -0
- package/src/audit/report.ts +3 -2
- package/src/audit/rules-doc.ts +13 -1
- package/src/audit/secrets.test.ts +303 -0
- package/src/audit/secrets.ts +406 -0
- package/src/audit/wrangler.test.ts +230 -0
- package/src/audit/wrangler.ts +290 -0
- package/src/build.test.ts +41 -0
- package/src/build.ts +39 -6
- package/src/cli/command-group.ts +1 -1
- package/src/cli/commands/__fixtures__/audit-fountain/agents/fleet.yaml +27 -0
- package/src/cli/commands/__fixtures__/audit-fountain/k8s/deploy.yaml +16 -0
- package/src/cli/commands/__fixtures__/audit-fountain-clean/fleet.yaml +20 -0
- package/src/cli/commands/__fixtures__/schemas/sarif-2.1.0.schema.json +2882 -0
- package/src/cli/commands/audit.test.ts +268 -1
- package/src/cli/commands/audit.ts +87 -18
- package/src/cli/commands/build.test.ts +245 -0
- package/src/cli/commands/build.ts +210 -21
- package/src/cli/commands/lint.ts +15 -3
- package/src/cli/handlers/build.ts +2 -0
- package/src/cli/handlers/components.test.ts +199 -1
- package/src/cli/handlers/components.ts +160 -3
- package/src/cli/handlers/explain.test.ts +70 -1
- package/src/cli/handlers/graph.test.ts +20 -0
- package/src/cli/handlers/graph.ts +12 -3
- package/src/cli/handlers/lifecycle.test.ts +115 -1
- package/src/cli/handlers/lifecycle.ts +96 -15
- package/src/cli/handlers/operator.test.ts +255 -0
- package/src/cli/handlers/operator.ts +240 -0
- package/src/cli/handlers/scenario.test.ts +456 -0
- package/src/cli/handlers/scenario.ts +330 -0
- package/src/cli/main.test.ts +23 -0
- package/src/cli/main.ts +72 -1
- package/src/cli/mcp/resource-handlers.ts +38 -1
- package/src/cli/mcp/server.test.ts +323 -3
- package/src/cli/mcp/server.ts +84 -7
- package/src/cli/mcp/tools/explain.ts +51 -2
- package/src/cli/mcp/types.ts +27 -1
- package/src/cli/plugins.ts +4 -2
- package/src/cli/registry.ts +14 -2
- package/src/cli/reporters/stylish.test.ts +154 -0
- package/src/cli/reporters/stylish.ts +154 -33
- package/src/codegen/docs-rule-scanning.test.ts +42 -0
- package/src/codegen/docs-rule-scanning.ts +25 -2
- package/src/components/README.md +7 -0
- package/src/components/auto-release.ts +6 -0
- package/src/components/capability.ts +17 -2
- package/src/components/cli-support.test.ts +17 -0
- package/src/components/cli-support.ts +13 -1
- package/src/components/component-schema.test.ts +32 -0
- package/src/components/component.schema.json +6 -0
- package/src/components/component.test.ts +21 -0
- package/src/components/component.ts +15 -0
- package/src/components/driver.ts +12 -4
- package/src/components/registry.test.ts +7 -2
- package/src/components/starter-plugin.ts +17 -0
- package/src/components/verbs/ensure-secret.test.ts +130 -0
- package/src/components/verbs/ensure-secret.ts +79 -0
- package/src/components/verbs/index.ts +13 -0
- package/src/components/verbs/r2-sync.test.ts +107 -0
- package/src/components/verbs/r2-sync.ts +124 -0
- package/src/components/verbs/run-agent.test.ts +683 -0
- package/src/components/verbs/run-agent.ts +786 -0
- package/src/components/verbs/sign.test.ts +19 -0
- package/src/components/verbs/sign.ts +34 -2
- package/src/components/verbs/wrangler.test.ts +170 -0
- package/src/components/verbs/wrangler.ts +241 -0
- package/src/composite.ts +31 -2
- package/src/config.test.ts +15 -0
- package/src/config.ts +30 -0
- package/src/deep-observation.test.ts +19 -0
- package/src/deep-observation.ts +17 -0
- package/src/discovery/collect.ts +11 -2
- package/src/discovery/fold-import.test.ts +54 -0
- package/src/discovery/fold-import.ts +178 -38
- package/src/discovery/fold-rank.test.ts +197 -0
- package/src/discovery/fold-rank.ts +346 -0
- package/src/discovery/index.ts +16 -1
- package/src/discovery/param-deps.test.ts +118 -0
- package/src/discovery/param-deps.ts +170 -0
- package/src/effect-receipt-exclusion.test.ts +190 -0
- package/src/effect-receipt.test.ts +419 -0
- package/src/effect-receipt.ts +412 -0
- package/src/fold/fold.test.ts +6 -2
- package/src/fold/fold.ts +184 -3
- package/src/fold/subset.test.ts +95 -6
- package/src/fold/subset.ts +66 -2
- package/src/index.ts +4 -0
- package/src/lexicon-schema.ts +3 -0
- package/src/lexicon.ts +151 -5
- package/src/lifecycle/change-set.ts +46 -7
- package/src/lifecycle/converge-ledger.test.ts +199 -0
- package/src/lifecycle/converge-ledger.ts +179 -0
- package/src/lifecycle/deep-diff.test.ts +79 -1
- package/src/lifecycle/deep-diff.ts +23 -0
- package/src/lifecycle/deep-observe.ts +13 -2
- package/src/lifecycle/gate-ledger.test.ts +103 -0
- package/src/lifecycle/gate-ledger.ts +140 -0
- package/src/lifecycle/git.test.ts +430 -0
- package/src/lifecycle/git.ts +446 -84
- package/src/lifecycle/index.ts +6 -0
- package/src/lifecycle/lease.test.ts +343 -0
- package/src/lifecycle/lease.ts +270 -0
- package/src/lifecycle/observation-baseline.test.ts +46 -0
- package/src/lifecycle/observation-baseline.ts +33 -1
- package/src/lifecycle/receipt-plan.test.ts +250 -0
- package/src/lifecycle/receipt-plan.ts +249 -0
- package/src/lifecycle/release-ledger.ts +20 -0
- package/src/lifecycle/scenario-eval.test.ts +199 -0
- package/src/lifecycle/scenario-eval.ts +158 -0
- package/src/lifecycle/scenario.test.ts +195 -0
- package/src/lifecycle/scenario.ts +321 -0
- package/src/lifecycle/symptoms.test.ts +116 -0
- package/src/lifecycle/symptoms.ts +126 -0
- package/src/lifecycle/teardown.test.ts +31 -0
- package/src/lifecycle/teardown.ts +6 -4
- package/src/lifecycle/unobserved-gate.test.ts +109 -0
- package/src/lifecycle/unobserved-gate.ts +102 -0
- package/src/lint/knowledge-checks.test.ts +80 -0
- package/src/lint/knowledge-checks.ts +74 -0
- package/src/lint/output-checks.test.ts +85 -0
- package/src/lint/output-checks.ts +99 -0
- package/src/lint/output-docs.test.ts +220 -0
- package/src/lint/output-docs.ts +204 -0
- package/src/lint/pipeline-change-gate.test.ts +144 -0
- package/src/lint/pipeline-change-gate.ts +153 -0
- package/src/lint/post-synth.test.ts +97 -0
- package/src/lint/post-synth.ts +60 -0
- package/src/lint/receipt-checks.test.ts +101 -0
- package/src/lint/receipt-checks.ts +93 -0
- package/src/lint/rules/__fixtures__/comp/comp003/pass/agent-turn.component.ts +26 -0
- package/src/lint/rules/comp/comp.test.ts +49 -1
- package/src/lint/rules/cor022-receipt-leaf.test.ts +116 -0
- package/src/lint/rules/cor022-receipt-leaf.ts +130 -0
- package/src/lint/rules/cor024-receipt-secret-pointer.test.ts +121 -0
- package/src/lint/rules/cor024-receipt-secret-pointer.ts +218 -0
- package/src/lint/rules/evl001-non-literal-expression.test.ts +35 -3
- package/src/lint/rules/evl001-non-literal-expression.ts +7 -0
- package/src/lint/rules/index.ts +7 -1
- package/src/lsp/lexicon-providers.test.ts +44 -0
- package/src/lsp/lexicon-providers.ts +11 -1
- package/src/okf-read.test.ts +149 -0
- package/src/okf-read.ts +197 -0
- package/src/op/activity-contract.test.ts +180 -0
- package/src/op/activity-contract.ts +278 -0
- package/src/op/builders-exports.test.ts +17 -1
- package/src/op/builders.ts +198 -6
- package/src/op/converge-rule.test.ts +179 -0
- package/src/op/converge-rule.ts +311 -0
- package/src/op/effect-step.test.ts +311 -0
- package/src/op/generate-pipeline.test.ts +53 -0
- package/src/op/generate-pipeline.ts +99 -0
- package/src/op/index.ts +40 -3
- package/src/op/local-executor.test.ts +92 -0
- package/src/op/local-executor.ts +212 -29
- package/src/op/op-verb-class.test.ts +126 -0
- package/src/op/op-verb-class.ts +115 -0
- package/src/op/op.test.ts +25 -2
- package/src/op/operator.test.ts +346 -0
- package/src/op/operator.ts +213 -0
- package/src/op/receipt-store.ts +211 -0
- package/src/op/step-output-ref.test.ts +334 -0
- package/src/op/step-output-ref.ts +453 -0
- package/src/op/types.ts +51 -2
- package/src/provenance.test.ts +151 -4
- package/src/provenance.ts +118 -4
- package/src/runtime-adapter.ts +31 -10
- package/src/secret-materialization.test.ts +199 -0
- package/src/secret-materialization.ts +235 -0
- package/src/secret-provenance.test.ts +388 -0
- package/src/secret-provenance.ts +475 -0
- package/src/serializer.ts +30 -0
- package/src/toml.test.ts +157 -384
- package/src/toml.ts +371 -5
- package/src/yaml.test.ts +88 -0
- package/src/yaml.ts +76 -6
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export declare const LEASE_REF_PREFIX = "refs/chant/lease/";
|
|
2
|
+
/**
|
|
3
|
+
* Side namespace `readLease` fetches remote lease state into (#1959 finding
|
|
4
|
+
* 3), rather than into `refs/chant/lease/<op>` itself. That ref is the CAS
|
|
5
|
+
* write path's alone (`acquireLease`/`releaseLease`, both via
|
|
6
|
+
* `updateRefCAS`/`deleteRefCAS`); a read path force-fetching directly into
|
|
7
|
+
* it would risk clobbering a just-acquired, not-yet-pushed local lease with
|
|
8
|
+
* the still-stale remote value — the exact race a concurrent `chant operator
|
|
9
|
+
* status` in the same clone could hit during the acquire→push window. See
|
|
10
|
+
* `readLease`'s doc for how the two are reconciled without that risk.
|
|
11
|
+
*/
|
|
12
|
+
export declare const LEASE_REMOTE_TRACKING_PREFIX = "refs/chant/lease-remote/";
|
|
13
|
+
/**
|
|
14
|
+
* Default lease TTL — long enough that a normal tick (observe, classify,
|
|
15
|
+
* a budget-bounded number of dispatches) finishes well inside it; short
|
|
16
|
+
* enough that a crashed operator's environment resumes converging soon
|
|
17
|
+
* after, without a human intervening. The operator loop renews well before
|
|
18
|
+
* this elapses (every round it still owns the lease for), so under normal
|
|
19
|
+
* operation the TTL is never actually reached.
|
|
20
|
+
*/
|
|
21
|
+
export declare const DEFAULT_LEASE_TTL_MS: number;
|
|
22
|
+
export declare function leaseRef(opName: string): string;
|
|
23
|
+
/** One lease's live state — the entire durable record; there is no history, only the current holder (see this module's doc on why no separate ledger). */
|
|
24
|
+
export interface LeaseRecord {
|
|
25
|
+
op: string;
|
|
26
|
+
/** `<hostname>:<pid>:<random>` — a diagnostic identity, not itself the fencing mechanism (`token` is). */
|
|
27
|
+
holder: string;
|
|
28
|
+
/** Fencing token — new only when the lease actually changes hands; see module doc. */
|
|
29
|
+
token: string;
|
|
30
|
+
acquiredAt: string;
|
|
31
|
+
expiresAt: string;
|
|
32
|
+
}
|
|
33
|
+
/** A stable-enough identity for "who holds this lease", for logs and `chant operator status` — hostname:pid, plus a short random suffix so two processes started in the same pid-reuse window never read as the same holder. */
|
|
34
|
+
export declare function currentHolderId(): string;
|
|
35
|
+
export interface ReadLeaseResult {
|
|
36
|
+
/** The ref's current SHA (the CAS anchor for the next write), or `null` if no lease has ever been written. */
|
|
37
|
+
sha: string | null;
|
|
38
|
+
record?: LeaseRecord;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Read the live lease for `opName`, fetching the remote ref first (best-
|
|
42
|
+
* effort) so a lease held by another machine is visible before deciding
|
|
43
|
+
* whether to acquire.
|
|
44
|
+
*
|
|
45
|
+
* The fetch lands in a side tracking ref (`refs/chant/lease-remote/<op>`),
|
|
46
|
+
* never directly into `refs/chant/lease/<op>` itself (#1959 finding 3) — the
|
|
47
|
+
* canonical local ref is written *only* by the CAS path
|
|
48
|
+
* (`acquireLease`/`releaseLease`), so a read (this function is called
|
|
49
|
+
* before every `acquireLease`, and directly by `chant operator status`) can
|
|
50
|
+
* never force it back to a stale remote value out from under a concurrent
|
|
51
|
+
* local acquirer. The returned `record` is whichever of the local/remote
|
|
52
|
+
* views is more current by `leaseFreshnessKey` (ties keep local): this
|
|
53
|
+
* still gives full cross-machine visibility — a genuinely newer remote
|
|
54
|
+
* holder wins — while a just-acquired, not-yet-pushed local lease (freshest
|
|
55
|
+
* by construction) always survives a same-clone concurrent read. `sha`
|
|
56
|
+
* — the CAS anchor a subsequent `acquireLease`/`releaseLease` writes
|
|
57
|
+
* against — is always the local ref's own actual value; only the local
|
|
58
|
+
* canonical ref is ever a valid basis for a `updateRefCAS`/`deleteRefCAS`
|
|
59
|
+
* call against it, regardless of what the comparison decided about `record`.
|
|
60
|
+
*/
|
|
61
|
+
export declare function readLease(opName: string, opts?: {
|
|
62
|
+
cwd?: string;
|
|
63
|
+
}): Promise<ReadLeaseResult>;
|
|
64
|
+
export interface AcquireLeaseResult {
|
|
65
|
+
acquired: boolean;
|
|
66
|
+
lease?: LeaseRecord;
|
|
67
|
+
/** Present when not acquired: the lease record currently held by someone else. */
|
|
68
|
+
heldBy?: LeaseRecord;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Acquire or renew the lease for `opName` as `holder`. Succeeds when the ref
|
|
72
|
+
* doesn't exist yet, is expired, or is already held by `holder` (a renewal:
|
|
73
|
+
* same token, pushed-out expiry). Fails — returns `acquired: false`, without
|
|
74
|
+
* throwing — when it's live-held by someone else, or when a concurrent CAS
|
|
75
|
+
* write is lost to a race that happened between this call's read and its
|
|
76
|
+
* write ({@link RefCASConflictError}); both read identically to a caller
|
|
77
|
+
* deciding whether to tick this round ("someone else has it right now,
|
|
78
|
+
* skip").
|
|
79
|
+
*
|
|
80
|
+
* Deliberately does NOT swallow a `StaleLockError` (./git.ts) into that same
|
|
81
|
+
* "someone else has it" outcome (#1959 finding 2): a leftover `.lock` file
|
|
82
|
+
* from a killed process is not contention, it's wreckage, and treating it as
|
|
83
|
+
* "held by someone else" would make `chant operator` back off forever
|
|
84
|
+
* against a lease nobody can ever actually acquire again without manual
|
|
85
|
+
* intervention. It propagates instead, so the caller (`../op/operator.ts`'s
|
|
86
|
+
* `runOperatorRound`) can surface it as its own distinct, diagnosable event
|
|
87
|
+
* rather than a silent, permanent skip.
|
|
88
|
+
*/
|
|
89
|
+
export declare function acquireLease(opName: string, holder: string, opts?: {
|
|
90
|
+
cwd?: string;
|
|
91
|
+
ttlMs?: number;
|
|
92
|
+
now?: () => Date;
|
|
93
|
+
}): Promise<AcquireLeaseResult>;
|
|
94
|
+
/**
|
|
95
|
+
* Release the lease, but only when `holder`/`token` still match the live
|
|
96
|
+
* value — releasing a lease this caller no longer actually holds would
|
|
97
|
+
* silently drop someone else's. Best-effort courtesy: a lease nobody
|
|
98
|
+
* releases is reclaimed anyway once its TTL passes, so a failed release
|
|
99
|
+
* (returns `false`, never throws) is not itself a correctness problem.
|
|
100
|
+
*/
|
|
101
|
+
export declare function releaseLease(opName: string, holder: string, token: string, opts?: {
|
|
102
|
+
cwd?: string;
|
|
103
|
+
}): Promise<boolean>;
|
|
104
|
+
/**
|
|
105
|
+
* Does `holder`/`token` still match the live lease? The fencing check a
|
|
106
|
+
* tick uses right before trusting its own work as authoritative (see
|
|
107
|
+
* `../op/operator.ts`). Fetches first, so a lease stolen by another machine
|
|
108
|
+
* is detected, not just a stale local read.
|
|
109
|
+
*/
|
|
110
|
+
export declare function stillHoldsLease(opName: string, holder: string, token: string, opts?: {
|
|
111
|
+
cwd?: string;
|
|
112
|
+
}): Promise<boolean>;
|
|
113
|
+
//# sourceMappingURL=lease.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lease.d.ts","sourceRoot":"","sources":["../../src/lifecycle/lease.ts"],"names":[],"mappings":"AAqCA,eAAO,MAAM,gBAAgB,sBAAsB,CAAC;AAEpD;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,6BAA6B,CAAC;AAEvE;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,QAAa,CAAC;AAE/C,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE/C;AAoBD,0JAA0J;AAC1J,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,0GAA0G;IAC1G,MAAM,EAAE,MAAM,CAAC;IACf,sFAAsF;IACtF,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,gOAAgO;AAChO,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAwBD,MAAM,WAAW,eAAe;IAC9B,8GAA8G;IAC9G,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAajG;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,kFAAkF;IAClF,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,GACxD,OAAO,CAAC,kBAAkB,CAAC,CAoC7B;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACtB,OAAO,CAAC,OAAO,CAAC,CAUlB;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACtB,OAAO,CAAC,OAAO,CAAC,CAGlB"}
|
|
@@ -91,15 +91,33 @@ export interface DeviationToAccept {
|
|
|
91
91
|
value: unknown;
|
|
92
92
|
note?: string;
|
|
93
93
|
}
|
|
94
|
+
/** Options for {@link acceptDeviations}. */
|
|
95
|
+
export interface AcceptDeviationsOptions {
|
|
96
|
+
/** ISO timestamp to stamp instead of the wall clock (tests, replays). */
|
|
97
|
+
now?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Entity names the caller recognized as effect receipts (#1833) — the
|
|
100
|
+
* marker-based read (`collectEffectReceipts`, ../effect-receipt.ts) over
|
|
101
|
+
* the build's entities, which is how a lexicon-materialized receipt row is
|
|
102
|
+
* caught even though its `entityType` is the row's own. Core-typed
|
|
103
|
+
* receipts are refused regardless, via {@link DeviationToAccept.type}.
|
|
104
|
+
*/
|
|
105
|
+
receipts?: ReadonlySet<string>;
|
|
106
|
+
}
|
|
94
107
|
/**
|
|
95
108
|
* Record deviations as accepted, returning a new baseline (the input is not
|
|
96
109
|
* mutated). An existing acceptance for the same entity+path is replaced — that
|
|
97
110
|
* is how re-accepting after a deliberate change works, and it keeps the file
|
|
98
111
|
* from growing a second entry for every value a path has ever held.
|
|
112
|
+
*
|
|
113
|
+
* REFUSES a deviation on an effect receipt (#1833, epic #1703), throwing
|
|
114
|
+
* before anything is recorded: a receipt is the declared witness that its
|
|
115
|
+
* effect ran, and the `effect()` step is its only writer — baselining a
|
|
116
|
+
* receipt's live value would accept "the effect never fired" as the new
|
|
117
|
+
* normal and silently defuse the effect. The whole acceptance aborts, not
|
|
118
|
+
* just the receipt's row, so a partial baseline never lands.
|
|
99
119
|
*/
|
|
100
|
-
export declare function acceptDeviations(baseline: ObservationBaseline, lexicon: string, deviations: readonly DeviationToAccept[], opts?:
|
|
101
|
-
now?: string;
|
|
102
|
-
}): ObservationBaseline;
|
|
120
|
+
export declare function acceptDeviations(baseline: ObservationBaseline, lexicon: string, deviations: readonly DeviationToAccept[], opts?: AcceptDeviationsOptions): ObservationBaseline;
|
|
103
121
|
/** Total accepted deviations across every lexicon — for the "N accepted" line. */
|
|
104
122
|
export declare function countAccepted(baseline: ObservationBaseline | null | undefined): number;
|
|
105
123
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observation-baseline.d.ts","sourceRoot":"","sources":["../../src/lifecycle/observation-baseline.ts"],"names":[],"mappings":"AAAA;;;;;;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,CAAC,CAErC;AAED,oFAAoF;AACpF,wBAAsB,wBAAwB,CAC5C,QAAQ,EAAE,mBAAmB,EAC7B,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACtB,OAAO,CAAC,MAAM,CAAC,CAQjB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type EffectReceiptDeclaration, type ReceiptInputResolver } from "../effect-receipt.js";
|
|
2
|
+
import type { ResourceMetadata } from "../lexicon.js";
|
|
3
|
+
import type { UnobservedReason } from "../observation.js";
|
|
4
|
+
import type { ChangeSet, ChangeSetEntry } from "./change-set.js";
|
|
5
|
+
/**
|
|
6
|
+
* The attribute a materialized receipt's live value is read from. A lexicon
|
|
7
|
+
* receipt row's observation (#1835) maps the stored value onto
|
|
8
|
+
* `attributes[RECEIPT_VALUE_ATTRIBUTE]`; `Value` is accepted as a fallback for
|
|
9
|
+
* observations that keep the provider's own casing (SSM's `Value`).
|
|
10
|
+
*/
|
|
11
|
+
export declare const RECEIPT_VALUE_ATTRIBUTE = "value";
|
|
12
|
+
/** Read a live receipt's stored value off an observation's attributes. */
|
|
13
|
+
export declare function readReceiptValue(attributes: Record<string, unknown> | undefined): unknown;
|
|
14
|
+
/**
|
|
15
|
+
* What the plan's observation pass learned about one declared receipt.
|
|
16
|
+
* Deliberately tri-state, the same shape the change set rests on (#1089):
|
|
17
|
+
* `observed: false` means "nobody looked", which is a hole — never absence.
|
|
18
|
+
* A receipt with no reading at all means no loaded lexicon even claims it.
|
|
19
|
+
*/
|
|
20
|
+
export interface ReceiptReading {
|
|
21
|
+
/** The lexicon actually looked. `false` → the receipt is a plan hole. */
|
|
22
|
+
observed: boolean;
|
|
23
|
+
/** Observed present in the live system. Meaningful only when `observed`. */
|
|
24
|
+
present: boolean;
|
|
25
|
+
/** The live receipt's stored value ({@link readReceiptValue}). */
|
|
26
|
+
value?: unknown;
|
|
27
|
+
/** Live resource type, when reported. */
|
|
28
|
+
type?: string;
|
|
29
|
+
/** Provider-assigned physical id, when reported. */
|
|
30
|
+
physicalId?: string;
|
|
31
|
+
/** The lexicon whose observation produced this reading. */
|
|
32
|
+
lexicon?: string;
|
|
33
|
+
/** Why the read did not happen, when `observed: false`. */
|
|
34
|
+
unobservedReason?: UnobservedReason;
|
|
35
|
+
unobservedDetail?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A {@link ReceiptInputResolver} over the plan's merged observed values: an
|
|
39
|
+
* attr-ref resolves to the referenced entity's observed attribute. Anything
|
|
40
|
+
* that is not among the observed values throws — which `planReceipts` renders
|
|
41
|
+
* as an effect-will-fire entry with an "unresolved input" note rather than a
|
|
42
|
+
* guessed expectation.
|
|
43
|
+
*/
|
|
44
|
+
export declare function observedValueResolver(resources: Readonly<Record<string, ResourceMetadata>>): ReceiptInputResolver;
|
|
45
|
+
/**
|
|
46
|
+
* Classify every declared receipt into its change-set entry. See the module
|
|
47
|
+
* doc for the classification; entries come back sorted by name.
|
|
48
|
+
*/
|
|
49
|
+
export declare function planReceipts(receipts: ReadonlyMap<string, EffectReceiptDeclaration>, readings: ReadonlyMap<string, ReceiptReading>, resolver: ReceiptInputResolver): ChangeSetEntry[];
|
|
50
|
+
/**
|
|
51
|
+
* Replace whatever the generic classification proposed for the receipts with
|
|
52
|
+
* the receipt entries built by {@link planReceipts}, in place.
|
|
53
|
+
*
|
|
54
|
+
* This is the plan-side write-exclusion (#1832): the generic change set,
|
|
55
|
+
* knowing nothing about receipts, classifies a declared-but-absent receipt as
|
|
56
|
+
* `create` and an undeclared-but-live one as `delete`/`adopt` — proposals the
|
|
57
|
+
* generic apply path must never act on for a receipt, and prune candidacy a
|
|
58
|
+
* receipt must never have. Every entry named like a receipt is dropped and
|
|
59
|
+
* the receipt's own entries stand in.
|
|
60
|
+
*/
|
|
61
|
+
export declare function mergeReceiptEntries(cs: ChangeSet, receipts: ReadonlyMap<string, EffectReceiptDeclaration>, receiptEntries: ChangeSetEntry[]): ChangeSet;
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AAW,CAAC,MAAM,EAAE,wBAAwB,CAAC,EACvD,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,EAC7C,QAAQ,EAAE,oBAAoB,GAC7B,cAAc,EAAE,CAoGlB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,SAAS,EACb,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,wBAAwB,CAAC,EACvD,cAAc,EAAE,cAAc,EAAE,GAC/B,SAAS,CAMX"}
|
|
@@ -74,6 +74,26 @@ export interface ReleaseRecord {
|
|
|
74
74
|
approver?: string;
|
|
75
75
|
/** Optional: the archive's own manifest digest (../components/verbs/build-archive.ts's `manifestDigest`), when the caller has it — lets a reader recover full build contents/provenance, not just the promoted image digest. */
|
|
76
76
|
manifestDigest?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Optional: set when the deploy's capability-profile assertion (chant
|
|
79
|
+
* #1244, helm lexicon) was deliberately overridden — carries the named
|
|
80
|
+
* divergences that were bypassed (declared vs live), so the ledger shows
|
|
81
|
+
* this release knowingly skewed from its declared profile. Absent for a
|
|
82
|
+
* deploy whose target matched, and for deploys with no declared profile.
|
|
83
|
+
*/
|
|
84
|
+
profileOverride?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Optional: the deploy's input-side digest, when `digest` is a
|
|
87
|
+
* rendered-content identity rather than an input identity. A pinned helm
|
|
88
|
+
* deploy (chant #1242) records the render's `contentDigest` as `digest` —
|
|
89
|
+
* what this cluster actually received — and carries the input digest
|
|
90
|
+
* (chart, chart version, resolved values, capability facts; chant #1243)
|
|
91
|
+
* here, because profiles are per cluster: two environments legitimately
|
|
92
|
+
* render to different bytes, so cross-environment "is prod running what
|
|
93
|
+
* staging tested" joins on this field while `digest` proves the exact
|
|
94
|
+
* bytes each cluster got. Absent when `digest` is already input-side.
|
|
95
|
+
*/
|
|
96
|
+
inputDigest?: string;
|
|
77
97
|
}
|
|
78
98
|
/** Thrown by `appendReleaseRecord` when the record is missing a required field — a release record can never be recorded partially, since it is never editable afterward. */
|
|
79
99
|
export declare class InvalidReleaseRecordError extends Error {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release-ledger.d.ts","sourceRoot":"","sources":["../../src/lifecycle/release-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,4FAA4F;IAC5F,OAAO,EAAE,CAAC,CAAC;IACX,6FAA6F;IAC7F,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;OAOG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,iJAAiJ;IACjJ,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gOAAgO;IAChO,cAAc,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"release-ledger.d.ts","sourceRoot":"","sources":["../../src/lifecycle/release-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,4FAA4F;IAC5F,OAAO,EAAE,CAAC,CAAC;IACX,6FAA6F;IAC7F,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;OAOG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,iJAAiJ;IACjJ,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,SAAS,EAAE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kBAAkB,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CASvF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,CAE1F"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure evaluation of a plan scenario's `expect` clause against a `ChangeSet`
|
|
3
|
+
* (#1292).
|
|
4
|
+
*
|
|
5
|
+
* `evaluateScenario` reads only what the caller hands it — a `ChangeSet` and
|
|
6
|
+
* a `ScenarioExpect` — and does no I/O. Building the change set (reading a
|
|
7
|
+
* fixture, replaying it in place of a live observation) is the CLI handler's
|
|
8
|
+
* job (../cli/handlers/scenario.ts); this module is the part that stays
|
|
9
|
+
* testable without a filesystem, a build, or a fixture.
|
|
10
|
+
*
|
|
11
|
+
* Built on the same primitives `chant lifecycle plan` already computes from:
|
|
12
|
+
* `summarize` for counts, a filter over `cs.entries` for named deletes and
|
|
13
|
+
* ownership, and `evaluateUnobservedGate` (./unobserved-gate.ts, #1568) for
|
|
14
|
+
* the unobserved clause.
|
|
15
|
+
*/
|
|
16
|
+
import { type ChangeSet } from "./change-set.js";
|
|
17
|
+
import type { ScenarioExpect } from "./scenario.js";
|
|
18
|
+
/**
|
|
19
|
+
* One clause's verdict — always present in {@link ScenarioVerdict.checks}, in
|
|
20
|
+
* declaration order, whether it passed or not. A scenario with no failing
|
|
21
|
+
* clauses is legible too: every check that ran, and that it held.
|
|
22
|
+
*/
|
|
23
|
+
export interface ScenarioCheckResult {
|
|
24
|
+
/** Which `expect` clause this is (`"noop"`, `"create"`, `"deletes"`, …). */
|
|
25
|
+
clause: string;
|
|
26
|
+
pass: boolean;
|
|
27
|
+
/** Present when `pass` is false — what was expected vs what the plan proposes, naming resources for delete/ownership failures. */
|
|
28
|
+
detail?: string;
|
|
29
|
+
}
|
|
30
|
+
/** The result of evaluating one scenario's `expect` against a change set. */
|
|
31
|
+
export interface ScenarioVerdict {
|
|
32
|
+
pass: boolean;
|
|
33
|
+
/** Every clause `expect` declared, evaluated — see {@link ScenarioCheckResult}. */
|
|
34
|
+
checks: ScenarioCheckResult[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Evaluate `expect` against `cs`. Pure: reads `cs` and `expect`, computes
|
|
38
|
+
* nothing else. Every clause present on `expect` is checked independently and
|
|
39
|
+
* every one contributes to `checks`; `pass` is true only when all of them are.
|
|
40
|
+
*/
|
|
41
|
+
export declare function evaluateScenario(cs: ChangeSet, expect: ScenarioExpect): ScenarioVerdict;
|
|
42
|
+
//# sourceMappingURL=scenario-eval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenario-eval.d.ts","sourceRoot":"","sources":["../../src/lifecycle/scenario-eval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzD,OAAO,KAAK,EAA6B,cAAc,EAA4B,MAAM,YAAY,CAAC;AAEtG;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,kIAAkI;IAClI,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,6EAA6E;AAC7E,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,mFAAmF;IACnF,MAAM,EAAE,mBAAmB,EAAE,CAAC;CAC/B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,GAAG,eAAe,CAgDvF"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan scenarios (chant #1292): a declared expectation about what a change
|
|
3
|
+
* SHOULD do, checkable offline against a fixture snapshot.
|
|
4
|
+
*
|
|
5
|
+
* Everything else chant validates is about shape — is this declaration
|
|
6
|
+
* well-formed, does this reference resolve. Nothing answers "what will this
|
|
7
|
+
* change do" as something source can assert about itself, until now. A
|
|
8
|
+
* `Scenario` pairs a `given` (a stand-in for live observation) with an
|
|
9
|
+
* `expect` (a claim about the resulting change set) — `chant scenario check`
|
|
10
|
+
* (../cli/handlers/scenario.ts) builds the project, replays `given` in place
|
|
11
|
+
* of a live read, and evaluates `expect` against the resulting `ChangeSet`
|
|
12
|
+
* (./change-set.ts) via `evaluateScenario` (./scenario-eval.ts).
|
|
13
|
+
*
|
|
14
|
+
* Modeled precisely on the other non-resource Declarables (../effect-receipt.ts,
|
|
15
|
+
* ../secret-provenance.ts): discovery collects a `Scenario` like any entity
|
|
16
|
+
* (it is a Declarable), but it carries no resource payload and no serializer
|
|
17
|
+
* ever emits it — `partitionByLexicon` (../build.ts) excludes it from every
|
|
18
|
+
* lexicon's partition, the same way it excludes a secret declaration.
|
|
19
|
+
*
|
|
20
|
+
* This module is pure and does no I/O: `snapshot()` records where the fixture
|
|
21
|
+
* comes from without reading it, and the factory validates and freezes. The
|
|
22
|
+
* CLI handler is where the fixture is actually read, replayed, and compared —
|
|
23
|
+
* the same synthesis/plan split every other lifecycle primitive here follows.
|
|
24
|
+
*/
|
|
25
|
+
import { type Declarable } from "../declarable.js";
|
|
26
|
+
import type { Ownership } from "./change-set.js";
|
|
27
|
+
/** Marker symbol identifying a scenario declaration. `Symbol.for` so it
|
|
28
|
+
* survives the entity-wire codec, the same reason ../effect-receipt.ts and
|
|
29
|
+
* ../secret-provenance.ts use `Symbol.for` for their markers. */
|
|
30
|
+
export declare const SCENARIO_MARKER: unique symbol;
|
|
31
|
+
/** The `entityType` every scenario declaration carries. */
|
|
32
|
+
export declare const SCENARIO_ENTITY_TYPE = "Chant::Scenario";
|
|
33
|
+
/**
|
|
34
|
+
* `given: snapshot("fixtures/prod-baseline.json")` — a checked-in fixture, in
|
|
35
|
+
* the same {@link LifecycleSnapshot} JSON shape `chant lifecycle snapshot`
|
|
36
|
+
* writes (a single lexicon's recorded resources). Path-relative to the
|
|
37
|
+
* project root, read at check time — never here.
|
|
38
|
+
*/
|
|
39
|
+
export interface ScenarioGivenFile {
|
|
40
|
+
readonly kind: "file";
|
|
41
|
+
/** Repo-relative path to the fixture JSON file. */
|
|
42
|
+
readonly path: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* `given: snapshot("prod")` — the last snapshot recorded for that environment
|
|
46
|
+
* on the `chant/lifecycle` orphan branch (one file per lexicon, read via
|
|
47
|
+
* `readSnapshot`/`readEnvironmentSnapshots`, ../lifecycle/git.ts), replayed
|
|
48
|
+
* exactly as `chant lifecycle plan` reads its own prior snapshot.
|
|
49
|
+
*/
|
|
50
|
+
export interface ScenarioGivenEnv {
|
|
51
|
+
readonly kind: "env";
|
|
52
|
+
/** Environment name, matching a `chant.config.ts` `environments` entry. */
|
|
53
|
+
readonly env: string;
|
|
54
|
+
}
|
|
55
|
+
/** What a scenario's `given` stands in for — a fixture file or a recorded environment. */
|
|
56
|
+
export type ScenarioGiven = ScenarioGivenFile | ScenarioGivenEnv;
|
|
57
|
+
/**
|
|
58
|
+
* Declare `given` from a single string. Pure and offline: no filesystem
|
|
59
|
+
* access, no git — the factory only classifies the string's SHAPE, never
|
|
60
|
+
* checks whether it exists. That is what keeps `Scenario` foldable under
|
|
61
|
+
* `--sandbox`, the same discipline `declareSecret`'s committed-encrypted path
|
|
62
|
+
* validation follows (../secret-provenance.ts).
|
|
63
|
+
*
|
|
64
|
+
* The classification is structural: a string containing a path separator or
|
|
65
|
+
* ending in `.json` is a fixture file; anything else (a bare token like
|
|
66
|
+
* `"prod"`) is an environment name. A `chant.config.ts` environment name that
|
|
67
|
+
* happens to contain a slash or end in `.json` is not supported by this
|
|
68
|
+
* heuristic — pass `{ kind: "env", env }` directly in that unlikely case.
|
|
69
|
+
*/
|
|
70
|
+
export declare function snapshot(source: string): ScenarioGiven;
|
|
71
|
+
/** One named delete an `expect.deletes` clause requires — the resource must
|
|
72
|
+
* be proposed for deletion, and with exactly this ownership verdict. */
|
|
73
|
+
export interface ScenarioDeleteExpectation {
|
|
74
|
+
/** The change-set entry name (ChangeSetEntry.name) expected to delete. */
|
|
75
|
+
readonly name: string;
|
|
76
|
+
/** The ownership verdict (./change-set.ts's `Ownership`) the delete must carry. */
|
|
77
|
+
readonly ownership: Ownership;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* How a scenario treats the change set's `unobserved` rows (#1089):
|
|
81
|
+
*
|
|
82
|
+
* - `"refuse"` — any unobserved entry fails the scenario. The plan admitting
|
|
83
|
+
* a hole is never a pass, the same fail-closed instinct
|
|
84
|
+
* `evaluateUnobservedGate`'s default takes (./unobserved-gate.ts).
|
|
85
|
+
* - `{ allow: [names] }` — the named entities may be unobserved without
|
|
86
|
+
* failing the scenario; any unobserved entity NOT in the list still fails
|
|
87
|
+
* it. Unlike `evaluateUnobservedGate`'s policy (which allows by *reason*),
|
|
88
|
+
* this allows by entity *name* — the natural unit for a scenario written
|
|
89
|
+
* against one fixture, where "this specific resource has no binding in the
|
|
90
|
+
* fixture" is a known, accepted gap rather than a class of reason to trust
|
|
91
|
+
* everywhere.
|
|
92
|
+
*/
|
|
93
|
+
export type ScenarioUnobservedPolicy = "refuse" | {
|
|
94
|
+
readonly allow: readonly string[];
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* The assertion vocabulary (#1292 research, settled shape). Every clause is
|
|
98
|
+
* independently optional and clauses compose within one `expect` object — a
|
|
99
|
+
* scenario can assert `noop`, exact counts, specific named deletes, and an
|
|
100
|
+
* unobserved policy together. At least one clause must be present; an empty
|
|
101
|
+
* `expect` asserts nothing and is refused as a likely mistake.
|
|
102
|
+
*/
|
|
103
|
+
export interface ScenarioExpect {
|
|
104
|
+
/** The plan proposes no create, update, or delete, and no declared effect
|
|
105
|
+
* receipt (#1832) fires — the majority-value case (refactors, upgrades,
|
|
106
|
+
* no-op deploys). Equivalent to `{ create: 0, update: 0, delete: 0 }` plus
|
|
107
|
+
* "no receipt classifies as `effect`", but reads as the specific claim it
|
|
108
|
+
* is: a pending effect fire is a real proposed action even though it never
|
|
109
|
+
* joins the create/update/delete triad. */
|
|
110
|
+
readonly noop?: true;
|
|
111
|
+
/** Exact count of `create` rows the plan must propose. Omitted = unconstrained. */
|
|
112
|
+
readonly create?: number;
|
|
113
|
+
/** Exact count of `update` rows the plan must propose. Omitted = unconstrained. */
|
|
114
|
+
readonly update?: number;
|
|
115
|
+
/** Exact count of `delete` rows the plan must propose. Omitted = unconstrained. */
|
|
116
|
+
readonly delete?: number;
|
|
117
|
+
/** Exactly these resources must delete, each with the stated ownership —
|
|
118
|
+
* and no OTHER delete may be proposed. The highest-value assertion in the
|
|
119
|
+
* vocabulary: "this plan deletes nothing foreign", made precise per-name. */
|
|
120
|
+
readonly deletes?: readonly ScenarioDeleteExpectation[];
|
|
121
|
+
/** How the scenario treats unobserved rows. Omitted = unconstrained (an
|
|
122
|
+
* unobserved entity neither passes nor fails the scenario on its own). */
|
|
123
|
+
readonly unobserved?: ScenarioUnobservedPolicy;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* A scenario declaration — a Declarable, so discovery collects it and `chant
|
|
127
|
+
* list` shows it, but it carries no resource payload: `partitionByLexicon`
|
|
128
|
+
* (../build.ts) excludes it from every serializer partition, so no lexicon
|
|
129
|
+
* ever emits it and no apply-bound document ever contains one.
|
|
130
|
+
*/
|
|
131
|
+
export interface ScenarioDeclaration extends Declarable {
|
|
132
|
+
readonly [SCENARIO_MARKER]: true;
|
|
133
|
+
readonly lexicon: "chant";
|
|
134
|
+
readonly entityType: typeof SCENARIO_ENTITY_TYPE;
|
|
135
|
+
/** The scenario's own name — what `chant scenario check` reports pass/fail against. */
|
|
136
|
+
readonly name: string;
|
|
137
|
+
readonly given: ScenarioGiven;
|
|
138
|
+
readonly expect: ScenarioExpect;
|
|
139
|
+
}
|
|
140
|
+
/** Factory options for {@link Scenario}. */
|
|
141
|
+
export interface ScenarioOptions {
|
|
142
|
+
/** What stands in for live observation — a fixture file or a recorded environment. */
|
|
143
|
+
readonly given: ScenarioGiven;
|
|
144
|
+
/** The claim about the resulting change set. At least one clause required. */
|
|
145
|
+
readonly expect: ScenarioExpect;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Declare a plan scenario. The returned object is a locked Declarable:
|
|
149
|
+
* declared fields are immutable and nested structures are frozen, the same
|
|
150
|
+
* shape ../effect-receipt.ts and ../secret-provenance.ts lock down; the
|
|
151
|
+
* top-level object stays extensible so discovery can still stamp its own
|
|
152
|
+
* symbol-keyed metadata.
|
|
153
|
+
*/
|
|
154
|
+
export declare function Scenario(name: string, options: ScenarioOptions): ScenarioDeclaration;
|
|
155
|
+
/** Type guard for a scenario declaration. */
|
|
156
|
+
export declare function isScenario(value: unknown): value is ScenarioDeclaration;
|
|
157
|
+
/**
|
|
158
|
+
* Extract the scenario declarations from a discovered entity map — the read
|
|
159
|
+
* surface `chant scenario check` (../cli/handlers/scenario.ts) uses. Keyed by
|
|
160
|
+
* entity name (export name), the same key `DiscoveryResult.entities` uses.
|
|
161
|
+
*/
|
|
162
|
+
export declare function collectScenarios(entities: ReadonlyMap<string, Declarable>): Map<string, ScenarioDeclaration>;
|
|
163
|
+
//# sourceMappingURL=scenario.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenario.d.ts","sourceRoot":"","sources":["../../src/lifecycle/scenario.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;iEAEiE;AACjE,eAAO,MAAM,eAAe,eAA+B,CAAC;AAE5D,2DAA2D;AAC3D,eAAO,MAAM,oBAAo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CAChD;AAQD;;;;;GAKG;AACH,MAAM,WAAW,mBAAoB,SAAQ,UAAU;IACrD,QAAQ,CAAC,CAAC,eAAe,CAAC,EAAE,IAAI,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,OAAO,oBAAoB,CAAC;IACjD,uFAAuF;IACvF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;CACjC;AAED,4CAA4C;AAC5C,MAAM,WAAW,eAAe;IAC9B,sFAAsF;IACtF,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;CACjC;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,mBAAmB,CAoBpF;AAuGD,6CAA6C;AAC7C,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAOvE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAM5G"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Symptom derivation (#1484, epic #1487 feature 5) — one typed record joining
|
|
3
|
+
* the status join (./status.ts), change-set summaries (./change-set.ts), and
|
|
4
|
+
* unobserved evidence (../observation.ts) into the shape `ConvergeOp`'s rule
|
|
5
|
+
* table evaluates against.
|
|
6
|
+
*
|
|
7
|
+
* Derive-only, per the issue's leaning on its own open question 4: no new
|
|
8
|
+
* `LexiconPlugin.symptoms?()` interface in v1 — everything here is a pure
|
|
9
|
+
* projection of structures chant already computes (`ChangeSet`,
|
|
10
|
+
* `ComponentStatusRow[]`). No I/O in this module; a caller (the `convergeTick`
|
|
11
|
+
* activity, lexicons/temporal/src/op/activities/converge.ts) gathers those
|
|
12
|
+
* inputs and hands them here.
|
|
13
|
+
*
|
|
14
|
+
* One record per tick, not per component: the issue's own rule sketch reads
|
|
15
|
+
* `s.status`/`s.backupVerifiedAge` as a single symptom `s` a rule closes
|
|
16
|
+
* over, and epic feature 5 calls it "one typed record" (singular). A
|
|
17
|
+
* multi-component environment still resolves to one record per tick —
|
|
18
|
+
* `components` carries the per-component detail behind the aggregate for
|
|
19
|
+
* reporting, and `status` is the worst verdict across all of them (see
|
|
20
|
+
* {@link worstStatus}), so "any component is unknown" is enough to trip
|
|
21
|
+
* `unknown never remediates` for the whole tick.
|
|
22
|
+
*/
|
|
23
|
+
import type { ChangeSet } from "./change-set.js";
|
|
24
|
+
import type { ComponentStatusRow } from "./status.js";
|
|
25
|
+
import { type UnobservedReason } from "../observation.js";
|
|
26
|
+
/** The worst (most-cautious) reconciliation verdict across a set of component rows. `"reconciled"` for an empty set — nothing to converge is a quiet environment. */
|
|
27
|
+
export declare function worstStatus(rows: ComponentStatusRow[]): ComponentStatusRow["reconciliation"];
|
|
28
|
+
/**
|
|
29
|
+
* One tick's typed symptom record. Every field a `ConvergeOp` rule may
|
|
30
|
+
* reference — see `../op/converge-rule.ts`'s `SymptomPredicate<S>`, where
|
|
31
|
+
* `S` is this interface, so a rule whose predicate names a field outside
|
|
32
|
+
* this shape fails TypeScript at the author's call site (the "symptom field
|
|
33
|
+
* nothing produces" build-time refusal).
|
|
34
|
+
*/
|
|
35
|
+
export interface ConvergeSymptom {
|
|
36
|
+
env: string;
|
|
37
|
+
/** The worst reconciliation verdict across every component row this tick observed (see {@link worstStatus}). */
|
|
38
|
+
status: ComponentStatusRow["reconciliation"];
|
|
39
|
+
/** Per-component detail behind `status`, for reporting — never read by a rule predicate directly (rules read the flat counts below). */
|
|
40
|
+
components: ComponentStatusRow[];
|
|
41
|
+
/** Change-set action counts for the tick (./change-set.ts's `summarize`). */
|
|
42
|
+
createCount: number;
|
|
43
|
+
updateCount: number;
|
|
44
|
+
deleteCount: number;
|
|
45
|
+
/** Live but undeclared, ownership unestablished — a candidate to adopt into source. Never auto-claimed; see the issue's "adopt is reported, never auto-claimed" honesty requirement. */
|
|
46
|
+
adoptCount: number;
|
|
47
|
+
runtimeCount: number;
|
|
48
|
+
effectCount: number;
|
|
49
|
+
/** Declared, but the lexicon could not observe it (#1089) — the count backing `status: "unknown"`. */
|
|
50
|
+
unobservedCount: number;
|
|
51
|
+
/** Every distinct reason behind `unobservedCount`, for a report action's detail. */
|
|
52
|
+
unobservedReasons: UnobservedReason[];
|
|
53
|
+
/** Total resource count under change-set evidence for this tick (sum of the six counts above). */
|
|
54
|
+
totalCount: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Join a `ChangeSet` and `ComponentStatusRow[]` for one tick into a
|
|
58
|
+
* `ConvergeSymptom`. Pure — no I/O.
|
|
59
|
+
*/
|
|
60
|
+
export declare function deriveSymptoms(env: string, cs: ChangeSet, statusRows: ComponentStatusRow[]): ConvergeSymptom;
|
|
61
|
+
/** Every field name a `ConvergeSymptom` produces — the runtime whitelist `TMP014` (lexicons/temporal) re-validates a serialized rule table's predicates against. Kept in sync with {@link ConvergeSymptom} by hand (deliberately small, changes rarely). */
|
|
62
|
+
export declare const CONVERGE_SYMPTOM_FIELDS: ReadonlySet<string>;
|
|
63
|
+
//# sourceMappingURL=symptoms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symptoms.d.ts","sourceRoot":"","sources":["../../src/lifecycle/symptoms.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAwB,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAkB7E,qKAAqK;AACrK,wBAAgB,WAAW,CAAC,IAAI,EAAE,kBAAkB,EAAE,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,CAM5F;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,gHAAgH;IAChH,MAAM,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;IAC7C,wIAAwI;IACxI,UAAU,EAAE,kBAAkB,EAAE,CAAC;IACjC,6EAA6E;IAC7E,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,wLAAwL;IACxL,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,sGAAsG;IACtG,eAAe,EAAE,MAAM,CAAC;IACxB,oFAAoF;IACpF,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,kGAAkG;IAClG,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,EAAE,GAAG,eAAe,CAwB5G;AAED,4PAA4P;AAC5P,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAatD,CAAC"}
|
|
@@ -86,11 +86,13 @@ export declare function planTeardown(opts: PlanTeardownOptions): Promise<Teardow
|
|
|
86
86
|
export interface TeardownOutcomeEntry extends TeardownPlanEntry {
|
|
87
87
|
/**
|
|
88
88
|
* `skipped` is core's verdict for a candidate whose lexicon implements no
|
|
89
|
-
* `executeTeardown` yet; the
|
|
90
|
-
* {@link TeardownOutcome}).
|
|
89
|
+
* `executeTeardown` yet; the others come from the lexicon (see
|
|
90
|
+
* {@link TeardownOutcome}). `retained` is the loud keep (#1365 decision 5):
|
|
91
|
+
* owned, no longer declared, deliberately not deleted — a `generated-once`
|
|
92
|
+
* secret survives every sweep and says so with a row.
|
|
91
93
|
*/
|
|
92
|
-
outcome: "deleted" | "failed" | "not-prunable" | "skipped";
|
|
93
|
-
/** The error for `failed`, the reason for `not-prunable`/`skipped`. */
|
|
94
|
+
outcome: "deleted" | "failed" | "not-prunable" | "retained" | "skipped";
|
|
95
|
+
/** The error for `failed`, the reason for `not-prunable`/`retained`/`skipped`. */
|
|
94
96
|
detail?: string;
|
|
95
97
|
/** True when this final outcome came from the bounded retry pass. */
|
|
96
98
|
retried?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teardown.d.ts","sourceRoot":"","sources":["../../src/lifecycle/teardown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,YAAY,EAAmB,MAAM,YAAY,CAAC;AAGvG,0EAA0E;AAC1E,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,sEAAsE;AACtE,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,2EAA2E;AAC3E,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,+EAA+E;IAC/E,KAAK,EAAE,MAAM,CAAC;IACd,uFAAuF;IACvF,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,kFAAkF;IAClF,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B;;;;OAIG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,qEAAqE;IACrE,WAAW,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,kBAA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