@quickchatai/pi-quickreview 1.1.0 → 1.3.1
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/README.md +79 -27
- package/assets/config.example.toml +60 -14
- package/assets/prompts/onboarding.md +58 -18
- package/assets/schemas/review-result.v1.json +60 -0
- package/dist/extensions/quickreview.d.ts +13 -5
- package/dist/extensions/quickreview.d.ts.map +1 -1
- package/dist/extensions/quickreview.js +77 -25
- package/dist/extensions/quickreview.js.map +1 -1
- package/dist/src/engine/auth.d.ts +4 -0
- package/dist/src/engine/auth.d.ts.map +1 -1
- package/dist/src/engine/auth.js +11 -2
- package/dist/src/engine/auth.js.map +1 -1
- package/dist/src/engine/envmap.d.ts.map +1 -1
- package/dist/src/engine/envmap.js +5 -0
- package/dist/src/engine/envmap.js.map +1 -1
- package/dist/src/engine/lens/activity.d.ts +45 -0
- package/dist/src/engine/lens/activity.d.ts.map +1 -0
- package/dist/src/engine/lens/activity.js +118 -0
- package/dist/src/engine/lens/activity.js.map +1 -0
- package/dist/src/engine/lens/runlens.d.ts +7 -0
- package/dist/src/engine/lens/runlens.d.ts.map +1 -1
- package/dist/src/engine/lens/runlens.js +30 -1
- package/dist/src/engine/lens/runlens.js.map +1 -1
- package/dist/src/engine/lens/tool.d.ts +7 -0
- package/dist/src/engine/lens/tool.d.ts.map +1 -1
- package/dist/src/engine/lens/tool.js +101 -18
- package/dist/src/engine/lens/tool.js.map +1 -1
- package/dist/src/engine/lens/wave.d.ts +6 -0
- package/dist/src/engine/lens/wave.d.ts.map +1 -1
- package/dist/src/engine/lens/wave.js +16 -0
- package/dist/src/engine/lens/wave.js.map +1 -1
- package/dist/src/engine/pisdk.d.ts +9 -0
- package/dist/src/engine/pisdk.d.ts.map +1 -1
- package/dist/src/engine/pisdk.js +29 -4
- package/dist/src/engine/pisdk.js.map +1 -1
- package/dist/src/githubAuth.d.ts +39 -1
- package/dist/src/githubAuth.d.ts.map +1 -1
- package/dist/src/githubAuth.js +75 -8
- package/dist/src/githubAuth.js.map +1 -1
- package/dist/src/guards.d.ts +14 -1
- package/dist/src/guards.d.ts.map +1 -1
- package/dist/src/guards.js +61 -2
- package/dist/src/guards.js.map +1 -1
- package/dist/src/homes.js +1 -1
- package/dist/src/homes.js.map +1 -1
- package/dist/src/identity.d.ts +34 -0
- package/dist/src/identity.d.ts.map +1 -0
- package/dist/src/identity.js +67 -0
- package/dist/src/identity.js.map +1 -0
- package/dist/src/live/events.d.ts +3 -0
- package/dist/src/live/events.d.ts.map +1 -1
- package/dist/src/live/events.js.map +1 -1
- package/dist/src/live/lensline.d.ts +20 -0
- package/dist/src/live/lensline.d.ts.map +1 -0
- package/dist/src/live/lensline.js +70 -0
- package/dist/src/live/lensline.js.map +1 -0
- package/dist/src/live/projection.d.ts +55 -0
- package/dist/src/live/projection.d.ts.map +1 -0
- package/dist/src/live/projection.js +465 -0
- package/dist/src/live/projection.js.map +1 -0
- package/dist/src/live/read.d.ts +24 -0
- package/dist/src/live/read.d.ts.map +1 -0
- package/dist/src/live/read.js +60 -0
- package/dist/src/live/read.js.map +1 -0
- package/dist/src/live/writer.d.ts +3 -0
- package/dist/src/live/writer.d.ts.map +1 -1
- package/dist/src/live/writer.js +6 -1
- package/dist/src/live/writer.js.map +1 -1
- package/dist/src/localreview.d.ts +18 -8
- package/dist/src/localreview.d.ts.map +1 -1
- package/dist/src/localreview.js +103 -43
- package/dist/src/localreview.js.map +1 -1
- package/dist/src/modelroute.d.ts +42 -0
- package/dist/src/modelroute.d.ts.map +1 -0
- package/dist/src/modelroute.js +126 -0
- package/dist/src/modelroute.js.map +1 -0
- package/dist/src/plugin/args.d.ts +38 -7
- package/dist/src/plugin/args.d.ts.map +1 -1
- package/dist/src/plugin/args.js +134 -37
- package/dist/src/plugin/args.js.map +1 -1
- package/dist/src/plugin/login.d.ts +11 -4
- package/dist/src/plugin/login.d.ts.map +1 -1
- package/dist/src/plugin/login.js +28 -26
- package/dist/src/plugin/login.js.map +1 -1
- package/dist/src/plugin/messages.d.ts +7 -0
- package/dist/src/plugin/messages.d.ts.map +1 -0
- package/dist/src/plugin/messages.js +13 -0
- package/dist/src/plugin/messages.js.map +1 -0
- package/dist/src/plugin/review.d.ts +52 -6
- package/dist/src/plugin/review.d.ts.map +1 -1
- package/dist/src/plugin/review.js +269 -99
- package/dist/src/plugin/review.js.map +1 -1
- package/dist/src/plugin/scan.d.ts +80 -44
- package/dist/src/plugin/scan.d.ts.map +1 -1
- package/dist/src/plugin/scan.js +450 -233
- package/dist/src/plugin/scan.js.map +1 -1
- package/dist/src/plugin/scancases.d.ts +33 -0
- package/dist/src/plugin/scancases.d.ts.map +1 -0
- package/dist/src/plugin/scancases.js +153 -0
- package/dist/src/plugin/scancases.js.map +1 -0
- package/dist/src/plugin/settings.d.ts +18 -0
- package/dist/src/plugin/settings.d.ts.map +1 -0
- package/dist/src/plugin/settings.js +47 -0
- package/dist/src/plugin/settings.js.map +1 -0
- package/dist/src/plugin/setup.d.ts +35 -12
- package/dist/src/plugin/setup.d.ts.map +1 -1
- package/dist/src/plugin/setup.js +258 -118
- package/dist/src/plugin/setup.js.map +1 -1
- package/dist/src/plugin/versiongate.js +1 -1
- package/dist/src/plugin/versiongate.js.map +1 -1
- package/dist/src/profileoverrides.d.ts +3 -0
- package/dist/src/profileoverrides.d.ts.map +1 -1
- package/dist/src/profileoverrides.js +9 -2
- package/dist/src/profileoverrides.js.map +1 -1
- package/dist/src/reviewapi.d.ts +22 -31
- package/dist/src/reviewapi.d.ts.map +1 -1
- package/dist/src/reviewapi.js +90 -66
- package/dist/src/reviewapi.js.map +1 -1
- package/dist/src/reviewconfig.d.ts +12 -0
- package/dist/src/reviewconfig.d.ts.map +1 -1
- package/dist/src/reviewconfig.js +9 -1
- package/dist/src/reviewconfig.js.map +1 -1
- package/dist/src/reviewdest.d.ts +1 -1
- package/dist/src/reviewdest.d.ts.map +1 -1
- package/dist/src/reviewdest.js +4 -3
- package/dist/src/reviewdest.js.map +1 -1
- package/dist/src/reviewtarget.d.ts +36 -0
- package/dist/src/reviewtarget.d.ts.map +1 -0
- package/dist/src/reviewtarget.js +6 -0
- package/dist/src/reviewtarget.js.map +1 -0
- package/dist/src/round-progress.d.ts +5 -0
- package/dist/src/round-progress.d.ts.map +1 -1
- package/dist/src/round-progress.js.map +1 -1
- package/dist/src/savedpost.d.ts +65 -0
- package/dist/src/savedpost.d.ts.map +1 -0
- package/dist/src/savedpost.js +131 -0
- package/dist/src/savedpost.js.map +1 -0
- package/dist/src/scan/caseread.d.ts +84 -0
- package/dist/src/scan/caseread.d.ts.map +1 -0
- package/dist/src/scan/caseread.js +263 -0
- package/dist/src/scan/caseread.js.map +1 -0
- package/dist/src/scan/channelfs.d.ts +6 -0
- package/dist/src/scan/channelfs.d.ts.map +1 -0
- package/dist/src/scan/channelfs.js +27 -0
- package/dist/src/scan/channelfs.js.map +1 -0
- package/dist/src/scan/cutrender.d.ts +13 -0
- package/dist/src/scan/cutrender.d.ts.map +1 -0
- package/dist/src/scan/cutrender.js +51 -0
- package/dist/src/scan/cutrender.js.map +1 -0
- package/dist/src/scan/facts.d.ts +72 -0
- package/dist/src/scan/facts.d.ts.map +1 -0
- package/dist/src/scan/facts.js +593 -0
- package/dist/src/scan/facts.js.map +1 -0
- package/dist/src/scan/findings.d.ts +320 -0
- package/dist/src/scan/findings.d.ts.map +1 -0
- package/dist/src/scan/findings.js +948 -0
- package/dist/src/scan/findings.js.map +1 -0
- package/dist/src/scan/ledger.d.ts +116 -0
- package/dist/src/scan/ledger.d.ts.map +1 -0
- package/dist/src/scan/ledger.js +207 -0
- package/dist/src/scan/ledger.js.map +1 -0
- package/dist/src/scan/presentation.d.ts +19 -0
- package/dist/src/scan/presentation.d.ts.map +1 -0
- package/dist/src/scan/presentation.js +9 -0
- package/dist/src/scan/presentation.js.map +1 -0
- package/dist/src/scan/scan.d.ts +354 -0
- package/dist/src/scan/scan.d.ts.map +1 -0
- package/dist/src/scan/scan.js +725 -0
- package/dist/src/scan/scan.js.map +1 -0
- package/dist/src/scan/scanagents.d.ts +23 -0
- package/dist/src/scan/scanagents.d.ts.map +1 -0
- package/dist/src/scan/scanagents.js +99 -0
- package/dist/src/scan/scanagents.js.map +1 -0
- package/dist/src/scan/scanassemble.d.ts +65 -0
- package/dist/src/scan/scanassemble.d.ts.map +1 -0
- package/dist/src/scan/scanassemble.js +93 -0
- package/dist/src/scan/scanassemble.js.map +1 -0
- package/dist/src/scan/scanfs.d.ts +26 -0
- package/dist/src/scan/scanfs.d.ts.map +1 -0
- package/dist/src/scan/scanfs.js +229 -0
- package/dist/src/scan/scanfs.js.map +1 -0
- package/dist/src/scan/scanlease.d.ts +50 -0
- package/dist/src/scan/scanlease.d.ts.map +1 -0
- package/dist/src/scan/scanlease.js +251 -0
- package/dist/src/scan/scanlease.js.map +1 -0
- package/dist/src/scan/scanleaves.d.ts +55 -0
- package/dist/src/scan/scanleaves.d.ts.map +1 -0
- package/dist/src/scan/scanleaves.js +258 -0
- package/dist/src/scan/scanleaves.js.map +1 -0
- package/dist/src/scan/scanports.d.ts +79 -0
- package/dist/src/scan/scanports.d.ts.map +1 -0
- package/dist/src/scan/scanports.js +8 -0
- package/dist/src/scan/scanports.js.map +1 -0
- package/dist/src/scan/scanrender.d.ts +128 -0
- package/dist/src/scan/scanrender.d.ts.map +1 -0
- package/dist/src/scan/scanrender.js +527 -0
- package/dist/src/scan/scanrender.js.map +1 -0
- package/dist/src/scan/scanreport.d.ts +126 -0
- package/dist/src/scan/scanreport.d.ts.map +1 -0
- package/dist/src/scan/scanreport.js +289 -0
- package/dist/src/scan/scanreport.js.map +1 -0
- package/dist/src/scan/scanrun.d.ts +472 -0
- package/dist/src/scan/scanrun.d.ts.map +1 -0
- package/dist/src/scan/scanrun.js +1733 -0
- package/dist/src/scan/scanrun.js.map +1 -0
- package/dist/src/scan/scantree.d.ts +21 -0
- package/dist/src/scan/scantree.d.ts.map +1 -0
- package/dist/src/scan/scantree.js +297 -0
- package/dist/src/scan/scantree.js.map +1 -0
- package/dist/src/scan/scanverbs.d.ts +208 -0
- package/dist/src/scan/scanverbs.d.ts.map +1 -0
- package/dist/src/scan/scanverbs.js +689 -0
- package/dist/src/scan/scanverbs.js.map +1 -0
- package/dist/src/scan/stage2.d.ts +221 -0
- package/dist/src/scan/stage2.d.ts.map +1 -0
- package/dist/src/scan/stage2.js +617 -0
- package/dist/src/scan/stage2.js.map +1 -0
- package/dist/src/scan/stage2request.d.ts +125 -0
- package/dist/src/scan/stage2request.d.ts.map +1 -0
- package/dist/src/scan/stage2request.js +259 -0
- package/dist/src/scan/stage2request.js.map +1 -0
- package/dist/src/scan/textsniff.d.ts +14 -0
- package/dist/src/scan/textsniff.d.ts.map +1 -0
- package/dist/src/scan/textsniff.js +88 -0
- package/dist/src/scan/textsniff.js.map +1 -0
- package/dist/src/scan/unitcut.d.ts +135 -0
- package/dist/src/scan/unitcut.d.ts.map +1 -0
- package/dist/src/scan/unitcut.js +437 -0
- package/dist/src/scan/unitcut.js.map +1 -0
- package/dist/src/scan/unitcutstore.d.ts +155 -0
- package/dist/src/scan/unitcutstore.d.ts.map +1 -0
- package/dist/src/scan/unitcutstore.js +381 -0
- package/dist/src/scan/unitcutstore.js.map +1 -0
- package/dist/src/setupchecklist.d.ts +240 -0
- package/dist/src/setupchecklist.d.ts.map +1 -0
- package/dist/src/setupchecklist.js +407 -0
- package/dist/src/setupchecklist.js.map +1 -0
- package/package.json +7 -3
- package/skills/qcr-review/SKILL.md +24 -0
- package/skills/qcr-scan/SKILL.md +23 -0
- package/skills/qcr-setup/SKILL.md +18 -0
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import type { StateFs } from "./scanports.js";
|
|
2
|
+
import { type LedgerEntry } from "./ledger.js";
|
|
3
|
+
import { type ScanSeverity } from "./scan.js";
|
|
4
|
+
import type { Reachability } from "../severity.js";
|
|
5
|
+
import { FINDING_STATES, FINDINGS_FILE, FINDINGS_VERSION, dismissedLookalike, lookalikeRank, type Validity, type ValidityView } from "./scanreport.js";
|
|
6
|
+
export { FINDINGS_FILE, FINDINGS_VERSION, dismissedLookalike, lookalikeRank };
|
|
7
|
+
export type { Validity, ValidityView };
|
|
8
|
+
export { FINDING_STATES };
|
|
9
|
+
export type FindingState = (typeof FINDING_STATES)[number];
|
|
10
|
+
export interface Sighting {
|
|
11
|
+
run: string;
|
|
12
|
+
sha: string;
|
|
13
|
+
at: string;
|
|
14
|
+
}
|
|
15
|
+
/** Where a finding stopped being reported, and what it was before. */
|
|
16
|
+
export interface FixedMark extends Sighting {
|
|
17
|
+
from: Exclude<FindingState, "fixed">;
|
|
18
|
+
}
|
|
19
|
+
export interface ScanFinding {
|
|
20
|
+
/** sha256 hex — the identity. */
|
|
21
|
+
fingerprint: string;
|
|
22
|
+
unit: string;
|
|
23
|
+
path: string;
|
|
24
|
+
/** The file's content hash at the last sighting (absent on legacy
|
|
25
|
+
* findings). */
|
|
26
|
+
blob?: string | null;
|
|
27
|
+
/** The anchored lines at the last sighting (1-based, inclusive). */
|
|
28
|
+
start: number;
|
|
29
|
+
end: number;
|
|
30
|
+
lens: string;
|
|
31
|
+
kind: string;
|
|
32
|
+
severity: ScanSeverity;
|
|
33
|
+
confidence: number | null;
|
|
34
|
+
/** The lens's reachability (null: it wrote none, read as routine). Absent
|
|
35
|
+
* on legacy findings. */
|
|
36
|
+
reachability?: Reachability | null;
|
|
37
|
+
/** What the lens said before the reachability cap lowered `severity`. */
|
|
38
|
+
capped_from?: ScanSeverity | null;
|
|
39
|
+
/** Whether `evidence` quotes the anchored code (`evidenceQuotesAnchor`) —
|
|
40
|
+
* false marks a finding whose lines may not be the defect's. */
|
|
41
|
+
anchor_quoted?: boolean;
|
|
42
|
+
claim: string;
|
|
43
|
+
evidence: string | null;
|
|
44
|
+
fix: string | null;
|
|
45
|
+
detail: string | null;
|
|
46
|
+
state: FindingState;
|
|
47
|
+
/** A validator looked at it (survived, or doubted). */
|
|
48
|
+
validated: boolean;
|
|
49
|
+
/** "May not be valid": the validator's doubt word and reason — and, from
|
|
50
|
+
* the scan skeptic, the false-positive class it matched (a
|
|
51
|
+
* SCAN_FALSE_POSITIVE_CLASSES slug; null or absent when none). */
|
|
52
|
+
doubt: FindingDoubt | null;
|
|
53
|
+
/** The skeptic's tier. Null or absent: no skeptic judged it — UNKNOWN. */
|
|
54
|
+
validity?: Validity | null;
|
|
55
|
+
/** The skeptic's scenario for a confirmed or likely finding: the traced
|
|
56
|
+
* path from an entry point (confirmed), or what it could and could not
|
|
57
|
+
* trace (likely). */
|
|
58
|
+
scenario?: string | null;
|
|
59
|
+
first_seen: Sighting;
|
|
60
|
+
last_seen: Sighting;
|
|
61
|
+
/** Scans that reported it. */
|
|
62
|
+
seen: number;
|
|
63
|
+
/** Set while (and only while) the state is `fixed`. */
|
|
64
|
+
fixed?: FixedMark | null;
|
|
65
|
+
/** A DISMISSED finding a re-scan settled as no longer reported (its file
|
|
66
|
+
* re-read at other content, or gone, and nothing paired it): where — the
|
|
67
|
+
* audit of what would otherwise have been `fixed`. The state stays
|
|
68
|
+
* `dismissed` (the operator's triage is never overwritten by a scan);
|
|
69
|
+
* cleared when a scan reports it again. Absent: never so settled. */
|
|
70
|
+
unreported?: Sighting | null;
|
|
71
|
+
/** Re-reads of the unchanged content it was last seen at that did not
|
|
72
|
+
* report it again — the latest, and how many since its last sighting.
|
|
73
|
+
* The finding stays open; cleared when a scan reports it again. */
|
|
74
|
+
not_reproduced?: NotReproduced | null;
|
|
75
|
+
/** Fingerprints this finding carried before the companion matched it to
|
|
76
|
+
* a moved or reworded sighting, and those of near-duplicates collapsed
|
|
77
|
+
* into it — a ticket stamped with one still finds it. */
|
|
78
|
+
aliases?: string[];
|
|
79
|
+
/** Every lens that raised it, its own first — set once a near-duplicate
|
|
80
|
+
* from another report was collapsed into it (absent: just `lens`). */
|
|
81
|
+
lenses?: string[];
|
|
82
|
+
/** The near-duplicate sightings collapsed into it, as last reported. */
|
|
83
|
+
merged?: MergedSighting[];
|
|
84
|
+
/** Its OWN fingerprint's latest severity, kept once near-duplicates
|
|
85
|
+
* collapsed into it (`severity` is then the highest of this and each
|
|
86
|
+
* merged sighting's) — so the aggregate is recomputed from the latest
|
|
87
|
+
* reports whichever sighting reports last. */
|
|
88
|
+
own_severity?: ScanSeverity;
|
|
89
|
+
/** Its own latest judgement, before aggregating merged sightings. */
|
|
90
|
+
own_judgement?: Judgement;
|
|
91
|
+
/** Why the operator dismissed it; kept after a later promote. */
|
|
92
|
+
dismissal?: Dismissal | null;
|
|
93
|
+
/** Where it was filed when promoted. */
|
|
94
|
+
ticket?: FindingTicket | null;
|
|
95
|
+
/** It resembles (`nearDuplicate`) a finding the operator DISMISSED: that
|
|
96
|
+
* finding and its dismissal's reason. A flag only — it stays
|
|
97
|
+
* `new` for the operator to triage; read through `dismissedLookalike`.
|
|
98
|
+
* Absent or null: it resembles none. */
|
|
99
|
+
resembles_dismissed?: ResemblesDismissed | null;
|
|
100
|
+
}
|
|
101
|
+
export interface ResemblesDismissed {
|
|
102
|
+
fingerprint: string;
|
|
103
|
+
reason: string;
|
|
104
|
+
}
|
|
105
|
+
export interface FindingDoubt {
|
|
106
|
+
word: string;
|
|
107
|
+
reason: string;
|
|
108
|
+
class?: string | null;
|
|
109
|
+
}
|
|
110
|
+
export interface NotReproduced extends Sighting {
|
|
111
|
+
count: number;
|
|
112
|
+
}
|
|
113
|
+
type Judgement = Pick<ScanFinding, "validated" | "doubt" | "validity" | "scenario">;
|
|
114
|
+
export interface MergedSighting extends Partial<Judgement> {
|
|
115
|
+
fingerprint: string;
|
|
116
|
+
lens: string;
|
|
117
|
+
start: number;
|
|
118
|
+
end: number;
|
|
119
|
+
severity: ScanSeverity;
|
|
120
|
+
claim: string;
|
|
121
|
+
}
|
|
122
|
+
export interface Dismissal {
|
|
123
|
+
reason: string;
|
|
124
|
+
at: string;
|
|
125
|
+
/** The unpinned memory note: written, or why not (a later dismiss retries). */
|
|
126
|
+
memory: "written" | {
|
|
127
|
+
problem: string;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
export interface FindingTicket {
|
|
131
|
+
/** Which sink filed it — a close goes back through the same kind. */
|
|
132
|
+
sink: string;
|
|
133
|
+
/** The sink's reference: `FT-NNNN`, or the markdown file's path. */
|
|
134
|
+
ref: string;
|
|
135
|
+
effort: string;
|
|
136
|
+
filed_at: string;
|
|
137
|
+
/** Set once the ticket was closed because a re-scan found it fixed. */
|
|
138
|
+
closed?: {
|
|
139
|
+
at: string;
|
|
140
|
+
sha: string;
|
|
141
|
+
run: string;
|
|
142
|
+
} | null;
|
|
143
|
+
}
|
|
144
|
+
/** What a scan reports — a finding before the store gives it a history. */
|
|
145
|
+
export type ReportedFinding = Omit<ScanFinding, "state" | "first_seen" | "last_seen" | "seen" | "fixed" | "unreported" | "not_reproduced" | "aliases" | "lenses" | "merged" | "own_severity" | "own_judgement" | "dismissal" | "ticket" | "resembles_dismissed">;
|
|
146
|
+
/** How far apart (lines between the two ranges) two sightings of one defect
|
|
147
|
+
* may be anchored — one real pair sat 81 lines apart. */
|
|
148
|
+
export declare const NEAR_LINES = 100;
|
|
149
|
+
/** The stemmed-token Jaccard two claims must reach to be one defect. */
|
|
150
|
+
export declare const CLAIM_SIMILARITY = 0.4;
|
|
151
|
+
/**
|
|
152
|
+
* Are `a` and `b` the same defect reported twice? Same file, same kind,
|
|
153
|
+
* ranges overlapping or at most NEAR_LINES apart, the same subject (first
|
|
154
|
+
* content stem — "Inline-comment reads…" and "Issue-comment reads…" are one
|
|
155
|
+
* pattern in two places, not one defect) and claims whose stemmed tokens
|
|
156
|
+
* overlap at CLAIM_SIMILARITY or more. Pure; symmetric.
|
|
157
|
+
*/
|
|
158
|
+
export declare function nearDuplicate(a: Pick<ScanFinding, "path" | "kind" | "start" | "end" | "claim">, b: Pick<ScanFinding, "path" | "kind" | "start" | "end" | "claim">): boolean;
|
|
159
|
+
/** The companion's pending sameness call: stored findings a re-scan no
|
|
160
|
+
* longer reports exactly, and the fresh findings any of them might be. */
|
|
161
|
+
export interface MatchQuestion {
|
|
162
|
+
/** Moves whenever the question does; an answer must quote it. */
|
|
163
|
+
key: string;
|
|
164
|
+
/** The latest run that fed the question — a finding left unpaired is
|
|
165
|
+
* fixed as of this sighting. */
|
|
166
|
+
run: string;
|
|
167
|
+
sha: string;
|
|
168
|
+
at: string;
|
|
169
|
+
unreported: string[];
|
|
170
|
+
fresh: string[];
|
|
171
|
+
}
|
|
172
|
+
export interface FindingsFile {
|
|
173
|
+
version: number;
|
|
174
|
+
findings: ScanFinding[];
|
|
175
|
+
/** At most one pending match question. */
|
|
176
|
+
question?: MatchQuestion | null;
|
|
177
|
+
}
|
|
178
|
+
export interface FindingsFilter {
|
|
179
|
+
state?: FindingState;
|
|
180
|
+
lens?: string;
|
|
181
|
+
unit?: string;
|
|
182
|
+
severity?: ScanSeverity;
|
|
183
|
+
/** true: only "may not be valid"; false: only the rest. */
|
|
184
|
+
doubted?: boolean;
|
|
185
|
+
/** Only this tier (`unknown`: the findings no skeptic judged). */
|
|
186
|
+
validity?: ValidityView;
|
|
187
|
+
}
|
|
188
|
+
export interface ReconcileResult {
|
|
189
|
+
/** Findings fixed outright: nothing fresh could be them. */
|
|
190
|
+
fixed: number;
|
|
191
|
+
/** Unreported findings waiting on the companion's match. */
|
|
192
|
+
pending: number;
|
|
193
|
+
/** Open findings a re-read of their UNCHANGED content did not report
|
|
194
|
+
* again — kept open, stamped `not_reproduced`, never fixed. */
|
|
195
|
+
not_reproduced: number;
|
|
196
|
+
/** Dismissed findings settled as no longer reported: they stay
|
|
197
|
+
* `dismissed`, stamped `unreported` for audit — never counted as fixed. */
|
|
198
|
+
dismissed_unreported: number;
|
|
199
|
+
}
|
|
200
|
+
export interface MatchPair {
|
|
201
|
+
/** A fingerprint from the question's `unreported`. */
|
|
202
|
+
old: string;
|
|
203
|
+
/** A fingerprint from the question's `fresh`. */
|
|
204
|
+
new: string;
|
|
205
|
+
}
|
|
206
|
+
export type MatchResult = {
|
|
207
|
+
ok: true;
|
|
208
|
+
matched: number;
|
|
209
|
+
fixed: number;
|
|
210
|
+
new: number;
|
|
211
|
+
dismissed_unreported: number;
|
|
212
|
+
} | {
|
|
213
|
+
ok: false;
|
|
214
|
+
errors: string[];
|
|
215
|
+
};
|
|
216
|
+
/** The question, both sides expanded, for the companion to judge. */
|
|
217
|
+
export interface MatchQuestionView {
|
|
218
|
+
key: string;
|
|
219
|
+
run: string;
|
|
220
|
+
sha: string;
|
|
221
|
+
unreported: ScanFinding[];
|
|
222
|
+
fresh: ScanFinding[];
|
|
223
|
+
}
|
|
224
|
+
export { goneDismissal } from "./scanreport.js";
|
|
225
|
+
/** Is `f` already settled — fixed, or a gone dismissal? A settled finding is
|
|
226
|
+
* out of play until a scan reports it again. */
|
|
227
|
+
export declare const settled: (f: ScanFinding) => boolean;
|
|
228
|
+
export declare class FindingsStore {
|
|
229
|
+
private readonly state;
|
|
230
|
+
constructor(state: StateFs);
|
|
231
|
+
private loadFile;
|
|
232
|
+
private write;
|
|
233
|
+
load(): {
|
|
234
|
+
findings: ScanFinding[];
|
|
235
|
+
error: string | null;
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Record what one case reported. Exact fingerprint match first: a known
|
|
239
|
+
* finding keeps its state and first sighting; an unknown one is `new`.
|
|
240
|
+
* A known finding the pending match question held as unreported has been
|
|
241
|
+
* reported again, so it leaves the question. An unknown one that is a
|
|
242
|
+
* near-duplicate of a stored live finding is collapsed into it
|
|
243
|
+
* (`nearDuplicate`). Returns how many were new, how many matched (by
|
|
244
|
+
* fingerprint or alias) and how many were collapsed. Throws when the stored file cannot be read — never
|
|
245
|
+
* writes over it.
|
|
246
|
+
*/
|
|
247
|
+
report(reported: readonly ReportedFinding[], seen: Sighting): {
|
|
248
|
+
added: number;
|
|
249
|
+
matched: number;
|
|
250
|
+
merged: number;
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* After a run: find the stored findings a re-scan no longer reports and
|
|
254
|
+
* settle what an exact rule can. A finding is UNREPORTED when its file is
|
|
255
|
+
* gone from the run's tree, or when the ledger's newest row for its lens
|
|
256
|
+
* and file is a later run's reading of other content — so a run the
|
|
257
|
+
* companion never finished is still counted by the next one. Unreported
|
|
258
|
+
* findings with no possible fresh counterpart are fixed now; the rest join
|
|
259
|
+
* the one pending match question, with the fresh findings (first seen by
|
|
260
|
+
* the runs that re-read those files) that might be them.
|
|
261
|
+
*/
|
|
262
|
+
reconcile(args: {
|
|
263
|
+
rows: readonly LedgerEntry[];
|
|
264
|
+
tree: ReadonlySet<string>;
|
|
265
|
+
/** The run's tree's content hash per path: when given, only a reading
|
|
266
|
+
* of THAT content settles a finding — a newer reading of other content
|
|
267
|
+
* says nothing about a tree that has since gone back. */
|
|
268
|
+
blobs?: ReadonlyMap<string, string>;
|
|
269
|
+
run: Sighting;
|
|
270
|
+
}): ReconcileResult;
|
|
271
|
+
/** The pending match question with both sides expanded, or null. */
|
|
272
|
+
question(): {
|
|
273
|
+
question: MatchQuestionView | null;
|
|
274
|
+
error: string | null;
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* The companion's answer to the pending question, whole: `pairs` are the
|
|
278
|
+
* same finding (one-to-one, a lens in common); every unreported finding it does
|
|
279
|
+
* not pair is fixed; every fresh one it does not pair stays new. Refused —
|
|
280
|
+
* all of it — on a stale key, an unknown fingerprint, a reused one, a
|
|
281
|
+
* lens mismatch, or a pair whose two sides carry different tickets.
|
|
282
|
+
*/
|
|
283
|
+
match(args: {
|
|
284
|
+
key?: unknown;
|
|
285
|
+
pairs?: unknown;
|
|
286
|
+
}): MatchResult;
|
|
287
|
+
/** The stored findings the filter keeps, most severe first — a finding
|
|
288
|
+
* flagged as resembling a dismissed one below the rest of its severity —
|
|
289
|
+
* then by file. */
|
|
290
|
+
list(filter?: FindingsFilter): {
|
|
291
|
+
findings: ScanFinding[];
|
|
292
|
+
error: string | null;
|
|
293
|
+
};
|
|
294
|
+
/**
|
|
295
|
+
* The one stored finding `ref` names: a full fingerprint, an alias (a
|
|
296
|
+
* fingerprint it carried before a match), or an unambiguous prefix of at
|
|
297
|
+
* least 12 hex characters — what `scan_findings` shows.
|
|
298
|
+
*/
|
|
299
|
+
find(ref: string): {
|
|
300
|
+
ok: true;
|
|
301
|
+
finding: ScanFinding;
|
|
302
|
+
} | {
|
|
303
|
+
ok: false;
|
|
304
|
+
errors: string[];
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* Rewrite ONE finding, by its current fingerprint, under a fresh load —
|
|
308
|
+
* refused (nothing written) when the store cannot be read or the finding
|
|
309
|
+
* is gone (a match renamed it since the caller looked). `change` returns
|
|
310
|
+
* the new record, or an error string to refuse.
|
|
311
|
+
*/
|
|
312
|
+
update(fingerprint: string, change: (f: ScanFinding) => ScanFinding | string): {
|
|
313
|
+
ok: true;
|
|
314
|
+
finding: ScanFinding;
|
|
315
|
+
} | {
|
|
316
|
+
ok: false;
|
|
317
|
+
errors: string[];
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=findings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findings.d.ts","sourceRoot":"","sources":["../../../src/scan/findings.ts"],"names":[],"mappings":"AA6FA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAY,KAAK,WAAW,EAAgB,MAAM,aAAa,CAAC;AACvE,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACL,cAAc,EACd,aAAa,EACb,gBAAgB,EAEhB,kBAAkB,EAElB,aAAa,EAGb,KAAK,QAAQ,EACb,KAAK,YAAY,EAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,aAAa,EAAE,CAAC;AAC9E,YAAY,EAAE,QAAQ,EAAE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