diff --git a/.gitignore b/.gitignore index a6741cae..9ae2e7da 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /dist-client/ /dist-server/ /dist/ +/examples/delivery-report/dist/ /artifacts/ /.data/ /.local/ diff --git a/docs/VALIDATION.md b/docs/VALIDATION.md index 24df149f..525ff9b0 100644 --- a/docs/VALIDATION.md +++ b/docs/VALIDATION.md @@ -14,7 +14,7 @@ | 源码ZIP独立安装、构建和回归 | 离线安装、6份构建文件逐字节匹配、68/68通过 | [m1-source-package-validation.json](m1-source-package-validation.json) | | 两个ZIP的CRC、路径、清单与散列 | 全部通过 | [m1-archives-validation.json](m1-archives-validation.json) | | 正式原进程升级 | 1.1.0、同PID/内存连接、3项目/9会话及历史hash保留 | [m1-upgrade-live-validation.json](m1-upgrade-live-validation.json) | -| 真实模型四模块交付 | 正在实际执行 | 后续记录 | +| 真实模型四模块交付 | 13项失败→四模块修复→14/14及构建通过,同Task/2Run/1次审查/81秒 | [m1-live-delivery-validation.json](m1-live-delivery-validation.json) | 26组界面流程的页面异常/请求失败均为0,覆盖桌面和390px。已目视核对任务、差异和手机日志弹窗:标题、hash、正文、关闭/分页及固定任务输入区均可用,无遮挡或横向溢出。新增继续按钮使用明确的可访问名称。 @@ -22,6 +22,10 @@ 1.1.0实现Node/npm工程切片;三类工程完整M2验收、任务依赖图、外部引擎、REA执行和桌面/手机配对仍在后续阶段。真实模型样本的审查次数与用量单独报告。 +真实模型gpt-6.1-sol完成normalize/summary/render/cli四模块,仅修改允许的源文件。封存14项测试、fixtures、构建脚本和package保留;9个保护输入hash以及已有owner修改和未跟踪文件核对通过。验收器核对并应用一次四文件提案,通过「继续检查与交付」进入原Task的第2轮;最终实际测试14/14和构建通过,构建CLI结果一致。仅四个源文件进入本地交付commit `b17492ca0fb9d6ea562290f3857b1c4c06bf6bf2`。 + +该样本的Git提交由验收器完成,尚不属于1.1.0界面内的Git能力;后续M2将其内置。验收器的脚本确认、提案审查/应用和Git提交均属于已记录的介入,不能把此结果称为完全无人参与交付。可运行成果见[Delivery Report示例](../examples/delivery-report/README.md)。 + 以下保留1.0.0基线验收。 验收日期:2026-10-29(Asia/Shanghai)。环境:Windows x64,Node.js 24.22.1,npm 11.19.1,Microsoft Edge 156.0.4314.42。自动化验证使用独立项目和数据目录,正式用户会话验证单独记录。 diff --git a/docs/m1-live-delivery-validation.json b/docs/m1-live-delivery-validation.json new file mode 100644 index 00000000..ba1fb7a2 --- /dev/null +++ b/docs/m1-live-delivery-validation.json @@ -0,0 +1,209 @@ +{ + "success": true, + "version": "1.1.0", + "testedAt": "2026-10-29T07:20:52.067Z", + "model": "gpt-6.1-sol", + "projectRoot": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-delivery-c4fa89f0-46fe-4923-8a1f-4e3d028f3431\\交付报告工程", + "projectId": "3423bff0-d418-4a6d-9cc7-66bd85875a51", + "sessionId": "e8846c6e-1ba2-497e-b0db-ca5778181eb0", + "taskId": "5237de95-826f-45f2-9784-0402e59f52bb", + "baselineCommit": "badd7f77602c336bed6b00e253d1ef251a3f9922", + "deliveredCommit": "b17492ca0fb9d6ea562290f3857b1c4c06bf6bf2", + "elapsedSeconds": 81, + "runs": 2, + "reviewRounds": 1, + "applied": [ + { + "id": "03d3123a-0455-442d-b5f4-085ac5778e39", + "path": "src/normalize.mjs", + "sha256": "57eb47b09913b131982a14c276ba5292aba4c94e0f475c97955221f6a7b7cdcd", + "taskId": "5237de95-826f-45f2-9784-0402e59f52bb" + }, + { + "id": "798b3829-74a3-415c-aa25-40d8a48fcce3", + "path": "src/summary.mjs", + "sha256": "bf7ada9e5dbca167df2b9a5306c1d9399b4a658fb0777c73812856687ad0c5ef", + "taskId": "5237de95-826f-45f2-9784-0402e59f52bb" + }, + { + "id": "cf2a2a89-5d77-4675-8dda-5b346ba27989", + "path": "src/render.mjs", + "sha256": "d449524d731a55ef51d0143f38ee8b73db56363c78babc385fa58df7f2a542f0", + "taskId": "5237de95-826f-45f2-9784-0402e59f52bb" + }, + { + "id": "e5f2372c-7207-4157-9a1f-565467fa7f84", + "path": "src/cli.mjs", + "sha256": "b8223dd1c0a98b3b7a0cd716db0ae053a2ca17fbd8272b005adcedd3ce5f7a69", + "taskId": "5237de95-826f-45f2-9784-0402e59f52bb" + } + ], + "protectedHashes": { + "README.md": "4279c14b07a2b73a1a2c10ce8e80b6841ad39338b5a121215935c9c668ec2832", + "package.json": "15ac7e2e1840870f36886d634129551dbb8490fd7e5e613292beed95e8c50b6f", + "test/delivery.test.mjs": "90afb188568b27fa5c7c5a721c78e632b90e9e84d3fc75ee9008208d1487bb3f", + "scripts/build.mjs": "9dbc4bea4940fb0e87e7924a4601166c422149d3e9f5ecf1d22efde3b6c8c302", + "fixtures/tasks.json": "0ec1b97c5b84df8e70ff62828e80a0cc548814720ff7b995a2853ab1228d847d", + "fixtures/invalid.json": "f014956200206e75f522e90037ad0ead201b00a368deb58cbbabffa972b4bb50", + ".gitignore": "ed19d3c9c8a5e34d0179e0b1a9c2907d2e657738733e4a432a8cf81c76ce56f1", + "OWNER-NOTES.md": "38d076e1255121b92c4e1f8c04ca35155da345ae12df502d921df0bca09fae98", + "UNTRACKED-OWNER.txt": "389faf00156dd9bdc7c9d495be3c1d7a67189fa0e799fabb39400928dfd15fb1" + }, + "ownerEditsPreserved": true, + "buildOutput": { + "total": 4, + "counts": { + "todo": 0, + "doing": 1, + "done": 2, + "blocked": 1 + }, + "completedPercent": 50, + "remainingMinutes": 50 + }, + "usage": { + "requests": 11, + "inputTokens": 141382, + "outputTokens": 2339, + "totalTokens": 143721, + "unknownRequests": 0, + "estimatedUnknownTokens": 0 + }, + "checks": [ + { + "id": "42e896d0-5ebf-455b-9148-268d32b9513f", + "sessionId": "e8846c6e-1ba2-497e-b0db-ca5778181eb0", + "projectId": "3423bff0-d418-4a6d-9cc7-66bd85875a51", + "taskId": "5237de95-826f-45f2-9784-0402e59f52bb", + "runId": "69bf36c5-3997-421a-ae8f-8959556383ec", + "planId": "fc5ec679-798b-4bda-9db4-c3186d6349b8", + "status": "failed", + "source": "agent", + "startedAt": "2026-10-29T07:19:48.909Z", + "finishedAt": "2026-10-29T07:19:50.045Z", + "results": [ + { + "id": "80ce215c-bbcd-475e-aec4-404bf522bd70", + "name": "test", + "kind": "test", + "command": "npm run test", + "status": "failed", + "exitCode": 1, + "durationMs": 437, + "tests": { + "total": 14, + "passed": 1, + "failed": 13, + "cancelled": 0, + "skipped": 0 + }, + "timedOut": false, + "truncated": false, + "logArtifactId": "5c7e0e1e-e748-4288-b35d-d95a7e9d2c0e", + "logExcerpt": "rnal/test_runner/test:974:7) {\n generatedMessage: true,\n code: 'ERR_ASSERTION',\n actual: { id: 'one', title: '任务', status: 'todo', minutes: 5, unrelated: true },\n expected: { id: 'one', title: '任务', status: 'todo', minutes: 5 },\n operator: 'deepStrictEqual',\n diff: 'simple'\n }\n\ntest at test\\delivery.test.mjs:19:1\n✖ summary reports complete state counts and excludes completed work from remaining time (0.3599ms)\n AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:\n + actual - expected\n \n {\n + completedPercent: 100,\n - completedPercent: 50,\n counts: {\n - blocked: 1,\n - doing: 1,\n done: 2,\n - todo: 0\n },\n + remainingMinutes: 100,\n - remainingMinutes: 50,\n total: 4\n }\n \n at TestContext. (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/.qa/live-delivery-c4fa89f0-46fe-4923-8a1f-4e3d028f3431/%E4%BA%A4%E4%BB%98%E6%8A%A5%E5%91%8A%E5%B7%A5%E7%A8%8B/test/delivery.test.mjs:19:108)\n at Test.runInAsyncScope (node:async_hooks:227:14)\n at Test.run (node:internal/test_runner/test:1402:25)\n at Test.processPendingSubtests (node:internal/test_runner/test:974:18)\n at Test.postRun (node:internal/test_runner/test:1542:19)\n at Test.run (node:internal/test_runner/test:1467:12)\n at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {\n generatedMessage: true,\n code: 'ERR_ASSERTION',\n actual: { total: 4, counts: { done: 2 }, completedPercent: 100, remainingMinutes: 100 },\n expected: { total: 4, counts: { todo: 0, doing: 1, done: 2, blocked: 1 }, completedPercent: 50, remainingMinutes: 50 },\n operator: 'deepStrictEqual',\n diff: 'simple'\n }\n\ntest at test\\delivery.test.mjs:20:1\n✖ summary rounds progress instead of truncating percentages (0.1154ms)\n AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:\n \n 100 !== 67\n \n at TestContext. (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/.qa/live-delivery-c4fa89f0-46fe-4923-8a1f-4e3d028f3431/%E4%BA%A4%E4%BB%98%E6%8A%A5%E5%91%8A%E5%B7%A5%E7%A8%8B/test/delivery.test.mjs:20:80)\n at Test.runInAsyncScope (node:async_hooks:227:14)\n at Test.run (node:internal/test_runner/test:1402:25)\n at Test.processPendingSubtests (node:internal/test_runner/test:974:18)\n at Test.postRun (node:internal/test_runner/test:1542:19)\n at Test.run (node:internal/test_runner/test:1467:12)\n at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {\n generatedMessage: true,\n code: 'ERR_ASSERTION',\n actual: 100,\n expected: 67,\n operator: 'strictEqual',\n diff: 'simple'\n }\n\ntest at test\\delivery.test.mjs:21:1\n✖ summary handles an empty plan with every state present (0.1647ms)\n AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:\n + actual - expected\n \n {\n completedPercent: 0,\n counts: {\n - blocked: 0,\n - doing: 0,\n done: 0,\n - todo: 0\n },\n remainingMinutes: 0,\n total: 0\n }\n \n at TestContext. (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/.qa/live-delivery-c4fa89f0-46fe-4923-8a1f-4e3d028f3431/%E4%BA%A4%E4%BB%98%E6%8A%A5%E5%91%8A%E5%B7%A5%E7%A8%8B/test/delivery.test.mjs:21:77)\n at Test.runInAsyncScope (node:async_hooks:227:14)\n at Test.run (node:internal/test_runner/test:1402:25)\n at Test.processPendingSubtests (node:internal/test_runner/test:974:18)\n at Test.postRun (node:internal/test_runner/test:1542:19)\n at Test.run (node:internal/test_runner/test:1467:12)\n at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {\n generatedMessage: true,\n code: 'ERR_ASSERTION',\n actual: { total: 0, counts: { done: 0 }, completedPercent: 0, remainingMinutes: 0 },\n expected: { total: 0, counts: { todo: 0, doing: 0, done: 0, blocked: 0 }, completedPercent: 0, remainingMinutes: 0 },\n operator: 'deepStrictEqual',\n diff: 'simple'\n }\n\ntest at test\\delivery.test.mjs:22:1\n✖ text rendering keeps the required three readable Chinese lines (0.2086ms)\n AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:\n + actual - expected\n \n + 'Done: 2/4'\n - '交付进度:2/4(50%)\\n待办 0 · 进行中 1 · 已完成 2 · 阻塞 1\\n剩余预计:50 分钟'\n \n at TestContext. (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/.qa/live-delivery-c4fa89f0-46fe-4923-8a1f-4e3d028f3431/%E4%BA%A4%E4%BB%98%E6%8A%A5%E5%91%8A%E5%B7%A5%E7%A8%8B/test/delivery.test.mjs:22:85)\n at Test.runInAsyncScope (node:async_hooks:227:14)\n at Test.run (node:internal/test_runner/test:1402:25)\n at Test.processPendingSubtests (node:internal/test_runner/test:974:18)\n at Test.postRun (node:internal/test_runner/test:1542:19)\n at Test.run (node:internal/test_runner/test:1467:12)\n at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {\n generatedMessage: true,\n code: 'ERR_ASSERTION',\n actual: 'Done: 2/4',\n expected: '交付进度:2/4(50%)\\n待办 0 · 进行中 1 · 已完成 2 · 阻塞 1\\n剩余预计:50 分钟',\n operator: 'strictEqual',\n diff: 'simple'\n }\n\ntest at test\\delivery.test.mjs:23:1\n✖ CLI JSON output matches the summary contract and has a trailing newline (47.715ms)\n SyntaxError [Error]: Unexpected token 'D', \"Done: 2/4\n \" is not valid JSON\n at JSON.parse ()\n at TestContext. (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/.qa/live-delivery-c4fa89f0-46fe-4923-8a1f-4e3d028f3431/%E4%BA%A4%E4%BB%98%E6%8A%A5%E5%91%8A%E5%B7%A5%E7%A8%8B/test/delivery.test.mjs:23:232)\n at Test.runInAsyncScope (node:async_hooks:227:14)\n at Test.run (node:internal/test_runner/test:1402:25)\n at Test.processPendingSubtests (node:internal/test_runner/test:974:18)\n at Test.postRun (node:internal/test_runner/test:1542:19)\n at Test.run (node:internal/test_runner/test:1467:12)\n at async Test.processPendingSubtests (node:internal/test_runner/test:974:7)\n\ntest at test\\delivery.test.mjs:25:1\n✖ CLI missing arguments and unknown options return exit 2 without output (41.8575ms)\n AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:\n \n 0 !== 2\n \n at TestContext. (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/.qa/live-delivery-c4fa89f0-46fe-4923-8a1f-4e3d028f3431/%E4%BA%A4%E4%BB%98%E6%8A%A5%E5%91%8A%E5%B7%A5%E7%A8%8B/test/delivery.test.mjs:25:237)\n at Test.runInAsyncScope (node:async_hooks:227:14)\n at Test.run (node:internal/test_runner/test:1402:25)\n at Test.processPendingSubtests (node:internal/test_runner/test:974:18)\n at Test.postRun (node:internal/test_runner/test:1542:19)\n at Test.run (node:internal/test_runner/test:1467:12)\n at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {\n generatedMessage: true,\n code: 'ERR_ASSERTION',\n actual: 0,\n expected: 2,\n operator: 'strictEqual',\n diff: 'simple'\n }\n\ntest at test\\delivery.test.mjs:26:1\n✖ CLI invalid JSON and missing files preserve the failure exit code (41.2206ms)\n AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:\n \n 0 !== 2\n \n at TestContext. (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/.qa/live-delivery-c4fa89f0-46fe-4923-8a1f-4e3d028f3431/%E4%BA%A4%E4%BB%98%E6%8A%A5%E5%91%8A%E5%B7%A5%E7%A8%8B/test/delivery.test.mjs:26:194)\n at Test.runInAsyncScope (node:async_hooks:227:14)\n at Test.run (node:internal/test_runner/test:1402:25)\n at Test.processPendingSubtests (node:internal/test_runner/test:974:18)\n at Test.postRun (node:internal/test_runner/test:1542:19)\n at Test.run (node:internal/test_runner/test:1467:12)\n at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {\n generatedMessage: true,\n code: 'ERR_ASSERTION',\n actual: 0,\n expected: 2,\n operator: 'strictEqual',\n diff: 'simple'\n }\n" + }, + { + "id": "7fb6ab17-b2c7-4514-80b9-7979b4ddf201", + "name": "build", + "kind": "build", + "command": "npm run build", + "status": "passed", + "exitCode": 0, + "durationMs": 322, + "tests": null, + "timedOut": false, + "truncated": false, + "logArtifactId": "d5e217e5-9ced-4f6b-b6e9-3e75587a7ba6", + "logExcerpt": "\n> delivery-report-lab@0.1.0 build\n> node scripts/build.mjs\n\n四个模块语法检查及可运行构建完成。\n" + } + ], + "fingerprint": "8e53f7480212b8482fdc6a1febe111ea4a165d8524cc4b9622b790e4e83c6132", + "baseline": { + "head": "badd7f77602c336bed6b00e253d1ef251a3f9922", + "branch": "main", + "dirty": true + }, + "originalSessionStatus": "running", + "currentCheck": null, + "stale": false, + "summary": "有检查失败,请查看退出码和日志后修复。" + }, + { + "id": "54f3e5fc-dbab-4242-a8e3-20303c734251", + "sessionId": "e8846c6e-1ba2-497e-b0db-ca5778181eb0", + "projectId": "3423bff0-d418-4a6d-9cc7-66bd85875a51", + "taskId": "5237de95-826f-45f2-9784-0402e59f52bb", + "runId": "73666cd2-a5dd-444a-bd20-509b24fb141e", + "planId": "adc1247f-6204-486d-9bd5-4fe6fecf4f45", + "status": "passed", + "source": "agent", + "startedAt": "2026-10-29T07:20:40.107Z", + "finishedAt": "2026-10-29T07:20:41.302Z", + "results": [ + { + "id": "0361f013-5df4-4f06-9bee-3622949a0cba", + "name": "test", + "kind": "test", + "command": "npm run test", + "status": "passed", + "exitCode": 0, + "durationMs": 508, + "tests": { + "total": 14, + "passed": 14, + "failed": 0, + "cancelled": 0, + "skipped": 0 + }, + "timedOut": false, + "truncated": false, + "logArtifactId": "bb8a4592-3e94-4252-98e7-de7e7a72be20", + "logExcerpt": "\n> delivery-report-lab@0.1.0 test\n> node --test test/*.test.mjs\n\n✔ normalize trims identifiers and titles into independent records (1.0355ms)\n✔ normalize rejects blank and duplicate normalized identifiers (0.2485ms)\n✔ normalize validates record shape and bounded collection size (11.7295ms)\n✔ normalize supports all four states and rejects unknown states (0.2693ms)\n✔ normalize rejects noninteger and out-of-range estimates (0.1754ms)\n✔ normalize emits only the declared four-field contract (0.0834ms)\n✔ summary reports complete state counts and excludes completed work from remaining time (0.1883ms)\n✔ summary rounds progress instead of truncating percentages (0.0895ms)\n✔ summary handles an empty plan with every state present (0.0786ms)\n✔ text rendering keeps the required three readable Chinese lines (0.1182ms)\n✔ CLI JSON output matches the summary contract and has a trailing newline (43.1196ms)\n✔ CLI text output is readable and matches the shared rendering (41.0303ms)\n✔ CLI missing arguments and unknown options return exit 2 without output (122.5147ms)\n✔ CLI invalid JSON and missing files preserve the failure exit code (85.597ms)\nℹ tests 14\nℹ suites 0\nℹ pass 14\nℹ fail 0\nℹ cancelled 0\nℹ skipped 0\nℹ todo 0\nℹ duration_ms 359.2566\n" + }, + { + "id": "f73fa444-c7ea-4ce1-8d40-51e3629c4024", + "name": "build", + "kind": "build", + "command": "npm run build", + "status": "passed", + "exitCode": 0, + "durationMs": 306, + "tests": null, + "timedOut": false, + "truncated": false, + "logArtifactId": "26bde9cd-55ad-48e2-9193-e6c5f29ec798", + "logExcerpt": "\n> delivery-report-lab@0.1.0 build\n> node scripts/build.mjs\n\n四个模块语法检查及可运行构建完成。\n" + } + ], + "fingerprint": "131d12c5615006344b30a735f26c50d62369839ace954b17d7216cbaf0a237dc", + "baseline": { + "head": "badd7f77602c336bed6b00e253d1ef251a3f9922", + "branch": "main", + "dirty": true + }, + "originalSessionStatus": "running", + "currentCheck": null, + "stale": false, + "summary": "所选检查全部通过,测试数量与源码快照已记录。" + } + ], + "decisions": [ + { + "approvalId": "ca959fc7-8b32-4be8-927b-108a1a71f76c", + "planId": "fc5ec679-798b-4bda-9db4-c3186d6349b8", + "command": "npm run test\nnpm run build", + "allow": true + }, + { + "approvalId": "eed3ac40-70b3-437a-81a4-24375439453e", + "planId": "adc1247f-6204-486d-9bd5-4fe6fecf4f45", + "command": "npm run test\nnpm run build", + "allow": true + } + ], + "diffPath": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-delivery-c4fa89f0-46fe-4923-8a1f-4e3d028f3431\\reviewed-changes.diff", + "sessionPath": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\live-delivery-c4fa89f0-46fe-4923-8a1f-4e3d028f3431\\session.json", + "credentialsHandling": "Calls use the running host model configuration; no model key was read, copied or saved.", + "intervention": "Verifier approved only sealed npm scripts, checked four source proposals and applied them; implementation came from the configured model. The verifier saved a source-only local Git commit.", + "scope": "One synthetic Node engineering sample; does not establish M2 or M6 delivery success rates." +} \ No newline at end of file diff --git a/examples/delivery-report/README.md b/examples/delivery-report/README.md new file mode 100644 index 00000000..ac159e6d --- /dev/null +++ b/examples/delivery-report/README.md @@ -0,0 +1,22 @@ +# Delivery Report:已验证的四模块交付样本 + +本例由工作台内用户配置的gpt-6.1-sol完成。封存初始输入见[工程基准](../../benchmarks/node-delivery-v1/README.md):先取得13项真实测试失败,再产生四模块提案,审查应用后继续同一个Task,实际测试14/14通过并完成构建。验收文件与原工程的既有改动保留。 + +```powershell +npm test +npm run build +node dist/cli.mjs fixtures/tasks.json +node dist/cli.mjs fixtures/tasks.json --json +``` + +没有第三方依赖。Node24下默认输出: + +```text +交付进度:2/4(50%) +待办 0 · 进行中 1 · 已完成 2 · 阻塞 1 +剩余预计:50 分钟 +``` + +CLI接受JSON任务数组;无效参数、JSON、数据或文件返回退出码2与中文错误。normalize/summary/render/cli分别负责输入校验、统计、中文渲染和命令行入口。14项测试覆盖输入边界、数据独立性、统计、输出、CLI参数与错误退出;build核对语法并生成dist。 + +这是一个受控Node样本,不能代表所有真实项目的完成率。实现来自实际配置模型;验收器负责限定脚本确认、提案审查与应用,最后保存源文件Git提交。详细结果见[真实模型验收](../../docs/m1-live-delivery-validation.json)。 diff --git a/examples/delivery-report/fixtures/invalid.json b/examples/delivery-report/fixtures/invalid.json new file mode 100644 index 00000000..b0911c49 --- /dev/null +++ b/examples/delivery-report/fixtures/invalid.json @@ -0,0 +1 @@ +{ "unfinished": diff --git a/examples/delivery-report/fixtures/tasks.json b/examples/delivery-report/fixtures/tasks.json new file mode 100644 index 00000000..735200c6 --- /dev/null +++ b/examples/delivery-report/fixtures/tasks.json @@ -0,0 +1,6 @@ +[ + { "id": " docs ", "title": " 编写交付文档 ", "status": "done", "minutes": 30 }, + { "id": "api", "title": "接口回归", "status": "doing", "minutes": 40 }, + { "id": "release", "title": "准备发行包", "status": "blocked", "minutes": 10 }, + { "id": "review", "title": "代码审查", "status": "done", "minutes": 20 } +] diff --git a/examples/delivery-report/package.json b/examples/delivery-report/package.json new file mode 100644 index 00000000..3d971166 --- /dev/null +++ b/examples/delivery-report/package.json @@ -0,0 +1,7 @@ +{ + "name": "delivery-report-lab", + "version": "0.1.0", + "private": true, + "type": "module", + "scripts": { "test": "node --test test/*.test.mjs", "build": "node scripts/build.mjs" } +} diff --git a/examples/delivery-report/scripts/build.mjs b/examples/delivery-report/scripts/build.mjs new file mode 100644 index 00000000..679a831d --- /dev/null +++ b/examples/delivery-report/scripts/build.mjs @@ -0,0 +1,11 @@ +import fs from 'node:fs'; +import { spawnSync } from 'node:child_process'; +const modules = ['normalize.mjs', 'summary.mjs', 'render.mjs', 'cli.mjs']; +for (const name of modules) { + const check = spawnSync(process.execPath, ['--check', 'src/' + name], { encoding: 'utf8', windowsHide: true }); + if (check.status !== 0) { process.stderr.write(check.stderr); process.exit(1); } +} +fs.mkdirSync('dist', { recursive: true }); +for (const name of modules) fs.copyFileSync('src/' + name, 'dist/' + name); +fs.writeFileSync('dist/package.json', '{"type":"module"}\n'); +console.log('四个模块语法检查及可运行构建完成。'); diff --git a/examples/delivery-report/src/cli.mjs b/examples/delivery-report/src/cli.mjs new file mode 100644 index 00000000..de7b28de --- /dev/null +++ b/examples/delivery-report/src/cli.mjs @@ -0,0 +1,22 @@ +import fs from 'node:fs'; +import { normalizeTasks } from './normalize.mjs'; +import { summarize } from './summary.mjs'; +import { renderText } from './render.mjs'; + +try { + const args = process.argv.slice(2); + if (args.length < 1 || args.length > 2 || !args[0] || args[0].startsWith('-') || + (args.length === 2 && args[1] !== '--json')) { + throw new TypeError('用法:node src/cli.mjs [--json]'); + } + + const source = fs.readFileSync(args[0], 'utf8'); + const tasks = normalizeTasks(JSON.parse(source)); + const summary = summarize(tasks); + const output = args[1] === '--json' ? JSON.stringify(summary) : renderText(summary); + process.stdout.write(output + '\n'); + process.exitCode = 0; +} catch (error) { + process.stderr.write(`输入错误:${error.message}\n`); + process.exitCode = 2; +} diff --git a/examples/delivery-report/src/normalize.mjs b/examples/delivery-report/src/normalize.mjs new file mode 100644 index 00000000..faa2fa16 --- /dev/null +++ b/examples/delivery-report/src/normalize.mjs @@ -0,0 +1,32 @@ +const statuses = new Set(['todo', 'doing', 'done', 'blocked']); + +export function normalizeTasks(input) { + if (!Array.isArray(input)) throw new TypeError('任务必须是数组'); + if (input.length > 10000) throw new RangeError('任务数量不能超过10000项'); + + const ids = new Set(); + const tasks = []; + for (const task of input) { + if (task === null || typeof task !== 'object' || Array.isArray(task)) { + throw new TypeError('每项任务必须是对象'); + } + if (typeof task.id !== 'string' || typeof task.title !== 'string') { + throw new TypeError('任务id和title必须是字符串'); + } + const id = task.id.trim(); + const title = task.title.trim(); + if (!id || !title) throw new TypeError('任务id和title不能为空'); + if (ids.has(id)) throw new TypeError(`任务id重复:${id}`); + + const { status, minutes } = task; + if (!statuses.has(status)) { + throw new TypeError('任务status必须是todo、doing、done或blocked'); + } + if (!Number.isSafeInteger(minutes) || minutes < 0 || minutes > 1000000) { + throw new RangeError('任务minutes必须是0到1000000之间的安全整数'); + } + ids.add(id); + tasks.push({ id, title, status, minutes }); + } + return tasks; +} diff --git a/examples/delivery-report/src/render.mjs b/examples/delivery-report/src/render.mjs new file mode 100644 index 00000000..7f923c12 --- /dev/null +++ b/examples/delivery-report/src/render.mjs @@ -0,0 +1,8 @@ +export function renderText(summary) { + const { total, counts, completedPercent, remainingMinutes } = summary; + return [ + `交付进度:${counts.done}/${total}(${completedPercent}%)`, + `待办 ${counts.todo} · 进行中 ${counts.doing} · 已完成 ${counts.done} · 阻塞 ${counts.blocked}`, + `剩余预计:${remainingMinutes} 分钟`, + ].join('\n'); +} diff --git a/examples/delivery-report/src/summary.mjs b/examples/delivery-report/src/summary.mjs new file mode 100644 index 00000000..79ceefd1 --- /dev/null +++ b/examples/delivery-report/src/summary.mjs @@ -0,0 +1,16 @@ +export function summarize(tasks) { + const counts = { todo: 0, doing: 0, done: 0, blocked: 0 }; + let remainingMinutes = 0; + for (const task of tasks) { + counts[task.status] += 1; + if (task.status !== 'done') remainingMinutes += task.minutes; + } + + const total = tasks.length; + return { + total, + counts, + completedPercent: total === 0 ? 0 : Math.round(counts.done / total * 100), + remainingMinutes, + }; +} diff --git a/examples/delivery-report/test/delivery.test.mjs b/examples/delivery-report/test/delivery.test.mjs new file mode 100644 index 00000000..438c3e7e --- /dev/null +++ b/examples/delivery-report/test/delivery.test.mjs @@ -0,0 +1,26 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import fs from 'node:fs'; +import { spawnSync } from 'node:child_process'; +import { normalizeTasks } from '../src/normalize.mjs'; +import { summarize } from '../src/summary.mjs'; +import { renderText } from '../src/render.mjs'; +const input = () => JSON.parse(fs.readFileSync('fixtures/tasks.json', 'utf8')); +const record = overrides => ({ id: 'one', title: '任务', status: 'todo', minutes: 5, ...overrides }); +const expected = { total: 4, counts: { todo: 0, doing: 1, done: 2, blocked: 1 }, completedPercent: 50, remainingMinutes: 50 }; +const invoke = (...args) => spawnSync(process.execPath, ['src/cli.mjs', ...args], { encoding: 'utf8', windowsHide: true }); + +test('normalize trims identifiers and titles into independent records', () => { const original = input(), before = structuredClone(original), result = normalizeTasks(original); assert.equal(result[0].id, 'docs'); assert.equal(result[0].title, '编写交付文档'); assert.notEqual(result, original); assert.notEqual(result[1], original[1]); assert.deepEqual(original, before); }); +test('normalize rejects blank and duplicate normalized identifiers', () => { assert.throws(() => normalizeTasks([record({ id: ' ' })])); assert.throws(() => normalizeTasks([record({ title: ' ' })])); assert.throws(() => normalizeTasks([record(), record({ id: ' one ' })])); }); +test('normalize validates record shape and bounded collection size', () => { assert.throws(() => normalizeTasks({})); assert.throws(() => normalizeTasks([null])); assert.throws(() => normalizeTasks(Array.from({ length: 10001 }, (_, i) => record({ id: String(i) })))); }); +test('normalize supports all four states and rejects unknown states', () => { for (const status of ['todo', 'doing', 'done', 'blocked']) assert.equal(normalizeTasks([record({ status })])[0].status, status); assert.throws(() => normalizeTasks([record({ status: 'completed' })])); }); +test('normalize rejects noninteger and out-of-range estimates', () => { for (const minutes of ['5', null, -1, 0.5, NaN, Infinity, 1000001]) assert.throws(() => normalizeTasks([record({ minutes })])); assert.equal(normalizeTasks([record({ minutes: 0 })])[0].minutes, 0); assert.equal(normalizeTasks([record({ minutes: 1000000 })])[0].minutes, 1000000); }); +test('normalize emits only the declared four-field contract', () => assert.deepEqual(normalizeTasks([record({ unrelated: true })])[0], record())); +test('summary reports complete state counts and excludes completed work from remaining time', () => assert.deepEqual(summarize(normalizeTasks(input())), expected)); +test('summary rounds progress instead of truncating percentages', () => assert.equal(summarize([record({ status: 'done' }), record({ id: 'two', status: 'done' }), record({ id: 'three' })]).completedPercent, 67)); +test('summary handles an empty plan with every state present', () => assert.deepEqual(summarize([]), { total: 0, counts: { todo: 0, doing: 0, done: 0, blocked: 0 }, completedPercent: 0, remainingMinutes: 0 })); +test('text rendering keeps the required three readable Chinese lines', () => assert.equal(renderText(expected), '交付进度:2/4(50%)\n待办 0 · 进行中 1 · 已完成 2 · 阻塞 1\n剩余预计:50 分钟')); +test('CLI JSON output matches the summary contract and has a trailing newline', () => { const result = invoke('fixtures/tasks.json', '--json'); assert.equal(result.status, 0); assert.equal(result.stderr, ''); assert.deepEqual(JSON.parse(result.stdout), expected); assert.ok(result.stdout.endsWith('\n')); }); +test('CLI text output is readable and matches the shared rendering', () => { const result = invoke('fixtures/tasks.json'); assert.equal(result.status, 0); assert.equal(result.stdout, renderText(expected) + '\n'); assert.equal(result.stderr, ''); }); +test('CLI missing arguments and unknown options return exit 2 without output', () => { for (const args of [[], ['fixtures/tasks.json', '--unknown'], ['fixtures/tasks.json', '--json', '--json']]) { const result = invoke(...args); assert.equal(result.status, 2); assert.equal(result.stdout, ''); assert.match(result.stderr, /^输入错误:/); } }); +test('CLI invalid JSON and missing files preserve the failure exit code', () => { for (const file of ['fixtures/invalid.json', 'fixtures/not-found.json']) { const result = invoke(file); assert.equal(result.status, 2); assert.equal(result.stdout, ''); assert.match(result.stderr, /^输入错误:/); } }); diff --git a/findings.md b/findings.md index 90250bda..51404361 100644 --- a/findings.md +++ b/findings.md @@ -111,3 +111,8 @@ Claude Code 报告已验证工具输入校验、权限决定、队列并发屏 - README首个更新补丁因把完整长行截成前半句而未匹配,未写文件;改为完整行后应用成功。 - 新任务UI前6组通过,最后一组定位“继续检查与交付”超时。真实DOM与Task/Run核对确认按钮已显示,accessible name包含辅助说明,导致精确名称不匹配。为操作补充明确aria-label后重新构建并复验,保留界面截图与失败记录。 - 最终68/68行为与10/9/7组界面全部通过,证据已复制到docs/m1-*.json。持续浏览器补充观察的组合cell超时并重置kernel,功能验收仍以已完成的独立脚本和截图为准;后续浏览器操作拆成短cell。 +- 1.1.0便携/源码ZIP初次验证通过,源码独立构建6份文件完全一致、68项回归通过;真实原进程升级0.7秒成功,历史消息/工具/提案hash、状态、revision和连接保留。 +- 真实gpt-6.1-sol四模块样本通过:81秒、11次请求、143721个已报告tokens、1Task/2Run/1次审查,13失败→14通过,build与dist CLI正确。服务未提供价格配置,未换算金额;模型效果与固定行为测试分别记录。 +- M2 Git交付需新增sourceFingerprint:当前检查fingerprint包含HEAD/status,提交仅改变Git元数据也会导致旧指纹不同。源文件一致性与提交前Git准入基线需分开验证;提交只包含当前Task已应用的路径,已有暂存/工作区修改应保持。 +- Git提交副作用要持久job身份、未知结果核对和不重放;新core kind在原进程热升级时也要补齐Map,不能因ensureStorage已初始化直接跳过。 +- 新示例dist是构建产物,按具体路径加入ignore。首次补丁误用不存在的starter-project/node_modules行未写文件,已按实际/dist/锚点修正。 diff --git a/progress.md b/progress.md index 8e6a25bc..c4d8a07b 100644 --- a/progress.md +++ b/progress.md @@ -91,3 +91,5 @@ - 源码ZIP独立解压,离线安装、完整构建与68/68测试通过;6份客户端/服务端构建文件与本仓库逐字节相同。 - 4318已成功升级至1.1.0,仍是原PID23080,gpt-6.1-sol内存连接、3个项目、9个原会话及消息/工具/提案hash和revision保留;调试端口已关闭。 - 真实模型四模块交付验证已启动,只操作独立合成工程,不使用原用户项目作为实验输入。界面新版本链接已提交给当前Codex面板。 +- 真实模型验收81秒完成:1Task/2Run/1次四文件审查,14项测试由1通过/13失败变为14通过;build和dist CLI结果一致,9个保护输入与原owner改动保留。交付源文件commit b17492ca,详细结果与可运行样本已保存。 +- 继续M2首个内置Git交付切片:1.1.0的提交由验收器执行,产品需要Task绑定的审查计划/commit job/报告及未知结果核对。工作台原连接保持,开发仍在源码/独立QA进行。 diff --git a/task_plan.md b/task_plan.md index 0ef05e6b..50e4adfc 100644 --- a/task_plan.md +++ b/task_plan.md @@ -116,9 +116,9 @@ 1. [complete] 核对当前执行/保存/API/UI契约、升级机制和测试,确定兼容迁移与验收。 2. [complete] 实现独立任务/运行契约、SQLite状态与追加事件、JSON迁移/备份、恢复和工具结果核对;10个实际退出切点通过。 3. [complete] Runtime、配置/预算、审批/工具身份、任务/运行/工件界面和SSE补发已接入;6组任务UI及手机弹窗目视验收通过。 -4. [in_progress] 有界工程识别、npm检查计划/真实job和Git基线已实现并验证;正在建立真实模型跨文件工程交付样本。 -5. [in_progress] 当前68项完整测试、基础10/诊断9/任务7组界面通过;便携与源码独立构建/68项回归已通过,正在真实模型工程交付。 -6. [in_progress] 1.1.0已保留原进程与连接升级至4318;完整ZIP/清单通过,待补入真实工程记录并封存最终发行。 +4. [complete] 有界工程识别、npm检查计划/真实job和Git基线已验证;真实模型四模块工程13失败→14通过、构建及源文件Git交付完成。 +5. [complete] 68项完整测试、基础10/诊断9/任务7组界面、便携与源码独立构建/68项回归和真实模型样本通过。 +6. [in_progress] 1.1.0已保留原进程与连接升级至4318;正在补入真实工程记录和样本,封存最终发行。 ### 本轮执行边界与发现 @@ -139,6 +139,15 @@ - 保留已提交的2ea3485与已有未提交续作,接续审核后继续、日志工件读取、随附npm和封存工程样本。 - [complete] 完善“继续检查与交付”的Task归属、重复操作与请求失败行为,API并发/重启及7组任务界面已通过。 - [complete] 独立端口基础10/诊断9/任务7组回归通过,桌面与390px窄屏截图已目视核对。 -- [in_progress] 真实模型验收器已启动,使用现有内存连接修复四模块工程,保护测试/fixtures/构建脚本,保存失败和通过日志。 +- [complete] 真实模型四模块工程完成,保护测试/fixtures/构建脚本和既有改动;失败/通过日志、diff、2Run和commit已保存。 + +## M2首个内置Git交付切片 + +用户要求继续全量推进。在M1可运行版本与真实样本完成后,继续将审核后的源文件Git提交和确定性交付报告内置;三类工程、ChangeSet与完整M2验收仍另行推进。 + +1. [in_progress] 明确源文件校验与Git基线的区别,设计当前Task的提交计划、job、归属和恢复契约。 +2. [pending] 实现只包含已应用任务路径的审核提交,保留无关工作区/暂存改动;过期、重叠与未知结果不得自动重放。 +3. [pending] 保存实际commit/测试/源码hash和交付报告工件,接入任务面板与确认操作。 +4. [pending] 实测Git边界、停止/重启、界面和真实模型完整闭环,按小步本地提交后发布后续版本。 - [in_progress] 验证1.1.0便携包及原进程保留连接升级,整理实际能力边界和本地Git提交。 - 恢复时父目录不是Git根目录;已定位到Agent-Workbench仓库。大批读取发生输出截断,后续按文件与关键段读取,不将未返回段落当已核对。