fix: accept ingest wiki forward refs (#125)

This commit is contained in:
Andrey Avtomonov 2026-05-17 10:10:14 +02:00 committed by GitHub
parent 74be832aea
commit f49672ba5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 403 additions and 66 deletions

View file

@ -304,4 +304,40 @@ describe('WikiWriteTool', () => {
expect(result.markdown).toMatch(/orbit-team-lanes-detail/);
expect(wikiService.writePage).not.toHaveBeenCalled();
});
it('accepts forward refs during ingest sessions for post-pass validation', async () => {
const { tool, wikiService } = makeTool({
wikiService: {
listPageKeys: vi.fn().mockResolvedValue(['orbit-company-overview']),
},
});
const session: ToolSession = {
connectionId: 'conn-1',
isWorktreeScoped: true,
preHead: null,
touchedSlSources: createTouchedSlSources(),
actions: [],
semanticLayerService: {} as any,
wikiService: wikiService as any,
configService: {} as any,
gitService: {} as any,
ingest: { runId: 'run-1', jobId: 'job-1', syncId: 'sync-1', sourceKey: 'notion' },
};
const result = await tool.call(
{
key: 'orbit-how-we-work',
summary: 'Operating norms',
content: 'See [[orbit-team-lanes-detail]].',
refs: ['orbit-company-overview', 'orbit-team-lanes-detail'],
} as any,
{ ...baseContext, session },
);
expect(result.structured).toMatchObject({ success: true, key: 'orbit-how-we-work', action: 'created' });
expect(wikiService.writePage).toHaveBeenCalledTimes(1);
expect(session.actions).toContainEqual(
expect.objectContaining({ target: 'wiki', type: 'created', key: 'orbit-how-we-work' }),
);
});
});