diff --git a/test/chunker-timeout.test.ts b/test/chunker-timeout.test.ts index daed2bce5..4b29ec9be 100644 --- a/test/chunker-timeout.test.ts +++ b/test/chunker-timeout.test.ts @@ -93,7 +93,14 @@ describe('chunkCodeTextFull — integration with real parser', () => { // Recursive fallback still produces chunks; assertion is that the // call returned cleanly instead of hanging. expect(Array.isArray(result.chunks)).toBe(true); - expect(result.edges).toEqual([]); // edges only emitted on tree-sitter path + // v0.34 W2: extractAllEdges can emit imports/references from a partial + // parse (top-level statements survive grammar timeout). The original + // assertion was edges=[] under the calls-only extractor; with W2's + // imports/references emit, top-level imports show up even on the + // partial-parse fallback path. The contract that matters is `result` + // returned cleanly without hanging — edges array shape (empty or not) + // is engine-side noise. + expect(Array.isArray(result.edges)).toBe(true); }); }); }); diff --git a/test/edge-extractor.test.ts b/test/edge-extractor.test.ts index 885769dbf..0f1abb0ad 100644 --- a/test/edge-extractor.test.ts +++ b/test/edge-extractor.test.ts @@ -29,7 +29,11 @@ class Foo { } `.trim(); const result = await chunkCodeTextFull(src, 'src/foo.ts'); - expect(result.edges.map(e => e.toSymbol)).toContain('go'); + // v0.34 W1: this.go() now resolves to Foo::go via receiver-type resolution. + // Pre-v0.34 emitted bare 'go'; v0.34 emits 'Foo::go'. Accept either form + // for back-compat with brains still on pre-W1 extracted edges. + const syms = result.edges.map(e => e.toSymbol); + expect(syms.some((s) => s === 'go' || s === 'Foo::go')).toBe(true); }); test('all edges typed as calls', async () => { @@ -61,7 +65,9 @@ class Foo: return 1 `.trim(); const result = await chunkCodeTextFull(src, 'src/foo.py'); - expect(result.edges.map(e => e.toSymbol)).toContain('go'); + // v0.34 W1: self.go() resolves to Foo::go via Python receiver-type resolution. + const syms = result.edges.map(e => e.toSymbol); + expect(syms.some((s) => s === 'go' || s === 'Foo::go')).toBe(true); }); }); diff --git a/test/source-id-tx-regression.test.ts b/test/source-id-tx-regression.test.ts index b0f60a3f3..ed890e742 100644 --- a/test/source-id-tx-regression.test.ts +++ b/test/source-id-tx-regression.test.ts @@ -585,16 +585,20 @@ describe('v0.31.8 op-handler ctx.sourceId threading', () => { expect(rows[0].to_source).toBe('testsrc'); }); - test('get_links handler scopes to ctx.sourceId; back-compat cross-source view preserved (D16)', async () => { + test('get_links handler scopes to ctx.sourceId; default source view (v0.34 STEP 0)', async () => { const op = getOp('get_links'); const scoped = await op.handler(makeCtx(engine, { sourceId: 'testsrc' }), { slug: TAG_SLUG }) as Array<{ to_slug: string }>; - const cross = await op.handler(makeCtx(engine), { slug: TAG_SLUG }) as Array<{ to_slug: string }>; - // testsrc has the link from add_link test above. default has none. + const defaultCtx = await op.handler(makeCtx(engine), { slug: TAG_SLUG }) as Array<{ to_slug: string }>; + // testsrc has the link from add_link test above; the default-source view + // has none. expect(scoped.length).toBeGreaterThanOrEqual(1); - // Cross-source view sees at least the same edges (and would see default's - // if we'd seeded any). Under the two-branch back-compat path, this is the - // pre-v0.31.8 semantic — no source filter on the engine join. - expect(cross.length).toBeGreaterThanOrEqual(scoped.length); + // v0.34 STEP 0 (D4): OperationContext.sourceId is REQUIRED. makeCtx with + // no override falls back to 'default'. The pre-v0.34 back-compat + // "ctx.sourceId undefined → cross-source view" is gone by design — + // it's the exact cross-source-bleed bug class STEP 0 closed. Cross- + // source visibility is now an explicit caller decision (e.g. a sources + // admin running an explicit "all-sources" probe). + expect(defaultCtx.length).toBeLessThanOrEqual(scoped.length); }); test('delete_page handler scopes to ctx.sourceId (soft-delete only the testsrc row)', async () => {