This commit is contained in:
33333-33333 2026-08-11 21:51:07 +09:00
commit de7c6c32bd
123 changed files with 13201 additions and 6213 deletions

View file

@ -130,7 +130,12 @@ async function main() {
x1: world.originX + 132,
y1: world.originY + 118,
};
const candidate = { candidateId: "node-sync:1", candidateOrdinal: 1, variant: 1, seed: 0x51a7c3d3 };
const candidates = [1, 2, 3].map((variant, index) => ({
candidateId: `node-sync:${variant}`,
candidateOrdinal: index + 1,
variant,
seed: (0x51a7c3d3 + Math.imul(index, 0x9e3779b9)) >>> 0,
}));
const resultPromise = waitFor(worker, (message) => message?.id === 92 && message?.type !== "progress", 180_000);
worker.postMessage({
id: 92,
@ -139,11 +144,11 @@ async function main() {
options: {
patchMode: "regeneration",
terrainType: "auto",
variant: candidate.variant,
seed: candidate.seed,
variant: candidates[0].variant,
seed: candidates[0].seed,
maxQualityRetries: 0,
qualityTerrainAttempts: 1,
acceptBestAvailableQuality: false,
acceptBestAvailableQuality: true,
includeSeamVisualization: false,
},
search: {
@ -152,14 +157,29 @@ async function main() {
committedRevision: 1,
workerEpoch: 1,
executionAttempt: 1,
totalCandidateCount: 1,
totalCandidateCount: candidates.length,
reuseCommittedMirror: true,
candidatePlan: [candidate],
resolvedPatchMode: "regeneration",
selectBestCandidate: true,
draftSelection: true,
candidatePlan: candidates,
},
});
const result = await resultPromise;
assert(result.ok === true && result.result?.ok === true, "a cold-synchronized mirror can run a complete production patch without retransmitting world");
assert(result.result?.acceptedWorldHash && result.result?.applyToken, "cold-synchronized candidate returns transactional hash and Apply token");
assert(result.ok === true && result.result?.ok === true, "a cold-synchronized mirror can run draft-ranked production without retransmitting world");
const draftDebug = result.result?.draftSelection;
const exactBoundBehavior = draftDebug?.fullCandidateCount < 3
? draftDebug?.branchBoundPrunedCount > 0
: draftDebug?.fullCandidateCount === 3 && draftDebug?.branchBoundPrunedCount === 0 && draftDebug?.fullComparedCandidateOrdinals?.length === 3;
assert(draftDebug?.enabled === true
&& draftDebug?.draftCount === 3
&& draftDebug?.fullCandidateCount >= 1
&& draftDebug?.fullCandidateCount <= 3
&& draftDebug?.reusedWinningDraft === false
&& draftDebug?.fullProductionFromTerrainOnly === true
&& exactBoundBehavior,
"real Worker production ranks three terrain scouts, prunes only mathematically dominated candidates, and fully compares all candidates when admissible bounds overlap");
assert(result.result?.acceptedWorldHash && result.result?.applyToken, "draft-ranked finalist returns transactional hash and Apply token");
const ackId = "node-sync-apply";
const applyPromise = waitFor(worker, (message) => message?.type === "patch-apply-ack-result" && message.ackId === ackId);