@descryy/core 0.3.0 → 0.5.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/budget/reply.d.ts +11 -46
- package/dist/budget/reply.d.ts.map +1 -1
- package/dist/budget/reply.js +10 -39
- package/dist/budget/reply.js.map +1 -1
- package/dist/budget/size.d.ts +2 -21
- package/dist/budget/size.d.ts.map +1 -1
- package/dist/budget/size.js +3 -24
- package/dist/budget/size.js.map +1 -1
- package/dist/capabilities/preconditions.d.ts +7 -68
- package/dist/capabilities/preconditions.d.ts.map +1 -1
- package/dist/capabilities/preconditions.js +6 -57
- package/dist/capabilities/preconditions.js.map +1 -1
- package/dist/contracts/engine.d.ts +26 -12
- package/dist/contracts/engine.d.ts.map +1 -1
- package/dist/contracts/engine.js +28 -11
- package/dist/contracts/engine.js.map +1 -1
- package/dist/contracts/index.d.ts +1 -1
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/orphans.d.ts +28 -77
- package/dist/contracts/orphans.d.ts.map +1 -1
- package/dist/contracts/orphans.js +124 -94
- package/dist/contracts/orphans.js.map +1 -1
- package/dist/contracts/paths.d.ts +4 -114
- package/dist/contracts/paths.d.ts.map +1 -1
- package/dist/contracts/paths.js +7 -140
- package/dist/contracts/paths.js.map +1 -1
- package/dist/contracts/shapes.d.ts +13 -66
- package/dist/contracts/shapes.d.ts.map +1 -1
- package/dist/contracts/shapes.js +20 -91
- package/dist/contracts/shapes.js.map +1 -1
- package/dist/governance/budget.d.ts +12 -48
- package/dist/governance/budget.d.ts.map +1 -1
- package/dist/governance/budget.js +12 -48
- package/dist/governance/budget.js.map +1 -1
- package/dist/governance/candidate-boundary.d.ts +4 -32
- package/dist/governance/candidate-boundary.d.ts.map +1 -1
- package/dist/governance/candidate-boundary.js +4 -32
- package/dist/governance/candidate-boundary.js.map +1 -1
- package/dist/governance/escalation.d.ts +7 -45
- package/dist/governance/escalation.d.ts.map +1 -1
- package/dist/governance/escalation.js +7 -45
- package/dist/governance/escalation.js.map +1 -1
- package/dist/governance/fact-boundary.d.ts +7 -49
- package/dist/governance/fact-boundary.d.ts.map +1 -1
- package/dist/governance/fact-boundary.js +5 -43
- package/dist/governance/fact-boundary.js.map +1 -1
- package/dist/governance/finding-funnel.d.ts +11 -72
- package/dist/governance/finding-funnel.d.ts.map +1 -1
- package/dist/governance/finding-funnel.js +9 -68
- package/dist/governance/finding-funnel.js.map +1 -1
- package/dist/graph/build.d.ts +13 -75
- package/dist/graph/build.d.ts.map +1 -1
- package/dist/graph/build.js +0 -0
- package/dist/graph/build.js.map +1 -1
- package/dist/graph/cross-language.d.ts +4 -43
- package/dist/graph/cross-language.d.ts.map +1 -1
- package/dist/graph/cross-language.js +9 -77
- package/dist/graph/cross-language.js.map +1 -1
- package/dist/graph/index.d.ts +1 -1
- package/dist/graph/index.d.ts.map +1 -1
- package/dist/graph/merge.d.ts +8 -76
- package/dist/graph/merge.d.ts.map +1 -1
- package/dist/graph/merge.js +27 -77
- package/dist/graph/merge.js.map +1 -1
- package/dist/graph/observed-tests.d.ts +7 -68
- package/dist/graph/observed-tests.d.ts.map +1 -1
- package/dist/graph/observed-tests.js +5 -60
- package/dist/graph/observed-tests.js.map +1 -1
- package/dist/graph/persist.d.ts +2 -25
- package/dist/graph/persist.d.ts.map +1 -1
- package/dist/graph/persist.js +2 -25
- package/dist/graph/persist.js.map +1 -1
- package/dist/graph/runtime-confirmation.d.ts +14 -91
- package/dist/graph/runtime-confirmation.d.ts.map +1 -1
- package/dist/graph/runtime-confirmation.js +19 -103
- package/dist/graph/runtime-confirmation.js.map +1 -1
- package/dist/ledger/mint.d.ts +9 -43
- package/dist/ledger/mint.d.ts.map +1 -1
- package/dist/ledger/mint.js +15 -65
- package/dist/ledger/mint.js.map +1 -1
- package/dist/ledger/resolve.d.ts +13 -81
- package/dist/ledger/resolve.d.ts.map +1 -1
- package/dist/ledger/resolve.js +13 -76
- package/dist/ledger/resolve.js.map +1 -1
- package/dist/multipr/fingerprint.d.ts +5 -46
- package/dist/multipr/fingerprint.d.ts.map +1 -1
- package/dist/multipr/fingerprint.js +22 -74
- package/dist/multipr/fingerprint.js.map +1 -1
- package/dist/multipr/hidden-dependency.d.ts +13 -73
- package/dist/multipr/hidden-dependency.d.ts.map +1 -1
- package/dist/multipr/hidden-dependency.js +12 -63
- package/dist/multipr/hidden-dependency.js.map +1 -1
- package/dist/multipr/mechanical.d.ts +25 -160
- package/dist/multipr/mechanical.d.ts.map +1 -1
- package/dist/multipr/mechanical.js +21 -137
- package/dist/multipr/mechanical.js.map +1 -1
- package/dist/multipr/migration-heads.d.ts +18 -105
- package/dist/multipr/migration-heads.d.ts.map +1 -1
- package/dist/multipr/migration-heads.js +15 -84
- package/dist/multipr/migration-heads.js.map +1 -1
- package/dist/multipr/overlap.d.ts +16 -94
- package/dist/multipr/overlap.d.ts.map +1 -1
- package/dist/multipr/overlap.js +25 -105
- package/dist/multipr/overlap.js.map +1 -1
- package/dist/multipr/scope-store.d.ts +15 -80
- package/dist/multipr/scope-store.d.ts.map +1 -1
- package/dist/multipr/scope-store.js +17 -87
- package/dist/multipr/scope-store.js.map +1 -1
- package/dist/multipr/superseded.d.ts +10 -95
- package/dist/multipr/superseded.d.ts.map +1 -1
- package/dist/multipr/superseded.js +7 -60
- package/dist/multipr/superseded.js.map +1 -1
- package/dist/query/confirmed-facts.d.ts +12 -58
- package/dist/query/confirmed-facts.d.ts.map +1 -1
- package/dist/query/confirmed-facts.js +8 -47
- package/dist/query/confirmed-facts.js.map +1 -1
- package/dist/query/declared-value-closure.d.ts +13 -104
- package/dist/query/declared-value-closure.d.ts.map +1 -1
- package/dist/query/declared-value-closure.js +15 -104
- package/dist/query/declared-value-closure.js.map +1 -1
- package/dist/query/memory.d.ts +5 -9
- package/dist/query/memory.d.ts.map +1 -1
- package/dist/query/memory.js +31 -15
- package/dist/query/memory.js.map +1 -1
- package/dist/query/prominence.d.ts +6 -55
- package/dist/query/prominence.d.ts.map +1 -1
- package/dist/query/prominence.js +6 -55
- package/dist/query/prominence.js.map +1 -1
- package/dist/query/provider.d.ts +28 -81
- package/dist/query/provider.d.ts.map +1 -1
- package/dist/query/provider.js +8 -29
- package/dist/query/provider.js.map +1 -1
- package/dist/query/queries.d.ts +15 -65
- package/dist/query/queries.d.ts.map +1 -1
- package/dist/query/queries.js +43 -100
- package/dist/query/queries.js.map +1 -1
- package/dist/query/refusal-fetch.d.ts +8 -85
- package/dist/query/refusal-fetch.d.ts.map +1 -1
- package/dist/query/refusal-fetch.js +11 -93
- package/dist/query/refusal-fetch.js.map +1 -1
- package/dist/query/refusal-questions.d.ts +17 -92
- package/dist/query/refusal-questions.d.ts.map +1 -1
- package/dist/query/refusal-questions.js +14 -78
- package/dist/query/refusal-questions.js.map +1 -1
- package/dist/query/resolution-floor.d.ts +3 -23
- package/dist/query/resolution-floor.d.ts.map +1 -1
- package/dist/query/resolution-floor.js +3 -23
- package/dist/query/resolution-floor.js.map +1 -1
- package/dist/query/root-cause-score.d.ts +11 -161
- package/dist/query/root-cause-score.d.ts.map +1 -1
- package/dist/query/root-cause-score.js +6 -137
- package/dist/query/root-cause-score.js.map +1 -1
- package/dist/query/row-closure-picture.d.ts +5 -67
- package/dist/query/row-closure-picture.d.ts.map +1 -1
- package/dist/query/row-closure-picture.js +6 -67
- package/dist/query/row-closure-picture.js.map +1 -1
- package/dist/query/similar-incidents.d.ts +6 -41
- package/dist/query/similar-incidents.d.ts.map +1 -1
- package/dist/query/similar-incidents.js +15 -69
- package/dist/query/similar-incidents.js.map +1 -1
- package/dist/query/sqlite.d.ts +3 -7
- package/dist/query/sqlite.d.ts.map +1 -1
- package/dist/query/sqlite.js +13 -16
- package/dist/query/sqlite.js.map +1 -1
- package/dist/query/test-coverage.d.ts +5 -45
- package/dist/query/test-coverage.d.ts.map +1 -1
- package/dist/query/test-coverage.js +10 -53
- package/dist/query/test-coverage.js.map +1 -1
- package/dist/query/traverse.d.ts +22 -126
- package/dist/query/traverse.d.ts.map +1 -1
- package/dist/query/traverse.js +0 -0
- package/dist/query/traverse.js.map +1 -1
- package/dist/query/unresolved.d.ts +19 -164
- package/dist/query/unresolved.d.ts.map +1 -1
- package/dist/query/unresolved.js +11 -138
- package/dist/query/unresolved.js.map +1 -1
- package/dist/query/verification-status.d.ts +12 -109
- package/dist/query/verification-status.d.ts.map +1 -1
- package/dist/query/verification-status.js +9 -99
- package/dist/query/verification-status.js.map +1 -1
- package/dist/recording/migrate.d.ts +4 -10
- package/dist/recording/migrate.d.ts.map +1 -1
- package/dist/recording/migrate.js +4 -10
- package/dist/recording/migrate.js.map +1 -1
- package/dist/recording/reader.d.ts +2 -7
- package/dist/recording/reader.d.ts.map +1 -1
- package/dist/recording/reader.js +2 -7
- package/dist/recording/reader.js.map +1 -1
- package/dist/recording/redact.d.ts +6 -57
- package/dist/recording/redact.d.ts.map +1 -1
- package/dist/recording/redact.js +8 -64
- package/dist/recording/redact.js.map +1 -1
- package/dist/recording/schema.d.ts +3 -38
- package/dist/recording/schema.d.ts.map +1 -1
- package/dist/recording/schema.js +3 -38
- package/dist/recording/schema.js.map +1 -1
- package/dist/recording/writer.d.ts +11 -74
- package/dist/recording/writer.d.ts.map +1 -1
- package/dist/recording/writer.js +3 -43
- package/dist/recording/writer.js.map +1 -1
- package/dist/scoping/fanout.d.ts +6 -68
- package/dist/scoping/fanout.d.ts.map +1 -1
- package/dist/scoping/fanout.js +6 -68
- package/dist/scoping/fanout.js.map +1 -1
- package/dist/scoping/score.d.ts +20 -70
- package/dist/scoping/score.d.ts.map +1 -1
- package/dist/scoping/score.js +20 -70
- package/dist/scoping/score.js.map +1 -1
- package/dist/scoping/tiers.d.ts +4 -16
- package/dist/scoping/tiers.d.ts.map +1 -1
- package/dist/scoping/tiers.js +4 -16
- package/dist/scoping/tiers.js.map +1 -1
- package/dist/scoping/traverse.d.ts +3 -25
- package/dist/scoping/traverse.d.ts.map +1 -1
- package/dist/scoping/traverse.js +14 -49
- package/dist/scoping/traverse.js.map +1 -1
- package/dist/scoping/weights.d.ts +10 -74
- package/dist/scoping/weights.d.ts.map +1 -1
- package/dist/scoping/weights.js +14 -86
- package/dist/scoping/weights.js.map +1 -1
- package/dist/sources/confirmed/incidents.d.ts +5 -35
- package/dist/sources/confirmed/incidents.d.ts.map +1 -1
- package/dist/sources/confirmed/incidents.js +14 -48
- package/dist/sources/confirmed/incidents.js.map +1 -1
- package/dist/sources/git/diff.d.ts +71 -65
- package/dist/sources/git/diff.d.ts.map +1 -1
- package/dist/sources/git/diff.js +136 -83
- package/dist/sources/git/diff.js.map +1 -1
- package/dist/sources/git/env.d.ts +7 -0
- package/dist/sources/git/env.d.ts.map +1 -1
- package/dist/sources/git/env.js +10 -11
- package/dist/sources/git/env.js.map +1 -1
- package/dist/sources/git/history.d.ts +64 -84
- package/dist/sources/git/history.d.ts.map +1 -1
- package/dist/sources/git/history.js +141 -112
- package/dist/sources/git/history.js.map +1 -1
- package/dist/sources/git/incidents.d.ts +13 -75
- package/dist/sources/git/incidents.d.ts.map +1 -1
- package/dist/sources/git/incidents.js +21 -91
- package/dist/sources/git/incidents.js.map +1 -1
- package/dist/sources/git/index.d.ts +5 -3
- package/dist/sources/git/index.d.ts.map +1 -1
- package/dist/sources/git/index.js +3 -2
- package/dist/sources/git/index.js.map +1 -1
- package/dist/sources/git/source.d.ts +9 -79
- package/dist/sources/git/source.d.ts.map +1 -1
- package/dist/sources/git/source.js +0 -0
- package/dist/sources/git/source.js.map +1 -1
- package/dist/sources/migrations/across-change.d.ts +94 -0
- package/dist/sources/migrations/across-change.d.ts.map +1 -0
- package/dist/sources/migrations/across-change.js +278 -0
- package/dist/sources/migrations/across-change.js.map +1 -0
- package/dist/sources/migrations/dialects.d.ts +20 -36
- package/dist/sources/migrations/dialects.d.ts.map +1 -1
- package/dist/sources/migrations/dialects.js +11 -36
- package/dist/sources/migrations/dialects.js.map +1 -1
- package/dist/sources/migrations/index.d.ts +3 -1
- package/dist/sources/migrations/index.d.ts.map +1 -1
- package/dist/sources/migrations/index.js +2 -1
- package/dist/sources/migrations/index.js.map +1 -1
- package/dist/sources/migrations/read.d.ts +14 -79
- package/dist/sources/migrations/read.d.ts.map +1 -1
- package/dist/sources/migrations/read.js +14 -89
- package/dist/sources/migrations/read.js.map +1 -1
- package/dist/sources/workspace/workspace.d.ts +6 -42
- package/dist/sources/workspace/workspace.d.ts.map +1 -1
- package/dist/sources/workspace/workspace.js +10 -53
- package/dist/sources/workspace/workspace.js.map +1 -1
- package/dist/store/driver/driver.d.ts +9 -38
- package/dist/store/driver/driver.d.ts.map +1 -1
- package/dist/store/driver/driver.js +4 -22
- package/dist/store/driver/driver.js.map +1 -1
- package/dist/store/driver/node-sqlite.d.ts +3 -12
- package/dist/store/driver/node-sqlite.d.ts.map +1 -1
- package/dist/store/driver/node-sqlite.js +4 -18
- package/dist/store/driver/node-sqlite.js.map +1 -1
- package/dist/store/index.d.ts +2 -7
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +4 -10
- package/dist/store/index.js.map +1 -1
- package/dist/store/migrate.d.ts +14 -50
- package/dist/store/migrate.d.ts.map +1 -1
- package/dist/store/migrate.js +15 -52
- package/dist/store/migrate.js.map +1 -1
- package/dist/store/reader.d.ts +19 -84
- package/dist/store/reader.d.ts.map +1 -1
- package/dist/store/reader.js +25 -92
- package/dist/store/reader.js.map +1 -1
- package/dist/store/schema.d.ts +14 -76
- package/dist/store/schema.d.ts.map +1 -1
- package/dist/store/schema.js +14 -76
- package/dist/store/schema.js.map +1 -1
- package/dist/store/writer.d.ts +14 -88
- package/dist/store/writer.d.ts.map +1 -1
- package/dist/store/writer.js +29 -123
- package/dist/store/writer.js.map +1 -1
- package/dist/tiers/certify.d.ts +46 -281
- package/dist/tiers/certify.d.ts.map +1 -1
- package/dist/tiers/certify.js +46 -226
- package/dist/tiers/certify.js.map +1 -1
- package/dist/tiers/ladder.d.ts +7 -51
- package/dist/tiers/ladder.d.ts.map +1 -1
- package/dist/tiers/ladder.js +13 -89
- package/dist/tiers/ladder.js.map +1 -1
- package/dist/validation/attributes.d.ts +47 -0
- package/dist/validation/attributes.d.ts.map +1 -0
- package/dist/validation/attributes.js +130 -0
- package/dist/validation/attributes.js.map +1 -0
- package/dist/validation/config-graph.d.ts +7 -56
- package/dist/validation/config-graph.d.ts.map +1 -1
- package/dist/validation/config-graph.js +15 -61
- package/dist/validation/config-graph.js.map +1 -1
- package/dist/validation/env.d.ts +53 -2
- package/dist/validation/env.d.ts.map +1 -1
- package/dist/validation/env.js +99 -4
- package/dist/validation/env.js.map +1 -1
- package/dist/validation/index.d.ts +5 -1
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +3 -1
- package/dist/validation/index.js.map +1 -1
- package/dist/validation/join-substitution.d.ts +22 -120
- package/dist/validation/join-substitution.d.ts.map +1 -1
- package/dist/validation/join-substitution.js +13 -90
- package/dist/validation/join-substitution.js.map +1 -1
- package/dist/validation/migration-integrity.d.ts +72 -0
- package/dist/validation/migration-integrity.d.ts.map +1 -0
- package/dist/validation/migration-integrity.js +238 -0
- package/dist/validation/migration-integrity.js.map +1 -0
- package/dist/validation/migrations.d.ts +23 -88
- package/dist/validation/migrations.d.ts.map +1 -1
- package/dist/validation/migrations.js +20 -79
- package/dist/validation/migrations.js.map +1 -1
- package/dist/validation/nodes.d.ts +3 -1
- package/dist/validation/nodes.d.ts.map +1 -1
- package/dist/validation/nodes.js +3 -1
- package/dist/validation/nodes.js.map +1 -1
- package/dist/validation/rollback.d.ts +10 -73
- package/dist/validation/rollback.d.ts.map +1 -1
- package/dist/validation/rollback.js +23 -81
- package/dist/validation/rollback.js.map +1 -1
- package/dist/validation/route-drift.d.ts +9 -62
- package/dist/validation/route-drift.d.ts.map +1 -1
- package/dist/validation/route-drift.js +7 -52
- package/dist/validation/route-drift.js.map +1 -1
- package/dist/validation/sources.d.ts +16 -94
- package/dist/validation/sources.d.ts.map +1 -1
- package/dist/validation/sources.js +51 -147
- package/dist/validation/sources.js.map +1 -1
- package/dist/worker/pool.d.ts +6 -45
- package/dist/worker/pool.d.ts.map +1 -1
- package/dist/worker/pool.js +5 -42
- package/dist/worker/pool.js.map +1 -1
- package/dist/worker/protocol.d.ts +7 -20
- package/dist/worker/protocol.d.ts.map +1 -1
- package/dist/worker/protocol.js +3 -10
- package/dist/worker/protocol.js.map +1 -1
- package/dist/worker/traversal.worker.d.ts +2 -21
- package/dist/worker/traversal.worker.d.ts.map +1 -1
- package/dist/worker/traversal.worker.js +4 -23
- package/dist/worker/traversal.worker.js.map +1 -1
- package/package.json +11 -2
|
@@ -1,138 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* RootCauseScore = RuntimeEvidence + GraphDistance + ChangeCoupling + IncidentCorrelation
|
|
6
|
-
* ```
|
|
7
|
-
*
|
|
8
|
-
* §18.3 establishes why ranking exists at all: traversal alone returns a
|
|
9
|
-
* *path*, not a culprit. A five-hop chain has five candidate locations, and
|
|
10
|
-
* presenting all five is diagnostically equivalent to presenting none.
|
|
11
|
-
*
|
|
12
|
-
* ## Reuses three existing queries — does not re-derive them
|
|
13
|
-
*
|
|
14
|
-
* `documents/decisions-inbox/NOTE-4-correlation-graph-integration-prep.md`
|
|
15
|
-
* §1 maps three of the four terms onto queries this package already has,
|
|
16
|
-
* checked line by line against `queries.ts` rather than assumed:
|
|
17
|
-
*
|
|
18
|
-
* | Term | Query | Role here |
|
|
19
|
-
* | --- | --- | --- |
|
|
20
|
-
* | `GraphDistance` | `weightedBfs` (`impactOf`'s own underlying primitive, called directly — see below) | `direction: "out"`, walking `CALLS`/`USES_API`/`SERVES_API` from the failure point toward the deep implementation — §18.3's own worked example, and its own hop×confidence-decayed `score` is used as-is. |
|
|
21
|
-
* | `ChangeCoupling` | `changesWith` | Was this candidate, or a co-change partner of it, in the current diff. |
|
|
22
|
-
* | `IncidentCorrelation` | `rootCauseSearch` | Structural half only — inherits that query's own disclosed gap (no vector store, §8.2) unchanged. |
|
|
23
|
-
* | `RuntimeEvidence` | **none, and none should exist here** | See below. |
|
|
24
|
-
*
|
|
25
|
-
* **`weightedBfs` directly, not `impactOf`** — a deliberate, narrow deviation
|
|
26
|
-
* from "reuses, does not re-derive." `RankedRootCauseCandidate.path` (the
|
|
27
|
-
* real hop-by-hop `GraphPathHop[]` `Finding.graphPath` needs,
|
|
28
|
-
* `documents/decisions-inbox/DEC-D-NEXT-graph-path-hop-reconstruction.md`,
|
|
29
|
-
* `descry-desktop`) is reconstructed by walking `Reached.via`'s parent
|
|
30
|
-
* pointers back to the seed — the exact traversal that produced `depth`/
|
|
31
|
-
* `score`. `impactOf` discards `via` in its own `hydrate()` step before this
|
|
32
|
-
* module ever sees the result, so getting it means calling `weightedBfs`
|
|
33
|
-
* itself. The scoring math is not re-derived — `entry.score`/`entry.depth`
|
|
34
|
-
* are still `weightedBfs`'s own values, used as-is, same as before; only the
|
|
35
|
-
* thin hydrate-plus-note wrapper `impactOf` adds is now inlined here so the
|
|
36
|
-
* `via` chain survives.
|
|
37
|
-
*
|
|
38
|
-
* `RootCauseScore`'s own walk crosses the `SERVES_API` join the same way
|
|
39
|
-
* §18.3's example does: `SERVES_API` is stored route → endpoint
|
|
40
|
-
* (`queries.ts`'s own comment), so a plain `direction: "out"` walk reaches
|
|
41
|
-
* the endpoint from a caller's `USES_API` edge and stops — it never looks
|
|
42
|
-
* incoming at that one node to find the route serving it. `crossApiEndpoint`
|
|
43
|
-
* (DEC-138) is passed through for exactly this reason; without it, this
|
|
44
|
-
* module's own fixture (`InvoicePage → deleteInvoice → DELETE
|
|
45
|
-
* /invoice/:id`) would never reach `InvoiceController`/`InvoiceService` at
|
|
46
|
-
* all, and the architecture's own worked example would not walk. The join
|
|
47
|
-
* crossover means a hop's own `from`/`to` sometimes runs opposite the walk's
|
|
48
|
-
* direction (the route→endpoint edge is walked endpoint→controller) — `path`
|
|
49
|
-
* reports the edge exactly as stored, never flipped to look like a forward
|
|
50
|
-
* chain that was never actually walked that way; see `pathTo`'s own comment.
|
|
51
|
-
*
|
|
52
|
-
* ## `RuntimeEvidence` is a precondition, never a fourth addend — read this before changing anything
|
|
53
|
-
*
|
|
54
|
-
* NOTE-4 §5 settles this and `ai-layer-plan.md` §5 (G3) preserves it: a
|
|
55
|
-
* candidate with maximal `GraphDistance + ChangeCoupling + IncidentCorrelation`
|
|
56
|
-
* and zero `RuntimeEvidence` is a plausible guess ranked well, and it must
|
|
57
|
-
* **never** reach `confirmed` however the other three terms sum — because
|
|
58
|
-
* summing all four together *is* the failure mode where a well-ranked guess
|
|
59
|
-
* reads as an established fact. DEC-276 encodes the same rule one layer up
|
|
60
|
-
* as `E == 0 → unconfirmed`.
|
|
61
|
-
*
|
|
62
|
-
* So this module never computes `structuralScore + runtimeEvidence` — not
|
|
63
|
-
* as an internal step, not as a returned field, nowhere. Two design choices
|
|
64
|
-
* make this a **type constraint**, not just a documented convention (proven
|
|
65
|
-
* by a `@ts-expect-error` test in this module's test file, checked by
|
|
66
|
-
* `tsc`, not merely asserted at runtime):
|
|
67
|
-
*
|
|
68
|
-
* 1. `structuralScore: number` carries only `GraphDistance + ChangeCoupling
|
|
69
|
-
* + IncidentCorrelation`. Nothing runtime-evidence-shaped is a term in
|
|
70
|
-
* it, ever.
|
|
71
|
-
* 2. `namedByEvidence: readonly string[]` — the verbatim evidence
|
|
72
|
-
* descriptions naming this exact candidate, supplied by the caller
|
|
73
|
-
* (`descry-runtime`'s evidence-to-node resolution; NOTE-4 §2 is explicit
|
|
74
|
-
* that no graph query for this term exists or should — it is not a
|
|
75
|
-
* graph fact). A `string[]`, not a `number` or a boolean count:
|
|
76
|
-
* `structuralScore + namedByEvidence` does not typecheck, so a caller
|
|
77
|
-
* cannot casually fold it into the ranking arithmetic by accident. A
|
|
78
|
-
* caller who really wants to misuse it has to write new code to do so —
|
|
79
|
-
* this module supplies no field shaped like the thing G3 forbids
|
|
80
|
-
* summing.
|
|
81
|
-
*
|
|
82
|
-
* §18.3a's own table still calls `RuntimeEvidence` *"the strongest
|
|
83
|
-
* signal"* — a node named directly in a backend log outranks one merely on
|
|
84
|
-
* the path. That is honored **as a sort key, not a score term**:
|
|
85
|
-
* `namedByEvidence`-non-empty candidates sort before every candidate
|
|
86
|
-
* without it, and only within each of those two groups does
|
|
87
|
-
* `structuralScore` decide. Categorical partitioning, never arithmetic
|
|
88
|
-
* combination — the distinction NOTE-4 §5 draws is preserved exactly.
|
|
89
|
-
*
|
|
90
|
-
* `RootCauseScore` the architecture names is therefore not a function this
|
|
91
|
-
* module returns as one number. It ranks; a gate above this layer (G3/G4,
|
|
92
|
-
* `descry-runtime`/the pipeline) decides what `namedByEvidence` and the
|
|
93
|
-
* finding's actual evidence bundle are allowed to promote — this module
|
|
94
|
-
* does not gate and does not categorise.
|
|
95
|
-
*
|
|
96
|
-
* ## The resolution caveat (§18.3)
|
|
97
|
-
*
|
|
98
|
-
* *"At R0/R1 the tracer will lose the trail at the first cross-file call
|
|
99
|
-
* and must say 'trace stopped here' rather than presenting a truncated
|
|
100
|
-
* chain as complete."* When the traversal's own resolution floor is R0/R1,
|
|
101
|
-
* a note says so in those words — in addition to, not instead of,
|
|
102
|
-
* `impactOf`'s own disclosure, which explains *why* (cross-file calls are
|
|
103
|
-
* not reliably resolved at that level).
|
|
104
|
-
*
|
|
105
|
-
* ## Weights are starting values, not measurements
|
|
106
|
-
*
|
|
107
|
-
* `CLAUDE.md`: *"Numbers in the docs are targets or starting values, not
|
|
108
|
-
* measurements."* `DEFAULT_ROOT_CAUSE_WEIGHTS` and `INCIDENT_SATURATION`
|
|
109
|
-
* below are exactly that — picked, not measured, gathered into one named
|
|
110
|
-
* block rather than left as literals in the arithmetic so the next reader
|
|
111
|
-
* can find and tune them without reading the function body.
|
|
2
|
+
* RootCauseScore = RuntimeEvidence + GraphDistance + ChangeCoupling + IncidentCorrelation (§18.3a).
|
|
3
|
+
* RuntimeEvidence is never summed in — `namedByEvidence` is a sort key only (DEC-276: E==0 → unconfirmed).
|
|
4
|
+
* Weights/INCIDENT_SATURATION below are unmeasured starting values.
|
|
112
5
|
*/
|
|
113
6
|
import type { EdgeType, GraphPathHop, IRNode, ResolutionLevel } from "@descryy/ir";
|
|
114
7
|
import type { AdjacencyProvider } from "./provider.ts";
|
|
115
8
|
import { type RootCauseMatch } from "./queries.ts";
|
|
116
9
|
/** §18.3's own walk: from the failure point toward the deep implementation. */
|
|
117
10
|
export declare const ROOT_CAUSE_TRACE_EDGE_TYPES: readonly EdgeType[];
|
|
118
|
-
/**
|
|
119
|
-
* The three structural terms' multipliers. **Unmeasured starting values**
|
|
120
|
-
* (`CLAUDE.md`'s own rule) — tune from data, not intuition, once golden
|
|
121
|
-
* investigations (`ai-layer-plan.md` §9 layer 4) exist to tune against.
|
|
122
|
-
*/
|
|
11
|
+
/** Multipliers for the three structural terms. Unmeasured starting values — tune from data, not intuition. */
|
|
123
12
|
export interface RootCauseWeights {
|
|
124
13
|
readonly graphDistance: number;
|
|
125
14
|
readonly changeCoupling: number;
|
|
126
15
|
readonly incidentCorrelation: number;
|
|
127
16
|
}
|
|
128
17
|
export declare const DEFAULT_ROOT_CAUSE_WEIGHTS: RootCauseWeights;
|
|
129
|
-
/**
|
|
130
|
-
* How many correlated incidents saturate `IncidentCorrelation`'s raw 0–1
|
|
131
|
-
* contribution. Unmeasured, same rule as the weights above: a candidate
|
|
132
|
-
* with dozens of correlated incidents should not dominate the ranking
|
|
133
|
-
* arithmetically more than one with a handful, so the raw count is capped
|
|
134
|
-
* before it is weighted.
|
|
135
|
-
*/
|
|
18
|
+
/** How many correlated incidents saturate `IncidentCorrelation`'s 0–1 contribution. Unmeasured, caps raw count before weighting. */
|
|
136
19
|
export declare const INCIDENT_SATURATION = 3;
|
|
137
20
|
/** Why a candidate's `ChangeCoupling` term is nonzero — a fact worth keeping, not just a number. */
|
|
138
21
|
export type ChangeCouplingEvidence = {
|
|
@@ -151,52 +34,24 @@ export interface RootCauseOptions {
|
|
|
151
34
|
readonly budget?: number;
|
|
152
35
|
/** Node ids the current diff touches directly — `ChangeCoupling`'s "in the current diff" half. */
|
|
153
36
|
readonly changedIds?: ReadonlySet<string>;
|
|
154
|
-
/**
|
|
155
|
-
* Verbatim evidence descriptions, keyed by the exact node id they name
|
|
156
|
-
* directly — supplied by the caller, never computed here. See the module
|
|
157
|
-
* header: this is not a graph fact, and no query for it exists in this
|
|
158
|
-
* package.
|
|
159
|
-
*/
|
|
37
|
+
/** Verbatim evidence descriptions keyed by node id — supplied by the caller, never computed here (not a graph fact). */
|
|
160
38
|
readonly namedByEvidence?: ReadonlyMap<string, readonly string[]>;
|
|
161
39
|
}
|
|
162
40
|
export interface RankedRootCauseCandidate {
|
|
163
41
|
readonly node: IRNode;
|
|
164
42
|
/** Hops from the failure point along the traced walk. 0 at the failure point itself. */
|
|
165
43
|
readonly depth: number;
|
|
166
|
-
/**
|
|
167
|
-
* `GraphDistance + ChangeCoupling + IncidentCorrelation`, weighted.
|
|
168
|
-
* **Never** includes `RuntimeEvidence` — see the module header.
|
|
169
|
-
*/
|
|
44
|
+
/** `GraphDistance + ChangeCoupling + IncidentCorrelation`, weighted. Never includes `RuntimeEvidence`. */
|
|
170
45
|
readonly structuralScore: number;
|
|
171
46
|
readonly changeCoupling: ChangeCouplingEvidence | null;
|
|
172
47
|
readonly correlatedIncidents: readonly RootCauseMatch[];
|
|
173
|
-
/**
|
|
174
|
-
* Verbatim evidence naming this exact candidate. Empty, never omitted,
|
|
175
|
-
* when none. A precondition for promotion elsewhere (NOTE-4 §5, G3,
|
|
176
|
-
* DEC-276) — never a term in `structuralScore`.
|
|
177
|
-
*/
|
|
48
|
+
/** Verbatim evidence naming this candidate. Empty, never omitted, when none — precondition for promotion (NOTE-4 §5, DEC-276), never a `structuralScore` term. */
|
|
178
49
|
readonly namedByEvidence: readonly string[];
|
|
179
50
|
/** The candidate node's own resolution — a fact stored on it directly, not re-derived. */
|
|
180
51
|
readonly resolution: ResolutionLevel;
|
|
181
|
-
/**
|
|
182
|
-
* `true` when `depth === 0` — this candidate *is* the failure point, and
|
|
183
|
-
* `resolution` above is that single node's own fact, not the minimum over
|
|
184
|
-
* any traced hop. `DEC-NEXT-empty-graph-path-resolution-floor.md` ruled
|
|
185
|
-
* that a zero-hop path caps reliability at the same class as a
|
|
186
|
-
* genuinely-but-badly-resolved one, but the two are not the same claim —
|
|
187
|
-
* this field is what lets a caller (`reliabilityNote()`'s `emptyPath`
|
|
188
|
-
* parameter, `@descryy/ir`) say which one happened, rather than
|
|
189
|
-
* inferring it from `depth === 0` at every call site. Never `true` for a
|
|
190
|
-
* deeper candidate: at least one hop was traced to reach it, however
|
|
191
|
-
* poorly that hop resolved.
|
|
192
|
-
*/
|
|
52
|
+
/** `true` when `depth === 0` (this candidate is the failure point itself). Distinguishes a zero-hop path from a badly-resolved one (`DEC-NEXT-empty-graph-path-resolution-floor.md`). */
|
|
193
53
|
readonly emptyPath: boolean;
|
|
194
|
-
/**
|
|
195
|
-
* The real, walked hop-by-hop chain from the failure point to this
|
|
196
|
-
* candidate — `Finding.graphPath`'s own source. Empty exactly when
|
|
197
|
-
* `emptyPath` is `true`. Reconstructed from `weightedBfs`'s own `via`
|
|
198
|
-
* chain, not a second independent walk — see the module header.
|
|
199
|
-
*/
|
|
54
|
+
/** Walked hop-by-hop chain to this candidate (`Finding.graphPath`'s source); empty iff `emptyPath`. Reconstructed from `weightedBfs`'s `via` chain. */
|
|
200
55
|
readonly path: readonly GraphPathHop[];
|
|
201
56
|
}
|
|
202
57
|
export interface RootCauseRanking {
|
|
@@ -208,11 +63,6 @@ export interface RootCauseRanking {
|
|
|
208
63
|
readonly truncated: boolean;
|
|
209
64
|
readonly notes: readonly string[];
|
|
210
65
|
}
|
|
211
|
-
/**
|
|
212
|
-
* Rank the candidates reachable from `failurePoint` by the three structural
|
|
213
|
-
* terms of `RootCauseScore` (architecture §18.3a). See the module header
|
|
214
|
-
* for why `RuntimeEvidence` is deliberately absent from the arithmetic and
|
|
215
|
-
* present only as `namedByEvidence`, a categorical sort key.
|
|
216
|
-
*/
|
|
66
|
+
/** Ranks candidates reachable from `failurePoint` by the three structural terms of `RootCauseScore` (§18.3a). */
|
|
217
67
|
export declare function rankRootCause(provider: AdjacencyProvider, failurePoint: string, options?: RootCauseOptions): RootCauseRanking;
|
|
218
68
|
//# sourceMappingURL=root-cause-score.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root-cause-score.d.ts","sourceRoot":"","sources":["../../src/query/root-cause-score.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"root-cause-score.d.ts","sourceRoot":"","sources":["../../src/query/root-cause-score.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAgC,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAGjF,+EAA+E;AAC/E,eAAO,MAAM,2BAA2B,EAAE,SAAS,QAAQ,EAAwC,CAAC;AAEpG,8GAA8G;AAC9G,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;CACtC;AAED,eAAO,MAAM,0BAA0B,EAAE,gBAIxC,CAAC;AAEF,oIAAoI;AACpI,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAIrC,oGAAoG;AACpG,MAAM,MAAM,sBAAsB,GAC9B;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAA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AM,CAAC;IAChC,2FAA2F;IAC3F,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAsCD,iHAAiH;AACjH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,iBAAiB,EAC3B,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,gBAAqB,GAC7B,gBAAgB,CA8ElB"}
|
|
@@ -1,114 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* RootCauseScore = RuntimeEvidence + GraphDistance + ChangeCoupling + IncidentCorrelation
|
|
6
|
-
* ```
|
|
7
|
-
*
|
|
8
|
-
* §18.3 establishes why ranking exists at all: traversal alone returns a
|
|
9
|
-
* *path*, not a culprit. A five-hop chain has five candidate locations, and
|
|
10
|
-
* presenting all five is diagnostically equivalent to presenting none.
|
|
11
|
-
*
|
|
12
|
-
* ## Reuses three existing queries — does not re-derive them
|
|
13
|
-
*
|
|
14
|
-
* `documents/decisions-inbox/NOTE-4-correlation-graph-integration-prep.md`
|
|
15
|
-
* §1 maps three of the four terms onto queries this package already has,
|
|
16
|
-
* checked line by line against `queries.ts` rather than assumed:
|
|
17
|
-
*
|
|
18
|
-
* | Term | Query | Role here |
|
|
19
|
-
* | --- | --- | --- |
|
|
20
|
-
* | `GraphDistance` | `weightedBfs` (`impactOf`'s own underlying primitive, called directly — see below) | `direction: "out"`, walking `CALLS`/`USES_API`/`SERVES_API` from the failure point toward the deep implementation — §18.3's own worked example, and its own hop×confidence-decayed `score` is used as-is. |
|
|
21
|
-
* | `ChangeCoupling` | `changesWith` | Was this candidate, or a co-change partner of it, in the current diff. |
|
|
22
|
-
* | `IncidentCorrelation` | `rootCauseSearch` | Structural half only — inherits that query's own disclosed gap (no vector store, §8.2) unchanged. |
|
|
23
|
-
* | `RuntimeEvidence` | **none, and none should exist here** | See below. |
|
|
24
|
-
*
|
|
25
|
-
* **`weightedBfs` directly, not `impactOf`** — a deliberate, narrow deviation
|
|
26
|
-
* from "reuses, does not re-derive." `RankedRootCauseCandidate.path` (the
|
|
27
|
-
* real hop-by-hop `GraphPathHop[]` `Finding.graphPath` needs,
|
|
28
|
-
* `documents/decisions-inbox/DEC-D-NEXT-graph-path-hop-reconstruction.md`,
|
|
29
|
-
* `descry-desktop`) is reconstructed by walking `Reached.via`'s parent
|
|
30
|
-
* pointers back to the seed — the exact traversal that produced `depth`/
|
|
31
|
-
* `score`. `impactOf` discards `via` in its own `hydrate()` step before this
|
|
32
|
-
* module ever sees the result, so getting it means calling `weightedBfs`
|
|
33
|
-
* itself. The scoring math is not re-derived — `entry.score`/`entry.depth`
|
|
34
|
-
* are still `weightedBfs`'s own values, used as-is, same as before; only the
|
|
35
|
-
* thin hydrate-plus-note wrapper `impactOf` adds is now inlined here so the
|
|
36
|
-
* `via` chain survives.
|
|
37
|
-
*
|
|
38
|
-
* `RootCauseScore`'s own walk crosses the `SERVES_API` join the same way
|
|
39
|
-
* §18.3's example does: `SERVES_API` is stored route → endpoint
|
|
40
|
-
* (`queries.ts`'s own comment), so a plain `direction: "out"` walk reaches
|
|
41
|
-
* the endpoint from a caller's `USES_API` edge and stops — it never looks
|
|
42
|
-
* incoming at that one node to find the route serving it. `crossApiEndpoint`
|
|
43
|
-
* (DEC-138) is passed through for exactly this reason; without it, this
|
|
44
|
-
* module's own fixture (`InvoicePage → deleteInvoice → DELETE
|
|
45
|
-
* /invoice/:id`) would never reach `InvoiceController`/`InvoiceService` at
|
|
46
|
-
* all, and the architecture's own worked example would not walk. The join
|
|
47
|
-
* crossover means a hop's own `from`/`to` sometimes runs opposite the walk's
|
|
48
|
-
* direction (the route→endpoint edge is walked endpoint→controller) — `path`
|
|
49
|
-
* reports the edge exactly as stored, never flipped to look like a forward
|
|
50
|
-
* chain that was never actually walked that way; see `pathTo`'s own comment.
|
|
51
|
-
*
|
|
52
|
-
* ## `RuntimeEvidence` is a precondition, never a fourth addend — read this before changing anything
|
|
53
|
-
*
|
|
54
|
-
* NOTE-4 §5 settles this and `ai-layer-plan.md` §5 (G3) preserves it: a
|
|
55
|
-
* candidate with maximal `GraphDistance + ChangeCoupling + IncidentCorrelation`
|
|
56
|
-
* and zero `RuntimeEvidence` is a plausible guess ranked well, and it must
|
|
57
|
-
* **never** reach `confirmed` however the other three terms sum — because
|
|
58
|
-
* summing all four together *is* the failure mode where a well-ranked guess
|
|
59
|
-
* reads as an established fact. DEC-276 encodes the same rule one layer up
|
|
60
|
-
* as `E == 0 → unconfirmed`.
|
|
61
|
-
*
|
|
62
|
-
* So this module never computes `structuralScore + runtimeEvidence` — not
|
|
63
|
-
* as an internal step, not as a returned field, nowhere. Two design choices
|
|
64
|
-
* make this a **type constraint**, not just a documented convention (proven
|
|
65
|
-
* by a `@ts-expect-error` test in this module's test file, checked by
|
|
66
|
-
* `tsc`, not merely asserted at runtime):
|
|
67
|
-
*
|
|
68
|
-
* 1. `structuralScore: number` carries only `GraphDistance + ChangeCoupling
|
|
69
|
-
* + IncidentCorrelation`. Nothing runtime-evidence-shaped is a term in
|
|
70
|
-
* it, ever.
|
|
71
|
-
* 2. `namedByEvidence: readonly string[]` — the verbatim evidence
|
|
72
|
-
* descriptions naming this exact candidate, supplied by the caller
|
|
73
|
-
* (`descry-runtime`'s evidence-to-node resolution; NOTE-4 §2 is explicit
|
|
74
|
-
* that no graph query for this term exists or should — it is not a
|
|
75
|
-
* graph fact). A `string[]`, not a `number` or a boolean count:
|
|
76
|
-
* `structuralScore + namedByEvidence` does not typecheck, so a caller
|
|
77
|
-
* cannot casually fold it into the ranking arithmetic by accident. A
|
|
78
|
-
* caller who really wants to misuse it has to write new code to do so —
|
|
79
|
-
* this module supplies no field shaped like the thing G3 forbids
|
|
80
|
-
* summing.
|
|
81
|
-
*
|
|
82
|
-
* §18.3a's own table still calls `RuntimeEvidence` *"the strongest
|
|
83
|
-
* signal"* — a node named directly in a backend log outranks one merely on
|
|
84
|
-
* the path. That is honored **as a sort key, not a score term**:
|
|
85
|
-
* `namedByEvidence`-non-empty candidates sort before every candidate
|
|
86
|
-
* without it, and only within each of those two groups does
|
|
87
|
-
* `structuralScore` decide. Categorical partitioning, never arithmetic
|
|
88
|
-
* combination — the distinction NOTE-4 §5 draws is preserved exactly.
|
|
89
|
-
*
|
|
90
|
-
* `RootCauseScore` the architecture names is therefore not a function this
|
|
91
|
-
* module returns as one number. It ranks; a gate above this layer (G3/G4,
|
|
92
|
-
* `descry-runtime`/the pipeline) decides what `namedByEvidence` and the
|
|
93
|
-
* finding's actual evidence bundle are allowed to promote — this module
|
|
94
|
-
* does not gate and does not categorise.
|
|
95
|
-
*
|
|
96
|
-
* ## The resolution caveat (§18.3)
|
|
97
|
-
*
|
|
98
|
-
* *"At R0/R1 the tracer will lose the trail at the first cross-file call
|
|
99
|
-
* and must say 'trace stopped here' rather than presenting a truncated
|
|
100
|
-
* chain as complete."* When the traversal's own resolution floor is R0/R1,
|
|
101
|
-
* a note says so in those words — in addition to, not instead of,
|
|
102
|
-
* `impactOf`'s own disclosure, which explains *why* (cross-file calls are
|
|
103
|
-
* not reliably resolved at that level).
|
|
104
|
-
*
|
|
105
|
-
* ## Weights are starting values, not measurements
|
|
106
|
-
*
|
|
107
|
-
* `CLAUDE.md`: *"Numbers in the docs are targets or starting values, not
|
|
108
|
-
* measurements."* `DEFAULT_ROOT_CAUSE_WEIGHTS` and `INCIDENT_SATURATION`
|
|
109
|
-
* below are exactly that — picked, not measured, gathered into one named
|
|
110
|
-
* block rather than left as literals in the arithmetic so the next reader
|
|
111
|
-
* can find and tune them without reading the function body.
|
|
2
|
+
* RootCauseScore = RuntimeEvidence + GraphDistance + ChangeCoupling + IncidentCorrelation (§18.3a).
|
|
3
|
+
* RuntimeEvidence is never summed in — `namedByEvidence` is a sort key only (DEC-276: E==0 → unconfirmed).
|
|
4
|
+
* Weights/INCIDENT_SATURATION below are unmeasured starting values.
|
|
112
5
|
*/
|
|
113
6
|
import { changesWith, rootCauseSearch } from "./queries.js";
|
|
114
7
|
import { weightedBfs } from "./traverse.js";
|
|
@@ -119,13 +12,7 @@ export const DEFAULT_ROOT_CAUSE_WEIGHTS = {
|
|
|
119
12
|
changeCoupling: 0.6,
|
|
120
13
|
incidentCorrelation: 0.8,
|
|
121
14
|
};
|
|
122
|
-
/**
|
|
123
|
-
* How many correlated incidents saturate `IncidentCorrelation`'s raw 0–1
|
|
124
|
-
* contribution. Unmeasured, same rule as the weights above: a candidate
|
|
125
|
-
* with dozens of correlated incidents should not dominate the ranking
|
|
126
|
-
* arithmetically more than one with a handful, so the raw count is capped
|
|
127
|
-
* before it is weighted.
|
|
128
|
-
*/
|
|
15
|
+
/** How many correlated incidents saturate `IncidentCorrelation`'s 0–1 contribution. Unmeasured, caps raw count before weighting. */
|
|
129
16
|
export const INCIDENT_SATURATION = 3;
|
|
130
17
|
const DEFAULT_TOP_N = 5;
|
|
131
18
|
function changeCouplingFor(provider, candidateId, changedIds) {
|
|
@@ -146,20 +33,7 @@ function rawChangeCoupling(evidence) {
|
|
|
146
33
|
return 0;
|
|
147
34
|
return evidence.kind === "direct" ? 1 : evidence.confidence;
|
|
148
35
|
}
|
|
149
|
-
/**
|
|
150
|
-
* Walks `reachedById`'s `via` parent pointers from `targetId` back to the
|
|
151
|
-
* seed (`via === null`), returning the hops in seed-to-target order.
|
|
152
|
-
*
|
|
153
|
-
* The edge stored at each step is reported exactly as `IREdge` has it
|
|
154
|
-
* (`from`/`to` never flipped) — at a `crossApiEndpoint` join the walk can
|
|
155
|
-
* arrive at a node via an edge whose *stored* direction runs the other way
|
|
156
|
-
* (the route→endpoint `SERVES_API` edge, walked endpoint→controller), and
|
|
157
|
-
* `next`/`via` in `neighbours()` already account for that: `entry.id`
|
|
158
|
-
* (the node this hop reached) equals exactly one of `via.from`/`via.to`, and
|
|
159
|
-
* the other end is always the parent — regardless of which direction the
|
|
160
|
-
* walk actually moved. That is the rule this function uses, rather than
|
|
161
|
-
* assuming `via.from` is always the parent.
|
|
162
|
-
*/
|
|
36
|
+
/** Walks `via` pointers from `targetId` to the seed (hops seed-to-target); edges reported exactly as stored, never flipped. */
|
|
163
37
|
function pathTo(reachedById, targetId) {
|
|
164
38
|
const hops = [];
|
|
165
39
|
let currentId = targetId;
|
|
@@ -173,12 +47,7 @@ function pathTo(reachedById, targetId) {
|
|
|
173
47
|
}
|
|
174
48
|
return hops.reverse();
|
|
175
49
|
}
|
|
176
|
-
/**
|
|
177
|
-
* Rank the candidates reachable from `failurePoint` by the three structural
|
|
178
|
-
* terms of `RootCauseScore` (architecture §18.3a). See the module header
|
|
179
|
-
* for why `RuntimeEvidence` is deliberately absent from the arithmetic and
|
|
180
|
-
* present only as `namedByEvidence`, a categorical sort key.
|
|
181
|
-
*/
|
|
50
|
+
/** Ranks candidates reachable from `failurePoint` by the three structural terms of `RootCauseScore` (§18.3a). */
|
|
182
51
|
export function rankRootCause(provider, failurePoint, options = {}) {
|
|
183
52
|
const weights = options.weights ?? DEFAULT_ROOT_CAUSE_WEIGHTS;
|
|
184
53
|
const topN = Math.max(0, Math.floor(options.topN ?? DEFAULT_TOP_N));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root-cause-score.js","sourceRoot":"","sources":["../../src/query/root-cause-score.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"root-cause-score.js","sourceRoot":"","sources":["../../src/query/root-cause-score.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,WAAW,EAAE,eAAe,EAAuB,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,WAAW,EAAgB,MAAM,eAAe,CAAC;AAE1D,+EAA+E;AAC/E,MAAM,CAAC,MAAM,2BAA2B,GAAwB,CAAC,OAAO,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;AASpG,MAAM,CAAC,MAAM,0BAA0B,GAAqB;IAC1D,aAAa,EAAE,CAAC;IAChB,cAAc,EAAE,GAAG;IACnB,m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AC;QACjC,KAAK,CAAC,IAAI,CACR,0DAA0D,OAAO,CAAC,eAAe,UAAU;YACzF,yFAAyF;YACzF,sFAAsF;YACtF,8EAA8E,CACjF,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACrC,OAAO;QACL,MAAM;QACN,cAAc,EAAE,MAAM,CAAC,MAAM;QAC7B,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM;QAC7D,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -1,56 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* DEC-244
|
|
3
|
-
* evidence at once,
|
|
4
|
-
*
|
|
5
|
-
* `applyDeclaredValues` (`declared-value-closure.ts`) answers from `.env*`
|
|
6
|
-
* config alone. `applyConfirmedFacts` (`confirmed-facts.ts`) answers from
|
|
7
|
-
* human testimony alone, and — since `ConfirmedFact.environment` landed —
|
|
8
|
-
* testimony can now be scoped to a *named* environment, not just an unscoped
|
|
9
|
-
* blanket answer. This module is the picture that shows both kinds of
|
|
10
|
-
* evidence side by side, per environment, without ever letting one stand in
|
|
11
|
-
* for the other.
|
|
12
|
-
*
|
|
13
|
-
* ## The real case that forced this shape
|
|
14
|
-
*
|
|
15
|
-
* `sherpa-frontend`'s `import.meta.env.VITE_BACKEND_API_URL` today has, on
|
|
16
|
-
* disk, in this worktree:
|
|
17
|
-
*
|
|
18
|
-
* - `"development"` → `http://localhost:8000`, **declared** — read from
|
|
19
|
-
* `.env.development.local`, class A (DEC-244 Row 1).
|
|
20
|
-
* - `"staging"` → `https://sherpa-backend-staging.up.railway.app`,
|
|
21
|
-
* **asserted** — a human-confirmed `ConfirmedFact` with
|
|
22
|
-
* `environment: "staging"`, class B. `"staging"` never appears in any
|
|
23
|
-
* `.env*` filename here; the *only* reason this module knows it exists at
|
|
24
|
-
* all is that a person named it on the fact.
|
|
25
|
-
* - `"production"` — still entirely unaddressed, by either source, and
|
|
26
|
-
* **still unnameable from anything this module reads.**
|
|
27
|
-
*
|
|
28
|
-
* ## Why `environment` is never inferred, only ever read
|
|
29
|
-
*
|
|
30
|
-
* `ConfirmedFact.environment`'s own doc is explicit: "human-supplied only,
|
|
31
|
-
* never inferred." This module upholds that by construction — the only
|
|
32
|
-
* places an environment name enters this picture are `resolve.ts`'s
|
|
33
|
-
* `knownEnvironments` (from `.env*` **filenames**, DEC-223's own "never
|
|
34
|
-
* guessed, always refused" rule) and `fact.environment` (typed as the human
|
|
35
|
-
* literally set it). Nothing here parses `"staging"` out of a hostname; the
|
|
36
|
-
* hostname's word "staging" and the fact's `environment: "staging"` are
|
|
37
|
-
* correlated in this specific real case only because a *person* read the
|
|
38
|
-
* same signal and typed the same word — this module never makes that
|
|
39
|
-
* connection itself, and would behave identically if the two disagreed.
|
|
40
|
-
*
|
|
41
|
-
* ## Why `"closed"` is reserved for fully-declared rows
|
|
42
|
-
*
|
|
43
|
-
* A row where every named environment resolves — some from config, some from
|
|
44
|
-
* testimony — could be called "closed." It is deliberately not: `state`
|
|
45
|
-
* reaches `"closed"` only when **every** named environment's evidence is
|
|
46
|
-
* `declared` (class A). One environment resting on testimony keeps the whole
|
|
47
|
-
* row at `"partially-closed"`, even if nothing is technically unaddressed —
|
|
48
|
-
* because a caller reading the single word `"closed"` must never have to
|
|
49
|
-
* re-check `environments[].reliability` to find out whether that word is
|
|
50
|
-
* hiding an unaudited assertion. This is the concrete answer to "what each
|
|
51
|
-
* provenance earns, side by side" (DEC-244 Row 1): declared is A, asserted is
|
|
52
|
-
* B, and the top-level state can never quietly promote a B into looking like
|
|
53
|
-
* an A.
|
|
2
|
+
* DEC-244: a row closed by declared (`.env*`, class A) and asserted (human `ConfirmedFact`, class B)
|
|
3
|
+
* evidence at once, shown side by side, never collapsed. `environment` is read only, never inferred
|
|
4
|
+
* (DEC-223). `state` reaches "closed" only when every environment is declared — a B never looks like an A.
|
|
54
5
|
*/
|
|
55
6
|
import type { ConfirmedFact, ReliabilityClass, UnresolvedRef } from "@descryy/ir";
|
|
56
7
|
import type { DeclaredEnvValue } from "../ledger/resolve.ts";
|
|
@@ -61,10 +12,7 @@ export interface AssertedValue {
|
|
|
61
12
|
readonly confirmedBy: string;
|
|
62
13
|
readonly confirmedAt: string;
|
|
63
14
|
}
|
|
64
|
-
/**
|
|
65
|
-
* One named environment — named by a `.env*` filename, a scoped
|
|
66
|
-
* `ConfirmedFact`, or both — and everything either source says about it.
|
|
67
|
-
*/
|
|
15
|
+
/** One named environment (named by a `.env*` filename, a scoped `ConfirmedFact`, or both) and everything either source says. */
|
|
68
16
|
export interface EnvironmentValue {
|
|
69
17
|
readonly environment: string;
|
|
70
18
|
readonly declaredValue: string | null;
|
|
@@ -93,16 +41,6 @@ export interface RowClosureApplication {
|
|
|
93
41
|
/** Rows `askableHandle` refused outright: wrong class, unset, no handle. Untouched by either source. */
|
|
94
42
|
readonly notAskable: readonly UnresolvedRef[];
|
|
95
43
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Describe every askable row against both sources of evidence at once.
|
|
98
|
-
*
|
|
99
|
-
* `declared` and `facts` are both pre-loaded by the caller — same
|
|
100
|
-
* read-once-apply-many discipline `resolveAgainstDeclared`/
|
|
101
|
-
* `applyConfirmedFacts` already follow. The fact-matching itself is not
|
|
102
|
-
* re-derived here: `applyConfirmedFacts` is called once and its output
|
|
103
|
-
* reused, so the `(repo, blockedBy)` scoping and the askable filter it
|
|
104
|
-
* already enforces are not re-implemented a second, potentially-diverging
|
|
105
|
-
* way.
|
|
106
|
-
*/
|
|
44
|
+
/** Describe every askable row against both evidence sources. `applyConfirmedFacts` output is reused, not re-derived. */
|
|
107
45
|
export declare function describeRowClosures(refs: readonly UnresolvedRef[], declared: readonly DeclaredEnvValue[], facts: readonly ConfirmedFact[], repo: string): RowClosureApplication;
|
|
108
46
|
//# sourceMappingURL=row-closure-picture.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row-closure-picture.d.ts","sourceRoot":"","sources":["../../src/query/row-closure-picture.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"row-closure-picture.d.ts","sourceRoot":"","sources":["../../src/query/row-closure-picture.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIlF,OAAO,KAAK,EAAE,gBAAgB,EAA4B,MAAM,sBAAsB,CAAC;AAEvF,OAAO,EAA8B,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAK5F,gHAAgH;AAChH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,gIAAgI;AAChI,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,+GAA+G;IAC/G,QAAQ,CAAC,WAAW,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC/C;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,6GAA6G;IAC7G,QAAQ,CAAC,YAAY,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACnD,0GAA0G;IAC1G,QAAQ,CAAC,kBAAkB,EAAE,SAAS,aAAa,EAAE,CAAC;IACtD,qGAAqG;IACrG,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7C,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAAC;CACvC;AAED,MAAM,WAAW,qBAAqB;IACpC,gGAAgG;IAChG,QAAQ,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAChD,wGAAwG;IACxG,QAAQ,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,CAAC;CAC/C;AAMD,wHAAwH;AACxH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,SAAS,aAAa,EAAE,EAC9B,QAAQ,EAAE,SAAS,gBAAgB,EAAE,EACrC,KAAK,EAAE,SAAS,aAAa,EAAE,EAC/B,IAAI,EAAE,MAAM,GACX,qBAAqB,CAkEvB"}
|
|
@@ -1,56 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* DEC-244
|
|
3
|
-
* evidence at once,
|
|
4
|
-
*
|
|
5
|
-
* `applyDeclaredValues` (`declared-value-closure.ts`) answers from `.env*`
|
|
6
|
-
* config alone. `applyConfirmedFacts` (`confirmed-facts.ts`) answers from
|
|
7
|
-
* human testimony alone, and — since `ConfirmedFact.environment` landed —
|
|
8
|
-
* testimony can now be scoped to a *named* environment, not just an unscoped
|
|
9
|
-
* blanket answer. This module is the picture that shows both kinds of
|
|
10
|
-
* evidence side by side, per environment, without ever letting one stand in
|
|
11
|
-
* for the other.
|
|
12
|
-
*
|
|
13
|
-
* ## The real case that forced this shape
|
|
14
|
-
*
|
|
15
|
-
* `sherpa-frontend`'s `import.meta.env.VITE_BACKEND_API_URL` today has, on
|
|
16
|
-
* disk, in this worktree:
|
|
17
|
-
*
|
|
18
|
-
* - `"development"` → `http://localhost:8000`, **declared** — read from
|
|
19
|
-
* `.env.development.local`, class A (DEC-244 Row 1).
|
|
20
|
-
* - `"staging"` → `https://sherpa-backend-staging.up.railway.app`,
|
|
21
|
-
* **asserted** — a human-confirmed `ConfirmedFact` with
|
|
22
|
-
* `environment: "staging"`, class B. `"staging"` never appears in any
|
|
23
|
-
* `.env*` filename here; the *only* reason this module knows it exists at
|
|
24
|
-
* all is that a person named it on the fact.
|
|
25
|
-
* - `"production"` — still entirely unaddressed, by either source, and
|
|
26
|
-
* **still unnameable from anything this module reads.**
|
|
27
|
-
*
|
|
28
|
-
* ## Why `environment` is never inferred, only ever read
|
|
29
|
-
*
|
|
30
|
-
* `ConfirmedFact.environment`'s own doc is explicit: "human-supplied only,
|
|
31
|
-
* never inferred." This module upholds that by construction — the only
|
|
32
|
-
* places an environment name enters this picture are `resolve.ts`'s
|
|
33
|
-
* `knownEnvironments` (from `.env*` **filenames**, DEC-223's own "never
|
|
34
|
-
* guessed, always refused" rule) and `fact.environment` (typed as the human
|
|
35
|
-
* literally set it). Nothing here parses `"staging"` out of a hostname; the
|
|
36
|
-
* hostname's word "staging" and the fact's `environment: "staging"` are
|
|
37
|
-
* correlated in this specific real case only because a *person* read the
|
|
38
|
-
* same signal and typed the same word — this module never makes that
|
|
39
|
-
* connection itself, and would behave identically if the two disagreed.
|
|
40
|
-
*
|
|
41
|
-
* ## Why `"closed"` is reserved for fully-declared rows
|
|
42
|
-
*
|
|
43
|
-
* A row where every named environment resolves — some from config, some from
|
|
44
|
-
* testimony — could be called "closed." It is deliberately not: `state`
|
|
45
|
-
* reaches `"closed"` only when **every** named environment's evidence is
|
|
46
|
-
* `declared` (class A). One environment resting on testimony keeps the whole
|
|
47
|
-
* row at `"partially-closed"`, even if nothing is technically unaddressed —
|
|
48
|
-
* because a caller reading the single word `"closed"` must never have to
|
|
49
|
-
* re-check `environments[].reliability` to find out whether that word is
|
|
50
|
-
* hiding an unaudited assertion. This is the concrete answer to "what each
|
|
51
|
-
* provenance earns, side by side" (DEC-244 Row 1): declared is A, asserted is
|
|
52
|
-
* B, and the top-level state can never quietly promote a B into looking like
|
|
53
|
-
* an A.
|
|
2
|
+
* DEC-244: a row closed by declared (`.env*`, class A) and asserted (human `ConfirmedFact`, class B)
|
|
3
|
+
* evidence at once, shown side by side, never collapsed. `environment` is read only, never inferred
|
|
4
|
+
* (DEC-223). `state` reaches "closed" only when every environment is declared — a B never looks like an A.
|
|
54
5
|
*/
|
|
55
6
|
import { askableHandle } from "./refusal-questions.js";
|
|
56
7
|
import { applyConfirmedFacts } from "./confirmed-facts.js";
|
|
@@ -61,17 +12,7 @@ const MIN_KNOWN_ENVIRONMENTS_FOR_CLOSED = 2;
|
|
|
61
12
|
function isScoped(fact) {
|
|
62
13
|
return fact.environment !== undefined;
|
|
63
14
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Describe every askable row against both sources of evidence at once.
|
|
66
|
-
*
|
|
67
|
-
* `declared` and `facts` are both pre-loaded by the caller — same
|
|
68
|
-
* read-once-apply-many discipline `resolveAgainstDeclared`/
|
|
69
|
-
* `applyConfirmedFacts` already follow. The fact-matching itself is not
|
|
70
|
-
* re-derived here: `applyConfirmedFacts` is called once and its output
|
|
71
|
-
* reused, so the `(repo, blockedBy)` scoping and the askable filter it
|
|
72
|
-
* already enforces are not re-implemented a second, potentially-diverging
|
|
73
|
-
* way.
|
|
74
|
-
*/
|
|
15
|
+
/** Describe every askable row against both evidence sources. `applyConfirmedFacts` output is reused, not re-derived. */
|
|
75
16
|
export function describeRowClosures(refs, declared, facts, repo) {
|
|
76
17
|
const factApplication = applyConfirmedFacts(refs, facts, repo);
|
|
77
18
|
const factsByRef = new Map(factApplication.answered.map((m) => [m.ref, m.facts]));
|
|
@@ -99,10 +40,8 @@ export function describeRowClosures(refs, declared, facts, repo) {
|
|
|
99
40
|
environmentNames.add(f.environment);
|
|
100
41
|
const environments = [...environmentNames].sort().map((environment) => {
|
|
101
42
|
const declaredEntry = resolution.resolved.find((r) => r.environment === environment);
|
|
102
|
-
// First-write-wins
|
|
103
|
-
//
|
|
104
|
-
// adjudicate — surfacing one rather than silently averaging or
|
|
105
|
-
// discarding is the honest minimum.
|
|
43
|
+
// First-write-wins: two scoped facts for one environment is a producer
|
|
44
|
+
// data question, not this reader's to adjudicate.
|
|
106
45
|
const assertedEntry = scopedFacts.find((f) => f.environment === environment);
|
|
107
46
|
const reliability = declaredEntry !== undefined ? DECLARED_VALUE_RELIABILITY : assertedEntry !== undefined ? "B" : null;
|
|
108
47
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row-closure-picture.js","sourceRoot":"","sources":["../../src/query/row-closure-picture.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"row-closure-picture.js","sourceRoot":"","sources":["../../src/query/row-closure-picture.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,0BAA0B,EAAqB,MAAM,6BAA6B,CAAC;AAE5F,8GAA8G;AAC9G,MAAM,iCAAiC,GAAG,CAAC,CAAC;AAyC5C,SAAS,QAAQ,CAAC,IAAmB;IACnC,OAAO,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC;AACxC,CAAC;AAED,wHAAwH;AACxH,MAAM,UAAU,mBAAmB,CACjC,IAA8B,EAC9B,QAAqC,EACrC,KAA+B,EAC/B,IAAY;IAEZ,MAAM,eAAe,GAAG,mBAAmB,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAC/D,MAAM,UAAU,GAAG,IAAI,GAAG,CACxB,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CACtD,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