feat(workbench): locale-aware decimal/date evidence without an AI dependency
CI (SIAX Cloud) / integration (push) Skipped
CI (SIAX Cloud) / sonar (push) Skipped
CI (SIAX Cloud) / sonar (pull_request) Skipped
masterplan-lock / check (push) Successful in 4s
masterplan-lock / check (pull_request) Successful in 10s
CI (SIAX Cloud) / security (push) Successful in 20s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 20s
CI (SIAX Cloud) / security (pull_request) Successful in 21s
Security Scan (SIAX Cloud) / security (push) Successful in 28s
CI (SIAX Cloud) / integration (pull_request) Successful in 38s
CI (SIAX Cloud) / quality (push) Successful in 48s
CI (SIAX Cloud) / quality (pull_request) Successful in 47s
CI (SIAX Cloud) / integration (push) Skipped
CI (SIAX Cloud) / sonar (push) Skipped
CI (SIAX Cloud) / sonar (pull_request) Skipped
masterplan-lock / check (push) Successful in 4s
masterplan-lock / check (pull_request) Successful in 10s
CI (SIAX Cloud) / security (push) Successful in 20s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 20s
CI (SIAX Cloud) / security (pull_request) Successful in 21s
Security Scan (SIAX Cloud) / security (push) Successful in 28s
CI (SIAX Cloud) / integration (pull_request) Successful in 38s
CI (SIAX Cloud) / quality (push) Successful in 48s
CI (SIAX Cloud) / quality (pull_request) Successful in 47s
A source span now supports a decimal ('12 500,00' -> '12500.00') or a date
('14/10/2026' -> '2026-10-14') when the reading is unambiguous. Ambiguous
formats (01/02/2026, 1,234) still go to review. Evidence derivation scans the
source for typed candidates, so the local decision-server model only has to
return values, not UTF-16 offsets.
This commit is contained in:
@@ -159,6 +159,28 @@ describe('structure document workflow', () => {
|
||||
});
|
||||
expect(absent.status).toBe('needs_review');
|
||||
});
|
||||
it('derives evidence for decimals and dates from locale-formatted source text', async () => {
|
||||
const out = await structureDocument({
|
||||
request,
|
||||
countTokens: vi.fn(async () => 50),
|
||||
instructions: 'Extract amount and due date',
|
||||
fields: [
|
||||
{ name: 'amount', type: 'decimal' as const, required: true },
|
||||
{ name: 'due', type: 'date' as const, required: true },
|
||||
],
|
||||
sources: [{ id: 'p1', text: 'Belopp: 12 500,00 SEK\nFörfallodatum: 14/10/2026' }],
|
||||
gateway: {
|
||||
complete: vi.fn(async () => ({
|
||||
...response,
|
||||
content: JSON.stringify({ value: { amount: '12500.00', due: '2026-10-14' } }),
|
||||
})),
|
||||
},
|
||||
});
|
||||
expect(out.status).toBe('mechanically_validated');
|
||||
if (out.status !== 'mechanically_validated') throw new Error('expected validated');
|
||||
expect(out.evidence.map((e) => e.transform)).toEqual(['decimal', 'date']);
|
||||
expect(out.evidence[0]).toMatchObject({ start: 8, end: 17 });
|
||||
});
|
||||
it('rejects malformed contracts before a model call', async () => {
|
||||
const complete = vi.fn(async () => response);
|
||||
await expect(structureDocument({ ...base, fields: [], gateway: { complete } })).rejects.toThrow(
|
||||
|
||||
Reference in New Issue
Block a user