docs(release): seal and deliver task agreement 1.25 with retained production state

This commit is contained in:
Agent Workbench Dev
2026-11-04 15:34:29 +08:00
parent 78976ac775
commit ddefe5f108
1444 changed files with 2161122 additions and 17 deletions
@@ -0,0 +1,5 @@
# 真实模型先导工程
Node样本为小型多币种收支汇总,三个业务模块有意不完整;固定测试、构建脚本和声明不能修改。用于真实模型/Purge提示实验成对先导观测,不是固定模型回复,也不是完整商业项目。
金额输入为有限number或去空白后符合十进制格式的string;最多两位小数,转换为安全整数分;无效/越界输入抛TypeError。分组按大写三字母币种,支持负数退款、不改原数组,输出按币种排序。报告每行“币种 金额 (笔数)”,精确两位小数。
@@ -0,0 +1,9 @@
{
"name": "owned-live-expense-report",
"private": true,
"type": "module",
"scripts": {
"test": "node --test test/expense.test.mjs",
"build": "node scripts/build.mjs"
}
}
@@ -0,0 +1,8 @@
import { spawnSync } from 'node:child_process';
import { readFileSync } from 'node:fs';
for (const file of ['src/amount.mjs','src/summary.mjs','src/report.mjs']) {
const result=spawnSync(process.execPath,['--check',file],{encoding:'utf8'});
if(result.status!==0) { process.stderr.write(result.stderr);process.exit(result.status??1); }
if(!readFileSync(file,'utf8').trim()) throw new Error('Empty business module');
}
console.log('All three business modules compile.');
@@ -0,0 +1 @@
export function amountToCents(value) { return 0; }
@@ -0,0 +1 @@
export function formatReport(groups) { return ''; }
@@ -0,0 +1,2 @@
import { amountToCents } from './amount.mjs';
export function summarize(rows) { return []; }
@@ -0,0 +1,37 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { amountToCents } from '../src/amount.mjs';
import { summarize } from '../src/summary.mjs';
import { formatReport } from '../src/report.mjs';
test('decimal strings become exact cents including zero and refunds',()=>{
for(const [input,expected] of [['0',0],[' 12.34 ',1234],['+2.5',250],['-1.05',-105],['-0.00',0],['0009.10',910]]) assert.equal(amountToCents(input),expected);
});
test('finite decimal numbers use the same cents contract',()=>{
for(const [input,expected] of [[0,0],[1.01,101],[2.5,250],[-4.32,-432]]) assert.equal(amountToCents(input),expected);
});
test('malformed overprecision nonfinite and unsafe amounts are rejected',()=>{
for(const input of ['',null,undefined,true,{},'1e2','1,000','.50','1.234',1.234,NaN,Infinity,'900719925474099.99']) assert.throws(()=>amountToCents(input),TypeError,String(input));
});
test('independent currencies are sorted and summed without floating point loss',()=>{
assert.deepEqual(summarize([{currency:'usd',amount:'0.10'},{currency:' CNY ',amount:3},{currency:'USD',amount:'0.20'}]),[
{currency:'CNY',cents:300,count:1},{currency:'USD',cents:30,count:2}]);
});
test('refunds cancel totals while counting every original record',()=>{
assert.deepEqual(summarize([{currency:'eur',amount:'1.20'},{currency:'EUR',amount:'-1.20'}]),[{currency:'EUR',cents:0,count:2}]);
});
test('summarizing retains caller rows and handles an empty list',()=>{
const rows=Object.freeze([Object.freeze({currency:'usd',amount:'2.00'})]);
assert.deepEqual(summarize(rows),[{currency:'USD',cents:200,count:1}]);assert.deepEqual(summarize([]),[]);
});
test('invalid rows currency and unsafe aggregate totals are rejected',()=>{
for(const rows of [null,{},[null],[{currency:'US',amount:'1'}],[{currency:'U1D',amount:'1'}],[{currency:'USD',amount:'1.234'}],
[{currency:'USD',amount:'90071992547409.91'},{currency:'USD',amount:'0.01'}]]) assert.throws(()=>summarize(rows),TypeError);
});
test('reports use two decimals and render negative subunit amounts',()=>{
assert.equal(formatReport([{currency:'CNY',cents:300,count:2},{currency:'USD',cents:-105,count:1}]),'CNY 3.00 (2)\nUSD -1.05 (1)');
assert.equal(formatReport([{currency:'EUR',cents:-5,count:1}]),'EUR -0.05 (1)');assert.equal(formatReport([]),'');
});
test('complete expense flow preserves exact decimal sums',()=>{
assert.equal(formatReport(summarize([{currency:'usd',amount:'0.29'},{currency:'USD',amount:'-0.30'},{currency:'CNY',amount:'10.50'}])),
'CNY 10.50 (1)\nUSD -0.01 (2)');
});
@@ -0,0 +1,15 @@
# 四模块工程交付基准
[baseline/README.md](baseline/README.md)和14项测试固定初始缺失功能。`baseline`保持封存;验证器复制到独立`.qa`工程,在本地Git固定基线并增加需保留的原有工作区改动。
在已升级到1.1.0、已配置模型的工作台上,从本仓库运行:
```powershell
node scripts/verify-live-delivery.mjs
```
验证器使用工作台现有内存连接,允许模型读取当前合成工程、提出四个`src`模块改动,以及经核对的npm test/build计划。它核对提案范围、基线、保护文件hash后应用,随后调用“继续检查与交付”保留原Task。其他终端请求拒绝。
完成要求:实际失败记录、全部四文件修复、14项测试及构建通过、构建入口结果正确、保护输入与已有工作区改动保留、四源文件独立Git提交。日志、diff、会话及结果保存在`.qa/live-delivery-*/`,摘要索引为`.qa/live-delivery-validation.json`。
这是M1进入真实工程的单个受控样本。记录审核次数、模型用量与耗时,不将一次通过称为完整M2/M6能力;验收器的脚本确认、提案审查和Git提交属于已记录的人工介入替代操作。
@@ -0,0 +1,3 @@
/dist/
.awb-*
node_modules/
@@ -0,0 +1,15 @@
# Delivery Report 工程验收样本
这是有意保留缺失功能的Node工程,用于验证“失败→跨文件修复→实际测试→审查→Git交付”。本目录是封存输入,不是已完成产品。
仅修改 `src/normalize.mjs`、`src/summary.mjs`、`src/render.mjs`、`src/cli.mjs`。测试、fixtures、构建脚本、package.json与本文保持原字节。没有第三方依赖。
1. normalizeTasks接受最多10000项的数组;每项必须是对象,id/title为非空字符串且trim,trim后的id唯一。
2. status严格限定todo/doing/done/blocked;minutes必须是0到1000000之间的安全整数,拒绝文本、NaN、负数或越界;返回独立的四字段记录,不改变输入对象。
3. summarize返回total、counts(四种状态都出现)、completedPercent(done/total四舍五入到整数,空数组为0)、remainingMinutes(所有非done记录分钟数之和)。空数组计数全部为0。
4. renderText精确输出三行:`交付进度:D/T(P%)`、`待办 A · 进行中 B · 已完成 D · 阻塞 C`、`剩余预计:M 分钟`,保持中文可读。
5. CLI用法 `node src/cli.mjs <JSON文件> [--json]`。默认输出上述三行加尾换行,--json输出同一个summary的可解析JSON加换行。
6. 参数缺失、未知选项、无效JSON、无效数据或文件读取失败均以退出码2和stderr中文前缀“输入错误:”报告;stdout为空。成功退出0。
7. build核对四模块语法并复制到dist。`node dist/cli.mjs fixtures/tasks.json --json`与源码入口结果一致。
先运行npm test保存真实失败,再修改四个模块;应用提案后重跑npm test与npm run build。验收器另核对保护文件hash、源文件diff和构建入口,不把修改测试或只输出“成功”当交付。
@@ -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 }
]
@@ -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" }
}
@@ -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('四个模块语法检查及可运行构建完成。');
@@ -0,0 +1,8 @@
import fs from 'node:fs';
import { normalizeTasks } from './normalize.mjs';
import { summarize } from './summary.mjs';
import { renderText } from './render.mjs';
try {
const tasks = normalizeTasks(JSON.parse(fs.readFileSync(process.argv[2], 'utf8')));
console.log(renderText(summarize(tasks)));
} catch (error) { console.error(error.message); }
@@ -0,0 +1,4 @@
export function normalizeTasks(input) {
if (!Array.isArray(input)) throw new TypeError('tasks must be an array');
return input;
}
@@ -0,0 +1,3 @@
export function renderText(summary) {
return `Done: ${summary.counts.done}/${summary.total}`;
}
@@ -0,0 +1,5 @@
export function summarize(tasks) {
const done = tasks.filter(task => task.status === 'done').length;
return { total: tasks.length, counts: { done }, completedPercent: tasks.length ? 100 : 0,
remainingMinutes: tasks.reduce((sum, task) => sum + task.minutes, 0) };
}
@@ -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, /^输入错误:/); } });
@@ -0,0 +1,7 @@
# React/TypeScript 工程交付基准 v1
baseline封存一个能构建但功能不正确的任务看板,测试与构建配置不得修改。验收修复query、summary、transition和App四文件,通过实际Node测试、TypeScript检查、Vite生产构建以及真实浏览器筛选、搜索、精确任务切换和390px布局,再由工作台生成本地Git提交与证据报告。
在产品根目录执行 `node scripts/verify-react-delivery.mjs`。验证器使用独立数据/端口与从npm缓存离线安装的固定依赖;不访问正式模型连接。API夹具提供修复代码,结果只证明工程执行和审查链路,真实模型完成率须另行验收。
验收结果在[React工程记录](../../docs/react-engine-delivery-validation.json),当前发行情况在[1.7验收](../../docs/QA-1.7.md)。
@@ -0,0 +1,4 @@
node_modules/
dist/
.env
.awb-*
@@ -0,0 +1,5 @@
# React/TypeScript 工程交付基准
此目录封存可构建但功能错误的交付看板。测试、类型声明、构建配置和用户已有修改必须保持;修复范围为query、summary、transition和App四文件。
固定React19.3.1、Vite7.3.7和TypeScript5.9.3。独立目录安装依赖后执行npm test、npm run typecheck、npm run build;真正的浏览器还需验证筛选、搜索、精确任务切换和390px布局。只通过类型/构建检查不算业务交付通过。
@@ -0,0 +1,2 @@
<!doctype html>
<html lang="zh-CN"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width,initial-scale=1" /><title>工程交付看板</title></head><body><div id="root"></div><script type="module" src="/src/main.tsx"></script></body></html>
@@ -0,0 +1,22 @@
{
"name": "react-delivery-fixture",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"test": "node --test test/*.test.mjs",
"typecheck": "tsc --noEmit",
"build": "vite build"
},
"dependencies": {
"react": "19.3.1",
"react-dom": "19.3.1"
},
"devDependencies": {
"@types/react": "19.3.0",
"@types/react-dom": "19.3.0",
"@vitejs/plugin-react": "5.2.0",
"typescript": "5.9.3",
"vite": "7.3.7"
}
}
@@ -0,0 +1,33 @@
import { useState } from 'react';
import { selectTasks } from './query.ts';
import { summarizeTasks } from './summary.ts';
import { toggleTask } from './transition.ts';
import type { Task } from './types.ts';
const initial: Task[] = [
{ id: 'api', title: '编写接口', done: false, hours: 3 },
{ id: 'review', title: '验证交互', done: true, hours: 2 },
{ id: 'tests', title: '完成测试', done: false, hours: 5 },
];
export default function App() {
const [tasks, setTasks] = useState(initial), [filter, setFilter] = useState('all'), [query, setQuery] = useState('');
const summary = summarizeTasks(tasks), visible = selectTasks(tasks, filter, query);
return <main className="board">
<header><p className="eyebrow">PROJECT DELIVERY</p><h1>工程交付看板</h1><p>把每一项工作推进到可交付的结果。</p></header>
<section className="summary" aria-label="项目统计">
<div><span>全部任务</span><strong>{summary.total}</strong></div>
<div><span>完成任务</span><strong>{summary.completed}</strong></div>
<div><span>待办工时</span><strong>{summary.pendingHours}<small>小时</small></strong></div>
</section>
<section className="work"><div className="controls">
<input aria-label="任务搜索" placeholder="搜索任务…" value={query} onChange={event => setQuery(event.target.value)} />
<select aria-label="任务状态" value={filter} onChange={event => setFilter(event.target.value)}>
<option value="all">全部任务</option><option value="pending">待完成</option><option value="done">已完成</option>
</select></div>
<div className="task-list">{visible.map(task => <article key={task.id} data-task={task.id}>
<div><span className={task.done ? 'tag done' : 'tag'}>{task.done ? '已完成' : '待完成'}</span><h2>{task.title}</h2><p>预计 {task.hours} 小时</p></div>
<button onClick={() => setTasks(current => toggleTask(current, 'missing'))}>{task.done ? '恢复待办' : '标为完成'}</button>
</article>)}{!visible.length && <p className="empty">没有匹配的任务</p>}</div>
</section><footer>每次改变都应能核对、能恢复。</footer>
</main>;
}
@@ -0,0 +1,4 @@
import { createRoot } from 'react-dom/client';
import App from './App.tsx';
import './styles.css';
createRoot(document.getElementById('root')!).render(<App />);
@@ -0,0 +1,4 @@
import type { Task } from './types.ts';
export function selectTasks(tasks: Task[], filter: string, query: string): Task[] {
return tasks;
}
@@ -0,0 +1,26 @@
*{box-sizing:border-box}
body{margin:0;background:#f4f3ee;color:#263b35;font-family:"Segoe UI","Microsoft YaHei",sans-serif}
button,input,select{font:inherit}
button:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid #267564;outline-offset:3px}
.board{max-width:1040px;margin:0 auto;padding:56px 40px}
.eyebrow{letter-spacing:.18em;font-size:11px;color:#697d72;margin-bottom:12px}
h1{font-size:32px;letter-spacing:-1px;margin:0 0 14px}
header>p:last-child{font-size:14px;color:#6c7771}
.summary{display:grid;grid-template-columns:repeat(3,1fr);gap:18px;margin:36px 0}
.summary>div{border:1px solid #dce4dc;border-radius:12px;background:#fdfefa;padding:24px}
.summary span{font-size:12px;color:#677c71}
.summary strong{display:block;font-size:32px;margin-top:10px}
.summary small{font-size:12px;font-weight:400;margin-left:8px;color:#677c71}
.work{background:#fdfefa;border:1px solid #dce4dc;border-radius:14px;padding:24px}
.controls{display:flex;gap:12px;margin-bottom:24px}
.controls input{flex:1;min-width:0}
.controls input,.controls select{padding:11px 13px;border:1px solid #dce4dc;border-radius:7px;background:#fff}
article{display:flex;justify-content:space-between;align-items:center;gap:14px;border-top:1px solid #e6ece5;padding:20px 0}
article h2{font-size:16px;margin:10px 0 8px}
article p{font-size:12px;color:#6c7771;margin:0}
article button{border:1px solid #bdd1c5;background:#eaf4ed;color:#286b55;border-radius:7px;padding:9px 12px;white-space:nowrap}
.tag{display:inline-block;font-size:10px;background:#f6efdb;color:#857545;border-radius:4px;padding:4px 6px}
.tag.done{background:#e5f1e8;color:#367351}
.empty{padding:24px 0;text-align:center;color:#77857d}
footer{font-size:12px;color:#7d8981;text-align:center;margin-top:28px}
@media(max-width:600px){.board{padding:28px 18px}h1{font-size:25px}.summary{gap:8px;margin:24px 0}.summary>div{padding:16px 10px}.summary strong{font-size:25px}.summary small{display:block;margin:4px 0 0}.work{padding:16px}.controls{gap:8px}.controls select{max-width:112px}}
@@ -0,0 +1,4 @@
import type { Task } from './types.ts';
export function summarizeTasks(tasks: Task[]) {
return { total: tasks.length, completed: 0, pendingHours: 0 };
}
@@ -0,0 +1,4 @@
import type { Task } from './types.ts';
export function toggleTask(tasks: Task[], id: string): Task[] {
return tasks.map(task => ({ ...task, done: !task.done }));
}
@@ -0,0 +1 @@
export interface Task { id: string; title: string; done: boolean; hours: number }
@@ -0,0 +1,22 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { selectTasks } from '../src/query.ts';
import { summarizeTasks } from '../src/summary.ts';
import { toggleTask } from '../src/transition.ts';
const tasks = [
{ id: 'api', title: '编写接口', done: false, hours: 3 },
{ id: 'review', title: '验证交互', done: true, hours: 2 },
{ id: 'tests', title: '完成测试', done: false, hours: 5 },
];
test('the all filter preserves all tasks', () => assert.deepEqual(selectTasks(tasks, 'all', ''), tasks));
test('pending shows only pending tasks', () => assert.deepEqual(selectTasks(tasks, 'pending', '').map(task => task.id), ['api','tests']));
test('done shows only completed tasks', () => assert.deepEqual(selectTasks(tasks, 'done', '').map(task => task.id), ['review']));
test('search combines the selected state with trimmed text', () => assert.deepEqual(selectTasks(tasks, 'done', ' 验证 ').map(task => task.id), ['review']));
test('unmatched search returns an empty list', () => assert.equal(selectTasks(tasks, 'all', '不存在').length, 0));
test('actual totals use completion states and pending hours', () => assert.deepEqual(summarizeTasks(tasks), { total: 3, completed: 1, pendingHours: 8 }));
test('toggle changes only the selected task and keeps the input intact', () => {
const original = structuredClone(tasks), changed = toggleTask(tasks, 'api');
assert.deepEqual(changed.map(task => task.done), [true,true,false]); assert.deepEqual(tasks, original);
});
test('two toggles restore the selected task', () => assert.deepEqual(toggleTask(toggleTask(tasks, 'review'), 'review'), tasks));
test('an unknown identity preserves the tasks', () => assert.deepEqual(toggleTask(tasks, 'unknown'), tasks));
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "ES2022",
"lib": [
"ES2022",
"DOM",
"DOM.Iterable"
],
"module": "ESNext",
"moduleResolution": "Bundler",
"allowImportingTsExtensions": true,
"noEmit": true,
"jsx": "react-jsx",
"strict": true,
"skipLibCheck": true
},
"include": [
"src"
]
}
@@ -0,0 +1,3 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({ plugins: [react()] });
@@ -0,0 +1,9 @@
# 隔离协作的三个功能工程
这组自有样本验证实际工作区、工具、审批、原失败、修复、父归集/合并、完整检查和本地Git,固定Provider夹具提供预先定义的提案;它们不证明真实大模型的推理或自主成功率。
- Node:两个原错误模块,分别通过4项数值加法和4项完整整数区间测试;子任务只改所属模块,父工程必须8/8并构建。
- React/TypeScript:复用react-delivery-v1的9项原测试,两个独立范围各验证5/4项并类型检查/构建。父工程完整9/9,内置Edge在1280px和390px实际验证筛选、搜索、空态、单任务切换和统计。
- Python:原2项测试不变。每个子任务新增一个功能模块和4项固定测试,错误实现先实际失败,仅修复模块后各6/6;父工程金额精确转换/日程排序去重共10/10并编译。新增测试在后续修复中原字节保留。
先将AGENT_WORKBENCH_TEST_PYTHON设置为现有独立Python 3.10+解释器的绝对路径,再执行`node scripts/verify-workers-projects.mjs`。独立数据与原工件保存在本项目.qa唯一目录。每个父工程保留另行暂存、工作副本和未跟踪文件,Git只交付审查过的功能文件;运行期间输入冻结,不能修改src/scripts/tests/benchmarks或构建。
@@ -0,0 +1,12 @@
{
"name": "workers-number-library",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"test": "node --test test/*.test.mjs",
"test:add": "node --test test/add.test.mjs",
"test:range": "node --test test/range.test.mjs",
"build": "node scripts/build.mjs"
}
}
@@ -0,0 +1,9 @@
import fs from 'node:fs';
import { spawnSync } from 'node:child_process';
for (const file of ['src/add.mjs', 'src/range.mjs']) {
const checked = spawnSync(process.execPath, ['--check', file], { windowsHide: true, stdio: 'inherit' });
if (checked.status !== 0) process.exit(checked.status ?? 1);
}
fs.mkdirSync('dist', { recursive: true });
fs.cpSync('src', 'dist', { recursive: true });
console.log('Built two checked ESM library modules');
@@ -0,0 +1 @@
export function add(left, right) { return left - right; }
@@ -0,0 +1 @@
export function inclusiveRange(start, end) { return [start, end]; }
@@ -0,0 +1,9 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { add } from '../src/add.mjs';
test('positive additions return the actual sum', () => assert.equal(add(2, 3), 5));
test('negative additions preserve the signed result', () => assert.equal(add(-3, 1), -2));
test('fractional additions retain numeric precision', () => assert.ok(Math.abs(add(0.1, 0.2) - 0.3) < 1e-12));
test('nonfinite and nonnumeric inputs are rejected', () => {
for (const pair of [[Infinity, 1], ['2', 3], [NaN, 1]]) assert.throws(() => add(...pair), TypeError);
});
@@ -0,0 +1,9 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { inclusiveRange } from '../src/range.mjs';
test('inclusive ranges contain every integer between both ends', () => assert.deepEqual(inclusiveRange(1, 4), [1, 2, 3, 4]));
test('a single-point range contains exactly one number', () => assert.deepEqual(inclusiveRange(3, 3), [3]));
test('ranges cross zero without omitting negative values', () => assert.deepEqual(inclusiveRange(-2, 1), [-2, -1, 0, 1]));
test('descending fractional and oversized ranges are rejected', () => {
for (const pair of [[2, 1], [0.5, 3], [0, 10000]]) assert.throws(() => inclusiveRange(...pair), RangeError);
});
@@ -0,0 +1,17 @@
import unittest
from money import to_cents
class MoneyTests(unittest.TestCase):
def test_decimal_text_uses_exact_cents(self):
self.assertEqual(to_cents("0.29"), 29)
def test_half_cent_rounds_up(self):
self.assertEqual(to_cents("1.005"), 101)
def test_negative_half_cent_rounds_away_from_zero(self):
self.assertEqual(to_cents("-1.005"), -101)
def test_invalid_or_nonfinite_amount_is_rejected(self):
for value in ("bad", "Infinity", "NaN"):
with self.subTest(value=value), self.assertRaises(ValueError):
to_cents(value)
@@ -0,0 +1,21 @@
import unittest
from schedule import normalize_schedule
class ScheduleTests(unittest.TestCase):
def test_dates_are_sorted_chronologically(self):
self.assertEqual(normalize_schedule(["2026-11-03", "2026-10-31"]), ["2026-10-31", "2026-11-03"])
def test_duplicates_are_removed(self):
self.assertEqual(normalize_schedule(["2026-10-31", "2026-10-31"]), ["2026-10-31"])
def test_input_is_unchanged_and_empty_input_is_supported(self):
source = ["2026-11-01", "2026-10-31"]
original = list(source)
normalize_schedule(source)
self.assertEqual(source, original)
self.assertEqual(normalize_schedule([]), [])
def test_invalid_calendar_date_and_non_iso_text_are_rejected(self):
for value in ("2026-02-30", "2026/10/31", "20261031"):
with self.subTest(value=value), self.assertRaises(ValueError):
normalize_schedule([value])
@@ -0,0 +1,9 @@
[project]
name = "workers-money-schedule"
version = "0.1.0"
requires-python = ">=3.10"
[tool.agent-workbench.python]
framework = "unittest"
test-paths = ["tests"]
pattern = "test*.py"
@@ -0,0 +1,9 @@
import unittest
from util import label
class BaselineTests(unittest.TestCase):
def test_label_trims_whitespace(self):
self.assertEqual(label(" workshop "), "workshop")
def test_label_accepts_numeric_identity(self):
self.assertEqual(label(13), "13")
@@ -0,0 +1,2 @@
def label(value):
return str(value).strip()