@invarn/cibuild 2.2.7 → 2.2.9

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.
@@ -0,0 +1,37 @@
1
+ export interface PackageFile {
2
+ /** POSIX, package-relative path. Part of the digest so a rename is a change. */
3
+ path: string;
4
+ /** File contents. */
5
+ bytes: Buffer;
6
+ }
7
+ /**
8
+ * Compute the input digest for one render package: its source files plus the
9
+ * reference image the screen is judged against. Files are folded in sorted by
10
+ * path so iteration order can't affect the result; each is folded in as its git
11
+ * blob id (see the module header) so the digest is reproducible from a Git Trees
12
+ * listing with no blob content. The path is length-prefixed and the blob id is
13
+ * fixed-width, so boundaries are unambiguous.
14
+ */
15
+ export declare function sourceDigest(packageFiles: PackageFile[], referenceBytes: Buffer | null): string;
16
+ /**
17
+ * True when a render package is self-contained — no Gradle script reaches
18
+ * outside the package root. Render packages are hermetic by construction; this
19
+ * guard fails a non-hermetic package OUT of the cacheable set (its digest is not
20
+ * emitted / not trusted for skip) so a change in an external module it depends
21
+ * on can never replay a stale verdict. Pure: a function of the package files
22
+ * only, so a dispatch-time caller can apply the identical check.
23
+ */
24
+ export declare function isHermeticPackage(packageFiles: PackageFile[]): boolean;
25
+ /**
26
+ * Runtime twin of {@link sourceDigest}, spliced into the self-contained render
27
+ * script that runs on the macOS runner (which cannot import this module). It
28
+ * walks the built package directory, reads the paired reference, and computes
29
+ * the identical digest — a parity test pins it to `sourceDigest` so the twin
30
+ * cannot drift.
31
+ *
32
+ * Exposes `computeSourceDigest(projectRoot, referencePath)`. Build outputs and
33
+ * VCS/tooling dirs are excluded so they never perturb the content key. Reads
34
+ * are best-effort: an unreadable reference folds in as "absent", never throws.
35
+ */
36
+ export declare const RENDER_SCRIPT_SOURCE_DIGEST_STAGE: string;
37
+ //# sourceMappingURL=fidelity-input-digest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fidelity-input-digest.d.ts","sourceRoot":"","sources":["../../../src/yaml/fidelity-input-digest.ts"],"names":[],"mappings":"AAiCA,MAAM,WAAW,WAAW;IAC1B,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAuBD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,YAAY,EAAE,WAAW,EAAE,EAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,GAC5B,MAAM,CAoBR;AAwBD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,WAAW,EAAE,GAAG,OAAO,CAOtE;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iCAAiC,EAAE,MAiF/C,CAAC"}
@@ -0,0 +1,208 @@
1
+ /**
2
+ * Deterministic per-package input digest.
3
+ *
4
+ * A content key over a render package's inputs — the committed wrapper source
5
+ * files plus the paired reference image — so a consumer can tell when a render
6
+ * would be byte-identical to one already produced and skip re-rendering. Pure:
7
+ * a function of the input bytes only, never of absolute paths, timestamps, or
8
+ * commit ids, so the same inputs yield the same digest on any machine or
9
+ * branch.
10
+ *
11
+ * Scope: package-local inputs. Render packages are self-contained by
12
+ * construction — a parameterless wrapper that reproduces one screen from
13
+ * hardcoded fixtures, shipped with every dependency version pinned inline and
14
+ * its own assets vendored — so the package IS its own dependency closure and a
15
+ * package-local content key already invalidates on anything that can shift the
16
+ * render. (A package that escapes its own root — an `includeBuild`, an external
17
+ * `project(":…")` dependency, or a shared version catalog — would break that
18
+ * property; such a package is not safely cacheable and is caught by a separate
19
+ * hermeticity guard rather than folded into this digest.)
20
+ *
21
+ * Digest basis: each file is folded in as its **git blob id**
22
+ * (`sha1("blob " + byteLength + "\0" + content)`) rather than its raw bytes.
23
+ * That is the exact id the GitHub Git Trees API returns for a committed file, so
24
+ * a caller holding only a tree listing — a webhook dispatch with no checkout —
25
+ * can reproduce this digest from `(path, blobSha)` pairs WITHOUT fetching any
26
+ * blob content. The framing is: sha256 over, for each file sorted by path,
27
+ * `len(path) ‖ path ‖ blobSha(content)`, then the reference folded last as
28
+ * `blobSha(reference)` (or a presence-distinct `len(0xffffffff)` marker when
29
+ * there is no reference). `blobSha` is a fixed 20 bytes, so file boundaries stay
30
+ * unambiguous with only the path length-prefixed.
31
+ */
32
+ import { createHash } from 'crypto';
33
+ /** 4-byte big-endian length prefix, so concatenated fields can't alias
34
+ * (`["ab","c"]` must not hash equal to `["a","bc"]`). */
35
+ function len(n) {
36
+ const b = Buffer.allocUnsafe(4);
37
+ b.writeUInt32BE(n >>> 0, 0);
38
+ return b;
39
+ }
40
+ /**
41
+ * Git blob object id for a file's content: `sha1("blob " + len + "\0" + bytes)`.
42
+ * The identical id the GitHub Git Trees API returns for the committed blob, so a
43
+ * dispatch-time caller can read it from a tree listing instead of hashing bytes
44
+ * it never fetched. Returned as 20 raw bytes (folded straight into the digest).
45
+ */
46
+ function gitBlobSha(bytes) {
47
+ const h = createHash('sha1');
48
+ h.update(`blob ${bytes.length}\0`);
49
+ h.update(bytes);
50
+ return h.digest();
51
+ }
52
+ /**
53
+ * Compute the input digest for one render package: its source files plus the
54
+ * reference image the screen is judged against. Files are folded in sorted by
55
+ * path so iteration order can't affect the result; each is folded in as its git
56
+ * blob id (see the module header) so the digest is reproducible from a Git Trees
57
+ * listing with no blob content. The path is length-prefixed and the blob id is
58
+ * fixed-width, so boundaries are unambiguous.
59
+ */
60
+ export function sourceDigest(packageFiles, referenceBytes) {
61
+ const sorted = [...packageFiles].sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
62
+ const h = createHash('sha256');
63
+ for (const file of sorted) {
64
+ const pathBytes = Buffer.from(file.path, 'utf8');
65
+ h.update(len(pathBytes.length));
66
+ h.update(pathBytes);
67
+ h.update(gitBlobSha(file.bytes));
68
+ }
69
+ // Reference is folded in as its blob id, with a presence-distinct marker so
70
+ // "no reference" differs from "empty reference".
71
+ if (referenceBytes === null) {
72
+ h.update(len(0xffffffff));
73
+ }
74
+ else {
75
+ h.update(gitBlobSha(referenceBytes));
76
+ }
77
+ return h.digest('hex');
78
+ }
79
+ /**
80
+ * A Gradle build script — the only files that can reach outside the package
81
+ * root (source files and assets can mention `..` in prose without affecting the
82
+ * build graph).
83
+ */
84
+ function isGradleScript(path) {
85
+ return path.endsWith('.gradle') || path.endsWith('.gradle.kts');
86
+ }
87
+ /**
88
+ * Tokens by which a Gradle script reaches outside its own package root and so
89
+ * breaks the "package is its own dependency closure" invariant this digest
90
+ * relies on:
91
+ * - `includeBuild` — a composite/included build (another whole build).
92
+ * - `projectDir` — a module relocated to a directory outside the layout.
93
+ * - `../` — any parent-path reference (external file, script, or
94
+ * version catalog).
95
+ * Biased toward over-detection: a false positive only forces a re-render (safe),
96
+ * whereas a miss would let a shared external change replay a stale verdict.
97
+ */
98
+ const GRADLE_ESCAPE = /includeBuild|projectDir|\.\.\//;
99
+ /**
100
+ * True when a render package is self-contained — no Gradle script reaches
101
+ * outside the package root. Render packages are hermetic by construction; this
102
+ * guard fails a non-hermetic package OUT of the cacheable set (its digest is not
103
+ * emitted / not trusted for skip) so a change in an external module it depends
104
+ * on can never replay a stale verdict. Pure: a function of the package files
105
+ * only, so a dispatch-time caller can apply the identical check.
106
+ */
107
+ export function isHermeticPackage(packageFiles) {
108
+ for (const file of packageFiles) {
109
+ if (isGradleScript(file.path) && GRADLE_ESCAPE.test(file.bytes.toString('utf8'))) {
110
+ return false;
111
+ }
112
+ }
113
+ return true;
114
+ }
115
+ /**
116
+ * Runtime twin of {@link sourceDigest}, spliced into the self-contained render
117
+ * script that runs on the macOS runner (which cannot import this module). It
118
+ * walks the built package directory, reads the paired reference, and computes
119
+ * the identical digest — a parity test pins it to `sourceDigest` so the twin
120
+ * cannot drift.
121
+ *
122
+ * Exposes `computeSourceDigest(projectRoot, referencePath)`. Build outputs and
123
+ * VCS/tooling dirs are excluded so they never perturb the content key. Reads
124
+ * are best-effort: an unreadable reference folds in as "absent", never throws.
125
+ */
126
+ export const RENDER_SCRIPT_SOURCE_DIGEST_STAGE = String.raw `
127
+ // ---- source-digest stage: deterministic package input content key ----
128
+ function __fidLen(n) {
129
+ var b = Buffer.allocUnsafe(4);
130
+ b.writeUInt32BE(n >>> 0, 0);
131
+ return b;
132
+ }
133
+ var __FID_SKIP_DIRS = { build: 1, '.gradle': 1, '.git': 1, '.idea': 1, 'node_modules': 1, DerivedData: 1 };
134
+ function __fidCollectPackageFiles(root) {
135
+ var fs = require('fs');
136
+ var path = require('path');
137
+ var out = [];
138
+ function walk(dir, rel) {
139
+ var names;
140
+ try { names = fs.readdirSync(dir); } catch (e) { return; }
141
+ names.sort();
142
+ for (var i = 0; i < names.length; i++) {
143
+ var name = names[i];
144
+ var full = path.join(dir, name);
145
+ var relPath = rel ? rel + '/' + name : name;
146
+ var st;
147
+ try { st = fs.statSync(full); } catch (e) { continue; }
148
+ if (st.isDirectory()) {
149
+ if (__FID_SKIP_DIRS[name]) continue;
150
+ walk(full, relPath);
151
+ } else if (st.isFile()) {
152
+ out.push({ path: relPath, bytes: fs.readFileSync(full) });
153
+ }
154
+ }
155
+ }
156
+ walk(root, '');
157
+ return out;
158
+ }
159
+ function __fidBlobSha(bytes) {
160
+ var crypto = require('crypto');
161
+ var h = crypto.createHash('sha1');
162
+ h.update('blob ' + bytes.length + '\0');
163
+ h.update(bytes);
164
+ return h.digest();
165
+ }
166
+ function __fidSourceDigest(files, referenceBytes) {
167
+ var crypto = require('crypto');
168
+ var sorted = files.slice().sort(function (a, b) {
169
+ return a.path < b.path ? -1 : a.path > b.path ? 1 : 0;
170
+ });
171
+ var h = crypto.createHash('sha256');
172
+ for (var i = 0; i < sorted.length; i++) {
173
+ var pathBytes = Buffer.from(sorted[i].path, 'utf8');
174
+ h.update(__fidLen(pathBytes.length));
175
+ h.update(pathBytes);
176
+ h.update(__fidBlobSha(sorted[i].bytes));
177
+ }
178
+ if (referenceBytes === null || referenceBytes === undefined) {
179
+ h.update(__fidLen(0xffffffff));
180
+ } else {
181
+ h.update(__fidBlobSha(referenceBytes));
182
+ }
183
+ return h.digest('hex');
184
+ }
185
+ function computeSourceDigest(projectRoot, referencePath) {
186
+ var fs = require('fs');
187
+ var files = __fidCollectPackageFiles(projectRoot);
188
+ var ref = null;
189
+ try { if (referencePath) ref = fs.readFileSync(referencePath); } catch (e) { ref = null; }
190
+ return __fidSourceDigest(files, ref);
191
+ }
192
+ // Twin of isHermeticPackage: a package is cacheable only when no Gradle script
193
+ // reaches outside its own root (includeBuild / projectDir / a parent path).
194
+ var __FID_GRADLE_ESCAPE = /includeBuild|projectDir|\.\.\//;
195
+ function __fidIsGradleScript(p) {
196
+ return p.slice(-7) === '.gradle' || p.slice(-11) === '.gradle.kts';
197
+ }
198
+ function __fidIsHermetic(files) {
199
+ for (var i = 0; i < files.length; i++) {
200
+ if (__fidIsGradleScript(files[i].path) &&
201
+ __FID_GRADLE_ESCAPE.test(files[i].bytes.toString('utf8'))) {
202
+ return false;
203
+ }
204
+ }
205
+ return true;
206
+ }
207
+ `;
208
+ //# sourceMappingURL=fidelity-input-digest.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=fidelity-input-digest.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fidelity-input-digest.test.d.ts","sourceRoot":"","sources":["../../../src/yaml/fidelity-input-digest.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,167 @@
1
+ /**
2
+ * Unit tests for the deterministic per-package input digest.
3
+ *
4
+ * The digest is the content key the dashboard matches on to decide whether a
5
+ * render would be identical to one it already has — so it must be a pure
6
+ * function of the package's input bytes (wrapper source + reference), stable
7
+ * across machines/branches, and never derived from paths-as-location, mtimes,
8
+ * or commit ids.
9
+ */
10
+ import { describe, test, expect } from '@jest/globals';
11
+ import { createHash } from 'crypto';
12
+ import { createRequire } from 'module';
13
+ import { sourceDigest, isHermeticPackage, RENDER_SCRIPT_SOURCE_DIGEST_STAGE, } from './fidelity-input-digest.js';
14
+ function f(path, content) {
15
+ return { path, bytes: Buffer.from(content, 'utf8') };
16
+ }
17
+ /** Git blob object id: sha1('blob <len>\0<content>') — the SAME id the GitHub
18
+ * Git Trees API returns for a committed file. The digest is defined over these
19
+ * ids so a caller with only a tree listing (no blob content) can reproduce it. */
20
+ function gitBlobSha(bytes) {
21
+ const h = createHash('sha1');
22
+ h.update(`blob ${bytes.length}\0`);
23
+ h.update(bytes);
24
+ return h.digest('hex');
25
+ }
26
+ /** 4-byte big-endian length prefix — mirrors the module-private `len`. */
27
+ function len(n) {
28
+ const b = Buffer.allocUnsafe(4);
29
+ b.writeUInt32BE(n >>> 0, 0);
30
+ return b;
31
+ }
32
+ /** Extract the runner-side twin from the spliced stage source so a parity test
33
+ * can pin it to the pure function. `require` is injected because the stage
34
+ * runs in the runner's CJS scope, not this ESM test module. */
35
+ const require = createRequire(import.meta.url);
36
+ const twin = new Function('require', RENDER_SCRIPT_SOURCE_DIGEST_STAGE +
37
+ '\nreturn { __fidSourceDigest: __fidSourceDigest, __fidIsHermetic: __fidIsHermetic };')(require);
38
+ describe('sourceDigest', () => {
39
+ test('is deterministic: identical inputs produce the same 64-hex digest', () => {
40
+ const files = [f('Proof.kt', 'fun Proof() {}'), f('build.gradle.kts', 'plugins {}')];
41
+ const ref = Buffer.from('reference-image-bytes');
42
+ const first = sourceDigest(files, ref);
43
+ expect(first).toMatch(/^[0-9a-f]{64}$/);
44
+ expect(sourceDigest(files, ref)).toBe(first);
45
+ });
46
+ test('changes when any package file byte changes', () => {
47
+ const ref = Buffer.from('ref');
48
+ const before = sourceDigest([f('Proof.kt', 'fun Proof() {}')], ref);
49
+ const after = sourceDigest([f('Proof.kt', 'fun Proof() { Box() }')], ref);
50
+ expect(after).not.toBe(before);
51
+ });
52
+ test('changes when only the reference image changes', () => {
53
+ const files = [f('Proof.kt', 'fun Proof() {}')];
54
+ const withA = sourceDigest(files, Buffer.from('reference-A'));
55
+ const withB = sourceDigest(files, Buffer.from('reference-B'));
56
+ expect(withB).not.toBe(withA);
57
+ });
58
+ test('is independent of file iteration order', () => {
59
+ const ref = Buffer.from('ref');
60
+ const a = f('a.kt', 'A');
61
+ const b = f('b.kt', 'B');
62
+ expect(sourceDigest([a, b], ref)).toBe(sourceDigest([b, a], ref));
63
+ });
64
+ test('is unambiguous across file boundaries (path/content cannot alias)', () => {
65
+ const ref = Buffer.from('ref');
66
+ // Same concatenated bytes, different split: must not collide.
67
+ const split = sourceDigest([f('ab', 'x'), f('', 'y')], ref);
68
+ const joined = sourceDigest([f('a', 'bxy')], ref);
69
+ expect(split).not.toBe(joined);
70
+ });
71
+ test('is reconstructible from git blob shas alone (dashboard tree-API parity)', () => {
72
+ // The dashboard computes this SAME digest at webhook time from a Git Trees
73
+ // API listing — which carries each committed file's blob sha but NOT its
74
+ // content. Pin the exact framing so that reconstruction (path + blob sha,
75
+ // no bytes) reproduces the digest byte-for-byte.
76
+ const files = [f('b.kt', 'B'), f('a.kt', 'A')];
77
+ const ref = Buffer.from('reference-image-bytes');
78
+ const sorted = [...files].sort((x, y) => (x.path < y.path ? -1 : x.path > y.path ? 1 : 0));
79
+ const h = createHash('sha256');
80
+ for (const file of sorted) {
81
+ const p = Buffer.from(file.path, 'utf8');
82
+ h.update(len(p.length));
83
+ h.update(p);
84
+ h.update(Buffer.from(gitBlobSha(file.bytes), 'hex'));
85
+ }
86
+ h.update(Buffer.from(gitBlobSha(ref), 'hex'));
87
+ expect(sourceDigest(files, ref)).toBe(h.digest('hex'));
88
+ });
89
+ test('matches the cross-consumer golden vector (pins the wire format)', () => {
90
+ // A fixed known-answer vector shared verbatim with the dashboard's
91
+ // dispatch-time digest, so the two implementations cannot drift apart
92
+ // silently. If this changes, the dashboard golden must change in lockstep.
93
+ const files = [f('a.kt', 'A'), f('proof/build.gradle.kts', 'plugins {}')];
94
+ expect(sourceDigest(files, Buffer.from('ref-bytes'))).toBe('7fc57f481eb011299d34824e0a506345d15e96946e345beac882f26adab47374');
95
+ expect(sourceDigest(files, null)).toBe('2596ecea7f591c23f9397707a92b008dabedbd1fd4acc0efb2440849e97ddd3c');
96
+ });
97
+ test('folds a null reference in with a presence-distinct marker (not a blob sha)', () => {
98
+ const files = [f('a.kt', 'A')];
99
+ const sorted = files;
100
+ const h = createHash('sha256');
101
+ for (const file of sorted) {
102
+ const p = Buffer.from(file.path, 'utf8');
103
+ h.update(len(p.length));
104
+ h.update(p);
105
+ h.update(Buffer.from(gitBlobSha(file.bytes), 'hex'));
106
+ }
107
+ h.update(len(0xffffffff));
108
+ expect(sourceDigest(files, null)).toBe(h.digest('hex'));
109
+ });
110
+ });
111
+ describe('isHermeticPackage', () => {
112
+ const hermetic = [
113
+ f('settings.gradle.kts', 'rootProject.name = "p"\ninclude(":proof")\n'),
114
+ f('build.gradle.kts', 'plugins { id("com.android.library") version "8.13.2" }'),
115
+ f('proof/build.gradle.kts', 'dependencies { implementation("androidx.compose.ui:ui") }'),
116
+ f('proof/src/main/kotlin/Proof.kt', 'fun Proof() {}'),
117
+ ];
118
+ test('accepts a self-contained package with everything pinned inline', () => {
119
+ expect(isHermeticPackage(hermetic)).toBe(true);
120
+ });
121
+ test('rejects a composite build (includeBuild reaches another build)', () => {
122
+ const files = [...hermetic, f('settings.gradle.kts', 'includeBuild("../design-system")')];
123
+ expect(isHermeticPackage(files)).toBe(false);
124
+ });
125
+ test('rejects a module relocated outside the root via projectDir', () => {
126
+ const files = [
127
+ f('settings.gradle.kts', 'include(":ds")\nproject(":ds").projectDir = file("../ds")'),
128
+ ];
129
+ expect(isHermeticPackage(files)).toBe(false);
130
+ });
131
+ test('rejects a parent-path escape (external file / version catalog)', () => {
132
+ const files = [
133
+ f('settings.gradle.kts', 'versionCatalogs { create("libs") { from(files("../gradle/libs.versions.toml")) } }'),
134
+ ];
135
+ expect(isHermeticPackage(files)).toBe(false);
136
+ });
137
+ test('ignores escape tokens outside Gradle scripts (only build scripts can escape)', () => {
138
+ // A source file or asset mentioning "../" is not a build-graph escape.
139
+ const files = [
140
+ f('settings.gradle.kts', 'include(":proof")'),
141
+ f('proof/src/main/kotlin/Doc.kt', '// see ../design-system for the original'),
142
+ ];
143
+ expect(isHermeticPackage(files)).toBe(true);
144
+ });
145
+ });
146
+ describe('runtime twin parity', () => {
147
+ const files = [f('Proof.kt', 'fun Proof() { Box() }'), f('build.gradle.kts', 'plugins {}')];
148
+ test('the spliced runner-side digest matches the pure sourceDigest (with reference)', () => {
149
+ const ref = Buffer.from('reference-image-bytes');
150
+ expect(twin.__fidSourceDigest(files, ref)).toBe(sourceDigest(files, ref));
151
+ });
152
+ test('the spliced runner-side digest matches the pure sourceDigest (no reference)', () => {
153
+ expect(twin.__fidSourceDigest(files, null)).toBe(sourceDigest(files, null));
154
+ });
155
+ test('the spliced runner-side hermeticity check matches isHermeticPackage', () => {
156
+ const hermetic = [
157
+ f('settings.gradle.kts', 'include(":proof")'),
158
+ f('proof/src/main/kotlin/Doc.kt', '// mentions ../elsewhere harmlessly'),
159
+ ];
160
+ const escaping = [f('settings.gradle', 'includeBuild("../other")')];
161
+ expect(twin.__fidIsHermetic(hermetic)).toBe(isHermeticPackage(hermetic));
162
+ expect(twin.__fidIsHermetic(escaping)).toBe(isHermeticPackage(escaping));
163
+ expect(twin.__fidIsHermetic(hermetic)).toBe(true);
164
+ expect(twin.__fidIsHermetic(escaping)).toBe(false);
165
+ });
166
+ });
167
+ //# sourceMappingURL=fidelity-input-digest.test.js.map
@@ -77,7 +77,71 @@ export type StructuralFact = {
77
77
  height: number;
78
78
  };
79
79
  ratio: number;
80
+ } | {
81
+ /** Composition runs only (design-frame anchor): the captured wrapper
82
+ * root's dp size differs from the declared design frame — an authoring
83
+ * problem with the wrapper, never a defect of the screen. While this
84
+ * fact is present, placement facts are withheld for the State
85
+ * (`StructuralBlock.placement`), so a mis-sized root can never
86
+ * masquerade as placement drift. */
87
+ kind: 'frame_mismatch';
88
+ declared: {
89
+ w: number;
90
+ h: number;
91
+ };
92
+ captured: {
93
+ w: number;
94
+ h: number;
95
+ };
96
+ deltas: Array<{
97
+ dimension: 'w' | 'h';
98
+ delta: number;
99
+ }>;
80
100
  };
101
+ /** The declared design frame for one screen (design px, treated 1:1 with dp —
102
+ * same convention as `ReferenceGeometry`). Composition runs declare one per
103
+ * State via `params.reference_frame`; component runs never pass it. */
104
+ export interface ReferenceFrame {
105
+ w: number;
106
+ h: number;
107
+ }
108
+ /** One member root whose position on the surface diverges from the design
109
+ * frame beyond tolerance (composition runs only): `expected` is the declared
110
+ * design x/y (design px, 1:1 dp), `actual` the rendered root-space dp —
111
+ * directly comparable because the root is frame-sized (asserted). Only the
112
+ * out-of-tolerance dimensions appear in `deltas`. */
113
+ export interface PlacementFact {
114
+ elementId: string;
115
+ expected: {
116
+ x: number;
117
+ y: number;
118
+ };
119
+ actual: {
120
+ x: number;
121
+ y: number;
122
+ };
123
+ deltas: Array<{
124
+ dimension: 'x' | 'y';
125
+ delta: number;
126
+ }>;
127
+ }
128
+ /** Placement drift at or below this many dp is sub-pixel/rounding noise, not
129
+ * a misplacement — same reasoning as the size-delta floor. */
130
+ export declare const DEFAULT_PLACEMENT_TOLERANCE_DP = 2;
131
+ /** Placement-fact gate for one State (composition runs only): present when a
132
+ * design frame was declared and asserted against the captured root. When the
133
+ * root mis-matches the frame, placement facts are WITHHELD (`withheld: true`,
134
+ * with the reason, no `facts`) — the placement deriver must not compute drift
135
+ * against a wrongly-sized canvas. When the root matches, `facts` carries the
136
+ * tolerance-banded member-root x/y divergences (empty = placement holds). */
137
+ export interface StructuralPlacement {
138
+ withheld: boolean;
139
+ reason?: 'frame_mismatch';
140
+ facts?: PlacementFact[];
141
+ }
142
+ /** Captured-root vs declared-frame tolerance (dp): sub-pixel rounding must not
143
+ * read as a mis-sized wrapper root. */
144
+ export declare const DEFAULT_FRAME_TOLERANCE_DP = 1;
81
145
  export interface DeriveStructuralFactsOptions {
82
146
  /** Edge excesses / overlaps at or below this many px are ignored, so that
83
147
  * exact-touching layout edges don't read as overflow or overlap. */
@@ -192,6 +256,8 @@ export interface StructuralBlock {
192
256
  facts: StructuralFact[];
193
257
  geometry?: StructuralGeometry;
194
258
  appearance?: StructuralAppearance;
259
+ /** Composition runs only — see `StructuralPlacement`. */
260
+ placement?: StructuralPlacement;
195
261
  }
196
262
  /** Which reference the appearance facts were diffed against. `previous_render`
197
263
  * facts are regressions/drift, NOT design divergences (the no-Figma path). */
@@ -381,7 +447,7 @@ export declare function deriveColorFacts(rendered: ColorSource, reference: Color
381
447
  export declare function buildStructuralBlock(dump: LayoutDump, referenceGeometry?: ReferenceGeometry | null, density?: number, options?: {
382
448
  sizeTolerancePx?: number;
383
449
  overhangTolerancePx?: number;
384
- }, appearanceReference?: AppearanceReference | null): StructuralBlock;
450
+ }, appearanceReference?: AppearanceReference | null, referenceFrame?: ReferenceFrame | null): StructuralBlock;
385
451
  export interface ReviewRow {
386
452
  element: string;
387
453
  rendered: string | null;
@@ -451,7 +517,7 @@ export declare function getGeometryStageInternals(): {
451
517
  buildStructuralBlock: (dump: LayoutDump, referenceGeometry?: ReferenceGeometry | null, density?: number, options?: {
452
518
  sizeTolerancePx?: number;
453
519
  overhangTolerancePx?: number;
454
- }, appearanceReference?: AppearanceReference | null) => StructuralBlock;
520
+ }, appearanceReference?: AppearanceReference | null, referenceFrame?: ReferenceFrame | null) => StructuralBlock;
455
521
  buildReviewScaffold: (structural: {
456
522
  facts?: StructuralFact[];
457
523
  geometry?: StructuralGeometry | null;
@@ -1 +1 @@
1
- {"version":3,"file":"structural-facts.d.ts","sourceRoot":"","sources":["../../../../src/yaml/steps/structural-facts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAC;IACX;6CACyC;IACzC,MAAM,EAAE,YAAY,CAAC;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