Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions __tests__/kernel-retry-materialize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe.skipIf(!kernelBuilt)("kernel buffer-transport storage (#1541)", () => {
async (store) => {
const source =
"def target_fn(root, mission_path):\n" +
" return (root, mission_path, 'bompus_custom_ds_players')\n" +
" return (root, mission_path, 'demo_custom_players')\n" +
"\n" +
"class Adapter:\n" +
" def adapt(self):\n" +
Expand Down Expand Up @@ -147,7 +147,7 @@ describe.skipIf(!kernelBuilt)("kernel buffer-transport storage (#1541)", () => {
expect(nodes.map((n) => n.name)).toContain("target_fn");
expect(nodes.map((n) => n.name)).toContain("Adapter");
const queries = (cg as unknown as { queries: QueryBuilder }).queries;
const holders = queries.findNodeIdsByLiteral(["bompus_custom_ds_players"]);
const holders = queries.findNodeIdsByLiteral(["demo_custom_players"]);
expect(holders.map((id) => cg.getNode(id)?.name)).toEqual(["target_fn"]);
},
);
Expand Down
14 changes: 7 additions & 7 deletions __tests__/literal-capture.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ function node(id: string, kind: Node['kind'], startLine: number, endLine: number

describe('seedLiteralsInQuery', () => {
it('keeps storage keys, flags, dotted names and paths', () => {
for (const v of ['bompus_custom_ds_players', '--start', 'draft.pick', 'api/v1/users', 'ns:event'])
for (const v of ['demo_custom_players', '--start', 'draft.pick', 'api/v1/users', 'ns:event'])
expect(seedLiteralsInQuery(`who uses "${v}"`), v).toEqual([v]);
});
it('drops plain words, prose, short flags and values that start with a separator', () => {
for (const v of ['ready', 'Error', 'not found', './utils', '../x', '', 'a_b', '-v'])
expect(seedLiteralsInQuery(`who uses "${v}"`), v).toEqual([]);
});
it('finds quoted spans and bare runs, stripping surrounding punctuation', () => {
expect(seedLiteralsInQuery('who writes "bompus_custom_ds_players" (via --start)?'))
.toEqual(['bompus_custom_ds_players', '--start']);
expect(seedLiteralsInQuery('who writes "demo_custom_players" (via --start)?'))
.toEqual(['demo_custom_players', '--start']);
});
it('returns nothing for a symbol-anchored question', () => {
expect(seedLiteralsInQuery('callers of resolvePlayerKey in shared')).toEqual([]);
Expand Down Expand Up @@ -51,9 +51,9 @@ describe('seedRouteNamesInQuery', () => {
describe('captureLiterals', () => {
const source = [
`import { x } from './utils/helpers';`, // 1: path starts with '.', never qualifies
`const KEY = 'bompus_custom_ds_players';`, // 2: top level → file node
`const KEY = 'demo_custom_players';`, // 2: top level → file node
`export function save() {`, // 3
` storage.set('bompus_custom_ds_players', 1);`, // 4
` storage.set('demo_custom_players', 1);`, // 4
` log('ready');`, // 5: plain word
` emit(\`draft.pick\`); emit(\`draft.\${n}\`);`, // 6: second one interpolates
`}`, // 7
Expand All @@ -68,8 +68,8 @@ describe('captureLiterals', () => {
const imp = node('./utils/helpers', 'import', 1, 1);
const nodes = [file, imp, save, boot, start];
captureLiterals(source, nodes);
expect(file.literals).toEqual(['bompus_custom_ds_players']);
expect(save.literals).toEqual(['bompus_custom_ds_players', 'draft.pick']);
expect(file.literals).toEqual(['demo_custom_players']);
expect(save.literals).toEqual(['demo_custom_players', 'draft.pick']);
expect(start.literals).toEqual(['--start']);
expect(boot.literals).toBeUndefined();
expect(imp.literals).toBeUndefined();
Expand Down
24 changes: 12 additions & 12 deletions __tests__/literal-seeds.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ describe('literal seeds — index, query, and lifecycle', () => {
fs.writeFileSync(
path.join(dir, 'src', 'writer.ts'),
`export function persistRows(rows: unknown[]) {
chrome.storage.local.set({ 'bompus_custom_ds_players': rows });
chrome.storage.local.set({ 'demo_custom_players': rows });
}
export function unrelatedHelper() { return 'ready'; }
`,
);
fs.writeFileSync(
path.join(dir, 'src', 'reader.ts'),
`export async function readRows() {
const got = await chrome.storage.local.get('bompus_custom_ds_players');
const got = await chrome.storage.local.get('demo_custom_players');
return got;
}
`,
Expand All @@ -57,13 +57,13 @@ function start() { return 1; }
});

it('resolves a storage key to every symbol whose body holds it', () => {
const ids = queries().findNodeIdsByLiteral(['bompus_custom_ds_players']);
const ids = queries().findNodeIdsByLiteral(['demo_custom_players']);
const names = ids.map((id) => cg.getNode(id)?.name).sort();
expect(names).toEqual(['persistRows', 'readRows']);
});

it('a quoted key in a prose query puts the writers at the top of the subgraph', async () => {
const sub = await cg.findRelevantContext('which modules write "bompus_custom_ds_players" to storage');
const sub = await cg.findRelevantContext('which modules write "demo_custom_players" to storage');
const rootNames = sub.roots.map((id) => sub.nodes.get(id)?.name);
expect(rootNames.slice(0, 2).sort()).toEqual(['persistRows', 'readRows']);
expect(rootNames).not.toContain('unrelatedHelper');
Expand All @@ -77,7 +77,7 @@ function start() { return 1; }
it('CODEGRAPH_LITERAL_SEEDS=0 turns the seed off (the ablation switch)', async () => {
process.env.CODEGRAPH_LITERAL_SEEDS = '0';
try {
const sub = await cg.findRelevantContext('bompus_custom_ds_players');
const sub = await cg.findRelevantContext('demo_custom_players');
const names = [...sub.nodes.values()].map((n) => n.name);
expect(names).not.toContain('persistRows');
} finally {
Expand All @@ -88,12 +88,12 @@ function start() { return 1; }
it("a file's rows leave with its nodes on re-index, and a full index clears the table", async () => {
fs.writeFileSync(path.join(dir, 'src', 'reader.ts'), `export function readRows() { return null; }\n`);
await cg.indexFiles(['src/reader.ts']);
let names = queries().findNodeIdsByLiteral(['bompus_custom_ds_players']).map((id) => cg.getNode(id)?.name);
let names = queries().findNodeIdsByLiteral(['demo_custom_players']).map((id) => cg.getNode(id)?.name);
expect(names).toEqual(['persistRows']);

fs.rmSync(path.join(dir, 'src', 'writer.ts'));
await cg.indexAll();
expect(queries().findNodeIdsByLiteral(['bompus_custom_ds_players'])).toEqual([]);
expect(queries().findNodeIdsByLiteral(['demo_custom_players'])).toEqual([]);
});
});

Expand All @@ -113,7 +113,7 @@ describe('literal seeds — explore renders the holder file', () => {
fs.mkdirSync(path.join(dir, 'callers'), { recursive: true });
fs.writeFileSync(
path.join(dir, 'shared', 'bag.ts'),
`const BAG_KEY = 'bompus_custom_ds_players';
`const BAG_KEY = 'demo_custom_players';
export function persistBag(rows: unknown[]) {
chrome.storage.local.set({ [BAG_KEY]: rows });
}
Expand Down Expand Up @@ -153,7 +153,7 @@ export function storageWriter${i}() {

it('the file holding the quoted key takes the first source slot', async () => {
const res = await handler.execute('codegraph_explore', {
query: 'which modules write "bompus_custom_ds_players" to storage',
query: 'which modules write "demo_custom_players" to storage',
maxFiles: 1,
});
const text = res.content[0].text as string;
Expand All @@ -180,7 +180,7 @@ describe('literal seeds — every holder reaches the subgraph past the entry cap
fs.writeFileSync(
path.join(dir, 'src', `holder${i}.ts`),
`export function write${i}(rows: unknown[]) {
chrome.storage.local.set({ 'bompus_custom_ds_players': rows });
chrome.storage.local.set({ 'demo_custom_players': rows });
}
`,
);
Expand All @@ -195,14 +195,14 @@ describe('literal seeds — every holder reaches the subgraph past the entry cap
});

it('all holders are roots with the default searchLimit of 3', async () => {
const sub = await cg.findRelevantContext('which modules write "bompus_custom_ds_players" to storage');
const sub = await cg.findRelevantContext('which modules write "demo_custom_players" to storage');
const rootFiles = new Set(sub.roots.map((id) => sub.nodes.get(id)?.filePath));
expect(rootFiles.size).toBe(N);
});

it('explore renders every holder with the default file cap', async () => {
const res = await new ToolHandler(cg).execute('codegraph_explore', {
query: 'which modules write "bompus_custom_ds_players" to storage',
query: 'which modules write "demo_custom_players" to storage',
});
const text = res.content[0].text as string;
const sourced = [...text.matchAll(/^\*\*`(.+?)`\*\* —/gm)].map((m) => m[1]);
Expand Down
2 changes: 1 addition & 1 deletion __tests__/ts-chained-receiver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ beforeAll(async () => {
w(
'storage.ts',
'declare const chrome: any;\n' +
'export const DraftHubStorage = {\n' +
'export const AppStorage = {\n' +
' async get(key: string): Promise<unknown> {\n' +
' const result = await chrome.storage.local.get([key]);\n' +
' return result[key];\n' +
Expand Down
10 changes: 5 additions & 5 deletions __tests__/ts-this-field-call.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ beforeAll(async () => {
// A field typed as the type OF a value: an object literal used as a namespace.
w(
'storage.ts',
'export const DraftHubStorage = {\n' +
'export const AppStorage = {\n' +
' async get(key: string): Promise<string> { return key; },\n' +
' async getSettings(): Promise<object> { return {}; },\n' +
'};\n'
);
w(
'keeper.ts',
"import { DraftHubStorage } from './storage';\n" +
"import { AppStorage } from './storage';\n" +
'export class Keeper {\n' +
' constructor(private readonly storage: typeof DraftHubStorage) {}\n' +
' constructor(private readonly storage: typeof AppStorage) {}\n' +
' async get(key: string): Promise<string> { return this.storage.get(key); }\n' +
' async settings(): Promise<object> { return this.storage.getSettings(); }\n' +
'}\n'
Expand Down Expand Up @@ -116,8 +116,8 @@ describe('this.<field>.<method>() (#1496)', () => {
it('resolves a field typed `typeof <objectLiteral>` onto the literal\'s member', () => {
// The members are functions inside the constant's extent (#1573), qualified
// under it (#2300).
expect(calleesOf('Keeper::settings')).toEqual(['DraftHubStorage::getSettings']);
expect(calleesOf('Keeper::get')).toEqual(['DraftHubStorage::get']);
expect(calleesOf('Keeper::settings')).toEqual(['AppStorage::getSettings']);
expect(calleesOf('Keeper::get')).toEqual(['AppStorage::get']);
const self = cg.getCallers(method('Keeper::get').id).some(({ node }) => node.id === method('Keeper::get').id);
expect(self).toBe(false);
});
Expand Down
4 changes: 2 additions & 2 deletions __tests__/window-message-synthesizer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('window-message synthesizer', () => {

it('links a publisher to the listener that checks the same source discriminator', async () => {
fs.writeFileSync(path.join(dir, 'constants.ts'),
'export const MESSAGES = { TTD_AJAX_EVENT: "BOMPUS_TTD_AJAX", OTHER_EVENT: "BOMPUS_OTHER" };\n');
'export const MESSAGES = { TTD_AJAX_EVENT: "DEMO_AJAX", OTHER_EVENT: "DEMO_OTHER" };\n');
fs.writeFileSync(path.join(dir, 'publish.ts'), `import { MESSAGES } from "./constants";
export function publishTtdLivewire() {
window.postMessage({ source: MESSAGES.TTD_AJAX_EVENT, payload: {} }, "*");
Expand Down Expand Up @@ -56,7 +56,7 @@ export function listenWithoutCheck() {

it('does not pair a string discriminator with a different member name', async () => {
fs.writeFileSync(path.join(dir, 'a.ts'), `export function send() {
window.postMessage({ source: "BOMPUS_TTD_AJAX" }, "*");
window.postMessage({ source: "DEMO_AJAX" }, "*");
}
`);
fs.writeFileSync(path.join(dir, 'b.ts'), `export function listen() {
Expand Down
10 changes: 5 additions & 5 deletions docs/benchmarks/fork-vs-upstream-2026-09-26.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ n8n (Vue and TypeScript) and re-measures every corpus on one newer fork build.
- n8n (Vue and TypeScript) `7cc0450a`

Shallow clones, no dependencies installed.
- **Discarded runs.** Runs that a live draft room on the host refused or
contended were thrown away and re-run. The first n8n runs came from an
- **Discarded runs.** Runs disrupted by another job on the host were
thrown away and re-run. The first n8n runs came from an
incomplete clone (about 7.5% of files missing) and were discarded; every n8n
number below comes from a verified complete checkout. n8n was measured while a
draft room was active, and its pairs vary by about 10% (upstream 99.8 and
number below comes from a verified complete checkout. n8n was measured while another
job was active, and its pairs vary by about 10% (upstream 99.8 and
111.7 s, fork 103.8 and 92.8 s).

## Full index: fork vs upstream (Node 24)
Expand Down Expand Up @@ -151,7 +151,7 @@ in the README.
| supabase | 3.88 s, 973 MiB | 3.48 s, 977 MiB |
| n8n | 6.66 s, 1,230 MiB | 6.24 s, 1,236 MiB |

A live draft room paused the run after CPython; the last three corpora ran
Another job on the host paused the run after CPython; the last three corpora ran
once it ended, at a 1-minute load of 2–4 from other sessions. Supabase's base
syncs spread from 3.55 s to 4.37 s, so its difference is mostly noise. The
base column also sits below the second round's right-hand figures (pretix 1.85
Expand Down
2 changes: 1 addition & 1 deletion docs/design/kernel-only-extraction-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ On Node the per-worker WASM grammar heap is about 5 MB per worker, not the 60 MB

### Windows validation (2026-09-12)

Run on the Windows host itself (Windows-local checkout under `C:\Users\bompus\src\codegraph-win`, Node 26.8.1, MSVC Build Tools 18 / 14.51, cargo 1.98.1, Git Bash for the build script), against `fork/consolidated` at `de37daee` plus the fix below:
Run on the Windows host itself (Windows-local checkout under `<windows-checkout>\codegraph-win`, Node 26.8.1, MSVC Build Tools 18 / 14.51, cargo 1.98.1, Git Bash for the build script), against `fork/consolidated` at `de37daee` plus the fix below:

| Step | Result |
|---|---|
Expand Down
2 changes: 1 addition & 1 deletion docs/design/resolution-binding-model-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Tests: `__tests__/bindings-tsjs.test.ts` (every new row form) and `__tests__/bin

**Follow-up, kind eligibility for bare calls (same day).** A receiver-less JS/TS call may only resolve to a function, class, component, constant or variable (`BARE_CALL_TARGET_KINDS`, `name-matcher.ts`). The rule rejects the candidate exact-match would commit to; it does not filter the candidate set. The filtering form was tried first and manufactured 192 edges on vitest (dropping the property candidates from a crowd left a lone wrong survivor: every dynamic `import(...)` landed on a function named `import`, `trace()` on a Vue constant); the rejection form lost 102 property-target edges and gained 2 fuzzy ones. Corpus totals after: vite 28,826 → 28,688, vitest 74,987 → 74,887, svelte 70,603 → 70,589, all cases held. Goldens: the `a()` → Dart `enum_member` edge and an `expensive()` → Swift `field` edge are gone.

**Windows validation (2026-09-12).** `fork/consolidated` at `91902770` (PRs #29, #30, #31) on the Windows-local checkout (`C:\Users\bompus\src\codegraph-win`, Node 26.8.1, cargo 1.98.1, MSVC): `npm ci`, `bash scripts/build-kernel.sh` (53 s, 76 MB `win32-x64` prebuild, no source change needed), `npm run build`; the 14 binding-model and kernel suites pass (426 tests, golden dumps byte-identical), and the full suite passes: 268 files, 4,736 tests, 7 files skipped by the POSIX-only gates.
**Windows validation (2026-09-12).** `fork/consolidated` at `91902770` (PRs #29, #30, #31) on the Windows-local checkout (`<windows-checkout>\codegraph-win`, Node 26.8.1, cargo 1.98.1, MSVC): `npm ci`, `bash scripts/build-kernel.sh` (53 s, 76 MB `win32-x64` prebuild, no source change needed), `npm run build`; the 14 binding-model and kernel suites pass (426 tests, golden dumps byte-identical), and the full suite passes: 268 files, 4,736 tests, 7 files skipped by the POSIX-only gates.

**Windows validation of Phase 3 (2026-09-12).** `fork/consolidated` at `105210e3` (PRs #33 to #37: Python, Go, Java/Kotlin, PHP, C/C++) on the same Windows checkout: `npm ci`, `bash scripts/build-kernel.sh` (31 s, 76 MB `win32-x64` prebuild, no source change needed), `npm run build`; the 11 binding-model and kernel suites pass (995 tests, golden dumps byte-identical), and the full suite passes: 273 files, 4,766 tests, 7 files skipped by the POSIX-only gates.

Expand Down
8 changes: 5 additions & 3 deletions scripts/precision/bisect-case.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
# A step that cannot score the case (kernel build fails, runner errors, the
# case is absent from the report) ABORTS the bisect with 255 rather than
# skipping with 125: a systematic failure otherwise skips every commit and the
# bisect ends with nothing learned. Step logs go to $BISECT_LOGS. Run the
# precision runner once first so the corpus is already checked out.
# bisect ends with nothing learned. Step logs go to $BISECT_LOGS (default:
# bisect-<corpus> under ${XDG_STATE_HOME:-$HOME/.local/state}/codegraph, a
# per-user folder that stays the same from step to step). Run the precision
# runner once first so the corpus is already checked out.
#
# `git bisect run` exports GIT_DIR naming this repository; the runner (and the
# indexer under it) would then run every corpus git command against the engine.
Expand All @@ -23,7 +25,7 @@ case_id="${2:?usage: bisect-case.sh <corpus> <case-id>}"
: "${EVAL_REPOS:?set EVAL_REPOS to the directory holding the corpus checkout}"
engine="$(git rev-parse --show-toplevel)"
sha="$(git rev-parse --short HEAD)"
logs="${BISECT_LOGS:-${XDG_DATA_HOME:-$HOME/.local/share}/agent-documents/tmp/bisect-$corpus}"
logs="${BISECT_LOGS:-${XDG_STATE_HOME:-$HOME/.local/state}/codegraph/bisect-$corpus}"
mkdir -p "$logs"
log="$logs/$sha.log"
for v in $(git rev-parse --local-env-vars); do unset "$v"; done
Expand Down
2 changes: 1 addition & 1 deletion src/extraction/literal-capture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const MAX_LITERALS_PER_NODE = 32;
* A value qualifies when it looks like an identifier an agent would quote
* back verbatim: leading letter or underscore (or a `-`/`--` flag prefix),
* only identifier, path, and namespace characters, and at least one
* separator — `bompus_draft_state`, `--start`, `draft.pick`, `api/v1/users`.
* separator — `demo_draft_state`, `--start`, `draft.pick`, `api/v1/users`.
* A plain word (`ready`, `Error`) has no separator and stays out: it would
* seed on every function that logs it.
*/
Expand Down
Loading
Loading