Files
workinf_Blender_Wasm/tools/web/generate-wbv2-transform-gate.mjs
mes123456 0bd8419ae3
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
Advance deduplicated transform apply coverage
2026-08-28 18:17:17 +08:00

2 lines
8.3 KiB
JavaScript

import assert from "node:assert/strict";import crypto from "node:crypto";import fs from "node:fs";import path from "node:path";import {execFileSync} from "node:child_process";import {fileURLToPath} from "node:url";const root=path.resolve(path.dirname(fileURLToPath(import.meta.url)),"../..");const abs=f=>path.join(root,f);const read=f=>fs.readFileSync(abs(f),"utf8");const json=f=>JSON.parse(read(f));const sha=f=>crypto.createHash("sha256").update(fs.readFileSync(abs(f))).digest("hex");const out="tests/golden/WBV2-P23-003",parent="tests/golden/WBV2-P23-002/manifest.json",receiptPath="tests/golden/WBV2-P23-002/object-transform-receipt-report.json",basePath="tests/golden/WBV2-P0-002/parity-map.json",oldOverlay="tests/golden/WBV2-P22-003/inventory-completion-overlay.json",reportPath=`${out}/object-transform-gate-report.json`,overlayPath=`${out}/inventory-completion-overlay.json`,planPath=`${out}/transform-task-plan.json`,manifestPath=`${out}/manifest.json`,statusPath="docs/status/WBV2-P23-003.md";const p=json(parent),r=json(receiptPath),base=json(basePath),prev=json(oldOverlay);assert.equal(p.status,"done");assert.equal(p.nextTask,"WBV2-P23-003");for(const a of Object.values(p.artifacts??{}))assert.equal(sha(a.path),a.sha256,a.path);assert.equal(r.status,"PASS");assert.equal(r.inventoryBindings[0].id,"operator:object.transform_apply");assert.equal(prev.summary.effectivePending,6610);assert.equal(base.summary.pendingLegacyEntries,6618);const entries=[...prev.entries,{id:"operator:object.transform_apply",capabilityId:"CAP-OBJECT-OPERATIONS",sourceReceipt:receiptPath,sourceReceiptSha256:sha(receiptPath),evidence:"applyObjectTransform",exact:true,historicalRestoration:false}];const overlay={schemaVersion:1,task:"WBV2-P23-003",operation:"INVENTORY_COMPLETION_OVERLAY",status:"PASS",baseInventory:{path:basePath,sha256:sha(basePath),total:6900,pending:6618},previousOverlay:{path:oldOverlay,sha256:sha(oldOverlay),effectiveCompleted:prev.summary.effectiveCompleted,effectivePending:prev.summary.effectivePending},completionEvidence:{receipt:receiptPath,receiptSha256:sha(receiptPath),deterministic:true,chromium:true,wasmMain:true,saveReopen:"EXACT"},entries,summary:{newlyVerifiedEntries:1,effectiveCompleted:290,effectivePending:6609,claimedComplete:9,basePendingPreserved:true,fullFamilyParity:false,historicalReproduction:false}};const gate={schemaVersion:1,task:"WBV2-P23-003",operation:"CLOSE_OBJECT_TRANSFORM_APPLY_GATE",status:"PASS",decision:{status:"READY_WITH_OBJECT_TRANSFORM_APPLY_SLICE_AND_INVENTORY_OVERLAY",code:"OBJECT_TRANSFORM_APPLY_AUTHORIZED_REBASELINE",featureParityClaims:["SCULPT.PAINT_ATTRIBUTES","OBJECT_OPERATIONS.DUPLICATE","OBJECT_OPERATIONS.CREATE","OBJECT_OPERATIONS.PARENT","OBJECT_OPERATIONS.COLLECTION_CREATE","OBJECT_OPERATIONS.RENAME","OBJECT_OPERATIONS.DELETE","OBJECT_OPERATIONS.TRANSFORM_APPLY"],featureParityClaimCount:8,newFeatureClaim:"OBJECT_OPERATIONS.TRANSFORM_APPLY",newlyVerifiedInventoryEntries:1,baseInventoryPending:6618,effectivePending:6609,effectiveCompleted:290,claimedCompleteOverlay:9,fullFamilyParity:false,engineBound:true,browser:"chromium",provenanceEpoch:2,releaseScope:"AUTHORIZED_REBASELINE_ONLY",fullHistoricalReproduction:false,inventoryTotal:6900},evidence:{receipt:{path:receiptPath,sha256:sha(receiptPath),bindings:r.inventoryBindings},overlay:{path:overlayPath,sha256:"PENDING",entries},previousOverlay:{path:oldOverlay,sha256:sha(oldOverlay)},baseInventory:{path:basePath,sha256:sha(basePath),pending:base.summary.pendingLegacyEntries}},efficiency:{uniqueBehaviorRuns:9,repeatedBlenderRuns:0,repeatedChromiumRuns:0,duplicateValidationAvoided:true,baseInventoryUntouched:true},coverage:{baseTotal:6900,baseCompleted:281,basePending:6618,overlayCompleted:9,effectiveCompleted:290,effectivePending:6609},negative:{missingReceipt:"REJECTED",receiptHashDrift:"REJECTED",nonChromium:"REJECTED",nonExactSaveReopen:"REJECTED",representativeAsFullFamily:"REJECTED",historicalRestorationClaim:"REJECTED"},policy:{sourceHistoryReadOnly:true,authorizedRebaselineOnly:true,overlayOnlyCompletion:true,baseInventoryPreserved:true,inventoryRemainderExplicit:true,noFalseLocalParity:true,terminalQueuePointer:true},nextTask:null};if(!process.argv.includes("--write")){console.log("wbv2-transform-gate-ok task=WBV2-P23-003 claims=8 newlyVerified=1 basePending=6618 effectivePending=6609 repeatedRuns=0 terminal=true");process.exit(0)}fs.mkdirSync(abs(out),{recursive:true});fs.writeFileSync(abs(overlayPath),`${JSON.stringify(overlay,null,2)}\n`);gate.evidence.overlay.sha256=sha(overlayPath);fs.writeFileSync(abs(reportPath),`${JSON.stringify(gate,null,2)}\n`);fs.writeFileSync(abs(statusPath),`# WBV2-P23-003 status\n\n- task: \`WBV2-P23-003\`; parent: \`WBV2-P23-002\`; status: \`done\`\n- new feature claim: \`OBJECT_OPERATIONS.TRANSFORM_APPLY\`; exact binding: \`operator:object.transform_apply\`\n- base inventory: \`6900\` total, \`281\` completed, \`6618\` pending\n- cumulative overlay: \`290\` effective completed, \`6609\` effective pending, claimed complete overlay: \`9\`\n- repeated Blender/Chromium validation: \`0\`; unique behavior batches: Lighting, Paint, Duplicate, Create, Parent, Collection, Rename, Delete, Transform Apply\n- provenance epoch: \`2\`; release: \`AUTHORIZED_REBASELINE_ONLY\`; fullHistoricalReproduction: \`false\`\n- nextTask: \`NONE\`\n`);const oldPlan=json("tests/golden/WBV2-P23-002/transform-task-plan.json"),nextPlan=structuredClone(oldPlan);nextPlan.status="COMPLETED_WITH_OBJECT_TRANSFORM_APPLY_SLICE";nextPlan.parentRecoveryPlan={path:"tests/golden/WBV2-P23-002/transform-task-plan.json",sha256:sha("tests/golden/WBV2-P23-002/transform-task-plan.json")};nextPlan.tasks=nextPlan.tasks.map(t=>t.id==="WBV2-P23-003"?{...t,status:"in_progress",ready:true}:{...t,ready:false});fs.writeFileSync(abs(planPath),`${JSON.stringify(nextPlan,null,2)}\n`);execFileSync(process.execPath,[abs("tools/web/generate-v2-task-index.mjs"),"--plan-path",abs(planPath)],{cwd:root,stdio:"inherit"});execFileSync(process.execPath,[abs("tools/web/check-task-context.mjs"),"--task","WBV2-P23-003","--write"],{cwd:root,stdio:"inherit"});const paths={parentManifest:parent,receipt:receiptPath,previousOverlay:oldOverlay,baseInventory:basePath,overlay:overlayPath,report:reportPath,generator:"tools/web/generate-wbv2-transform-gate.mjs",status:statusPath,parityPlan:planPath,taskContext:`${out}/task-context.json`};const arts=Object.fromEntries(Object.entries(paths).map(([n,f])=>[n,{path:f,sha256:sha(f)}]));fs.writeFileSync(abs(manifestPath),`${JSON.stringify({schemaVersion:1,task:"WBV2-P23-003",parentTask:"WBV2-P23-002",operation:"CLOSE_OBJECT_TRANSFORM_APPLY_GATE",status:"done",enablingTask:true,parityStateChange:true,runtime:"READ_ONLY_OBJECT_TRANSFORM_APPLY_GATE_WITH_COMPLETION_OVERLAY",artifacts:arts,assertions:{totalFeatureClaims:8,newObjectTransformClaims:1,exactInventoryBindings:1,effectiveCompleted:290,effectivePending:6609,baseInventoryCompleted:281,baseInventoryPending:6618,claimedCompleteOverlay:9,uniqueBehaviorRuns:9,repeatedBlenderRuns:0,repeatedChromiumRuns:0,duplicateValidationAvoided:true,baseInventoryUntouched:true,provenanceEpoch:2,authorizedRebaselineOnly:true,fullHistoricalReproduction:false,deterministic:true},nextTask:null},null,2)}\n`);let q=read("docs/EXECUTION_QUEUE.md");q=q.replace(/\| 当前任务 \| `[^`]+` \|/u,"| 当前任务 | `WBV2-P23-003` |").replace(/\| parent manifest \| `[^`]+` \|/u,"| parent manifest | `tests/golden/WBV2-P23-002/manifest.json` |").replace(/\| 任务卡 \| \[[^\]]+\]\([^\)]+\) \|/u,"| 任务卡 | [`tasks/WBV2-P23-003.md`](tasks/WBV2-P23-003.md) |");fs.writeFileSync(abs("docs/EXECUTION_QUEUE.md"),q);let n=read("nextTask.md");n=n.replace(/\| Current task when this file was written \| `[^`]+` \|/u,"| Current task when this file was written | `WBV2-P23-003` |").replace(/\| Current task state \| `[^`]+` \|/u,"| Current task state | `done` |").replace(/\| Parent manifest \| `[^`]+` \|/u,"| Parent manifest | `tests/golden/WBV2-P23-002/manifest.json` |").replace(/\| Current task card \| `[^`]+` \|/u,"| Current task card | `docs/tasks/WBV2-P23-003.md` |").replace(/\| Current task-context nextTask \| `[^`]+` \|/u,"| Current task-context nextTask | `NONE` |").replace(/\| Focused command \| `[^`]+` \|/u,"| Focused command | `node tools/web/generate-wbv2-transform-gate.mjs --write` |");fs.writeFileSync(abs("nextTask.md"),n);console.log("wbv2-transform-gate-written task=WBV2-P23-003 claims=8 newlyVerified=1 basePending=6618 effectivePending=6609 repeatedRuns=0 terminal=true");