Compare commits

..
Author SHA1 Message Date
l0ng-ai 7809ef9c8e ci(smoke): keep full debug info for the fixtures the debug smoke builds
The line-tables-only dev profile from #5395 was set for the whole workflow,
so the Rust debug smoke built its fixture without variable debug info and
CodeLLDB showed no locals. Only the build job, which compiles the smoke
binaries, now uses it.
2026-11-24 19:50:13 +08:00
3 changed files with 13 additions and 71 deletions

No files matched your search

+4 -2
View File
@@ -65,8 +65,6 @@ concurrency:
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
# Line tables keep test backtraces readable and the binaries the build job hands on small.
CARGO_PROFILE_DEV_DEBUG: line-tables-only
jobs:
# The languages a pull request can affect: a change to one language's fixture, definition or
@@ -143,6 +141,10 @@ jobs:
# which is the same on every GitHub-hosted runner.
runs-on: ubuntu-22.04
timeout-minutes: 30
# Line tables keep test backtraces readable and the binaries handed on small. Only here: the
# debug smoke builds the Rust fixture, which needs full debug info to show its variables.
env:
CARGO_PROFILE_DEV_DEBUG: line-tables-only
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
@@ -26,10 +26,6 @@ interface ClassSpec {
name: string;
line: number;
col?: number;
/** The line the *index* saw (defaults to `line`): an unsaved edit has moved the class. */
indexedLine?: number;
/** Typed since the graph was indexed: the graph lacks it. */
unindexed?: boolean;
/** The bases the *index* saw (defaults to `bases`). */
indexedBases?: string[];
bases: string[];
@@ -107,14 +103,7 @@ class Fixture {
bases: spec.bases,
methods,
});
if (!spec.unindexed)
this.graph.push({
path,
line: spec.indexedLine ?? spec.line,
col,
name: spec.name,
bases: spec.indexedBases ?? spec.bases,
});
this.graph.push({ path, line: spec.line, col, name: spec.name, bases: spec.indexedBases ?? spec.bases });
this.outlines.set(path, [...(this.outlines.get(path) ?? []), classItem(spec, col, methods)]);
}
this.facts.set(path, { classes: [...(this.facts.get(path)?.classes ?? []), ...classFacts], suppressions: [] });
@@ -368,30 +357,6 @@ it("skips a class whose header no longer matches the indexed graph", async () =>
expect(await project.run()).toEqual([]);
});
it("keeps checking classes an unsaved edit moved off their indexed lines", async () => {
// A comment typed above `One` moved it and `Two` down a line; the graph still has the saved lines.
const project = new Fixture("/p/a.py").add("/p/a.py", [
{ name: "Base", line: 2, bases: ["ABC"], methods: [{ name: "report", line: 4, abstract: true }] },
{ name: "One", line: 7, indexedLine: 6, bases: ["Base"] },
{ name: "Two", line: 10, indexedLine: 9, bases: ["Base"] },
{ name: "Done", line: 13, indexedLine: 12, bases: ["Base"], methods: [{ name: "report", line: 14 }] },
]);
expect(codes(await project.run())).toEqual([
["builtin:python-abstract-method", "warning", 7],
["builtin:python-abstract-method", "warning", 10],
]);
});
it("pairs moved classes by position only once their names no longer line up", async () => {
// A class was added above `Two` since the graph was indexed: `Two` stays where it was indexed.
const project = new Fixture("/p/a.py").add("/p/a.py", [
{ name: "Base", line: 0, bases: [], methods: [{ name: "report", line: 1, abstract: true }] },
{ name: "New", line: 3, unindexed: true, bases: ["Base"] },
{ name: "Two", line: 6, bases: ["Base"] },
]);
expect(codes(await project.run())).toEqual([["builtin:python-abstract-method", "warning", 6]]);
});
it("runs only the producers that are enabled", async () => {
const project = new Fixture("/p/a.py").add("/p/a.py", [
{ name: "First", line: 0, bases: ["Second"] },
@@ -95,30 +95,7 @@ class ProjectView {
private outlines = new Map<string, Promise<readonly OutlineItem[]>>();
private ancestry = new Map<string, Promise<AncestryResolution>>();
/**
* The graph's declarations of this document paired with its live classes. An unsaved
* edit moves classes off the lines the graph indexed: while the classes still read the
* same names in the same order, they pair up in order; otherwise only by position.
*/
private readonly declOf = new Map<PythonClassFacts, ClassInheritance>();
private readonly liveOf = new Map<string, PythonClassFacts>();
constructor(private readonly deps: InheritanceInspectionDeps) {
const indexed = [...deps.index.byName.values()]
.flat()
.filter((c) => c.path === deps.path)
.sort(byPosition);
const live = [...deps.facts.classes].sort((a, b) => byPosition(a.selection.start, b.selection.start));
const inOrder = indexed.length === live.length && indexed.every((c, i) => c.name === live[i]!.name);
for (const [i, facts] of live.entries()) {
const decl = inOrder
? indexed[i]!
: indexed.find((c) => c.line === facts.selection.start.line && c.col === facts.selection.start.col);
if (!decl) continue;
this.declOf.set(facts, decl);
this.liveOf.set(declarationKey(decl), facts);
}
}
constructor(private readonly deps: InheritanceInspectionDeps) {}
/** The document's classes, in declaration order, skipping ones the graph does not match. */
async classes(): Promise<ClassView[]> {
@@ -149,16 +126,11 @@ class ProjectView {
}
async methodsOf(decl: ClassInheritance): Promise<PythonMethodFacts[]> {
if (decl.path === this.deps.path) return this.liveOf.get(declarationKey(decl))?.methods ?? [];
const facts = await this.factsOf(decl.path);
return facts?.classes.find((c) => sameDeclaration(c, decl))?.methods ?? [];
}
async membersOf(decl: ClassInheritance): Promise<ReadonlySet<string>> {
if (decl.path === this.deps.path) {
const live = this.liveOf.get(declarationKey(decl));
return memberNames(live ? classItem(this.deps.outline, live) : null);
}
const outline = await this.outlineOf(decl.path);
const item = outline.find(
(i) =>
@@ -168,7 +140,13 @@ class ProjectView {
}
private declarationOf(facts: PythonClassFacts): ClassInheritance | null {
return this.declOf.get(facts) ?? null;
const found = this.deps.index.byName.get(facts.name) ?? [];
return (
found.find(
(c) =>
c.path === this.deps.path && c.line === facts.selection.start.line && c.col === facts.selection.start.col,
) ?? null
);
}
private factsOf(path: string): Promise<PythonFacts | null> {
@@ -184,9 +162,6 @@ class ProjectView {
}
}
const byPosition = (a: { line: number; col: number }, b: { line: number; col: number }) =>
a.line - b.line || a.col - b.col;
function memo<T>(cache: Map<string, Promise<T>>, key: string, read: () => Promise<T>): Promise<T> {
let pending = cache.get(key);
if (!pending) {