lemmascript 0.6.14 → 0.6.16

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.
@@ -170,7 +170,7 @@ export class RunLog {
170
170
  failed: results?.failed ?? [],
171
171
  passed: results?.passed ?? [],
172
172
  tsHash: this.tsHash,
173
- dfyHash: safely(() => hashText(readFileSync(outcome.dfyPath, "utf8"))),
173
+ dfyHash: safely(() => this.proofHash(outcome.dfyPath)),
174
174
  lsc: this.init.lscVersion,
175
175
  };
176
176
  appendFileSync(path.join(dir, "runs.jsonl"), JSON.stringify(record) + "\n");
@@ -185,6 +185,20 @@ export class RunLog {
185
185
  this.done = true;
186
186
  this.removeTextLogDir();
187
187
  }
188
+ proofHash(dfyPath) {
189
+ const content = readFileSync(dfyPath, "utf8");
190
+ const files = [...new Set((this.init.proofFiles ?? []).map(file => path.resolve(file)))];
191
+ // Preserve historical comparisons for sources without registered proofs.
192
+ if (files.length === 0)
193
+ return hashText(content);
194
+ const proofs = files.map(file => [
195
+ path.relative(this.init.logDir, file).split(path.sep).join("/"),
196
+ readFileSync(file, "utf8"),
197
+ ]);
198
+ proofs.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
199
+ // Include paths and file boundaries, independent of registration order or checkout location.
200
+ return hashText(JSON.stringify([content, proofs]));
201
+ }
188
202
  textLogPath() {
189
203
  return path.join(this.textLogDir, "verify.txt");
190
204
  }