mirror of
https://github.com/morluto/rea.git
synced 2026-11-17 04:04:25 +00:00
refactor(kernel): migrate the remaining SHA-256 hex digests to sha256Hex and move isRecord into src/kernel (#11571)
* refactor(kernel): migrate the remaining one-shot SHA-256 hex digests to sha256Hex * refactor(kernel): move isRecord into src/kernel and replace its inline copies (#11574) * fix(scripts): import isRecord from src/kernel in the managed manifest parser
This commit is contained in:
1 parent
9ecfb109e8
commit
b51ed4c3ec
157 files changed
+397
-589
No files matched your search
@@ -10,7 +10,6 @@ import type {
|
||||
JavaScriptSemanticProjectionCapacity,
|
||||
JavaScriptSemanticFileProjection,
|
||||
} from "../../domain/javascript/javascriptSemanticFileProjection.js";
|
||||
import { createHash } from "node:crypto";
|
||||
import { readFile, writeFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { getHeapStatistics } from "node:v8";
|
||||
@@ -38,6 +37,7 @@ import {
|
||||
type JavaScriptWorkerMessage,
|
||||
} from "./JavaScriptAnalysisWorkerProtocol.js";
|
||||
import { errorMessage } from "../../kernel/errorMessage.js";
|
||||
import { sha256Hex } from "../../kernel/sha256Hex.js";
|
||||
|
||||
/** Trusted composition callback; this provider owns framing and temporary I/O. */
|
||||
export interface JavaScriptSourceWorkerAnalyzer {
|
||||
@@ -122,9 +122,7 @@ const analyzeJob = async (
|
||||
try {
|
||||
let resultBudgetBytes = 0;
|
||||
const source = await readFile(join(root, `${request.id}.source`), "utf8");
|
||||
if (
|
||||
createHash("sha256").update(source).digest("hex") !== request.text_sha256
|
||||
)
|
||||
if (sha256Hex(source) !== request.text_sha256)
|
||||
throw new TypeError(
|
||||
"JavaScript worker source text digest does not match its request",
|
||||
);
|
||||
@@ -180,7 +178,7 @@ const analyzeJob = async (
|
||||
kind: "static",
|
||||
id: request.id,
|
||||
bytes,
|
||||
sha256: createHash("sha256").update(text).digest("hex"),
|
||||
sha256: sha256Hex(text),
|
||||
});
|
||||
const next = await requests.next();
|
||||
if (next.done || !next.value.ok)
|
||||
|
||||
Reference in new issue
Block a user