@intentius/chant 0.49.0 → 0.51.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 +9 -0
- package/dist/audit/core.d.ts.map +1 -1
- package/dist/audit/discover.d.ts +6 -0
- 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.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/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 +11 -0
- package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
- package/dist/cli/handlers/op-progress.d.ts +57 -0
- package/dist/cli/handlers/op-progress.d.ts.map +1 -0
- package/dist/cli/handlers/operator.d.ts +32 -0
- package/dist/cli/handlers/operator.d.ts.map +1 -0
- package/dist/cli/handlers/run-client.d.ts +21 -1
- package/dist/cli/handlers/run-client.d.ts.map +1 -1
- package/dist/cli/handlers/run-report.d.ts.map +1 -1
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/scenario.d.ts +39 -0
- package/dist/cli/handlers/scenario.d.ts.map +1 -0
- package/dist/cli/handlers/search.d.ts +22 -0
- package/dist/cli/handlers/search.d.ts.map +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/mcp/op-tools.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/types.d.ts +29 -1
- package/dist/cli/mcp/types.d.ts.map +1 -1
- package/dist/cli/registry.d.ts +47 -3
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/codegen/docs-rule-scanning.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/run-progress.d.ts +7 -5
- package/dist/components/run-progress.d.ts.map +1 -1
- package/dist/components/verbs/index.d.ts +6 -1
- package/dist/components/verbs/index.d.ts.map +1 -1
- 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/composite.d.ts +6 -1
- package/dist/composite.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/fold/fold.d.ts +55 -2
- package/dist/fold/fold.d.ts.map +1 -1
- package/dist/fold/subset.d.ts +21 -14
- package/dist/fold/subset.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 +134 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/assert-live.d.ts +77 -0
- package/dist/lifecycle/assert-live.d.ts.map +1 -0
- package/dist/lifecycle/change-set.d.ts +17 -0
- 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/disruption.d.ts +96 -0
- package/dist/lifecycle/disruption.d.ts.map +1 -0
- 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/replay.d.ts +2 -0
- package/dist/lifecycle/replay.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/lint/output-docs.d.ts +94 -0
- package/dist/lint/output-docs.d.ts.map +1 -0
- package/dist/lint/post-synth.d.ts +29 -0
- package/dist/lint/post-synth.d.ts.map +1 -1
- 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/lsp/lexicon-providers.d.ts +7 -0
- package/dist/lsp/lexicon-providers.d.ts.map +1 -1
- 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 +42 -2
- 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 +14 -0
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/local-executor.d.ts +7 -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/step-output-ref.d.ts +187 -0
- package/dist/op/step-output-ref.d.ts.map +1 -0
- package/dist/op/types.d.ts +18 -1
- 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/serializer.d.ts +18 -0
- package/dist/serializer.d.ts.map +1 -1
- package/dist/testing.d.ts +23 -2
- package/dist/testing.d.ts.map +1 -1
- package/dist/toml.d.ts +40 -5
- package/dist/toml.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/audit/catalog.test.ts +1 -1
- package/src/audit/catalog.ts +75 -3
- package/src/audit/core.ts +9 -0
- package/src/audit/discover.ts +29 -2
- 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 +2 -0
- 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.ts +8 -3
- package/src/cli/command-group.ts +1 -1
- package/src/cli/commands/__fixtures__/schemas/sarif-2.1.0.schema.json +2882 -0
- package/src/cli/commands/audit.test.ts +215 -1
- package/src/cli/commands/audit.ts +86 -17
- package/src/cli/commands/build.test.ts +167 -2
- package/src/cli/commands/build.ts +114 -23
- 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/graph.test.ts +20 -0
- package/src/cli/handlers/graph.ts +10 -1
- package/src/cli/handlers/lifecycle.test.ts +90 -0
- package/src/cli/handlers/lifecycle.ts +30 -5
- package/src/cli/handlers/op-progress.test.ts +202 -0
- package/src/cli/handlers/op-progress.ts +192 -0
- package/src/cli/handlers/operator.test.ts +255 -0
- package/src/cli/handlers/operator.ts +240 -0
- package/src/cli/handlers/run-client.test.ts +82 -0
- package/src/cli/handlers/run-client.ts +85 -2
- package/src/cli/handlers/run-report.test.ts +62 -0
- package/src/cli/handlers/run-report.ts +20 -58
- package/src/cli/handlers/run.test.ts +144 -0
- package/src/cli/handlers/run.ts +40 -18
- package/src/cli/handlers/scenario.test.ts +456 -0
- package/src/cli/handlers/scenario.ts +330 -0
- package/src/cli/handlers/search-drift.test.ts +263 -0
- package/src/cli/handlers/search.ts +150 -1
- package/src/cli/main.test.ts +23 -0
- package/src/cli/main.ts +81 -1
- package/src/cli/mcp/op-tools.ts +17 -6
- package/src/cli/mcp/resource-handlers.ts +13 -5
- package/src/cli/mcp/server.test.ts +265 -2
- package/src/cli/mcp/server.ts +84 -7
- package/src/cli/mcp/types.ts +27 -1
- package/src/cli/registry.ts +47 -3
- 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/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/run-progress.ts +9 -5
- package/src/components/verbs/index.ts +6 -1
- 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/composite.ts +31 -2
- 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/fold/fold.test.ts +6 -2
- package/src/fold/fold.ts +184 -3
- package/src/fold/subset.test.ts +82 -19
- package/src/fold/subset.ts +79 -41
- package/src/lexicon-schema.ts +3 -0
- package/src/lexicon.ts +154 -2
- package/src/lifecycle/assert-live.test.ts +125 -0
- package/src/lifecycle/assert-live.ts +154 -0
- package/src/lifecycle/change-set.ts +35 -3
- 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/disruption.test.ts +186 -0
- package/src/lifecycle/disruption.ts +224 -0
- 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/replay.test.ts +25 -0
- package/src/lifecycle/replay.ts +11 -3
- 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/lint/output-docs.test.ts +220 -0
- package/src/lint/output-docs.ts +204 -0
- package/src/lint/post-synth.test.ts +97 -0
- package/src/lint/post-synth.ts +45 -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/evl001-non-literal-expression.test.ts +8 -3
- package/src/lint/rules/evl001-non-literal-expression.ts +6 -6
- package/src/lsp/lexicon-providers.test.ts +44 -0
- package/src/lsp/lexicon-providers.ts +11 -1
- 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 +59 -5
- package/src/op/converge-rule.test.ts +179 -0
- package/src/op/converge-rule.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 +30 -0
- package/src/op/local-executor.test.ts +92 -0
- package/src/op/local-executor.ts +52 -10
- package/src/op/local-output.ts +1 -1
- package/src/op/op-verb-class.test.ts +126 -0
- package/src/op/op-verb-class.ts +115 -0
- package/src/op/operator.test.ts +346 -0
- package/src/op/operator.ts +213 -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 +18 -1
- package/src/provenance.test.ts +151 -4
- package/src/provenance.ts +118 -4
- package/src/runtime-adapter.ts +31 -10
- package/src/serializer.ts +18 -0
- package/src/testing.test.ts +89 -2
- package/src/testing.ts +63 -3
- package/src/toml.test.ts +157 -384
- package/src/toml.ts +371 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/lifecycle/git.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/lifecycle/git.ts"],"names":[],"mappings":"AAyCA,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAC1D,OAAO,CAAC,MAAM,CAAC,CA0IjB;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACtB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQxB;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACtB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAE1E;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACtB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,WAAW,EAAE,MAA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H,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACtB,OAAO,CAAC,OAAO,CAAC,CAOlB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAErF;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAO5E"}
|
|
@@ -7,6 +7,7 @@ export * from "./deep-diff.js";
|
|
|
7
7
|
export * from "./deep-observe.js";
|
|
8
8
|
export * from "./observation-baseline.js";
|
|
9
9
|
export * from "./change-set.js";
|
|
10
|
+
export * from "./disruption.js";
|
|
10
11
|
export * from "./unobserved-gate.js";
|
|
11
12
|
export * from "./receipt-plan.js";
|
|
12
13
|
export * from "./affected.js";
|
|
@@ -16,4 +17,9 @@ export * from "./build-ledger-store.js";
|
|
|
16
17
|
export * from "./oras-referrer-lookup.js";
|
|
17
18
|
export * from "./status.js";
|
|
18
19
|
export * from "./teardown.js";
|
|
20
|
+
export * from "./assert-live.js";
|
|
21
|
+
export * from "./symptoms.js";
|
|
22
|
+
export * from "./converge-ledger.js";
|
|
23
|
+
export * from "./scenario.js";
|
|
24
|
+
export * from "./scenario-eval.js";
|
|
19
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lifecycle/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lifecycle/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC"}
|
|
@@ -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"}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* answer most questions but never all of them.
|
|
15
15
|
*/
|
|
16
16
|
import type { LiveObservation } from "../graph-ir.js";
|
|
17
|
+
import type { ObservationDepth } from "./types.js";
|
|
17
18
|
/**
|
|
18
19
|
* Rebuild observations from a recorded snapshot (#1266).
|
|
19
20
|
*
|
|
@@ -40,6 +41,7 @@ export declare function replaySnapshots(environment: string, ref: string, scoped
|
|
|
40
41
|
observations: LiveObservation[];
|
|
41
42
|
commit: string;
|
|
42
43
|
timestamp: string;
|
|
44
|
+
depth: ObservationDepth;
|
|
43
45
|
} | {
|
|
44
46
|
error: string;
|
|
45
47
|
hint?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../src/lifecycle/replay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../src/lifecycle/replay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAqB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEnE;;;;;;;;;;;;GAYG;AACH;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAMvE;AAED,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,GACxB,OAAO,CACN;IAAE,YAAY,EAAE,eAAe,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,gBAAgB,CAAA;CAAE,GAC/F;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CACnC,CA8IA"}
|
|
@@ -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,oBAAoB,oBAAoB,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,2EAA2E;IAC3E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,0FAA0F;AAC1F,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AAEjE;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAMtD;AAED;wEACwE;AACxE,MAAM,WAAW,yBAAyB;IACxC,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mFAAmF;IACnF,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC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;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"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parsed-output view for post-synth checks (chant #975).
|
|
3
|
+
*
|
|
4
|
+
* `PostSynthContext.outputs` carries raw serialized strings — a `chant build`
|
|
5
|
+
* consumer has to parse YAML/JSON itself before it can reason about
|
|
6
|
+
* structure. Every lexicon that needs this today rolls its own splitter
|
|
7
|
+
* (`parseK8sManifests` in k8s, hand-rolled `JSON.parse` in aws's
|
|
8
|
+
* `cf-refs.ts`), and each of the ~30 k8s post-synth checks reparses the same
|
|
9
|
+
* output independently. This module is the shared, parse-once primitive:
|
|
10
|
+
* `parseOutputDocs` turns `ctx.outputs` into a flat list of `OutputDoc`s,
|
|
11
|
+
* and `PostSynthContext.docs` (see `./post-synth.ts`) memoizes one call to it
|
|
12
|
+
* per build so every check — lexicon-shipped or project-authored policy —
|
|
13
|
+
* shares the same parse.
|
|
14
|
+
*
|
|
15
|
+
* `pick`/`get` are the "look at only the fields you care about" ergonomic
|
|
16
|
+
* from the issue's `,remain`-style framing — a partial, unvalidated view of
|
|
17
|
+
* an already-parsed tree, not a query DSL. Selector languages over the
|
|
18
|
+
* *source* AST stay in `./declarative.ts`; this module is output-side only.
|
|
19
|
+
*/
|
|
20
|
+
import type { SerializerResult } from "../serializer.js";
|
|
21
|
+
/**
|
|
22
|
+
* One parsed document from a build's serialized output.
|
|
23
|
+
*
|
|
24
|
+
* A single `ctx.outputs` entry can yield more than one `OutputDoc`: a
|
|
25
|
+
* multi-document YAML stream (`---`-separated) yields one per document, and
|
|
26
|
+
* a `SerializerResult` with `files` yields further docs for each nested
|
|
27
|
+
* file (a CloudFormation nested stack template, a sidecar manifest).
|
|
28
|
+
*/
|
|
29
|
+
export interface OutputDoc {
|
|
30
|
+
/** The `ctx.outputs` map key this document came from. */
|
|
31
|
+
lexicon: string;
|
|
32
|
+
/** Position of this document within its source (primary output or one
|
|
33
|
+
* `files` entry) — 0 for a single-document source, 0..n-1 for a
|
|
34
|
+
* multi-document YAML stream. */
|
|
35
|
+
index: number;
|
|
36
|
+
/** Whether this document was decoded as YAML or as whole-content JSON. */
|
|
37
|
+
format: "yaml" | "json";
|
|
38
|
+
/** The parsed tree. `undefined` when parsing failed — see `error`. */
|
|
39
|
+
value: unknown;
|
|
40
|
+
/**
|
|
41
|
+
* Set when this document came from a `SerializerResult.files` entry rather
|
|
42
|
+
* than the primary output — the file's key in that map (e.g. a nested
|
|
43
|
+
* stack template's filename).
|
|
44
|
+
*/
|
|
45
|
+
file?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Set when this document could not be parsed into a usable tree. The
|
|
48
|
+
* document is still returned (a marker, not a throw) so a caller can see
|
|
49
|
+
* that something in the build output failed to parse, rather than the
|
|
50
|
+
* failure disappearing silently the way `parseK8sManifests` has always
|
|
51
|
+
* swallowed it. `value` is `undefined` on an errored document. Filter with
|
|
52
|
+
* `ctx.docs.filter((d) => !d.error)` to get only usable documents.
|
|
53
|
+
*/
|
|
54
|
+
error?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Parse every output in `outputs` into a flat list of `OutputDoc`s: one call,
|
|
58
|
+
* shared by every post-synth check via `PostSynthContext.docs`.
|
|
59
|
+
*
|
|
60
|
+
* Format detection is whole-source, not per-document: if the entire source
|
|
61
|
+
* parses as JSON, it is one `"json"` document (CloudFormation, most non-k8s
|
|
62
|
+
* serializers). Otherwise the source is treated as a YAML stream — split on
|
|
63
|
+
* `---` document separators — and each resulting document is parsed as YAML
|
|
64
|
+
* (`format: "yaml"`), even one that happens to also be valid JSON, since
|
|
65
|
+
* JSON is a YAML subset. `SerializerResult.files` entries (nested templates,
|
|
66
|
+
* sidecar manifests) are parsed the same way, tagged with `file`.
|
|
67
|
+
*
|
|
68
|
+
* A document that fails to parse into a non-null object/array — malformed
|
|
69
|
+
* input, or a bare scalar where a manifest was expected — is not thrown:
|
|
70
|
+
* it is included with `error` set and `value: undefined`. See `OutputDoc`.
|
|
71
|
+
*/
|
|
72
|
+
export declare function parseOutputDocs(outputs: Map<string, string | SerializerResult>): OutputDoc[];
|
|
73
|
+
/**
|
|
74
|
+
* Partial typed decode — the `,remain`-style ergonomic from `ma91n/tfpolicy`:
|
|
75
|
+
* decode the fields you care about, leave everything else in place,
|
|
76
|
+
* unvalidated. Returns a shallow, top-level view of `value` narrowed to the
|
|
77
|
+
* keys named in `shape`. A key absent from `value` (or `value` not being a
|
|
78
|
+
* plain object) is simply absent from the result — no default is invented.
|
|
79
|
+
*
|
|
80
|
+
* This is NOT runtime validation: a key that IS present is copied as-is,
|
|
81
|
+
* whatever its actual shape, and cast to `T`'s declared type for that key.
|
|
82
|
+
* Use `get` for a deeper walk into one of the picked values.
|
|
83
|
+
*/
|
|
84
|
+
export declare function pick<T extends object>(value: unknown, shape: (keyof T)[]): Partial<T>;
|
|
85
|
+
/**
|
|
86
|
+
* Dotted-path getter for the common walk over a parsed doc, e.g.
|
|
87
|
+
* `get(doc.value, "spec.template.spec")`. Not a query DSL — no wildcards,
|
|
88
|
+
* no predicates, no array-flattening. An array index is just a numeric path
|
|
89
|
+
* segment (`get(value, "items.0.name")`), since JS indexes arrays by string
|
|
90
|
+
* key underneath. Returns `undefined` as soon as any segment is missing or
|
|
91
|
+
* the value at that point isn't indexable — it never throws on a bad path.
|
|
92
|
+
*/
|
|
93
|
+
export declare function get(value: unknown, path: string): unknown;
|
|
94
|
+
//# sourceMappingURL=output-docs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-docs.d.ts","sourceRoot":"","sources":["../../src/lint/output-docs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtD;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB;;sCAEkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,sEAAsE;IACtE,KAAK,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAAC,GAAG,SAAS,EAAE,CAY5F;AA4ED;;;;;;;;;;GAUG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAWrF;AAED;;;;;;;GAOG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAQzD"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Declarable } from "../declarable.js";
|
|
2
2
|
import type { SerializerResult } from "../serializer.js";
|
|
3
3
|
import type { Severity } from "./rule.js";
|
|
4
|
+
import { type OutputDoc } from "./output-docs.js";
|
|
5
|
+
export { parseOutputDocs, pick, get, type OutputDoc } from "./output-docs.js";
|
|
4
6
|
/**
|
|
5
7
|
* Context provided to post-synthesis checks.
|
|
6
8
|
*/
|
|
@@ -15,6 +17,25 @@ export interface PostSynthContext {
|
|
|
15
17
|
* e.g. "no public buckets in prod". Undefined when no environment is set.
|
|
16
18
|
*/
|
|
17
19
|
env?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Parsed output documents (chant #975) — `ctx.outputs` run through
|
|
22
|
+
* `parseOutputDocs` once and cached. A lazy `readonly` getter, not a plain
|
|
23
|
+
* field: computed on first access and shared across every check in the
|
|
24
|
+
* run, so a check that only reads `entities` pays nothing, and no two
|
|
25
|
+
* checks re-parse the same YAML/JSON. See `./output-docs.ts`.
|
|
26
|
+
*
|
|
27
|
+
* Optional at the type level — NOT because it can be absent from a real
|
|
28
|
+
* build. Every context chant itself constructs (`runPostSynthChecks`
|
|
29
|
+
* below, `@intentius/chant-test-utils`'s `createPostSynthContext` and
|
|
30
|
+
* `makePostSynthCtx*`) wires it up via `createDocsAccessor` and it is
|
|
31
|
+
* always present there. It is typed optional only so the many lexicon
|
|
32
|
+
* tests that build a `PostSynthContext` object literal by hand (predating
|
|
33
|
+
* this field) keep compiling unchanged, per this issue's own "existing
|
|
34
|
+
* checks compile unchanged" constraint — a new check that wants `ctx.docs`
|
|
35
|
+
* should still get a real array from every context chant builds; guard
|
|
36
|
+
* with `ctx.docs ?? []` only when a context's provenance is unknown.
|
|
37
|
+
*/
|
|
38
|
+
readonly docs?: OutputDoc[];
|
|
18
39
|
/** Raw build result object */
|
|
19
40
|
buildResult: {
|
|
20
41
|
outputs: Map<string, string | SerializerResult>;
|
|
@@ -27,6 +48,14 @@ export interface PostSynthContext {
|
|
|
27
48
|
sourceFileCount: number;
|
|
28
49
|
};
|
|
29
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Build the lazy, memoized `docs` accessor shared by `runPostSynthChecks`
|
|
53
|
+
* (below) and `@intentius/chant-test-utils`'s `createPostSynthContext` — the
|
|
54
|
+
* two places a `PostSynthContext` gets constructed. Returns a zero-arg
|
|
55
|
+
* function suitable for a `get docs()` object-literal accessor; the first
|
|
56
|
+
* call parses, every later call returns the same cached array.
|
|
57
|
+
*/
|
|
58
|
+
export declare function createDocsAccessor(outputs: Map<string, string | SerializerResult>): () => OutputDoc[];
|
|
30
59
|
/**
|
|
31
60
|
* Extract the primary content string from a serializer output.
|
|
32
61
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post-synth.d.ts","sourceRoot":"","sources":["../../src/lint/post-synth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"post-synth.d.ts","sourceRoot":"","sources":["../../src/lint/post-synth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,kEAAkE;IAClE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAAC,CAAC;IAChD,8CAA8C;IAC9C,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAClC;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;IAC5B,8BAA8B;IAC9B,WAAW,EAAE;QACX,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,C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