@inventarch/db 2.0.0 → 3.1.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.
Files changed (76) hide show
  1. package/README.md +4 -2
  2. package/SPEC.md +39 -5
  3. package/dist/checks.d.ts +66 -0
  4. package/dist/checks.d.ts.map +1 -0
  5. package/dist/checks.js +143 -0
  6. package/dist/checks.js.map +1 -0
  7. package/dist/descriptors/codec.js +2 -2
  8. package/dist/descriptors/codec.js.map +1 -1
  9. package/dist/descriptors/envelope.js +2 -2
  10. package/dist/descriptors/envelope.js.map +1 -1
  11. package/dist/descriptors/index.d.ts +1 -1
  12. package/dist/descriptors/index.js +1 -1
  13. package/dist/distribution/codec.d.ts +7 -1
  14. package/dist/distribution/codec.d.ts.map +1 -1
  15. package/dist/distribution/codec.js +6 -0
  16. package/dist/distribution/codec.js.map +1 -1
  17. package/dist/distribution/contracts.d.ts.map +1 -1
  18. package/dist/distribution/contracts.js +5 -2
  19. package/dist/distribution/contracts.js.map +1 -1
  20. package/dist/distribution/implementations.d.ts +56 -0
  21. package/dist/distribution/implementations.d.ts.map +1 -0
  22. package/dist/distribution/implementations.js +148 -0
  23. package/dist/distribution/implementations.js.map +1 -0
  24. package/dist/distribution/index.d.ts +4 -1
  25. package/dist/distribution/index.d.ts.map +1 -1
  26. package/dist/distribution/index.js +3 -1
  27. package/dist/distribution/index.js.map +1 -1
  28. package/dist/distribution/reader.d.ts +1 -1
  29. package/dist/distribution/reader.d.ts.map +1 -1
  30. package/dist/distribution/reader.js +34 -8
  31. package/dist/distribution/reader.js.map +1 -1
  32. package/dist/distribution/release-control.d.ts +4 -0
  33. package/dist/distribution/release-control.d.ts.map +1 -0
  34. package/dist/distribution/release-control.js +46 -0
  35. package/dist/distribution/release-control.js.map +1 -0
  36. package/dist/editor/index.d.ts +13 -2
  37. package/dist/editor/index.d.ts.map +1 -1
  38. package/dist/editor/index.js +9 -4
  39. package/dist/editor/index.js.map +1 -1
  40. package/dist/evidence.d.ts +84 -0
  41. package/dist/evidence.d.ts.map +1 -0
  42. package/dist/evidence.js +313 -0
  43. package/dist/evidence.js.map +1 -0
  44. package/dist/handle.d.ts +42 -7
  45. package/dist/handle.d.ts.map +1 -1
  46. package/dist/handle.js +62 -15
  47. package/dist/handle.js.map +1 -1
  48. package/dist/index.d.ts +10 -1
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +5 -0
  51. package/dist/index.js.map +1 -1
  52. package/dist/inputs.d.ts +37 -1
  53. package/dist/inputs.d.ts.map +1 -1
  54. package/dist/inputs.js +135 -18
  55. package/dist/inputs.js.map +1 -1
  56. package/dist/membership.d.ts +6 -0
  57. package/dist/membership.d.ts.map +1 -1
  58. package/dist/membership.js +7 -1
  59. package/dist/membership.js.map +1 -1
  60. package/dist/preview.d.ts +2 -2
  61. package/dist/preview.d.ts.map +1 -1
  62. package/dist/preview.js +9 -7
  63. package/dist/preview.js.map +1 -1
  64. package/dist/retention.d.ts +35 -14
  65. package/dist/retention.d.ts.map +1 -1
  66. package/dist/retention.js +49 -24
  67. package/dist/retention.js.map +1 -1
  68. package/dist/runner-evidence.d.ts +22 -0
  69. package/dist/runner-evidence.d.ts.map +1 -0
  70. package/dist/runner-evidence.js +388 -0
  71. package/dist/runner-evidence.js.map +1 -0
  72. package/dist/view.d.ts +85 -2
  73. package/dist/view.d.ts.map +1 -1
  74. package/dist/view.js +343 -42
  75. package/dist/view.js.map +1 -1
  76. package/package.json +8 -4
@@ -0,0 +1,313 @@
1
+ import { closeSync, constants, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, renameSync, unlinkSync, utimesSync, } from 'node:fs';
2
+ import { dirname } from 'node:path';
3
+ import { DbError } from './errors.js';
4
+ import { EVIDENCE_DIRECTORY, EVIDENCE_FILE, safePath } from './inputs.js';
5
+ import { discard, entryAt, staged, syncDirectory } from './retention.js';
6
+ /**
7
+ * D14: runtime evidence (milestone generation-binding, plan amendment C14). The validate effect records each bound check
8
+ * whose selected verdicts passed or failed as one `@observation` in `.ia/work/evidence/<authored revision>.ia`, a source
9
+ * at runtime placement band 0 that only a reader opened with `evidence` reads, and that never moves the authored
10
+ * revision. An observation is named `<check name>-<12-hex authored revision>`; pass is verdict `success`, fail is
11
+ * `refusal`, and a not-evaluated check records nothing. The validate request records nothing for a refused admission,
12
+ * and a failing built-in verdict always refuses it, so in this release it never writes a `refusal` (review finding F1).
13
+ * Nothing else writes this directory.
14
+ */
15
+ /** The word an evidence record is an instance of; a workspace whose vocabulary lacks it records no evidence. */
16
+ export const CHECK_EVIDENCE_WORD = 'observation';
17
+ const HEX = /^[0-9a-f]{64}$/,
18
+ /** The writer's own stamp, `Date.prototype.toISOString`'s exact form. */
19
+ STAMP = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/,
20
+ /** How far ahead of this clock a kept time may be: another writer's clock, never a time not yet reached. */
21
+ SKEW = 5 * 60 * 1000;
22
+ /** A text value as a quoted literal, with no character the string syntax would have to escape. */
23
+ const quoted = (text) => `"${text.replace(/["\\\u0000-\u001f]/g, ' ').trim()}"`;
24
+ const short = (revision) => revision.slice(0, 12);
25
+ /**
26
+ * The prior evidence file's observation times, by observation name, with the verdict and subject digest they were taken
27
+ * for: an observation that would be recorded again unchanged keeps the time it was first made, so validating twice at
28
+ * one authored revision writes the same bytes. Read from this writer's own layout; anything else is ignored, and so is a
29
+ * time the writer would not have written: not its exact stamp, observed and captured apart, or later than this clock
30
+ * allows (review finding B4-RC1). Times are carried, not verified: nothing else attests when an observation was made.
31
+ */
32
+ function priorTimes(text) {
33
+ const times = new Map();
34
+ if (text === null)
35
+ return times;
36
+ for (const block of text.split(/^(?=@observation )/m)) {
37
+ const name = /^@observation ([a-z][a-z0-9-]*)\n/.exec(block)?.[1], observedAt = /^ {4}observed-at "([^"\n]*)"$/m.exec(block)?.[1], capturedAt = /^ {4}captured-at "([^"\n]*)"$/m.exec(block)?.[1], verdict = /^ {4}verdict ([a-z]+)$/m.exec(block)?.[1], digest = /^ {4}subject-revision "([0-9a-f]{64})"$/m.exec(block)?.[1];
38
+ if (name &&
39
+ observedAt &&
40
+ capturedAt &&
41
+ verdict &&
42
+ digest &&
43
+ STAMP.test(observedAt) &&
44
+ observedAt === capturedAt &&
45
+ Date.parse(observedAt) <= Date.now() + SKEW)
46
+ times.set(name, { observedAt, capturedAt, verdict, digest });
47
+ }
48
+ return times;
49
+ }
50
+ /**
51
+ * The evidence file for `bindings` at `authoredRevision`, or null when no bound check passed or failed. `records` are the
52
+ * admitted records the checks were read from (for their digests and for whether a check's name refers to it alone);
53
+ * `prior` is the file this revision already has, whose times an unchanged observation keeps; `now` stamps the rest. A
54
+ * check whose observation name an authored `@observation` already holds records nothing, so evidence never shadows,
55
+ * duplicates or overwrites an authored record (a reader would refuse the whole file for it).
56
+ */
57
+ export function evidenceText(input) {
58
+ const { authoredRevision, bindings, records } = input;
59
+ if (!HEX.test(authoredRevision))
60
+ throw new TypeError('An authored revision is 64 hex digits');
61
+ const stamp = (input.now ?? new Date()).toISOString(), times = priorTimes(input.prior), checks = records.filter((record) => record.discriminator === 'check'), authored = new Set(records
62
+ .filter((record) => record.discriminator === CHECK_EVIDENCE_WORD && record.band !== 0)
63
+ .map((record) => record.name));
64
+ const observations = [], blocks = [];
65
+ for (const binding of bindings) {
66
+ if (binding.status !== 'bound' || binding.outcome === 'not-evaluated')
67
+ continue;
68
+ const record = checks.find((check) => check.identity === binding.identity);
69
+ if (record === undefined)
70
+ continue;
71
+ const name = `${binding.name}-${short(authoredRevision)}`;
72
+ if (authored.has(name))
73
+ continue;
74
+ const verdict = binding.outcome === 'pass' ? 'success' : 'refusal', prior = times.get(name), kept = prior !== undefined && prior.verdict === verdict && prior.digest === record.digest ? prior : undefined;
75
+ // A typed subject only when the check's name refers to it alone; the locator always carries its identity.
76
+ const unique = checks.filter((check) => check.name === binding.name).length === 1;
77
+ observations.push(Object.freeze({ name, check: binding.identity, verdict }));
78
+ blocks.push([
79
+ `@observation ${name}`,
80
+ ' meaning',
81
+ ` says ${quoted(`ia validate observed check ${binding.name} ${binding.outcome === 'pass' ? 'passing' : 'failing'} at authored revision ${short(authoredRevision)}.`)}`,
82
+ ` answers ${quoted(`Did check ${binding.name} pass at authored revision ${short(authoredRevision)}?`)}`,
83
+ ' evidence',
84
+ ' origin check',
85
+ ` actor ${quoted('ia validate')}`,
86
+ ` observed-at ${quoted(kept?.observedAt ?? stamp)}`,
87
+ ` captured-at ${quoted(kept?.capturedAt ?? stamp)}`,
88
+ ` workspace ${quoted('.')}`,
89
+ ` locator ${quoted(binding.identity)}`,
90
+ ` revision ${quoted(authoredRevision)}`,
91
+ ` bundle ${quoted(`${EVIDENCE_DIRECTORY}/${authoredRevision}.ia`)}`,
92
+ ` digest ${quoted(record.digest)}`,
93
+ ' availability available',
94
+ ...(unique ? [` subject @check ${binding.name}`] : []),
95
+ ` subject-revision ${quoted(record.digest)}`,
96
+ ` snapshot-revision ${quoted(authoredRevision)}`,
97
+ ` evaluator ${quoted(`${binding.implementation ?? 'none'} ${binding.runner ?? ''}`)}`,
98
+ ' move Verification',
99
+ ` verdict ${verdict}`,
100
+ ' interpretation',
101
+ ` applies ${quoted(`The admitted records of authored revision ${short(authoredRevision)} that check.scope ${binding.scope ?? ''} selects.`)}`,
102
+ ` limits ${quoted('The verdicts of a built-in evaluator in admission at one authored revision; no external evaluator ran and nothing was executed.')}`,
103
+ ` reason ${quoted(binding.reason)}`,
104
+ ' basis evaluation',
105
+ ' retention',
106
+ ' status retained',
107
+ ].join('\n'));
108
+ }
109
+ return Object.freeze({
110
+ text: blocks.length === 0 ? null : `#! ia 1.0\n\n${blocks.join('\n\n')}\n`,
111
+ observations: Object.freeze(observations),
112
+ });
113
+ }
114
+ /**
115
+ * Review findings B4-RC1 and B4-RC2: whether `text` is exactly the evidence file `evidenceText` writes for `bindings`
116
+ * over `records` at `authoredRevision`, its times taken from `text` itself: every observation the writer would make
117
+ * and nothing else, with the writer's verdicts, reasons and wording, byte for byte. A reader admits only such a file,
118
+ * and the writer keeps prior times only from one, so a planted or edited file can neither be read as evidence nor lend
119
+ * the writer its times.
120
+ */
121
+ export function reproducesEvidence(input) {
122
+ const { text } = input;
123
+ return evidenceText({ ...input, prior: text, now: new Date(0) }).text === text;
124
+ }
125
+ /**
126
+ * The directories evidence lives in, contained the D01 way from the root: a link or junction refuses as
127
+ * IA-DB-PATH-UNSAFE (safePath), as does an entry at `.ia`, `.ia/work` or the evidence directory that is not a directory.
128
+ */
129
+ function directories(root) {
130
+ for (const path of ['.ia', '.ia/work', EVIDENCE_DIRECTORY]) {
131
+ const stat = lstatSync(safePath(root, path), { throwIfNoEntry: false });
132
+ if (stat === undefined)
133
+ return;
134
+ if (!stat.isDirectory())
135
+ throw new DbError('IA-DB-PATH-UNSAFE', `${path} is not a directory`, path);
136
+ }
137
+ }
138
+ /** Whether `error` is D01's refusal of a link, junction or entry of the wrong kind. */
139
+ const unsafe = (error) => error instanceof DbError && error.code === 'IA-DB-PATH-UNSAFE';
140
+ /** Whether the evidence directories are plain directories as far as they exist (`directories` without refusing). */
141
+ function plain(root) {
142
+ try {
143
+ directories(root);
144
+ return true;
145
+ }
146
+ catch (error) {
147
+ if (unsafe(error))
148
+ return false;
149
+ throw error;
150
+ }
151
+ }
152
+ /**
153
+ * The bytes of the evidence file at `path`, or null when there is none, including when a link, junction, hard link or
154
+ * entry of the wrong kind stands on the way (review finding B3-N9): nothing is read through one, and the writer refuses
155
+ * only where it must write.
156
+ */
157
+ export function readEvidence(root, path) {
158
+ if (!plain(root))
159
+ return null;
160
+ try {
161
+ const target = entryAt(root, path);
162
+ if (target === undefined)
163
+ return null;
164
+ // Open before judging the link count, so the check and the read are of one file (CodeQL js/file-system-race), and
165
+ // read nothing whose name moved to another file meanwhile.
166
+ const fd = openSync(target, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
167
+ try {
168
+ const opened = fstatSync(fd, { bigint: true });
169
+ if (!opened.isFile() || opened.nlink !== 1n)
170
+ return null;
171
+ const text = readFileSync(fd, 'utf8'), named = lstatSync(target, { bigint: true, throwIfNoEntry: false });
172
+ return named?.isFile() && named.nlink === 1n && named.dev === opened.dev && named.ino === opened.ino
173
+ ? text
174
+ : null;
175
+ }
176
+ finally {
177
+ closeSync(fd);
178
+ }
179
+ }
180
+ catch (error) {
181
+ if (unsafe(error))
182
+ return null;
183
+ throw error;
184
+ }
185
+ }
186
+ /** The errors a win32 replacing rename returns while another handle holds the target (review finding D2-N3). */
187
+ const HELD = new Set(['EPERM', 'EACCES', 'EBUSY']);
188
+ /** How long the writer waits for a held target, in all; a reader holds the file for the moment one read takes. */
189
+ const HELD_MS = 2000;
190
+ const pause = (ms) => {
191
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
192
+ };
193
+ /**
194
+ * Review finding D2-N3: rename the staged `temporary` over `path`, true once it is in place. On win32 a replacing rename
195
+ * fails (EPERM, EACCES or EBUSY) while any other handle holds the target, as a concurrent validate does while it reads the
196
+ * evidence it found, or while a concurrent writer's rename is in flight; there the writer retries, backing off from 10 to
197
+ * 100 milliseconds, for up to two seconds. Between attempts it reads the target, and stops early only when it already
198
+ * holds exactly these bytes, byte for byte: then a concurrent writer of the same revision put them there and there is
199
+ * nothing left to write, so the answer is false and the caller discards its copy. That is rare: writers that each
200
+ * record an observation for the first time stamp their own times, so their bytes differ, and the retry then runs until
201
+ * its own rename lands, the last rename leaving one whole file. Any other platform, any other error, or a target still
202
+ * held at the end is the error itself.
203
+ */
204
+ function publish(root, temporary, path, bytes) {
205
+ const deadline = Date.now() + HELD_MS;
206
+ for (let attempt = 0;; attempt++) {
207
+ try {
208
+ renameSync(safePath(root, temporary), safePath(root, path));
209
+ return true;
210
+ }
211
+ catch (error) {
212
+ if (process.platform !== 'win32' || !HELD.has(error.code ?? ''))
213
+ throw error;
214
+ const current = readEvidence(root, path);
215
+ if (current !== null && Buffer.from(current, 'utf8').equals(bytes))
216
+ return false;
217
+ if (Date.now() >= deadline)
218
+ throw error;
219
+ pause(Math.min(10 * 2 ** attempt, 100));
220
+ }
221
+ }
222
+ }
223
+ /** The errors a prune skips rather than refuse for (review finding B3-R1): a file it may not or cannot remove. */
224
+ const SKIPPED = new Set(['EPERM', 'EACCES', 'EBUSY', 'ENOENT', 'EROFS']);
225
+ /**
226
+ * Write `text` as the evidence of `authoredRevision` (D14), or, for null, keep none for it, and prune the evidence files
227
+ * of other authored revisions. The writer refuses only when this revision's file must be written (review finding B3-R1):
228
+ * a link or junction on the way, or an entry of the wrong kind at a directory's or the file's path, refuses as
229
+ * IA-DB-PATH-UNSAFE, and a file it cannot write fails with the filesystem's code, before anything is pruned. With nothing
230
+ * to record (null, or a file that already holds exactly `text`) it never refuses, whatever stands at those paths (B3-N6).
231
+ * The bytes are staged in the evidence directory, flushed, and renamed into place, so a reader sees the whole old file or
232
+ * the whole new one; on win32, where a rename over a file another handle holds fails, the rename waits for it a bounded
233
+ * time, and stops once a concurrent writer of the same revision has put exactly these bytes there (`publish`). Pruning
234
+ * is best effort and comes last: only regular files named `<64 hex>.ia`, never temporary
235
+ * files or anything else; a file it may not remove is skipped; and with `pruneBefore` a file modified at or after that
236
+ * time, which a validation of a newer revision may have written meanwhile, is kept (B3-N2); a current file left
237
+ * unchanged is touched, so it counts as modified now (B4-RC3).
238
+ */
239
+ export function writeEvidence(root, authoredRevision, text, options = {}) {
240
+ if (!HEX.test(authoredRevision))
241
+ throw new TypeError('An authored revision is 64 hex digits');
242
+ const name = `${authoredRevision}.ia`, path = `${EVIDENCE_DIRECTORY}/${name}`, bytes = text === null ? null : Buffer.from(text, 'utf8'), current = bytes === null ? null : readEvidence(root, path);
243
+ let written = false;
244
+ if (bytes !== null && (current === null || !Buffer.from(current, 'utf8').equals(bytes))) {
245
+ // Only here may the writer refuse: this revision's file must be written.
246
+ directories(root);
247
+ entryAt(root, path);
248
+ mkdirSync(safePath(root, EVIDENCE_DIRECTORY), { recursive: true });
249
+ directories(root);
250
+ let temporary = staged(root, path, bytes);
251
+ try {
252
+ if (publish(root, temporary, path, bytes)) {
253
+ temporary = undefined;
254
+ syncDirectory(dirname(safePath(root, path)));
255
+ written = true;
256
+ }
257
+ }
258
+ finally {
259
+ discard(root, temporary);
260
+ }
261
+ }
262
+ else if (bytes !== null) {
263
+ // Review finding B4-RC3: the file is current again, so a validation of an older revision that began before now, and
264
+ // prunes only what was modified before it began, leaves it. Best effort: an untouchable file is still current.
265
+ try {
266
+ const now = new Date();
267
+ utimesSync(safePath(root, path), now, now);
268
+ }
269
+ catch {
270
+ // Nothing to record differs; the file stays as it is.
271
+ }
272
+ }
273
+ const pruned = prune(root, bytes === null ? null : name, options.pruneBefore);
274
+ return Object.freeze({
275
+ path: bytes === null ? null : path,
276
+ written: written || (bytes === null && pruned.includes(path)),
277
+ pruned: Object.freeze(pruned),
278
+ });
279
+ }
280
+ /** Best-effort removal of the evidence files other than `keep` (see `writeEvidence`); the paths removed. */
281
+ function prune(root, keep, before) {
282
+ if (!plain(root))
283
+ return [];
284
+ const directory = safePath(root, EVIDENCE_DIRECTORY);
285
+ let entries;
286
+ try {
287
+ entries =
288
+ lstatSync(directory, { throwIfNoEntry: false })?.isDirectory() === true ? readdirSync(directory).sort() : [];
289
+ }
290
+ catch {
291
+ return [];
292
+ }
293
+ const pruned = [];
294
+ for (const entry of entries) {
295
+ if (!EVIDENCE_FILE.test(entry) || entry === keep)
296
+ continue;
297
+ const other = `${EVIDENCE_DIRECTORY}/${entry}`, target = safePath(root, other), stat = lstatSync(target, { throwIfNoEntry: false });
298
+ if (stat?.isFile() !== true || (before !== undefined && stat.mtimeMs >= before))
299
+ continue;
300
+ try {
301
+ unlinkSync(target);
302
+ pruned.push(other);
303
+ }
304
+ catch (error) {
305
+ if (!SKIPPED.has(error.code ?? ''))
306
+ throw error;
307
+ }
308
+ }
309
+ if (pruned.length > 0)
310
+ syncDirectory(directory);
311
+ return pruned;
312
+ }
313
+ //# sourceMappingURL=evid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AC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI;YAAE,SAAS;QAC3D,MAAM,KAAK,GAAG,GAAG,kBAAkB,IAAI,KAAK,EAAE,EAC5C,MAAM,GAAG,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,EAC9B,IAAI,GAAG,SAAS,CAAC,MAAM,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;QACtD,IAAI,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,IAAI,MAAM,CAAC;YAAE,SAAS;QAC1F,IAAI,CAAC;YACH,UAAU,CAAC,MAAM,CAAC,CAAC;YACnB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,OAAO,CAAC,GAAG,CAAE,KAA+B,CAAC,IAAI,IAAI,EAAE,CAAC;gBAAE,MAAM,KAAK,CAAC;QAC7E,CAAC;IACH,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IAChD,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/dist/handle.d.ts CHANGED
@@ -7,10 +7,18 @@ import type { DeclaredRoot, InertDeclaration, MembershipRow } from './membership
7
7
  import type { Readiness, RetainedSnapshot, Staleness } from './retention.js';
8
8
  import type { SeatResolution } from './seat.js';
9
9
  import { viewBuilder } from './view.js';
10
- import type { RefusedRecord, View } from './view.js';
10
+ import type { ViewOptions } from './view.js';
11
+ import type { RefusedRecord, UnadmittedRecord, View } from './view.js';
11
12
  import type { DraftChange, DraftPreview } from './preview.js';
12
13
  export interface OpenOptions extends InputOptions {
13
14
  readonly cache?: boolean;
15
+ /**
16
+ * D13: how `@check` records are admitted (`ViewOptions.checks`). `strict`, the default, keeps every existing reader's
17
+ * admission; `structural` is for the validate path that binds checks, and `preview` drafts under it too. A handle
18
+ * opened `structural` or with `evidence` never reads or writes the cache, whatever `cache` says (review finding
19
+ * B3-N5), so `.ia/.iadb/graph.json` only ever holds a strict, evidence-free graph.
20
+ */
21
+ readonly checks?: 'strict' | 'structural';
14
22
  }
15
23
  export interface ReadOptions {
16
24
  readonly root?: string;
@@ -29,6 +37,11 @@ export interface Scope {
29
37
  }
30
38
  export interface Snapshot {
31
39
  readonly revision: string;
40
+ /**
41
+ * The view's authored revision (graph `authoredRevisionOf`): `revision` without the sources at runtime placement, so
42
+ * runtime-band evidence leaves it unchanged; it equals `revision` while no source is placed so.
43
+ */
44
+ readonly authoredRevision: string;
32
45
  readonly root: string;
33
46
  readonly phase?: Phase;
34
47
  readonly records: readonly Node[];
@@ -52,10 +65,10 @@ interface State {
52
65
  * files, and a refresh hands the previous side on unread.
53
66
  */
54
67
  interface Retention {
55
- /** The most recent admitted root snapshot whose revision differs from rootView's. */
68
+ /** The most recent admitted root snapshot whose authored revision differs from rootView's. */
56
69
  readonly previous: () => RetainedSnapshot | undefined;
57
- /** D08a: the revision of the capture at `.ia/work/snapshot/current.json`, when that file holds one. */
58
- readonly captured: () => string | undefined;
70
+ /** D08a: the revisions of the capture at `.ia/work/snapshot/current.json`, when that file holds one. */
71
+ readonly captured: () => Pick<RetainedSnapshot, 'revision' | 'authoredRevision'> | undefined;
59
72
  }
60
73
  /** D08: what a refresh rotates: the root snapshot a reader holds and its previous side, read on first use. */
61
74
  interface Held {
@@ -64,12 +77,12 @@ interface Held {
64
77
  }
65
78
  /** Internal observation seam: production supplies readInputs, tests can prove
66
79
  * the bounded retry and no-publication invariant with real captured inputs. */
67
- export declare function stableState(read: () => InputSnapshot, cache: boolean): State;
80
+ export declare function stableState(read: () => InputSnapshot, cache: boolean, view?: ViewOptions): State;
68
81
  /** Shared read engine for disk handles and cache-free editor snapshots. */
69
82
  export declare class Reader {
70
83
  #private;
71
84
  readonly root: string;
72
- constructor(state: State, locations?: Readonly<Record<string, import('@inventarch/language').Location>>);
85
+ constructor(state: State, locations?: Readonly<Record<string, import('@inventarch/language').Location>>, view?: ViewOptions);
73
86
  protected get capturedInputs(): InputSnapshot;
74
87
  /** D08: the root snapshot this reader holds and the previous side it retains, unread, as a refresh rotates them. */
75
88
  protected get retention(): Held;
@@ -79,8 +92,23 @@ export declare class Reader {
79
92
  /** Whole-workspace preview can expose refused sources as diagnostics. Admitted-record counts cannot prove disclosure. */
80
93
  isCompleteScope(token: string): boolean;
81
94
  get revision(): string;
95
+ /**
96
+ * The root view's authored revision (graph `authoredRevisionOf`): `revision` without the sources at runtime
97
+ * placement, the derived revision-only input (D03) kept, so a runtime-band source moves `revision` and leaves this
98
+ * unchanged, while an authored edit moves both. It equals `revision` while no source is placed so. `revision` stays
99
+ * what read bindings assert (IA-DB-STALE) and scopes bind; retention and the capture pair key on this one (D08, D08a).
100
+ */
101
+ get authoredRevision(): string;
82
102
  get report(): Report;
83
103
  get refused(): readonly RefusedRecord[];
104
+ /**
105
+ * Lane D, D1: every record occurrence of the root view's sources that it does not admit, at the band of its source's
106
+ * placement (`UnadmittedRecord`): those `refused` names, those an identity tie drops, and those of a file refused whole
107
+ * by a language error or a duplicate requirement id, which `refused` cannot name because no graph ever held them. Like
108
+ * `refused` and `report` it reads the root view, whatever scope a read binds: an occurrence that is not admitted is in
109
+ * no scope. Nothing is read from disk for it: the view's own parse, compile and captured text decide it.
110
+ */
111
+ get unadmitted(): readonly UnadmittedRecord[];
84
112
  get cache(): CacheStatus;
85
113
  snapshot(options?: ReadOptions): Snapshot;
86
114
  records(options?: ReadOptions): readonly Node[];
@@ -88,11 +116,18 @@ export declare class Reader {
88
116
  get(identity: string, options?: ReadOptions): Node | undefined;
89
117
  /** D08: the revision of the retained previous root snapshot, when one is retained. */
90
118
  get previousRevision(): string | undefined;
119
+ /** D08: the authored revision of the retained previous root snapshot, when one is retained. */
120
+ get previousAuthoredRevision(): string | undefined;
91
121
  /**
92
122
  * D08a: the revision of the capture `ia capture` last wrote, at `.ia/work/snapshot/current.json`; undefined when there
93
- * is none or the file holds no capture this handle trusts. A capture at another revision than `revision` is stale.
123
+ * is none or the file holds no capture this handle trusts.
94
124
  */
95
125
  get capturedRevision(): string | undefined;
126
+ /**
127
+ * D08a: the authored revision of that capture, under the same conditions. A capture at another authored revision than
128
+ * `authoredRevision` is stale; one that differs only in runtime-band sources is not.
129
+ */
130
+ get capturedAuthoredRevision(): string | undefined;
96
131
  /**
97
132
  * D08: the digest of the record `get` returns against the previous root snapshot's. Undefined when neither side has
98
133
  * one, or when the selected view reads an occurrence the root snapshots do not describe; every current identity is
@@ -1 +1 @@
1
- {"version":3,"file":"handle.d.ts","sourceRoot":"","sources":["../src/handle.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAWjE,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,IAAI,EACJ,UAAU,EACV,SAAS,EACT,SAAS,EACT,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG9C,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErF,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAiB,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gBAEpB,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB;IA0BnD,OAAO,IAAI,QAAQ;CAiBpB;AACD,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AACjD,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAEpE"}
package/dist/handle.js CHANGED
@@ -29,10 +29,10 @@ function scopeRoot(value) {
29
29
  }
30
30
  /** Internal observation seam: production supplies readInputs, tests can prove
31
31
  * the bounded retry and no-publication invariant with real captured inputs. */
32
- export function stableState(read, cache) {
32
+ export function stableState(read, cache, view = {}) {
33
33
  for (let attempt = 0; attempt < 3; attempt++) {
34
34
  try {
35
- const inputs = read(), build = viewBuilder(inputs), rootView = build();
35
+ const inputs = read(), build = viewBuilder(inputs, view), rootView = build();
36
36
  if (read().fingerprint !== inputs.fingerprint)
37
37
  continue;
38
38
  return {
@@ -50,17 +50,24 @@ export function stableState(read, cache) {
50
50
  }
51
51
  throw new DbError('IA-DB-SOURCE-CHANGED', 'Source inputs changed during three consecutive snapshot attempts');
52
52
  }
53
- const rootSnapshot = (state) => Object.freeze({ revision: state.rootView.graph.revision, membership: state.rootView.membership });
53
+ const rootSnapshot = (state) => Object.freeze({
54
+ revision: state.rootView.graph.revision,
55
+ authoredRevision: state.rootView.authoredRevision,
56
+ membership: state.rootView.membership,
57
+ });
54
58
  /** Shared read engine for disk handles and cache-free editor snapshots. */
55
59
  export class Reader {
56
60
  root;
57
61
  #locations;
62
+ /** How `preview` admits a draft: as this reader's view does (`OpenOptions.checks`). */
63
+ #view;
58
64
  #state;
59
65
  #closed = false;
60
66
  #generation = 0;
61
67
  #scopes = new Map();
62
- constructor(state, locations = {}) {
68
+ constructor(state, locations = {}, view = {}) {
63
69
  this.#locations = locations;
70
+ this.#view = view;
64
71
  this.#state = state;
65
72
  this.root = state.inputs.root;
66
73
  }
@@ -176,6 +183,16 @@ export class Reader {
176
183
  this.#assertOpen();
177
184
  return this.#state.rootView.graph.revision;
178
185
  }
186
+ /**
187
+ * The root view's authored revision (graph `authoredRevisionOf`): `revision` without the sources at runtime
188
+ * placement, the derived revision-only input (D03) kept, so a runtime-band source moves `revision` and leaves this
189
+ * unchanged, while an authored edit moves both. It equals `revision` while no source is placed so. `revision` stays
190
+ * what read bindings assert (IA-DB-STALE) and scopes bind; retention and the capture pair key on this one (D08, D08a).
191
+ */
192
+ get authoredRevision() {
193
+ this.#assertOpen();
194
+ return this.#state.rootView.authoredRevision;
195
+ }
179
196
  get report() {
180
197
  this.#assertOpen();
181
198
  return this.#state.rootView.report;
@@ -184,6 +201,17 @@ export class Reader {
184
201
  this.#assertOpen();
185
202
  return this.#state.rootView.refused;
186
203
  }
204
+ /**
205
+ * Lane D, D1: every record occurrence of the root view's sources that it does not admit, at the band of its source's
206
+ * placement (`UnadmittedRecord`): those `refused` names, those an identity tie drops, and those of a file refused whole
207
+ * by a language error or a duplicate requirement id, which `refused` cannot name because no graph ever held them. Like
208
+ * `refused` and `report` it reads the root view, whatever scope a read binds: an occurrence that is not admitted is in
209
+ * no scope. Nothing is read from disk for it: the view's own parse, compile and captured text decide it.
210
+ */
211
+ get unadmitted() {
212
+ this.#assertOpen();
213
+ return this.#state.rootView.unadmitted;
214
+ }
187
215
  get cache() {
188
216
  this.#assertOpen();
189
217
  return this.#state.cache;
@@ -192,6 +220,7 @@ export class Reader {
192
220
  const { view, allowed } = this.#select(options);
193
221
  return Object.freeze({
194
222
  revision: view.graph.revision,
223
+ authoredRevision: view.authoredRevision,
195
224
  root: view.graph.location,
196
225
  ...(view.graph.phase === undefined ? {} : { phase: view.graph.phase }),
197
226
  records: Object.freeze([...view.graph.nodes.values()].filter((node) => allowed === undefined || allowed.has(node.identity))),
@@ -208,7 +237,7 @@ export class Reader {
208
237
  }
209
238
  preview(changes) {
210
239
  this.#assertOpen();
211
- return previewInputs(this.#state.inputs, this.revision, changes, this.#locations);
240
+ return previewInputs(this.#state.inputs, this.revision, changes, this.#locations, this.#view);
212
241
  }
213
242
  get(identity, options = {}) {
214
243
  return this.#admit(identity, options).view.graph.nodes.get(identity);
@@ -218,13 +247,26 @@ export class Reader {
218
247
  this.#assertOpen();
219
248
  return this.#previous()?.revision;
220
249
  }
250
+ /** D08: the authored revision of the retained previous root snapshot, when one is retained. */
251
+ get previousAuthoredRevision() {
252
+ this.#assertOpen();
253
+ return this.#previous()?.authoredRevision;
254
+ }
221
255
  /**
222
256
  * D08a: the revision of the capture `ia capture` last wrote, at `.ia/work/snapshot/current.json`; undefined when there
223
- * is none or the file holds no capture this handle trusts. A capture at another revision than `revision` is stale.
257
+ * is none or the file holds no capture this handle trusts.
224
258
  */
225
259
  get capturedRevision() {
226
260
  this.#assertOpen();
227
- return this.#state.retention?.captured();
261
+ return this.#state.retention?.captured()?.revision;
262
+ }
263
+ /**
264
+ * D08a: the authored revision of that capture, under the same conditions. A capture at another authored revision than
265
+ * `authoredRevision` is stale; one that differs only in runtime-band sources is not.
266
+ */
267
+ get capturedAuthoredRevision() {
268
+ this.#assertOpen();
269
+ return this.#state.retention?.captured()?.authoredRevision;
228
270
  }
229
271
  /**
230
272
  * D08: the identity's digest in the view `get` reads under `options` and, when that is also its current root digest
@@ -345,8 +387,12 @@ export class Reader {
345
387
  export class Handle extends Reader {
346
388
  #options;
347
389
  constructor(root, options = {}) {
348
- const selected = Object.freeze({ ...inputOptions(options), cache: options.cache ?? true });
349
- const state = stableState(() => readInputs(root, selected), selected.cache), canonical = state.inputs.root, current = rootSnapshot(state), seed = once(() => readCapture(canonical, current));
390
+ const selected = Object.freeze({
391
+ ...inputOptions(options),
392
+ cache: options.checks === 'structural' || options.evidence === true ? false : (options.cache ?? true),
393
+ ...(options.checks === 'structural' ? { checks: 'structural' } : {}),
394
+ });
395
+ const state = stableState(() => readInputs(root, selected), selected.cache, selected), canonical = state.inputs.root, current = rootSnapshot(state), seed = once(() => readCapture(canonical, current));
350
396
  // D08a: whatever the cache setting, the capture pair seeds the previous snapshot, the first time it is asked; the
351
397
  // handle never writes it.
352
398
  super({
@@ -355,16 +401,17 @@ export class Handle extends Reader {
355
401
  previous: once(() => rotate(seed().prior, current).previous),
356
402
  captured: () => seed().captured,
357
403
  },
358
- }, selected.locations);
404
+ }, selected.locations, selected.checks === 'structural' ? { checks: 'structural' } : {});
359
405
  this.#options = selected;
360
406
  Object.freeze(this);
361
407
  }
362
408
  refresh() {
363
- const held = this.retention, next = stableState(() => readInputs(this.root, this.#options), this.#options.cache), root = next.inputs.root, current = rootSnapshot(next);
364
- // D08 rotation (`rotate`) without reading the pair: a changed revision makes the held root snapshot previous, an
365
- // unchanged one keeps the held previous side, still unread until asked, so no refresh lengthens what a handle holds.
366
- // The capture pair's current revision is read again when asked, as `ia capture` may have run.
367
- const before = held.current, previous = before.revision === current.revision ? held.previous : () => before;
409
+ const held = this.retention, next = stableState(() => readInputs(this.root, this.#options), this.#options.cache, this.#options), root = next.inputs.root, current = rootSnapshot(next);
410
+ // D08 rotation (`rotate`) without reading the pair: a changed authored revision makes the held root snapshot
411
+ // previous, an unchanged one (a runtime-band change alone among them) keeps the held previous side, still unread
412
+ // until asked, so no refresh lengthens what a handle holds. The capture pair's current revisions are read again
413
+ // when asked, as `ia capture` may have run.
414
+ const before = held.current, previous = before.authoredRevision === current.authoredRevision ? held.previous : () => before;
368
415
  this.replaceState({
369
416
  ...next,
370
417
  retention: { previous, captured: once(() => readCapture(root, current).captured) },