@endora-commerce/cli 0.100.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/LICENSE +21 -0
- package/README.md +37 -0
- package/dist/bin/endora.d.ts +28 -0
- package/dist/bin/endora.d.ts.map +1 -0
- package/dist/bin/endora.js +926 -0
- package/dist/bin/endora.js.map +1 -0
- package/dist/check/estate.d.ts +189 -0
- package/dist/check/estate.d.ts.map +1 -0
- package/dist/check/estate.js +1037 -0
- package/dist/check/estate.js.map +1 -0
- package/dist/check/hosts.d.ts +25 -0
- package/dist/check/hosts.d.ts.map +1 -0
- package/dist/check/hosts.js +1347 -0
- package/dist/check/hosts.js.map +1 -0
- package/dist/check/index.d.ts +60 -0
- package/dist/check/index.d.ts.map +1 -0
- package/dist/check/index.js +111 -0
- package/dist/check/index.js.map +1 -0
- package/dist/check/layout.d.ts +136 -0
- package/dist/check/layout.d.ts.map +1 -0
- package/dist/check/layout.js +262 -0
- package/dist/check/layout.js.map +1 -0
- package/dist/check/ledger.d.ts +98 -0
- package/dist/check/ledger.d.ts.map +1 -0
- package/dist/check/ledger.js +173 -0
- package/dist/check/ledger.js.map +1 -0
- package/dist/check/peer-owners.d.ts +116 -0
- package/dist/check/peer-owners.d.ts.map +1 -0
- package/dist/check/peer-owners.js +225 -0
- package/dist/check/peer-owners.js.map +1 -0
- package/dist/check/report.d.ts +33 -0
- package/dist/check/report.d.ts.map +1 -0
- package/dist/check/report.js +107 -0
- package/dist/check/report.js.map +1 -0
- package/dist/check/run.d.ts +147 -0
- package/dist/check/run.d.ts.map +1 -0
- package/dist/check/run.js +111 -0
- package/dist/check/run.js.map +1 -0
- package/dist/checks.d.ts +17 -0
- package/dist/checks.d.ts.map +1 -0
- package/dist/checks.js +17 -0
- package/dist/checks.js.map +1 -0
- package/dist/dev/index.d.ts +83 -0
- package/dist/dev/index.d.ts.map +1 -0
- package/dist/dev/index.js +298 -0
- package/dist/dev/index.js.map +1 -0
- package/dist/generate/divergence.d.ts +38 -0
- package/dist/generate/divergence.d.ts.map +1 -0
- package/dist/generate/divergence.js +237 -0
- package/dist/generate/divergence.js.map +1 -0
- package/dist/generate/index.d.ts +90 -0
- package/dist/generate/index.d.ts.map +1 -0
- package/dist/generate/index.js +369 -0
- package/dist/generate/index.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/inputs/declaration.d.ts +18 -0
- package/dist/inputs/declaration.d.ts.map +1 -0
- package/dist/inputs/declaration.js +64 -0
- package/dist/inputs/declaration.js.map +1 -0
- package/dist/inputs/env-file.d.ts +73 -0
- package/dist/inputs/env-file.d.ts.map +1 -0
- package/dist/inputs/env-file.js +134 -0
- package/dist/inputs/env-file.js.map +1 -0
- package/dist/inputs/prompt.d.ts +21 -0
- package/dist/inputs/prompt.d.ts.map +1 -0
- package/dist/inputs/prompt.js +59 -0
- package/dist/inputs/prompt.js.map +1 -0
- package/dist/inputs/resolve.d.ts +163 -0
- package/dist/inputs/resolve.d.ts.map +1 -0
- package/dist/inputs/resolve.js +290 -0
- package/dist/inputs/resolve.js.map +1 -0
- package/dist/install/host.d.ts +27 -0
- package/dist/install/host.d.ts.map +1 -0
- package/dist/install/host.js +90 -0
- package/dist/install/host.js.map +1 -0
- package/dist/install/index.d.ts +173 -0
- package/dist/install/index.d.ts.map +1 -0
- package/dist/install/index.js +793 -0
- package/dist/install/index.js.map +1 -0
- package/dist/install/wizard.d.ts +144 -0
- package/dist/install/wizard.d.ts.map +1 -0
- package/dist/install/wizard.js +362 -0
- package/dist/install/wizard.js.map +1 -0
- package/dist/lib/admin-artefacts.d.ts +70 -0
- package/dist/lib/admin-artefacts.d.ts.map +1 -0
- package/dist/lib/admin-artefacts.js +354 -0
- package/dist/lib/admin-artefacts.js.map +1 -0
- package/dist/lib/admin-surfaces.d.ts +298 -0
- package/dist/lib/admin-surfaces.d.ts.map +1 -0
- package/dist/lib/admin-surfaces.js +669 -0
- package/dist/lib/admin-surfaces.js.map +1 -0
- package/dist/lib/delegated-composer.d.ts +85 -0
- package/dist/lib/delegated-composer.d.ts.map +1 -0
- package/dist/lib/delegated-composer.js +241 -0
- package/dist/lib/delegated-composer.js.map +1 -0
- package/dist/lib/divergence-artefacts.d.ts +305 -0
- package/dist/lib/divergence-artefacts.d.ts.map +1 -0
- package/dist/lib/divergence-artefacts.js +828 -0
- package/dist/lib/divergence-artefacts.js.map +1 -0
- package/dist/lib/divergence.d.ts +337 -0
- package/dist/lib/divergence.d.ts.map +1 -0
- package/dist/lib/divergence.js +1005 -0
- package/dist/lib/divergence.js.map +1 -0
- package/dist/lib/docs-artefacts.d.ts +395 -0
- package/dist/lib/docs-artefacts.d.ts.map +1 -0
- package/dist/lib/docs-artefacts.js +781 -0
- package/dist/lib/docs-artefacts.js.map +1 -0
- package/dist/lib/emitted-exports.d.ts +21 -0
- package/dist/lib/emitted-exports.d.ts.map +1 -0
- package/dist/lib/emitted-exports.js +96 -0
- package/dist/lib/emitted-exports.js.map +1 -0
- package/dist/lib/emitted-freshness.d.ts +112 -0
- package/dist/lib/emitted-freshness.d.ts.map +1 -0
- package/dist/lib/emitted-freshness.js +288 -0
- package/dist/lib/emitted-freshness.js.map +1 -0
- package/dist/lib/entity-index-artefact.d.ts +95 -0
- package/dist/lib/entity-index-artefact.d.ts.map +1 -0
- package/dist/lib/entity-index-artefact.js +210 -0
- package/dist/lib/entity-index-artefact.js.map +1 -0
- package/dist/lib/instance-build-inputs.d.ts +108 -0
- package/dist/lib/instance-build-inputs.d.ts.map +1 -0
- package/dist/lib/instance-build-inputs.js +165 -0
- package/dist/lib/instance-build-inputs.js.map +1 -0
- package/dist/lib/module-docs.d.ts +473 -0
- package/dist/lib/module-docs.d.ts.map +1 -0
- package/dist/lib/module-docs.js +711 -0
- package/dist/lib/module-docs.js.map +1 -0
- package/dist/lib/module-package-subpaths.d.ts +56 -0
- package/dist/lib/module-package-subpaths.d.ts.map +1 -0
- package/dist/lib/module-package-subpaths.js +223 -0
- package/dist/lib/module-package-subpaths.js.map +1 -0
- package/dist/lib/module-packages.d.ts +200 -0
- package/dist/lib/module-packages.d.ts.map +1 -0
- package/dist/lib/module-packages.js +580 -0
- package/dist/lib/module-packages.js.map +1 -0
- package/dist/lib/module-population.d.ts +129 -0
- package/dist/lib/module-population.d.ts.map +1 -0
- package/dist/lib/module-population.js +172 -0
- package/dist/lib/module-population.js.map +1 -0
- package/dist/lib/module-roots.d.ts +337 -0
- package/dist/lib/module-roots.d.ts.map +1 -0
- package/dist/lib/module-roots.js +586 -0
- package/dist/lib/module-roots.js.map +1 -0
- package/dist/lib/nested-checkouts.d.ts +33 -0
- package/dist/lib/nested-checkouts.d.ts.map +1 -0
- package/dist/lib/nested-checkouts.js +160 -0
- package/dist/lib/nested-checkouts.js.map +1 -0
- package/dist/lib/platform-root.d.ts +43 -0
- package/dist/lib/platform-root.d.ts.map +1 -0
- package/dist/lib/platform-root.js +134 -0
- package/dist/lib/platform-root.js.map +1 -0
- package/dist/lib/platform-surface.d.ts +235 -0
- package/dist/lib/platform-surface.d.ts.map +1 -0
- package/dist/lib/platform-surface.js +393 -0
- package/dist/lib/platform-surface.js.map +1 -0
- package/dist/lib/port-registrations.d.ts +223 -0
- package/dist/lib/port-registrations.d.ts.map +1 -0
- package/dist/lib/port-registrations.js +532 -0
- package/dist/lib/port-registrations.js.map +1 -0
- package/dist/lib/read-size.d.ts +154 -0
- package/dist/lib/read-size.d.ts.map +1 -0
- package/dist/lib/read-size.js +182 -0
- package/dist/lib/read-size.js.map +1 -0
- package/dist/lib/registration-owners.d.ts +79 -0
- package/dist/lib/registration-owners.d.ts.map +1 -0
- package/dist/lib/registration-owners.js +77 -0
- package/dist/lib/registration-owners.js.map +1 -0
- package/dist/lib/release-index.d.ts +53 -0
- package/dist/lib/release-index.d.ts.map +1 -0
- package/dist/lib/release-index.js +162 -0
- package/dist/lib/release-index.js.map +1 -0
- package/dist/lib/repeating-timers.d.ts +79 -0
- package/dist/lib/repeating-timers.d.ts.map +1 -0
- package/dist/lib/repeating-timers.js +189 -0
- package/dist/lib/repeating-timers.js.map +1 -0
- package/dist/lib/source-text.d.ts +34 -0
- package/dist/lib/source-text.d.ts.map +1 -0
- package/dist/lib/source-text.js +80 -0
- package/dist/lib/source-text.js.map +1 -0
- package/dist/lib/specifiers.d.ts +20 -0
- package/dist/lib/specifiers.d.ts.map +1 -0
- package/dist/lib/specifiers.js +130 -0
- package/dist/lib/specifiers.js.map +1 -0
- package/dist/lib/sql-tables.d.ts +166 -0
- package/dist/lib/sql-tables.d.ts.map +1 -0
- package/dist/lib/sql-tables.js +464 -0
- package/dist/lib/sql-tables.js.map +1 -0
- package/dist/lib/switchable-modules.d.ts +54 -0
- package/dist/lib/switchable-modules.d.ts.map +1 -0
- package/dist/lib/switchable-modules.js +104 -0
- package/dist/lib/switchable-modules.js.map +1 -0
- package/dist/lib/tailwind-sources.d.ts +136 -0
- package/dist/lib/tailwind-sources.d.ts.map +1 -0
- package/dist/lib/tailwind-sources.js +307 -0
- package/dist/lib/tailwind-sources.js.map +1 -0
- package/dist/lib/ui-layer.d.ts +54 -0
- package/dist/lib/ui-layer.d.ts.map +1 -0
- package/dist/lib/ui-layer.js +57 -0
- package/dist/lib/ui-layer.js.map +1 -0
- package/dist/lib/workspace-packages.d.ts +186 -0
- package/dist/lib/workspace-packages.d.ts.map +1 -0
- package/dist/lib/workspace-packages.js +351 -0
- package/dist/lib/workspace-packages.js.map +1 -0
- package/dist/new-instance/deploy.d.ts +211 -0
- package/dist/new-instance/deploy.d.ts.map +1 -0
- package/dist/new-instance/deploy.js +1381 -0
- package/dist/new-instance/deploy.js.map +1 -0
- package/dist/new-instance/docs-toolchain.d.ts +66 -0
- package/dist/new-instance/docs-toolchain.d.ts.map +1 -0
- package/dist/new-instance/docs-toolchain.js +69 -0
- package/dist/new-instance/docs-toolchain.js.map +1 -0
- package/dist/new-instance/host.d.ts +124 -0
- package/dist/new-instance/host.d.ts.map +1 -0
- package/dist/new-instance/host.js +276 -0
- package/dist/new-instance/host.js.map +1 -0
- package/dist/new-instance/index.d.ts +118 -0
- package/dist/new-instance/index.d.ts.map +1 -0
- package/dist/new-instance/index.js +567 -0
- package/dist/new-instance/index.js.map +1 -0
- package/dist/new-instance/modules.d.ts +188 -0
- package/dist/new-instance/modules.d.ts.map +1 -0
- package/dist/new-instance/modules.js +392 -0
- package/dist/new-instance/modules.js.map +1 -0
- package/dist/new-instance/template.d.ts +505 -0
- package/dist/new-instance/template.d.ts.map +1 -0
- package/dist/new-instance/template.js +1886 -0
- package/dist/new-instance/template.js.map +1 -0
- package/dist/new-module/emit.d.ts +67 -0
- package/dist/new-module/emit.d.ts.map +1 -0
- package/dist/new-module/emit.js +1393 -0
- package/dist/new-module/emit.js.map +1 -0
- package/dist/new-module/host.d.ts +67 -0
- package/dist/new-module/host.d.ts.map +1 -0
- package/dist/new-module/host.js +224 -0
- package/dist/new-module/host.js.map +1 -0
- package/dist/new-module/index.d.ts +32 -0
- package/dist/new-module/index.d.ts.map +1 -0
- package/dist/new-module/index.js +193 -0
- package/dist/new-module/index.js.map +1 -0
- package/dist/new-module/spec.d.ts +188 -0
- package/dist/new-module/spec.d.ts.map +1 -0
- package/dist/new-module/spec.js +404 -0
- package/dist/new-module/spec.js.map +1 -0
- package/dist/new-module/text.d.ts +15 -0
- package/dist/new-module/text.d.ts.map +1 -0
- package/dist/new-module/text.js +22 -0
- package/dist/new-module/text.js.map +1 -0
- package/dist/new-storefront/dockerfile.d.ts +20 -0
- package/dist/new-storefront/dockerfile.d.ts.map +1 -0
- package/dist/new-storefront/dockerfile.js +131 -0
- package/dist/new-storefront/dockerfile.js.map +1 -0
- package/dist/new-storefront/gitignore.d.ts +23 -0
- package/dist/new-storefront/gitignore.d.ts.map +1 -0
- package/dist/new-storefront/gitignore.js +39 -0
- package/dist/new-storefront/gitignore.js.map +1 -0
- package/dist/new-storefront/index.d.ts +93 -0
- package/dist/new-storefront/index.d.ts.map +1 -0
- package/dist/new-storefront/index.js +329 -0
- package/dist/new-storefront/index.js.map +1 -0
- package/dist/new-storefront/npmrc.d.ts +98 -0
- package/dist/new-storefront/npmrc.d.ts.map +1 -0
- package/dist/new-storefront/npmrc.js +217 -0
- package/dist/new-storefront/npmrc.js.map +1 -0
- package/dist/new-storefront/reference.d.ts +189 -0
- package/dist/new-storefront/reference.d.ts.map +1 -0
- package/dist/new-storefront/reference.js +430 -0
- package/dist/new-storefront/reference.js.map +1 -0
- package/dist/new-storefront/rewrite.d.ts +171 -0
- package/dist/new-storefront/rewrite.d.ts.map +1 -0
- package/dist/new-storefront/rewrite.js +701 -0
- package/dist/new-storefront/rewrite.js.map +1 -0
- package/dist/release-index.json +284 -0
- package/dist/rules/action-route-permissions.d.ts +141 -0
- package/dist/rules/action-route-permissions.d.ts.map +1 -0
- package/dist/rules/action-route-permissions.js +556 -0
- package/dist/rules/action-route-permissions.js.map +1 -0
- package/dist/rules/bundle-pairing.d.ts +74 -0
- package/dist/rules/bundle-pairing.d.ts.map +1 -0
- package/dist/rules/bundle-pairing.js +281 -0
- package/dist/rules/bundle-pairing.js.map +1 -0
- package/dist/rules/channel-resolution.d.ts +17 -0
- package/dist/rules/channel-resolution.d.ts.map +1 -0
- package/dist/rules/channel-resolution.js +382 -0
- package/dist/rules/channel-resolution.js.map +1 -0
- package/dist/rules/command-coverage.d.ts +210 -0
- package/dist/rules/command-coverage.d.ts.map +1 -0
- package/dist/rules/command-coverage.js +714 -0
- package/dist/rules/command-coverage.js.map +1 -0
- package/dist/rules/container-imports.d.ts +60 -0
- package/dist/rules/container-imports.d.ts.map +1 -0
- package/dist/rules/container-imports.js +158 -0
- package/dist/rules/container-imports.js.map +1 -0
- package/dist/rules/default-language-prose.d.ts +212 -0
- package/dist/rules/default-language-prose.d.ts.map +1 -0
- package/dist/rules/default-language-prose.js +710 -0
- package/dist/rules/default-language-prose.js.map +1 -0
- package/dist/rules/diacritic-folds.d.ts +238 -0
- package/dist/rules/diacritic-folds.d.ts.map +1 -0
- package/dist/rules/diacritic-folds.js +681 -0
- package/dist/rules/diacritic-folds.js.map +1 -0
- package/dist/rules/entity-tenant-classification.d.ts +171 -0
- package/dist/rules/entity-tenant-classification.d.ts.map +1 -0
- package/dist/rules/entity-tenant-classification.js +323 -0
- package/dist/rules/entity-tenant-classification.js.map +1 -0
- package/dist/rules/entry-presence.d.ts +142 -0
- package/dist/rules/entry-presence.d.ts.map +1 -0
- package/dist/rules/entry-presence.js +339 -0
- package/dist/rules/entry-presence.js.map +1 -0
- package/dist/rules/entry-scope.d.ts +91 -0
- package/dist/rules/entry-scope.d.ts.map +1 -0
- package/dist/rules/entry-scope.js +404 -0
- package/dist/rules/entry-scope.js.map +1 -0
- package/dist/rules/env-inputs.d.ts +222 -0
- package/dist/rules/env-inputs.d.ts.map +1 -0
- package/dist/rules/env-inputs.js +951 -0
- package/dist/rules/env-inputs.js.map +1 -0
- package/dist/rules/kernel-boundary.d.ts +37 -0
- package/dist/rules/kernel-boundary.d.ts.map +1 -0
- package/dist/rules/kernel-boundary.js +195 -0
- package/dist/rules/kernel-boundary.js.map +1 -0
- package/dist/rules/nul-bytes.d.ts +233 -0
- package/dist/rules/nul-bytes.d.ts.map +1 -0
- package/dist/rules/nul-bytes.js +332 -0
- package/dist/rules/nul-bytes.js.map +1 -0
- package/dist/rules/platform-surface.d.ts +479 -0
- package/dist/rules/platform-surface.d.ts.map +1 -0
- package/dist/rules/platform-surface.js +749 -0
- package/dist/rules/platform-surface.js.map +1 -0
- package/dist/rules/port-catches.d.ts +225 -0
- package/dist/rules/port-catches.d.ts.map +1 -0
- package/dist/rules/port-catches.js +1374 -0
- package/dist/rules/port-catches.js.map +1 -0
- package/dist/rules/port-shape.d.ts +213 -0
- package/dist/rules/port-shape.d.ts.map +1 -0
- package/dist/rules/port-shape.js +670 -0
- package/dist/rules/port-shape.js.map +1 -0
- package/dist/rules/queue-names.d.ts +108 -0
- package/dist/rules/queue-names.d.ts.map +1 -0
- package/dist/rules/queue-names.js +395 -0
- package/dist/rules/queue-names.js.map +1 -0
- package/dist/rules/singleton-identity.d.ts +205 -0
- package/dist/rules/singleton-identity.d.ts.map +1 -0
- package/dist/rules/singleton-identity.js +830 -0
- package/dist/rules/singleton-identity.js.map +1 -0
- package/dist/rules/subscribe-seam.d.ts +121 -0
- package/dist/rules/subscribe-seam.d.ts.map +1 -0
- package/dist/rules/subscribe-seam.js +594 -0
- package/dist/rules/subscribe-seam.js.map +1 -0
- package/dist/rules/transaction-context.d.ts +40 -0
- package/dist/rules/transaction-context.d.ts.map +1 -0
- package/dist/rules/transaction-context.js +294 -0
- package/dist/rules/transaction-context.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "What did this check actually read?" — the one line every check prints
|
|
3
|
+
* (issue #244).
|
|
4
|
+
*
|
|
5
|
+
* ## The defect family
|
|
6
|
+
*
|
|
7
|
+
* Seven times now a check has reported `violations=0` because it was not
|
|
8
|
+
* looking, not because the tree was clean:
|
|
9
|
+
*
|
|
10
|
+
* * **#215** — the walk came back *short*. `files.length === 0` is the wrong
|
|
11
|
+
* floor when 1364 of 1469 files live under `src/modules`: move that tree
|
|
12
|
+
* out and eight checks read the other 105 files, find nothing, and report
|
|
13
|
+
* clean.
|
|
14
|
+
* * **#228** — the *population definition* excluded a live entry point, so
|
|
15
|
+
* `unscoped=0` said nothing about `src/seeds/dev-catalog-seed.ts`.
|
|
16
|
+
* * **#235 / #237** — a file in the population hid a *site* inside it: the
|
|
17
|
+
* answer was per file while the rule is per call.
|
|
18
|
+
* * **#238** — a spread bypassed excess-property checking, so the off-state
|
|
19
|
+
* test stopped testing anything while `tsc` stayed green.
|
|
20
|
+
* * **#241** — an input transform ate 41% of the file before matching.
|
|
21
|
+
* * **#244** — the population is defined by the presence of the thing being
|
|
22
|
+
* checked, so its *absence* is undetectable.
|
|
23
|
+
*
|
|
24
|
+
* They are one defect. **A check's output says what it found and never says
|
|
25
|
+
* what it read**, so "found nothing" and "read nothing" print the same green.
|
|
26
|
+
* Every repair so far has been per check and after the fact; this is the
|
|
27
|
+
* general answer, and it is deliberately not a new rule about correctness. It
|
|
28
|
+
* is a rule about *disclosure*: the size of the input is printed beside the
|
|
29
|
+
* count of findings, on every run, in one grammar, so that a reader — or the
|
|
30
|
+
* ratchet in `test/unit/scripts/check-read-size.test.ts` — can tell a clean
|
|
31
|
+
* tree from a check that stopped reading it.
|
|
32
|
+
*
|
|
33
|
+
* ## The grammar
|
|
34
|
+
*
|
|
35
|
+
* ```
|
|
36
|
+
* [entry-scope] read: files=1459 sites=47 sources=manifest-index:65/65,package-scripts:18/18
|
|
37
|
+
* [nul-bytes] read: files=5163 sources=self-reported
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* * **`files`** — how many files the check *opened*. Not how many it had a
|
|
41
|
+
* finding in, and not how many survived a filter it applied afterwards.
|
|
42
|
+
* That distinction is the whole point and it is easy to get backwards:
|
|
43
|
+
* `check-entry-scope` already printed `files=38`, which is the number of
|
|
44
|
+
* files that hold an entry site, out of the 1459 it reads. A number that
|
|
45
|
+
* moves with the findings cannot answer "did you read the tree".
|
|
46
|
+
* * **`sites`** — the finer population, where the check has one: the calls,
|
|
47
|
+
* nodes, entries, documents or records it examined *inside* those files.
|
|
48
|
+
* Issues #235 and #237 are exactly the case where the file count is
|
|
49
|
+
* unchanged and the examined-site count is what moved, so a check that
|
|
50
|
+
* answers per site must print both. Omitted where the file is the unit.
|
|
51
|
+
* * **`sources`** — how the two numbers above are corroborated. A check that
|
|
52
|
+
* computes its own population and then reports it has not closed #215:
|
|
53
|
+
* that is the same value twice. Where an *independent* derivation exists —
|
|
54
|
+
* the generated manifest index for a module walk, `package.json` scripts
|
|
55
|
+
* for a declared program — the reconciliation is printed as
|
|
56
|
+
* `<source>:<covered>/<expected>` and a shortfall is refused. Where there
|
|
57
|
+
* genuinely is none, the token is the literal `self-reported`: the honest
|
|
58
|
+
* word, so that a reader can see which checks still rest on their own
|
|
59
|
+
* answer, and so the inventory can require a reason for each.
|
|
60
|
+
*
|
|
61
|
+
* ## What it refuses
|
|
62
|
+
*
|
|
63
|
+
* Three shapes, all exit 2 — "nothing was read" is neither a pass (0) nor a
|
|
64
|
+
* violation (1):
|
|
65
|
+
*
|
|
66
|
+
* 1. `read-nothing` — `files=0`. The pre-existing floor, kept uniform.
|
|
67
|
+
* 2. `short-walk` — a declared source expected more than the walk covered.
|
|
68
|
+
* This is #215's predicate, generalised past the module tree: any check
|
|
69
|
+
* that can name an independent expectation gets the short case, not only
|
|
70
|
+
* the empty one.
|
|
71
|
+
* 3. `no-expectation` — a declared source whose expectation is zero. An
|
|
72
|
+
* independent derivation that derived nothing silently turns the floor off
|
|
73
|
+
* while looking like a normal run, which is the same green this file
|
|
74
|
+
* exists to break.
|
|
75
|
+
*
|
|
76
|
+
* The verdict is a pure function over the record so a red proof enters where a
|
|
77
|
+
* real run enters (issue #130); {@link reportReadSize} is the thin CLI half
|
|
78
|
+
* that prints it and exits.
|
|
79
|
+
*/
|
|
80
|
+
/** One independent derivation of what the check should have read. */
|
|
81
|
+
export interface ReadCoverage {
|
|
82
|
+
/**
|
|
83
|
+
* Where the expectation came from — printed, so the reader can check it
|
|
84
|
+
* themselves. `manifest-index` and `package-scripts` are the two the tree
|
|
85
|
+
* has; the token is free text so a check with a third can name it.
|
|
86
|
+
*/
|
|
87
|
+
readonly source: string;
|
|
88
|
+
/** How many units that source says exist. */
|
|
89
|
+
readonly expected: number;
|
|
90
|
+
/** How many of them the walk actually reached. */
|
|
91
|
+
readonly covered: number;
|
|
92
|
+
}
|
|
93
|
+
export interface ReadSizeInput {
|
|
94
|
+
/** The check's log prefix, e.g. `[entry-scope]` — brackets included. */
|
|
95
|
+
readonly prefix: string;
|
|
96
|
+
/** Files opened. Never files with a finding, never files after a filter. */
|
|
97
|
+
readonly files: number;
|
|
98
|
+
/** The finer population examined inside them, where the check has one. */
|
|
99
|
+
readonly sites?: number;
|
|
100
|
+
/**
|
|
101
|
+
* Independent corroboration, if any. An empty list prints `self-reported`,
|
|
102
|
+
* which is a statement rather than an omission: the inventory requires a
|
|
103
|
+
* reason for every check that prints it.
|
|
104
|
+
*/
|
|
105
|
+
readonly coverage?: readonly ReadCoverage[];
|
|
106
|
+
}
|
|
107
|
+
export type ReadSizeRefusalKind = 'read-nothing' | 'short-walk' | 'no-expectation';
|
|
108
|
+
export interface ReadSizeRefusal {
|
|
109
|
+
readonly kind: ReadSizeRefusalKind;
|
|
110
|
+
readonly message: string;
|
|
111
|
+
}
|
|
112
|
+
/** The literal printed where no independent derivation exists. */
|
|
113
|
+
export declare const SELF_REPORTED = "self-reported";
|
|
114
|
+
/** The `sources=` token: every derivation, or the honest word for none. */
|
|
115
|
+
export declare function coverageToken(coverage?: readonly ReadCoverage[]): string;
|
|
116
|
+
/**
|
|
117
|
+
* The line itself. One grammar for every check, so the ratchet parses one
|
|
118
|
+
* shape and a reader learns one.
|
|
119
|
+
*/
|
|
120
|
+
export declare function readSizeLine(input: ReadSizeInput): string;
|
|
121
|
+
/**
|
|
122
|
+
* Why this run may not report on what it read, or `null`.
|
|
123
|
+
*
|
|
124
|
+
* Pure, and over the record the check hands in — the top of this helper's
|
|
125
|
+
* analysis. A proof that constructed the message instead would prove the
|
|
126
|
+
* string formatting and leave all three predicates unproven.
|
|
127
|
+
*/
|
|
128
|
+
export declare function readSizeRefusal(input: ReadSizeInput): ReadSizeRefusal | null;
|
|
129
|
+
/**
|
|
130
|
+
* The CLI half: print the read size, or refuse and exit 2.
|
|
131
|
+
*
|
|
132
|
+
* One function rather than a copy per check, because a copy per check is a
|
|
133
|
+
* chance per check to write the one that prints a number nothing compares —
|
|
134
|
+
* which is the state this repository was in when the family reached seven.
|
|
135
|
+
*/
|
|
136
|
+
export declare function reportReadSize(input: ReadSizeInput): void;
|
|
137
|
+
export interface ParsedReadSize {
|
|
138
|
+
readonly prefix: string;
|
|
139
|
+
readonly files: number;
|
|
140
|
+
/** `null` when the check declares no finer population. */
|
|
141
|
+
readonly sites: number | null;
|
|
142
|
+
readonly coverage: readonly ReadCoverage[];
|
|
143
|
+
/** True when the `sources=` token is the literal `self-reported`. */
|
|
144
|
+
readonly selfReported: boolean;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* The line back out of a check's output, for the ratchet that spawns it.
|
|
148
|
+
*
|
|
149
|
+
* Returns `null` when the output holds no read line — which the ratchet reads
|
|
150
|
+
* as "this check does not disclose its read size", a failure rather than a
|
|
151
|
+
* skip.
|
|
152
|
+
*/
|
|
153
|
+
export declare function parseReadSize(output: string): ParsedReadSize | null;
|
|
154
|
+
//# sourceMappingURL=read-size.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-size.d.ts","sourceRoot":"","sources":["../../src/lib/read-size.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8EG;AAGH,qEAAqE;AACrE,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,6CAA6C;IAC7C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,kDAAkD;IAClD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;CAC7C;AAED,MAAM,MAAM,mBAAmB,GAAG,cAAc,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAEnF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,kEAAkE;AAClE,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAE7C,2EAA2E;AAC3E,wBAAgB,aAAa,CAAC,QAAQ,GAAE,SAAS,YAAY,EAAO,GAAG,MAAM,CAG5E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAGzD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,GAAG,eAAe,GAAG,IAAI,CA8B5E;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAOzD;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAC;IAC3C,qEAAqE;IACrE,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;CAChC;AAKD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAyBnE"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "What did this check actually read?" — the one line every check prints
|
|
3
|
+
* (issue #244).
|
|
4
|
+
*
|
|
5
|
+
* ## The defect family
|
|
6
|
+
*
|
|
7
|
+
* Seven times now a check has reported `violations=0` because it was not
|
|
8
|
+
* looking, not because the tree was clean:
|
|
9
|
+
*
|
|
10
|
+
* * **#215** — the walk came back *short*. `files.length === 0` is the wrong
|
|
11
|
+
* floor when 1364 of 1469 files live under `src/modules`: move that tree
|
|
12
|
+
* out and eight checks read the other 105 files, find nothing, and report
|
|
13
|
+
* clean.
|
|
14
|
+
* * **#228** — the *population definition* excluded a live entry point, so
|
|
15
|
+
* `unscoped=0` said nothing about `src/seeds/dev-catalog-seed.ts`.
|
|
16
|
+
* * **#235 / #237** — a file in the population hid a *site* inside it: the
|
|
17
|
+
* answer was per file while the rule is per call.
|
|
18
|
+
* * **#238** — a spread bypassed excess-property checking, so the off-state
|
|
19
|
+
* test stopped testing anything while `tsc` stayed green.
|
|
20
|
+
* * **#241** — an input transform ate 41% of the file before matching.
|
|
21
|
+
* * **#244** — the population is defined by the presence of the thing being
|
|
22
|
+
* checked, so its *absence* is undetectable.
|
|
23
|
+
*
|
|
24
|
+
* They are one defect. **A check's output says what it found and never says
|
|
25
|
+
* what it read**, so "found nothing" and "read nothing" print the same green.
|
|
26
|
+
* Every repair so far has been per check and after the fact; this is the
|
|
27
|
+
* general answer, and it is deliberately not a new rule about correctness. It
|
|
28
|
+
* is a rule about *disclosure*: the size of the input is printed beside the
|
|
29
|
+
* count of findings, on every run, in one grammar, so that a reader — or the
|
|
30
|
+
* ratchet in `test/unit/scripts/check-read-size.test.ts` — can tell a clean
|
|
31
|
+
* tree from a check that stopped reading it.
|
|
32
|
+
*
|
|
33
|
+
* ## The grammar
|
|
34
|
+
*
|
|
35
|
+
* ```
|
|
36
|
+
* [entry-scope] read: files=1459 sites=47 sources=manifest-index:65/65,package-scripts:18/18
|
|
37
|
+
* [nul-bytes] read: files=5163 sources=self-reported
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* * **`files`** — how many files the check *opened*. Not how many it had a
|
|
41
|
+
* finding in, and not how many survived a filter it applied afterwards.
|
|
42
|
+
* That distinction is the whole point and it is easy to get backwards:
|
|
43
|
+
* `check-entry-scope` already printed `files=38`, which is the number of
|
|
44
|
+
* files that hold an entry site, out of the 1459 it reads. A number that
|
|
45
|
+
* moves with the findings cannot answer "did you read the tree".
|
|
46
|
+
* * **`sites`** — the finer population, where the check has one: the calls,
|
|
47
|
+
* nodes, entries, documents or records it examined *inside* those files.
|
|
48
|
+
* Issues #235 and #237 are exactly the case where the file count is
|
|
49
|
+
* unchanged and the examined-site count is what moved, so a check that
|
|
50
|
+
* answers per site must print both. Omitted where the file is the unit.
|
|
51
|
+
* * **`sources`** — how the two numbers above are corroborated. A check that
|
|
52
|
+
* computes its own population and then reports it has not closed #215:
|
|
53
|
+
* that is the same value twice. Where an *independent* derivation exists —
|
|
54
|
+
* the generated manifest index for a module walk, `package.json` scripts
|
|
55
|
+
* for a declared program — the reconciliation is printed as
|
|
56
|
+
* `<source>:<covered>/<expected>` and a shortfall is refused. Where there
|
|
57
|
+
* genuinely is none, the token is the literal `self-reported`: the honest
|
|
58
|
+
* word, so that a reader can see which checks still rest on their own
|
|
59
|
+
* answer, and so the inventory can require a reason for each.
|
|
60
|
+
*
|
|
61
|
+
* ## What it refuses
|
|
62
|
+
*
|
|
63
|
+
* Three shapes, all exit 2 — "nothing was read" is neither a pass (0) nor a
|
|
64
|
+
* violation (1):
|
|
65
|
+
*
|
|
66
|
+
* 1. `read-nothing` — `files=0`. The pre-existing floor, kept uniform.
|
|
67
|
+
* 2. `short-walk` — a declared source expected more than the walk covered.
|
|
68
|
+
* This is #215's predicate, generalised past the module tree: any check
|
|
69
|
+
* that can name an independent expectation gets the short case, not only
|
|
70
|
+
* the empty one.
|
|
71
|
+
* 3. `no-expectation` — a declared source whose expectation is zero. An
|
|
72
|
+
* independent derivation that derived nothing silently turns the floor off
|
|
73
|
+
* while looking like a normal run, which is the same green this file
|
|
74
|
+
* exists to break.
|
|
75
|
+
*
|
|
76
|
+
* The verdict is a pure function over the record so a red proof enters where a
|
|
77
|
+
* real run enters (issue #130); {@link reportReadSize} is the thin CLI half
|
|
78
|
+
* that prints it and exits.
|
|
79
|
+
*/
|
|
80
|
+
/* eslint-disable no-console -- prints on behalf of the CLI checks: stdout is their interface. */
|
|
81
|
+
/** The literal printed where no independent derivation exists. */
|
|
82
|
+
export const SELF_REPORTED = 'self-reported';
|
|
83
|
+
/** The `sources=` token: every derivation, or the honest word for none. */
|
|
84
|
+
export function coverageToken(coverage = []) {
|
|
85
|
+
if (coverage.length === 0)
|
|
86
|
+
return SELF_REPORTED;
|
|
87
|
+
return coverage.map((c) => `${c.source}:${c.covered}/${c.expected}`).join(',');
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The line itself. One grammar for every check, so the ratchet parses one
|
|
91
|
+
* shape and a reader learns one.
|
|
92
|
+
*/
|
|
93
|
+
export function readSizeLine(input) {
|
|
94
|
+
const sites = input.sites === undefined ? '' : ` sites=${input.sites}`;
|
|
95
|
+
return `${input.prefix} read: files=${input.files}${sites} sources=${coverageToken(input.coverage)}`;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Why this run may not report on what it read, or `null`.
|
|
99
|
+
*
|
|
100
|
+
* Pure, and over the record the check hands in — the top of this helper's
|
|
101
|
+
* analysis. A proof that constructed the message instead would prove the
|
|
102
|
+
* string formatting and leave all three predicates unproven.
|
|
103
|
+
*/
|
|
104
|
+
export function readSizeRefusal(input) {
|
|
105
|
+
if (input.files <= 0) {
|
|
106
|
+
return {
|
|
107
|
+
kind: 'read-nothing',
|
|
108
|
+
message: 'the walk opened no file at all — a finding count over an empty input is not a ' +
|
|
109
|
+
'clean tree; refusing to report a vacuous pass',
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
for (const coverage of input.coverage ?? []) {
|
|
113
|
+
if (coverage.expected <= 0) {
|
|
114
|
+
return {
|
|
115
|
+
kind: 'no-expectation',
|
|
116
|
+
message: `the independent derivation \`${coverage.source}\` expects nothing, so it ` +
|
|
117
|
+
'corroborates nothing — the floor it exists to provide is switched off; ' +
|
|
118
|
+
'refusing to report a vacuous pass',
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
if (coverage.covered < coverage.expected) {
|
|
122
|
+
return {
|
|
123
|
+
kind: 'short-walk',
|
|
124
|
+
message: `the walk opened ${input.files} file(s) and covered ${coverage.covered} of the ` +
|
|
125
|
+
`${coverage.expected} unit(s) \`${coverage.source}\` derives — it is reading a ` +
|
|
126
|
+
'residue of its population, not the population; refusing to report a vacuous pass',
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* The CLI half: print the read size, or refuse and exit 2.
|
|
134
|
+
*
|
|
135
|
+
* One function rather than a copy per check, because a copy per check is a
|
|
136
|
+
* chance per check to write the one that prints a number nothing compares —
|
|
137
|
+
* which is the state this repository was in when the family reached seven.
|
|
138
|
+
*/
|
|
139
|
+
export function reportReadSize(input) {
|
|
140
|
+
const refusal = readSizeRefusal(input);
|
|
141
|
+
if (refusal !== null) {
|
|
142
|
+
console.error(`${input.prefix} ${refusal.message}`);
|
|
143
|
+
process.exit(2);
|
|
144
|
+
}
|
|
145
|
+
console.log(readSizeLine(input));
|
|
146
|
+
}
|
|
147
|
+
const READ_LINE = /\[([^\]\n]+)\] read: files=(\d+)(?: sites=(\d+))? sources=(\S+)/;
|
|
148
|
+
/**
|
|
149
|
+
* The line back out of a check's output, for the ratchet that spawns it.
|
|
150
|
+
*
|
|
151
|
+
* Returns `null` when the output holds no read line — which the ratchet reads
|
|
152
|
+
* as "this check does not disclose its read size", a failure rather than a
|
|
153
|
+
* skip.
|
|
154
|
+
*/
|
|
155
|
+
export function parseReadSize(output) {
|
|
156
|
+
const match = READ_LINE.exec(output);
|
|
157
|
+
if (match === null)
|
|
158
|
+
return null;
|
|
159
|
+
const token = match[4] ?? SELF_REPORTED;
|
|
160
|
+
const coverage = token === SELF_REPORTED
|
|
161
|
+
? []
|
|
162
|
+
: token.split(',').flatMap((part) => {
|
|
163
|
+
const parsed = /^([^:]+):(\d+)\/(\d+)$/.exec(part);
|
|
164
|
+
if (parsed === null)
|
|
165
|
+
return [];
|
|
166
|
+
return [
|
|
167
|
+
{
|
|
168
|
+
source: parsed[1],
|
|
169
|
+
covered: Number(parsed[2]),
|
|
170
|
+
expected: Number(parsed[3]),
|
|
171
|
+
},
|
|
172
|
+
];
|
|
173
|
+
});
|
|
174
|
+
return {
|
|
175
|
+
prefix: match[1],
|
|
176
|
+
files: Number(match[2]),
|
|
177
|
+
sites: match[3] === undefined ? null : Number(match[3]),
|
|
178
|
+
coverage,
|
|
179
|
+
selfReported: token === SELF_REPORTED,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=read-size.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-size.js","sourceRoot":"","sources":["../../src/lib/read-size.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Which module registered this container name?" — the port→owner map, as one
|
|
3
|
+
* merge rule rather than two.
|
|
4
|
+
*
|
|
5
|
+
* `check:port-dependencies` has built this map since feature 080's T034, from
|
|
6
|
+
* three sources with a precedence between them, and the divergence report
|
|
7
|
+
* (`specs/107-override-report-and-ladder/contracts/divergence-report.md` §3.2)
|
|
8
|
+
* needs the same answer: a decoration or a port resolution names a subject, and
|
|
9
|
+
* the entry has to say who owns it. §3.2's own words are *"it is not recomputed
|
|
10
|
+
* here"*, and this file is what makes that true — the two checks share the merge
|
|
11
|
+
* as well as the syntactic primitives (`registeredNames`, `moduleOf`,
|
|
12
|
+
* `loadPackageDeclarations`), so they cannot come to disagree about who owns a
|
|
13
|
+
* name.
|
|
14
|
+
*
|
|
15
|
+
* The precedence is the rule and it is stated once, here:
|
|
16
|
+
*
|
|
17
|
+
* 1. **the host table** seeds the map — `HOST_REGISTERED_PORTS`, the names a
|
|
18
|
+
* composition root registers on an unconverted module's behalf;
|
|
19
|
+
* 2. **the tree** overwrites it, last claim winning, because a module that
|
|
20
|
+
* registers a name is its owner whatever a bridging table says;
|
|
21
|
+
* 3. **an installed package** claims only a name nothing above claimed. The
|
|
22
|
+
* tree wins a collision for the reason `check:module-boundary`'s table map
|
|
23
|
+
* gives: two registrations of one name is a `DuplicateRegistrationError` the
|
|
24
|
+
* container raises for itself, and until it does, a stranger must not take a
|
|
25
|
+
* core module's name away from it in the diagnosis.
|
|
26
|
+
*
|
|
27
|
+
* ## Three sources, and an instance has one of them
|
|
28
|
+
*
|
|
29
|
+
* It moved here from `backend/scripts/lib/` with the derivation it feeds
|
|
30
|
+
* (`specs/110-instance-repository/` T138a), because the divergence report now has
|
|
31
|
+
* a second host and the two must not come to disagree about who owns a name. The
|
|
32
|
+
* precedence above is unchanged and is what the two hosts differ **in the inputs
|
|
33
|
+
* to**, never in: this repository fills all three, and a client's instance fills
|
|
34
|
+
* only the third — it has no module sources and no composition root of its own,
|
|
35
|
+
* every module being an installed package and `composeApp` the platform's. So an
|
|
36
|
+
* instance's report attributes a name the platform's composition root registers
|
|
37
|
+
* on a module's behalf to *a composition root* rather than to that module, which
|
|
38
|
+
* is true of the instance and is said out loud in its report's `boundary`
|
|
39
|
+
* (`divergence-artefacts.ts`' `INSTANCE_BOUNDARY_NOTES`) rather than left to be
|
|
40
|
+
* noticed.
|
|
41
|
+
*/
|
|
42
|
+
/** One claim on a container name. */
|
|
43
|
+
export interface OwnerClaim {
|
|
44
|
+
readonly name: string;
|
|
45
|
+
readonly moduleId: string;
|
|
46
|
+
}
|
|
47
|
+
export interface RegistrationOwnerInput {
|
|
48
|
+
/** The host bridging table — name → the module a root registers it for. */
|
|
49
|
+
readonly hostRegistered: Readonly<Record<string, string>>;
|
|
50
|
+
/** Claims read from this repository's own module sources, in walk order. */
|
|
51
|
+
readonly treeClaims: Iterable<OwnerClaim>;
|
|
52
|
+
/** Claims read from installed extension packages' `./backend` artefacts. */
|
|
53
|
+
readonly packageClaims: Iterable<OwnerClaim>;
|
|
54
|
+
}
|
|
55
|
+
/** The port→owner map, under the precedence above. */
|
|
56
|
+
export declare function mergeRegistrationOwners(input: RegistrationOwnerInput): Map<string, string>;
|
|
57
|
+
/**
|
|
58
|
+
* The names **no module owns** — what a composition root supplies.
|
|
59
|
+
*
|
|
60
|
+
* They matter to the divergence report for one reason: an overlay module's
|
|
61
|
+
* decoration of `commandBus`, `auditLogService`, `eventBus` or `emFactory` is
|
|
62
|
+
* legal and total (D-156.4), and a report that could not tell "a root registers
|
|
63
|
+
* it" from "nobody registers it" would file every one of them as
|
|
64
|
+
* `unowned-subject` — a finding about the run dressed as one about the tree.
|
|
65
|
+
*
|
|
66
|
+
* Derived, never listed (D-100, D-156.5): a name the container holds that no
|
|
67
|
+
* module claimed is exactly a name a composition root supplied, which is the
|
|
68
|
+
* same derivation `ForeignRegistrationError` rests on. The caller supplies the
|
|
69
|
+
* sources so a fixture enters at the top of this analysis.
|
|
70
|
+
*/
|
|
71
|
+
export declare function rootSuppliedNames(input: {
|
|
72
|
+
/** Every name a composition root writes, from `rootRegisteredNames`. */
|
|
73
|
+
readonly rootNames: Iterable<string>;
|
|
74
|
+
/** Every name the platform's own kernel registers. */
|
|
75
|
+
readonly kernelNames: Iterable<string>;
|
|
76
|
+
/** The owner map — a name a module owns is not root-supplied. */
|
|
77
|
+
readonly owners: ReadonlyMap<string, string>;
|
|
78
|
+
}): Set<string>;
|
|
79
|
+
//# sourceMappingURL=registration-owners.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registration-owners.d.ts","sourceRoot":"","sources":["../../src/lib/registration-owners.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,qCAAqC;AACrC,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,sBAAsB;IACrC,2EAA2E;IAC3E,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1D,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC1C,4EAA4E;IAC5E,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;CAC9C;AAED,sDAAsD;AACtD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,sBAAsB,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAO1F;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,wEAAwE;IACxE,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACrC,sDAAsD;IACtD,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACvC,iEAAiE;IACjE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9C,GAAG,GAAG,CAAC,MAAM,CAAC,CAKd"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Which module registered this container name?" — the port→owner map, as one
|
|
3
|
+
* merge rule rather than two.
|
|
4
|
+
*
|
|
5
|
+
* `check:port-dependencies` has built this map since feature 080's T034, from
|
|
6
|
+
* three sources with a precedence between them, and the divergence report
|
|
7
|
+
* (`specs/107-override-report-and-ladder/contracts/divergence-report.md` §3.2)
|
|
8
|
+
* needs the same answer: a decoration or a port resolution names a subject, and
|
|
9
|
+
* the entry has to say who owns it. §3.2's own words are *"it is not recomputed
|
|
10
|
+
* here"*, and this file is what makes that true — the two checks share the merge
|
|
11
|
+
* as well as the syntactic primitives (`registeredNames`, `moduleOf`,
|
|
12
|
+
* `loadPackageDeclarations`), so they cannot come to disagree about who owns a
|
|
13
|
+
* name.
|
|
14
|
+
*
|
|
15
|
+
* The precedence is the rule and it is stated once, here:
|
|
16
|
+
*
|
|
17
|
+
* 1. **the host table** seeds the map — `HOST_REGISTERED_PORTS`, the names a
|
|
18
|
+
* composition root registers on an unconverted module's behalf;
|
|
19
|
+
* 2. **the tree** overwrites it, last claim winning, because a module that
|
|
20
|
+
* registers a name is its owner whatever a bridging table says;
|
|
21
|
+
* 3. **an installed package** claims only a name nothing above claimed. The
|
|
22
|
+
* tree wins a collision for the reason `check:module-boundary`'s table map
|
|
23
|
+
* gives: two registrations of one name is a `DuplicateRegistrationError` the
|
|
24
|
+
* container raises for itself, and until it does, a stranger must not take a
|
|
25
|
+
* core module's name away from it in the diagnosis.
|
|
26
|
+
*
|
|
27
|
+
* ## Three sources, and an instance has one of them
|
|
28
|
+
*
|
|
29
|
+
* It moved here from `backend/scripts/lib/` with the derivation it feeds
|
|
30
|
+
* (`specs/110-instance-repository/` T138a), because the divergence report now has
|
|
31
|
+
* a second host and the two must not come to disagree about who owns a name. The
|
|
32
|
+
* precedence above is unchanged and is what the two hosts differ **in the inputs
|
|
33
|
+
* to**, never in: this repository fills all three, and a client's instance fills
|
|
34
|
+
* only the third — it has no module sources and no composition root of its own,
|
|
35
|
+
* every module being an installed package and `composeApp` the platform's. So an
|
|
36
|
+
* instance's report attributes a name the platform's composition root registers
|
|
37
|
+
* on a module's behalf to *a composition root* rather than to that module, which
|
|
38
|
+
* is true of the instance and is said out loud in its report's `boundary`
|
|
39
|
+
* (`divergence-artefacts.ts`' `INSTANCE_BOUNDARY_NOTES`) rather than left to be
|
|
40
|
+
* noticed.
|
|
41
|
+
*/
|
|
42
|
+
/** The port→owner map, under the precedence above. */
|
|
43
|
+
export function mergeRegistrationOwners(input) {
|
|
44
|
+
const owners = new Map(Object.entries(input.hostRegistered));
|
|
45
|
+
for (const claim of input.treeClaims)
|
|
46
|
+
owners.set(claim.name, claim.moduleId);
|
|
47
|
+
for (const claim of input.packageClaims) {
|
|
48
|
+
if (!owners.has(claim.name))
|
|
49
|
+
owners.set(claim.name, claim.moduleId);
|
|
50
|
+
}
|
|
51
|
+
return owners;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The names **no module owns** — what a composition root supplies.
|
|
55
|
+
*
|
|
56
|
+
* They matter to the divergence report for one reason: an overlay module's
|
|
57
|
+
* decoration of `commandBus`, `auditLogService`, `eventBus` or `emFactory` is
|
|
58
|
+
* legal and total (D-156.4), and a report that could not tell "a root registers
|
|
59
|
+
* it" from "nobody registers it" would file every one of them as
|
|
60
|
+
* `unowned-subject` — a finding about the run dressed as one about the tree.
|
|
61
|
+
*
|
|
62
|
+
* Derived, never listed (D-100, D-156.5): a name the container holds that no
|
|
63
|
+
* module claimed is exactly a name a composition root supplied, which is the
|
|
64
|
+
* same derivation `ForeignRegistrationError` rests on. The caller supplies the
|
|
65
|
+
* sources so a fixture enters at the top of this analysis.
|
|
66
|
+
*/
|
|
67
|
+
export function rootSuppliedNames(input) {
|
|
68
|
+
const supplied = new Set();
|
|
69
|
+
for (const name of input.rootNames)
|
|
70
|
+
if (!input.owners.has(name))
|
|
71
|
+
supplied.add(name);
|
|
72
|
+
for (const name of input.kernelNames)
|
|
73
|
+
if (!input.owners.has(name))
|
|
74
|
+
supplied.add(name);
|
|
75
|
+
return supplied;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=registration-owners.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registration-owners.js","sourceRoot":"","sources":["../../src/lib/registration-owners.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAiBH,sDAAsD;AACtD,MAAM,UAAU,uBAAuB,CAAC,KAA6B;IACnE,MAAM,MAAM,GAAG,IAAI,GAAG,CAAiB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;IAC7E,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,UAAU;QAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC7E,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;QACxC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;YAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAOjC;IACC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,SAAS;QAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpF,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,WAAW;QAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** The file's name under the CLI's `dist`. */
|
|
2
|
+
export declare const RELEASE_INDEX_FILE = "release-index.json";
|
|
3
|
+
/** One publishable workspace package, with its directory and declared version. */
|
|
4
|
+
export interface PublishablePackage {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly dir: string;
|
|
7
|
+
/** Absent when the manifest declares none; the index refuses such a package. */
|
|
8
|
+
readonly version: string | undefined;
|
|
9
|
+
}
|
|
10
|
+
/** One entry of the index. */
|
|
11
|
+
export interface ReleaseIndexEntry {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly version: string;
|
|
14
|
+
}
|
|
15
|
+
/** The whole index: this CLI's release, sorted by name. */
|
|
16
|
+
export interface ReleaseIndex {
|
|
17
|
+
readonly packages: readonly ReleaseIndexEntry[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Every publishable workspace package under `packagesRoot`, with its directory.
|
|
21
|
+
*
|
|
22
|
+
* A directory holding a `package.json` is a package and is not descended
|
|
23
|
+
* into; one without is a grouping directory (`packages/modules/`) and is. A
|
|
24
|
+
* manifest declaring `private: true`, or no `name`, is not publishable.
|
|
25
|
+
*/
|
|
26
|
+
export declare function publishablePackages(packagesRoot: string): readonly PublishablePackage[];
|
|
27
|
+
/**
|
|
28
|
+
* The index over `packagesRoot`, narrowed to `scope` (`@endora-commerce/`).
|
|
29
|
+
*
|
|
30
|
+
* A publishable package that declares no version is a throw rather than a
|
|
31
|
+
* skip: an index short by a package is a host short by a module, and the
|
|
32
|
+
* module set derived from it would be silently smaller than the release.
|
|
33
|
+
*/
|
|
34
|
+
export declare function releaseIndexOf(packagesRoot: string, scope: string): ReleaseIndex;
|
|
35
|
+
/** Read an index back, refusing anything that is not one. `source` names the file. */
|
|
36
|
+
export declare function parseReleaseIndex(text: string, source: string): ReleaseIndex;
|
|
37
|
+
/**
|
|
38
|
+
* Where this CLI's own index is: `dist/` of the nearest package root above
|
|
39
|
+
* this module — the same file from `src/` in a checkout and from `dist/` in an
|
|
40
|
+
* installed tarball.
|
|
41
|
+
*/
|
|
42
|
+
export declare function ownReleaseIndexPath(moduleUrl?: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* The build step: derive the index for the CLI package at `cliDir` and write
|
|
45
|
+
* it into its `dist`.
|
|
46
|
+
*
|
|
47
|
+
* The workspace is found by walking up to `pnpm-workspace.yaml`, and the
|
|
48
|
+
* scope comes off the CLI's own name — nothing here is written down. Called by
|
|
49
|
+
* `scripts/write-release-index.mjs`, which the package's `build` runs after
|
|
50
|
+
* `tsc`; a failure fails the build rather than shipping a CLI with no index.
|
|
51
|
+
*/
|
|
52
|
+
export declare function writeReleaseIndex(cliDir: string): ReleaseIndex;
|
|
53
|
+
//# sourceMappingURL=release-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-index.d.ts","sourceRoot":"","sources":["../../src/lib/release-index.ts"],"names":[],"mappings":"AA+BA,8CAA8C;AAC9C,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD,kFAAkF;AAClF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AAED,8BAA8B;AAC9B,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,2DAA2D;AAC3D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACjD;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,kBAAkB,EAAE,CA2BvF;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CAchF;AAED,sFAAsF;AACtF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY,CA0B5E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,GAAE,MAAwB,GAAG,MAAM,CAQ/E;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAsB9D"}
|