@pacspace-io/check 0.5.3 → 0.5.5
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/CHANGELOG.md +12 -0
- package/README.md +16 -1
- package/dist/check.d.ts +9 -0
- package/dist/cli.d.ts +3 -1
- package/dist/cli.js +591 -34
- package/dist/index.d.ts +1 -1
- package/dist/index.js +580 -31
- package/dist/inputs.txt +2 -0
- package/dist/release.d.ts +4 -0
- package/dist/report.d.ts +56 -2
- package/dist/writes.d.ts +55 -0
- package/package.json +1 -1
package/dist/inputs.txt
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
../shared/src/records/layout-not-read.ts
|
|
30
30
|
../shared/src/records/layouts.generated.ts
|
|
31
31
|
../shared/src/records/layouts.ts
|
|
32
|
+
../shared/src/records/ledger-write-search-v1.ts
|
|
32
33
|
../shared/src/records/model-record-link-v1.ts
|
|
33
34
|
../shared/src/records/record-content-v1.ts
|
|
34
35
|
../shared/src/records/record-entry-kind-v1.ts
|
|
@@ -43,3 +44,4 @@ src/cli.ts
|
|
|
43
44
|
src/open.ts
|
|
44
45
|
src/release.ts
|
|
45
46
|
src/report.ts
|
|
47
|
+
src/writes.ts
|
package/dist/release.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MirrorRefusalCode } from '@pacspace/shared';
|
|
1
2
|
import { type CheckOptions } from './check';
|
|
2
3
|
export declare const RELEASES_SCHEMA = "pacspace-releases/v1";
|
|
3
4
|
export declare const RELEASE_MANIFEST_FORMAT = "pacspace-release-manifest/v2";
|
|
@@ -30,6 +31,7 @@ export declare const releaseWords: {
|
|
|
30
31
|
readonly notProductionRecord: "The ledger record here is not the production release record.";
|
|
31
32
|
readonly inProgress: (served: string, latest: string) => string;
|
|
32
33
|
readonly unreachable: (origin: string) => string;
|
|
34
|
+
readonly refused: (code: MirrorRefusalCode) => string;
|
|
33
35
|
readonly total: (n: number) => string;
|
|
34
36
|
};
|
|
35
37
|
export interface ReleaseManifestFile {
|
|
@@ -113,6 +115,8 @@ export interface ReleaseReport {
|
|
|
113
115
|
stagingRecord?: string;
|
|
114
116
|
/** 0 everything matches; 1 any difference, or any staging run; 2 the host or the ledger could not be reached. */
|
|
115
117
|
exitCode: 0 | 1 | 2;
|
|
118
|
+
/** Present only with `unreachable` when the ledger's source answered and its answer was refused: which rule it broke. */
|
|
119
|
+
refused?: MirrorRefusalCode;
|
|
116
120
|
}
|
|
117
121
|
/** One answer as the host sent it: no decoding, every header. */
|
|
118
122
|
export interface RawAnswer {
|
package/dist/report.d.ts
CHANGED
|
@@ -8,7 +8,13 @@
|
|
|
8
8
|
* from the forbidden lists. A seal history's sentences are the Shared
|
|
9
9
|
* Record page's, verbatim.
|
|
10
10
|
*/
|
|
11
|
+
import type { MirrorRefusalCode } from '@pacspace/shared';
|
|
11
12
|
export declare const REPORT_SCHEMA: "pacspace-check-report/v1";
|
|
13
|
+
/**
|
|
14
|
+
* Why a source's answer was not read, by the reader's refusal code. Each command puts the reason in its own
|
|
15
|
+
* sentence; nothing the source sent is printed.
|
|
16
|
+
*/
|
|
17
|
+
export declare const SOURCE_REFUSAL_REASONS: Record<MirrorRefusalCode, string>;
|
|
12
18
|
export type SourceOutcome = {
|
|
13
19
|
compared: false;
|
|
14
20
|
reason: 'offline';
|
|
@@ -16,6 +22,8 @@ export type SourceOutcome = {
|
|
|
16
22
|
compared: false;
|
|
17
23
|
reason: 'unreachable';
|
|
18
24
|
detail: string;
|
|
25
|
+
/** Present only when the source answered and its answer was refused: which rule it broke. */
|
|
26
|
+
refused?: MirrorRefusalCode;
|
|
19
27
|
} | {
|
|
20
28
|
compared: true;
|
|
21
29
|
matches: boolean;
|
|
@@ -63,6 +71,30 @@ export type DisclosureOutcome = {
|
|
|
63
71
|
items: unknown[];
|
|
64
72
|
}>;
|
|
65
73
|
};
|
|
74
|
+
/** Where one or more entries were committed: one write on the proof layer. */
|
|
75
|
+
export interface EntryWrite {
|
|
76
|
+
/** Entry numbers (1-based) committed together. */
|
|
77
|
+
entries: number[];
|
|
78
|
+
/** When the proof layer committed them, ISO 8601 (UTC). */
|
|
79
|
+
committedAt: string;
|
|
80
|
+
transactionHash: string;
|
|
81
|
+
blockNumber: number | null;
|
|
82
|
+
/** The write on an explorer of the proof layer; null when the checker has none for the source it read. */
|
|
83
|
+
link: string | null;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Where each entry was committed, looked up after the check had its verdict. Information only: it is
|
|
87
|
+
* never read by the verdict, the sentences or the exit code.
|
|
88
|
+
*/
|
|
89
|
+
export type WritesOutcome = {
|
|
90
|
+
read: true;
|
|
91
|
+
entries: EntryWrite[];
|
|
92
|
+
/** Entry numbers (1-based) whose write this read of the proof layer did not find. */
|
|
93
|
+
notFound: number[];
|
|
94
|
+
} | {
|
|
95
|
+
read: false;
|
|
96
|
+
reason: 'unreachable' | 'timeout';
|
|
97
|
+
};
|
|
66
98
|
export interface CheckReport {
|
|
67
99
|
schema: typeof REPORT_SCHEMA;
|
|
68
100
|
checker: {
|
|
@@ -109,6 +141,8 @@ export interface CheckReport {
|
|
|
109
141
|
sentences: string[];
|
|
110
142
|
/** 0 the check passed as asked; 1 it did not; 3 the proof layer could not be reached. */
|
|
111
143
|
exitCode: 0 | 1 | 3;
|
|
144
|
+
/** Present only when the lookup ran: where each entry was committed. */
|
|
145
|
+
writes?: WritesOutcome;
|
|
112
146
|
}
|
|
113
147
|
/** The subset of the shared verifier's result the report reads. */
|
|
114
148
|
export interface VerificationFacts {
|
|
@@ -205,6 +239,8 @@ export declare function sealsVerdict(entries: number | null, v: SealsFacts, queu
|
|
|
205
239
|
sentence: string;
|
|
206
240
|
passed: boolean;
|
|
207
241
|
};
|
|
242
|
+
/** The refusal code of a source that answered and was refused; undefined for any other outcome. */
|
|
243
|
+
export declare function refusedOf(source: SourceOutcome): MirrorRefusalCode | undefined;
|
|
208
244
|
export declare function sourceSentence(source: SourceOutcome): string;
|
|
209
245
|
/**
|
|
210
246
|
* The report's line on the daily statement. `changed` is true when the file no longer produces the
|
|
@@ -238,5 +274,23 @@ export interface SealsReportInput {
|
|
|
238
274
|
}
|
|
239
275
|
/** A seal history's report, alone or in a kept copy, with any disclosure checked against it. */
|
|
240
276
|
export declare function buildSealsReport(input: SealsReportInput): CheckReport;
|
|
241
|
-
|
|
242
|
-
export declare
|
|
277
|
+
export declare const WRITES_HEADING = "Where each entry was committed on the proof layer:";
|
|
278
|
+
export declare const WRITES_NOT_READ_SENTENCE = "Where each entry was committed could not be read from the proof layer this time. The check above does not depend on it.";
|
|
279
|
+
/** The text report lists at most this many writes; `--json` lists all. */
|
|
280
|
+
export declare const WRITES_LISTED_MAX = 25;
|
|
281
|
+
/** "16 November 2026, 13:15:42 UTC" for an ISO instant. */
|
|
282
|
+
export declare function committedWhen(iso: string): string;
|
|
283
|
+
export declare function writesNotFoundSentence(notFound: number[], suggestFull: boolean): string;
|
|
284
|
+
export declare function writesNotListedSentence(count: number): string;
|
|
285
|
+
/**
|
|
286
|
+
* The lines that say where each entry was committed, or none when the lookup did not run or found
|
|
287
|
+
* nothing to say. `suggestFull` is false when the run already read the record's whole history.
|
|
288
|
+
*/
|
|
289
|
+
export declare function writesLines(writes: WritesOutcome | undefined, suggestFull?: boolean): string[];
|
|
290
|
+
/**
|
|
291
|
+
* The report as the terminal prints it: labeled facts in a column, then the sentences. Where each
|
|
292
|
+
* entry was committed, when it was looked up, follows the line that compares the file with the proof layer.
|
|
293
|
+
*/
|
|
294
|
+
export declare function renderReport(report: CheckReport, options?: {
|
|
295
|
+
suggestFull?: boolean;
|
|
296
|
+
}): string;
|
package/dist/writes.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { RecordChainReader } from '@pacspace/shared';
|
|
2
|
+
import type { WritesOutcome } from './report';
|
|
3
|
+
/**
|
|
4
|
+
* Where each entry was committed, read from the proof layer after the check
|
|
5
|
+
* has its verdict. Information only: nothing here can change what the check
|
|
6
|
+
* found, and every failure ends as "not read".
|
|
7
|
+
*/
|
|
8
|
+
/** At most this many requests for one lookup, one at a time, one attempt each. */
|
|
9
|
+
export declare const WRITES_LOOKUP_MAX_REQUESTS = 40;
|
|
10
|
+
/** The lookup's whole budget when `--timeout` is not given, milliseconds. */
|
|
11
|
+
export declare const WRITES_LOOKUP_DEFAULT_BUDGET_MS = 10000;
|
|
12
|
+
/**
|
|
13
|
+
* Where an explorer of the proof layer shows a write, by network. Kept here, not read from the
|
|
14
|
+
* platform's chain settings, so the package carries nothing else of them; a test holds the two equal.
|
|
15
|
+
*/
|
|
16
|
+
export declare const WRITE_EXPLORERS: Readonly<Record<number, string>>;
|
|
17
|
+
/**
|
|
18
|
+
* The explorer address of a write, or null. The checker links a write only when it read the mirror it
|
|
19
|
+
* knows for one of the two networks it knows: with `--source`, `--rpc` or any other network, the
|
|
20
|
+
* explorer may not be showing what was read, so none is named.
|
|
21
|
+
*/
|
|
22
|
+
export declare function writeLinkFor(source: 'mirror' | 'offline' | string | {
|
|
23
|
+
rpc: string;
|
|
24
|
+
} | undefined, chainId: unknown): (transactionHash: string) => string | null;
|
|
25
|
+
/** One committed entry of the file: its number (from 1) and the two words its write carries. */
|
|
26
|
+
export interface WantedEntry {
|
|
27
|
+
entry: number;
|
|
28
|
+
previousWord: string;
|
|
29
|
+
newWord: string;
|
|
30
|
+
}
|
|
31
|
+
export interface WritesLookupInput {
|
|
32
|
+
reader: RecordChainReader;
|
|
33
|
+
recordKey: string;
|
|
34
|
+
/** The contract the file names; a write counts only when its log names the same one. */
|
|
35
|
+
contractAddress: string;
|
|
36
|
+
wanted: WantedEntry[];
|
|
37
|
+
/** The file's export time, a hint for where the search starts. */
|
|
38
|
+
startAt: string | null;
|
|
39
|
+
/** True when this run already read the record's whole history (`--full` on a mirror), so nothing more is asked. */
|
|
40
|
+
whole: boolean;
|
|
41
|
+
budgetMs: number;
|
|
42
|
+
/** The explorer address for a write, or null when the checker has none for this source. */
|
|
43
|
+
linkFor: (transactionHash: string) => string | null;
|
|
44
|
+
/** Test seams. */
|
|
45
|
+
windowSeconds?: number;
|
|
46
|
+
now?: () => number;
|
|
47
|
+
}
|
|
48
|
+
/** The committed entries of a history's receipts that passed the check, with the words their writes carry. */
|
|
49
|
+
export declare function wantedEntriesOf(receipts: unknown, verifiedSeqs: ReadonlySet<number>): WantedEntry[];
|
|
50
|
+
/**
|
|
51
|
+
* Look up where each wanted entry was committed. One log per entry or the
|
|
52
|
+
* entry is listed as not found; a refused or failed read, or one that the
|
|
53
|
+
* budget cut off before anything was found, is "not read". Never throws.
|
|
54
|
+
*/
|
|
55
|
+
export declare function lookUpWrites(input: WritesLookupInput): Promise<WritesOutcome>;
|
package/package.json
CHANGED