fix(cli): reject display-only macro consumers in explicit --from (post-merge with #9945)

The mid-DAG --from feature (#9945, now on main) admits any autorun-able script
via validFromStarts/fromEligible, which was filtered only by macroLibPaths. A
non-// pipeline macro-consumer helper (a --local display node) therefore passed
--from eligibility and produced an empty plan. Filter fromEligible by the broader
notRunnablePaths too, and reject such a --from with a clear message instead of a
silent empty plan.
This commit is contained in:
Ruben Fiszel
2026-07-05 22:28:41 +00:00
parent 7c386636e2
commit 32d70bd5f4
+9 -1
View File
@@ -709,7 +709,7 @@ async function run(
);
const fromEligible = new Set(
[...validFromStarts(graph), ...boundNodeIds].filter(
(id) => !macroLibPaths.has(scriptPathOf(id)),
(id) => !notRunnablePaths.has(scriptPathOf(id)),
),
);
// `runAll` = no `--from` on a multi-root pipeline (fan-in): run the whole
@@ -738,6 +738,14 @@ async function run(
`--from '${opts.from}' is a \`// macros\` library — definition-only, injected into consuming scripts at run time, never a runnable step.`,
);
}
// A `--local` display-only node (a non-`// pipeline` DuckDB script surfaced
// only because it calls a macro) has no previewable content — reject it
// clearly rather than admitting it and silently producing an empty plan.
if (notRunnablePaths.has(scriptPathOf(resolved))) {
throw new Error(
`--from '${opts.from}' isn't a \`// pipeline\` script — it appears in the local graph only as a macro consumer (lineage). Mark it \`// pipeline\` to run it.`,
);
}
if (!resolved.startsWith("script:")) {
throw new Error(
`--from '${opts.from}' is an asset, not a runnable — start a run from a script (assets are produced, not run).`,