fix(research): preserve verified hypothesis links after partial lookup failure (RP11)

This commit is contained in:
Boki 2026-10-27 14:14:30 -04:00
parent f4cee5affa
commit 32f40ee753
3 changed files with 136 additions and 17 deletions

View file

@ -3456,12 +3456,35 @@ test('research_project_to_finding_browser_with_canonical_strategy_setup_run_and_
await f.page.getByRole('button', { name: 'View revision 1', exact: true }).click();
await visible(f.page, 'Costs and losses require further validation.');
await visible(f.page, 'Immutable history: this revision is read-only.');
// Move the cited hypothesis forward so the exact link requires history resolution.
await f.request(`/api/v2/hypotheses/${hypothesis.id}/revisions`, 'POST', {
expectedRevision: 1,
title: 'Revised AI trend hypothesis',
proposition: 'A revised hypothesis, still not validated alpha.',
validationCriteria: 'Out-of-sample evidence required.',
contentOrigin: 'ai',
});
const { hypothesis: unrelatedHypothesis } = await f.request(
`/api/v2/research-projects/${project.id}/hypotheses`,
'POST',
{ title: 'Unrelated hypothesis', proposition: 'Separate future investigation.' }
);
const unrelatedHistoryPath = `**/api/v2/hypotheses/${unrelatedHypothesis.id}/revisions`;
await f.page.route(unrelatedHistoryPath, route =>
route.fulfill({ status: 503, json: { error: 'Unrelated history unavailable' } })
);
const unrelatedHistoryFailure = f.page.waitForResponse(response =>
response.url().endsWith(`/hypotheses/${unrelatedHypothesis.id}/revisions`)
);
await f.page.reload();
expect((await unrelatedHistoryFailure).status()).toBe(503);
await visible(f.page, 'Costs and losses require further validation.');
await f.page.getByRole('link', { name: 'Open exact hypothesis revision', exact: true }).click();
await f.page.waitForURL(
`${f.origin}/research/${project.id}?hypothesis=${hypothesis.id}&revision=${hypothesis.latestRevision.id}`
);
await f.page.unroute(unrelatedHistoryPath);
await visible(f.page, 'A hypothesis, not validated alpha.');
await visible(f.page, /AI-authored \(declared\).*Unvalidated narrative/);
await f.page.getByRole('button', { name: 'Archive project', exact: true }).click();
await visible(f.page, 'Archived project: research entries are read-only.');