fix(workbench): tolerate flat or fenced JSON from a small local model
CI (SIAX Cloud) / integration (push) Skipped
CI (SIAX Cloud) / sonar (push) Skipped
CI (SIAX Cloud) / sonar (pull_request) Skipped
masterplan-lock / check (pull_request) Successful in 8s
CI (SIAX Cloud) / security (push) Successful in 21s
CI (SIAX Cloud) / integration (pull_request) Successful in 28s
CI (SIAX Cloud) / quality (pull_request) Successful in 42s
masterplan-lock / check (push) Successful in 1m4s
Security Scan (SIAX Cloud) / security (push) Successful in 1m14s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 1m16s
CI (SIAX Cloud) / security (pull_request) Successful in 1m18s
CI (SIAX Cloud) / quality (push) Successful in 1m24s
CI (SIAX Cloud) / integration (push) Skipped
CI (SIAX Cloud) / sonar (push) Skipped
CI (SIAX Cloud) / sonar (pull_request) Skipped
masterplan-lock / check (pull_request) Successful in 8s
CI (SIAX Cloud) / security (push) Successful in 21s
CI (SIAX Cloud) / integration (pull_request) Successful in 28s
CI (SIAX Cloud) / quality (pull_request) Successful in 42s
masterplan-lock / check (push) Successful in 1m4s
Security Scan (SIAX Cloud) / security (push) Successful in 1m14s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 1m16s
CI (SIAX Cloud) / security (pull_request) Successful in 1m18s
CI (SIAX Cloud) / quality (push) Successful in 1m24s
The decision-server model sometimes returns {field: value} or wraps the JSON
in a markdown fence. Accept both, while still requiring every value to be an
exact, unique substring of the source before it can be validated.
This commit is contained in:
@@ -122,6 +122,20 @@ describe('structure document workflow', () => {
|
||||
{ field: 'name', sourceId: 'page1', start: 6, end: 10, transform: 'exact' },
|
||||
]);
|
||||
});
|
||||
it('accepts a flat object or a fenced JSON object from a small local model', async () => {
|
||||
const flat = await structureDocument({
|
||||
...base,
|
||||
gateway: { complete: vi.fn(async () => ({ ...response, content: JSON.stringify({ name: 'Acme' }) })) },
|
||||
});
|
||||
expect(flat).toMatchObject({ status: 'mechanically_validated', value: { name: 'Acme' } });
|
||||
const fenced = await structureDocument({
|
||||
...base,
|
||||
gateway: {
|
||||
complete: vi.fn(async () => ({ ...response, content: '```json\n{"value":{"name":"Acme"}}\n```' })),
|
||||
},
|
||||
});
|
||||
expect(fenced).toMatchObject({ status: 'mechanically_validated', value: { name: 'Acme' } });
|
||||
});
|
||||
it('refuses ambiguous or absent values when computing evidence itself', async () => {
|
||||
const twice = await structureDocument({
|
||||
...base,
|
||||
|
||||
Reference in New Issue
Block a user