Skip to content

Commit a791790

Browse files
committed
Merge main to pick up the CI contract fixes (DeusData#2732)
Signed-off-by: Petteri Ponsimaa <petterip@gmail.com>
2 parents d9766ae + 10ab613 commit a791790

18 files changed

Lines changed: 1180 additions & 24 deletions

‎graph-ui/package-lock.json‎

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎graph-ui/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"playwright": "1.62.1",
6363
"three-stdlib": "2.36.1",
6464
"typescript": "5.9.3",
65-
"vite": "6.4.3",
65+
"vite": "6.4.4",
6666
"vitest": "4.1.11"
6767
},
6868
"overrides": {

‎graph-ui/src/galaxy/GalaxyPanel.reader-focus.test.tsx‎

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { createRoot, type Root } from 'react-dom/client';
44
import { afterEach, beforeEach, expect, it, vi } from 'vitest';
55
import GalaxyPanel, { type GalaxyPanelProps } from './GalaxyPanel';
66
import type { GraphData, GraphNode } from './types';
7+
import type { OrganicLayoutRequest, OrganicLayoutResponse } from './organic-layout.worker';
78

89
/** The layout can be capped; focused relationships come independently from RPC. */
910
function graphFetch(nodes: GraphNode[], edges: GraphData['edges'], total = nodes.length) {
@@ -102,10 +103,24 @@ it('opens a file hierarchy without a caret symbol and follows literal marked ran
102103
expect(fetchLayout.mock.calls.filter(([url]) => String(url).includes('/api/layout'))).toHaveLength(1);
103104
});
104105

105-
it('does not report a file missing from a capped layout while its indexed scope is loading', async () => {
106+
it.each([true, false])('does not report a file missing while its scope or layout is loading (indexed: %s)', async indexed => {
107+
let worker!: LayoutWorker;
108+
class LayoutWorker {
109+
onmessage: ((event: MessageEvent<OrganicLayoutResponse>) => void) | null = null;
110+
requests: OrganicLayoutRequest[] = [];
111+
constructor() { worker = this; }
112+
postMessage(request: OrganicLayoutRequest) { this.requests.push(request); }
113+
terminate() {}
114+
reply() {
115+
const { sequence, data } = this.requests.at(-1)!;
116+
this.onmessage?.(new MessageEvent<OrganicLayoutResponse>('message', { data: { sequence,
117+
result: { data, groups: [], groupByNode: new Map() } } }));
118+
}
119+
}
120+
vi.stubGlobal('Worker', LayoutWorker);
106121
const node: GraphNode = { id: 15, name: 'outside', qualified_name: 'sample.outside', label: 'Function',
107122
file_path: 'src/a.ts', start_line: 1, end_line: 10, x: 0, y: 0, z: 0, size: 1, color: '#999999' };
108-
const source = graphFetch([node], []);
123+
const source = graphFetch(indexed ? [node] : [], []);
109124
let release!: () => void;
110125
const pending = new Promise<void>(resolve => { release = resolve; });
111126
const fetchImpl = vi.fn(async (url: RequestInfo | URL, init?: RequestInit) => {
@@ -114,15 +129,27 @@ it('does not report a file missing from a capped layout while its indexed scope
114129
return source(url, init);
115130
});
116131
await act(async () => root.render(<GalaxyPanel project="sample" visible focusFilePath="src/a.ts" onOpenNode={vi.fn()} fetch={fetchImpl} />));
117-
// Hand test K8: the status names the layer that is loading instead of an endless "Loading relationships".
118-
// It may first say "Checking index…" while the index generation is read; wait for the load itself.
119-
await vi.waitFor(() => expect(host.textContent).toContain('Loading layer 1…'));
132+
expect(host.textContent).toContain('Loading layer 1…');
133+
// Finish the empty capped-layout preview while the indexed scope is held.
134+
// This leaves a missing-file note in state, hidden until the scope finishes.
135+
expect(worker.requests).toHaveLength(1);
136+
expect(worker.requests[0]!.data.nodes).toEqual([]);
137+
await act(async () => worker.reply());
120138
expect(host.querySelector('[data-testid="atlas-galaxy-note"]')).toBeNull();
121139
await act(async () => { release(); });
122140
expect(host.textContent).toContain('All indexed direct dependencies included.');
141+
// The scope is complete, but its new picture has not been arranged yet.
142+
expect(worker.requests).toHaveLength(2);
143+
expect(host.querySelector('[role="status"][data-state="arranging"]')).not.toBeNull();
144+
expect(host.querySelector('[data-testid="atlas-galaxy-note"]')).toBeNull();
123145
expect(host.textContent).not.toContain('not in the loaded graph');
146+
await act(async () => worker.reply());
147+
expect(host.querySelector('[role="status"][data-state="complete"]')).not.toBeNull();
148+
expect(JSON.parse(host.querySelector('[data-testid="graph-selection"]')!.textContent!)).toEqual(indexed ? [15] : []);
149+
if (indexed) expect(host.querySelector('[data-testid="atlas-galaxy-note"]')).toBeNull();
150+
else expect(host.querySelector('[data-testid="atlas-galaxy-note"]')?.textContent).toBe('src/a.ts is not in the loaded graph layout.');
124151
});
125-
afterEach(async () => { await act(async () => root.unmount()); host.remove(); globalThis.__atlasGalaxy = undefined; });
152+
afterEach(async () => { await act(async () => root.unmount()); host.remove(); globalThis.__atlasGalaxy = undefined; vi.unstubAllGlobals(); });
126153

127154
it('selects the whole file, narrows only to marked code, and restores the file when the mark clears', async () => {
128155
const common = { file_path: 'src/a.ts', x: 0, y: 0, z: 0, size: 1, color: '#999999' };

‎graph-ui/src/galaxy/GalaxyPanel.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3055,7 +3055,7 @@ export default function GalaxyPanel(props: GalaxyPanelProps): JSX.Element {
30553055
<summary>Selection details</summary>
30563056
<div className="atlas-galaxy-selection-details-body">{selectionContent}</div>
30573057
</details>}
3058-
{note.length > 0 && !scope.loading && (
3058+
{note.length > 0 && !scope.loading && !organicTask.loading && (
30593059
<p className="atlas-galaxy-note" data-testid="atlas-galaxy-note">
30603060
{props.workspaceExpanded && note === GALAXY_NO_FOCUS_NOTE
30613061
? 'Select a node or entry point to attach graph context to chat.' : note}

‎pkg/pypi/requirements-publish.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
build==1.3.0 \
1616
--hash=sha256:698edd0ea270bde950f53aed21f3a0135672206f3911e0176261a31e0e07b397 \
1717
--hash=sha256:7145f0b5061ba90a1500d60bd1b13ca0a8a4cebdd0cc16ed8adf1c0e739f43b4
18-
certifi==2026.7.22 \
19-
--hash=sha256:62f22742b58a1a33014a2b6b706588a8d7e2a88ae7bd1a6ebe8c992928483775 \
20-
--hash=sha256:741e2c3b351ddf169a738da9f2c048608ff7f2c5cc02f1ebc6b118bb090d5d55
18+
certifi==2026.10.19 \
19+
--hash=sha256:035c1e85572b141bf1c3a3eff0e33a8eb74917522f2559075ff8d2fea780a1ae \
20+
--hash=sha256:42d35340cc5b9ba78e818ddbff0c5b1c2b779de448a340fd1b989f5fa8670e1b
2121
cffi==2.1.1 \
2222
--hash=sha256:046bfc24911b37851ee1b51aab8bffe713d89c68c6a057b09484ce9fd5f69b4e \
2323
--hash=sha256:06c72bb76605a4b0cd0aad6930b69d4baf7dd5d806cfc409b824191099700e66 \

‎scripts/ci/codeql-retrace-vendored.sh‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ fi
8080
printf '%s\n' "$changed" |
8181
bash "$ROOT/scripts/ci/select-lanes.sh" --codeql-scope c-cpp |
8282
while IFS= read -r path; do
83+
# Native Windows Python writes CRLF; read removes only the LF.
84+
path="${path%$'\r'}"
8385
entrypoints=()
8486
case "$path" in
8587
internal/cbm/grammar_*.c | internal/cbm/ts_runtime.c)

‎src/pipeline/pass_calls.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,15 @@ static int resolve_single_call(cbm_pipeline_ctx_t *ctx, CBMCall *call, const CBM
11431143
/* The member guard's one exemption (Python, self/cls-rooted receiver,
11441144
* unique_name, not a builtin type's method) — see
11451145
* cbm_weak_member_unique_name_exempt. MUST match pass_parallel.c exactly. */
1146+
/* #1355: `import { eq } from "drizzle-orm"` binds `eq` to a package that is
1147+
* not in the indexed tree, so a project-wide same-name guess must not turn
1148+
* `eq(...)` into a CALLS edge to an unrelated project `eq`. Joined to
1149+
* drop_plain_call for the reason spelled out above: dropping the call here
1150+
* would also skip route/HTTP/CONFIG classification, and a route
1151+
* registration reached through a static import (`import static
1152+
* spark.Spark.get` + `get("/x", handler)`) is exactly a bare call bound by
1153+
* a package specifier. Suppressing only the plain-CALLS fall-through keeps
1154+
* every Route node and service edge main-identical. */
11461155
bool drop_plain_call =
11471156
(cbm_suppress_weak_member_match(suppress_weak_member, call->is_method, res.strategy) &&
11481157
!cbm_weak_member_unique_name_exempt(lang == CBM_LANG_PYTHON,
@@ -1159,6 +1168,9 @@ static int resolve_single_call(cbm_pipeline_ctx_t *ctx, CBMCall *call, const CBM
11591168
(lang == CBM_LANG_PYTHON && cbm_suppress_weak_import_bound_call(true, true, res.strategy) &&
11601169
cbm_python_import_binding_contradicts(imports, call->callee_name, res.qualified_name,
11611170
ctx->gbuf, ctx->project_name, rel)) ||
1171+
cbm_suppress_external_import_shadow(call->callee_name, res.strategy, imports, imp_keys,
1172+
imp_count, cbm_pipeline_get_pkgmap(),
1173+
cbm_pipeline_get_nsmap()) ||
11621174
/* MUST match pass_parallel.c exactly. */
11631175
(lang == CBM_LANG_PHP && cbm_suppress_weak_member_match(true, true, res.strategy) &&
11641176
cbm_pipeline_php_receiver_type_unindexed(lsp_calls, call, ctx->registry));

‎src/pipeline/pass_definitions.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,9 @@ int cbm_pipeline_pass_definitions(cbm_pipeline_ctx_t *ctx, const cbm_file_info_t
11841184
cbm_pipeline_diagram_arrows(ctx, result);
11851185
cbm_pipeline_create_env_configures_for_file(ctx, result, files[i].rel_path);
11861186
}
1187-
cbm_pipeline_namespace_map_free(namespace_map);
1187+
/* Publish instead of free — see the twin in pass_parallel.c (#1355). */
1188+
cbm_pipeline_namespace_map_free(cbm_pipeline_get_nsmap());
1189+
cbm_pipeline_set_nsmap(namespace_map);
11881190
if (owns_local_cache) {
11891191
for (int i = 0; i < file_count; i++) {
11901192
if (local_cache[i]) {

‎src/pipeline/pass_parallel.c‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2041,7 +2041,11 @@ int cbm_build_registry_from_cache(cbm_pipeline_ctx_t *ctx, const cbm_file_info_t
20412041
}
20422042
}
20432043

2044-
cbm_pipeline_namespace_map_free(namespace_map);
2044+
/* Publish instead of free: the call pass needs the same declared-package
2045+
* set to tell an in-tree package path from a third-party one (#1355).
2046+
* The pipeline owns it from here and frees it in its cleanup. */
2047+
cbm_pipeline_namespace_map_free(cbm_pipeline_get_nsmap());
2048+
cbm_pipeline_set_nsmap(namespace_map);
20452049

20462050
cbm_log_info("parallel.registry.done", "entries", itoa_log(reg_entries), "defines",
20472051
itoa_log(defines_edges), "imports", itoa_log(imports_edges));
@@ -3406,6 +3410,11 @@ static void resolve_file_calls(resolve_ctx_t *rc, resolve_worker_state_t *ws, CB
34063410
* This gate MUST stay identical to the one there. */
34073411
bool suppress_weak_local_binding = lang == CBM_LANG_PYTHON;
34083412
/* The member guard's one exemption — MUST match pass_calls.c exactly. */
3413+
/* #1355: same guard as pass_calls.c, and joined to drop_plain_call for
3414+
* the same reason — a `continue` here would also skip route/HTTP/CONFIG
3415+
* classification, and a static-import route registration is a bare call
3416+
* bound by a package specifier. Suppress only the plain-CALLS
3417+
* fall-through so every Route node stays main-identical. */
34093418
bool drop_plain_call =
34103419
(cbm_suppress_weak_member_match(suppress_weak_member, call->is_method, res.strategy) &&
34113420
!cbm_weak_member_unique_name_exempt(lang == CBM_LANG_PYTHON,
@@ -3422,6 +3431,9 @@ static void resolve_file_calls(resolve_ctx_t *rc, resolve_worker_state_t *ws, CB
34223431
cbm_python_import_binding_contradicts(&result->imports, call->callee_name,
34233432
res.qualified_name, rc->main_gbuf,
34243433
rc->project_name, rel)) ||
3434+
cbm_suppress_external_import_shadow(call->callee_name, res.strategy, &result->imports,
3435+
imp_keys, imp_count, cbm_pipeline_get_pkgmap(),
3436+
cbm_pipeline_get_nsmap()) ||
34253437
/* MUST match pass_calls.c exactly. */
34263438
(lang == CBM_LANG_PHP && cbm_suppress_weak_member_match(true, true, res.strategy) &&
34273439
cbm_pipeline_php_receiver_type_unindexed(&result->resolved_calls, call, rc->registry));

‎src/pipeline/pipeline.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,18 @@ void cbm_pipeline_set_pkgmap(CBMHashTable *map) {
792792
g_pkgmap = map;
793793
}
794794

795+
/* ── Global declared-package map (one active pipeline at a time) ── */
796+
797+
static CBMHashTable *g_nsmap = NULL;
798+
799+
CBMHashTable *cbm_pipeline_get_nsmap(void) {
800+
return g_nsmap;
801+
}
802+
803+
void cbm_pipeline_set_nsmap(CBMHashTable *map) {
804+
g_nsmap = map;
805+
}
806+
795807
bool cbm_pipeline_had_format_migration(const cbm_pipeline_t *p) {
796808
return p && p->format_migration;
797809
}
@@ -4095,6 +4107,8 @@ static int cbm_pipeline_run_staged(cbm_pipeline_t *p) {
40954107
cleanup:
40964108
cbm_pkgmap_free(cbm_pipeline_get_pkgmap());
40974109
cbm_pipeline_set_pkgmap(NULL);
4110+
cbm_pipeline_namespace_map_free(cbm_pipeline_get_nsmap());
4111+
cbm_pipeline_set_nsmap(NULL);
40984112
cbm_discover_free(files, file_count);
40994113
if (p->frozen) {
41004114
p->frozen->baseline = baseline_manifest;

0 commit comments

Comments
 (0)