Skip to content

Commit e90fe2e

Browse files
committed
πŸš‘ Authorize the root import only where a tier closes it (#758)
CI found a regression the whole local battery missed. The protected tier is present in every execution, so `ExecutionImports` is now built unconditionally β€” it used to be `undefined` for a run with no bundle and no declarations. The root import read that as permission to authorize: imports === undefined ? imported : imports.authorize("__root__", imported) With the authority always present, that asks a question nothing answers β€” `__root__` is claimed by no tier unless a bundle closes the execution β€” and an ordinary run's root refuses with *this execution authorizes no import of this name*. It now asks only when a tier actually closes the name, which is the rule every other import already followed, and restores the previous behaviour exactly: absent authority and unclosed name both skip authorization, a bundle still closes the execution and still authorizes its root. Also restores the `documentation-validation.test.ts` exclusion I removed last round. My reasoning then was that the test shells out to `deno` and so is portable, and it does pass under a local Bun β€” because a developer machine has Deno installed. The CI Bun shard does not: every case fails with `Executable not found in $PATH: "deno"`. Needing the `deno` executable is exactly as disqualifying as calling `Deno.*`, and the local pass was the misleading signal. Verified: `deno task test packages/core/tests/` β€” 352 passed, 0 failed.
1 parent d9985f1 commit e90fe2e

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

β€Žpackages/core/src/execute.tsβ€Ž

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1900,7 +1900,15 @@ function* documentWorkflow(
19001900
(function* (): Operation<ComponentDefinition | FunctionComponentDefinition> {
19011901
const imported = yield* importComponent("__root__");
19021902
const imports = authority.imports;
1903-
return imports === undefined ? imported : imports.authorize("__root__", imported);
1903+
// Asked only when a tier actually closes this name, exactly as an
1904+
// ordinary import is. The authority used to be absent altogether for a
1905+
// run with no bundle and no declarations, so this could authorize
1906+
// unconditionally; the protected tier is present in *every* execution, so
1907+
// an unguarded call now refuses the root of every ordinary run β€” nothing
1908+
// claims `__root__` unless a bundle closes the execution.
1909+
return imports?.closes("__root__") === true
1910+
? imports.authorize("__root__", imported)
1911+
: imported;
19041912
})(),
19051913
);
19061914

β€Žscripts/runtime-test-exclusions.tsβ€Ž

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ const DENO_ONLY_TOOLING: RuntimeExclusion[] = [
4747
"builds the npm package with dnt, which only runs under Deno; the test calls Deno.readTextFileSync",
4848
issue: DERIVED_SCOPE,
4949
},
50+
{
51+
path: "scripts/tests/documentation-validation.test.ts",
52+
reason:
53+
"runs the repository's build gate as a subprocess β€” `deno run scripts/validate-documentation.ts` β€” and the Node and Bun shards have no `deno` on PATH, so every case fails with `Executable not found in $PATH`. The subject is the gate, which is a Deno entrypoint; a local Bun run passes only because a developer machine happens to have Deno installed",
54+
issue: DERIVED_SCOPE,
55+
},
5056
{
5157
path: "scripts/tests/jsr-consumer-documentation.test.ts",
5258
reason:

0 commit comments

Comments
Β (0)