Skip to content

Commit b54729e

Browse files
committed
Merge current main to include shared CI repairs
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2 parents b759b95 + ff28841 commit b54729e

5 files changed

Lines changed: 64 additions & 12 deletions

File tree

‎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}

‎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)

‎tests/test_language_count_contract.sh‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,12 @@ if [[ "$manifest_count" != "$expected" ]]; then
4646
fi
4747

4848
# --- 3. Every published surface must claim exactly that number. ---
49+
# The #2729 messaging refresh dropped the count from docs/index.html,
50+
# docs/llms.txt, pkg/npm/README.md, scripts/package-release.sh and server.json;
51+
# section 4 below still fails if any of them states a count again unregistered.
4952
SURFACES=(
5053
README.md
51-
docs/index.html
52-
docs/llms.txt
53-
pkg/npm/README.md
5454
pkg/chocolatey/codebase-memory-mcp.nuspec
55-
scripts/package-release.sh
56-
server.json
5755
)
5856

5957
# Files that legitimately say "<N> languages" about something OTHER than the

‎tests/test_select_lanes.sh‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,31 @@ if proc.returncode != 0 or got != ["internal/cbm/grammar_go.c",
275275
"vendored/sqlite3/sqlite3.c"]:
276276
failures.append(f"codeql (c): the retrace helper must list the translation units for "
277277
f"changed vendored code and wrappers, got {got} (exit {proc.returncode})")
278+
# Native Windows Python emits CRLF even when the change list uses LF. Pin
279+
# that producer/consumer boundary on every platform, including direct wrapper
280+
# paths that must survive verbatim rather than being mapped to a family name.
281+
crlf_root = work / "crlf-selector"
282+
crlf_scripts = crlf_root / "scripts" / "ci"
283+
crlf_scripts.mkdir(parents=True)
284+
(crlf_scripts / retrace.name).write_bytes(retrace.read_bytes())
285+
expected_retrace = ["internal/cbm/grammar_go.c", "internal/cbm/grammar_json.c",
286+
"internal/cbm/ts_runtime.c", "vendored/sqlite3/sqlite3.c"]
287+
for path in expected_retrace:
288+
fixture = crlf_root / path
289+
fixture.parent.mkdir(parents=True, exist_ok=True)
290+
fixture.touch()
291+
(crlf_scripts / "select-lanes.sh").write_bytes(
292+
b"#!/usr/bin/env bash\nprintf '%s\\r\\n' "
293+
b"internal/cbm/vendored/grammars/go/parser.c internal/cbm/grammar_json.c "
294+
b"internal/cbm/ts_runtime.c vendored/sqlite3/sqlite3.c\n")
295+
proc = subprocess.run([bash, str(crlf_scripts / retrace.name),
296+
"--changed", str(changed), str(listed)],
297+
capture_output=True, text=True, env=env)
298+
got = listed.read_bytes() if listed.exists() else None
299+
if proc.returncode != 0 or got != ("\n".join(expected_retrace) + "\n").encode("utf-8"):
300+
failures.append(f"codeql CRLF: the retrace helper must preserve every changed "
301+
f"wrapper and write LF entrypoints, got {got!r} (exit {proc.returncode})")
302+
278303
for label, args in (("an unreadable change list", ["--changed", str(work / "missing.txt")]),
279304
("no pull request", [])):
280305
listed.write_text("stale\n", encoding="utf-8")

0 commit comments

Comments
 (0)