test: freeze expense sample and live cohort conditions
This commit is contained in:
@@ -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)');
|
||||
});
|
||||
@@ -24,6 +24,12 @@
|
||||
|
||||
两轮小样本仅作为先导观测,不做统计显著性或普遍性能结论。代理声明的模型名作为实际路由标识,不独立证明上游底层权重身份。
|
||||
|
||||
## 请求前条件修订与原结果
|
||||
|
||||
首个React使用原GPT连接,连接前超时,原样本保留为未交付/网络错误,没有重跑。只读HEAD证实Node默认DNS顺序连接jojocode超时,而IPv4优先和curl分别收到404;Claude代理的Node HEAD收到404。余下五个新样本固定已配置Claude连接09b0293b、revision1、Chat Completions流式;不跨模型合并成功率或token差值。
|
||||
|
||||
Python原样本6请求、201964报告tokens,原运行token_limit暂停,尚无改动。无追加提示和预算续接。为遵守总700000报告tokens,四个Purge对照样本在开始前统一固定原生子任务110000 token预算、24步/80工具/10分钟,保留每个实际停止原因和全部尝试。金额/币种三模块采用新固定Node样本,避免用相加函数样本代替工程能力。
|
||||
|
||||
## 状态保持与证据
|
||||
|
||||
请求前对原项目/会话/表/导出/工件散列;测试只追加独立工程与所属请求。模型选择暂时固定单连接,结束后恢复原池;保留原连接凭据与所有历史请求。请求/工具/检查/页面/交付原件保存到独立本机QA目录,Git只纳入本轮可审查且不含凭据的必要证据。
|
||||
|
||||
Reference in New Issue
Block a user