Skip to content

fix(cli): ignore text imports and follow renamed exports in Strong reports - #2060

Merged
trueadm merged 3 commits into
mainfrom
fix/strong-dependencies-report
Oct 14, 2026
Merged

trueadm merged 3 commits into
mainfrom
fix/strong-dependencies-report

Conversation

@trueadm

@trueadm trueadm commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This fixes two bugs in octane analyze that #2059 found while measuring the website under --strong-dependencies.

  • Code samples were read as real imports. The statement scanners matched import/export lines anywhere in the raw source, including inside template literals and comments.
    • website/src/lib/playground-examples.ts was reported as a ReactCompat boundary, because two of its template strings begin with import … from 'octane/react'.
    • A .ts module that mentioned octane only inside a sample counted toward Strong coverage.
    • Fix: both scanners now read the source with comment and template-literal text blanked out. Quoted strings stay, because import specifiers are quoted strings.
  • Renamed exports stopped the walk. The dependency walk only followed export … from. A dependency module that imports a binding and exports it under another name ended the walk, so the module that defines the component never appeared.
    • @octanejs/tanstack-devtools was missing from the website's report entirely. Its entry does export const TanStackDevtools = Devtools.TanStackDevtools.
    • Fix: an export that only renames an imported binding now passes the import's names on, as a re-export does. That covers export const X = binding, = ns.member, export { binding as X } and export default binding.
    • An export that builds a new value from an import, such as memo(Internal), is still declared by its own module. The walk doesn't follow that import, because it's the module's implementation.

On the website, with every module temporarily marked Strong, the report now lists @octanejs/tanstack-devtools (src/devtools.tsrx) and no longer reports a ReactCompat boundary.

Validation

  • pnpm format:check (not run repo-wide; pnpm format:files:check on the changed files passes)
  • pnpm typecheck (not run repo-wide; pnpm typecheck:files on both changed source files passes)
  • pnpm test (not run locally; CI runs it)
  • targeted tests: vitest run packages/cli/tests/analyze.test.js --project cli, 28 passed
    • The new assertions fail on main's code: 2 tests.
    • The renamed-export assertion still fails with only the string fix applied, so each fix has its own regression.
  • pnpm sync: no generated changes.
  • perf-review: not applicable. The diff is limited to packages/cli: no runtime, compiler output or binding hot path.
  • concise-code:
    • Size: src +113 −40 (runtime +0 −0).
    • New files: the changeset only.
    • New export: codeOnly in strong-coverage.js, used by runtimeRequests and by the export scanner in strong-dependencies.js.
    • Alternative: a real parser. I rejected parsing with @tsrx/core or es-module-lexer. The CLI has no parser dependency, and it has to keep working against older installed octane builds, so it would need a new compiler API plus a regex fallback anyway.
    • Alternative: follow every import of a dependency module. That would be one line, but I rejected it. It would report implementation modules as dependencies, which the walk's contract excludes, and the new Internal.tsrx fixture asserts that it stays excluded.
    • Bytes: not applicable.

Risk / follow-ups

  • Regex limits. The scanner is still regex-based. A regular-expression literal that contains a backtick or /* can still be misread, as before. That is acceptable for a report-only tool.
  • Vite plugin settings. Not fixed here, and tracked in Run the website in Strong mode #2059 section 1: octane analyze can't read a Strong setting passed through the Vite plugin, such as the website's tanstackStart({ octane }). It only reads octane.config.ts.

Provenance

  • An agent produced this diff (agent-authored)

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Note

Low Risk
Report-only CLI heuristics change; no runtime, compiler, or auth paths. Remaining regex edge cases are unchanged in spirit.

Overview
octane analyze now strips comment and template-literal text before regex-based import/export scanning, so playground-style samples no longer fake Strong coverage hits or octane/react ReactCompat boundaries.

--strong-dependencies walks through rename-only exports (export const X = binding, namespace members, export { a as X }, export default binding) to the defining module, while still treating wrapped values like memo(Internal) as local declarations and not following their implementation imports.

CLI tests cover template-string samples and the @kit/panel rename/re-export scenarios.

Reviewed by Cursor Bugbot for commit 2d06e2b. Bugbot is set up for automated code reviews on this repo. Configure here.

…ports

`octane analyze` scanned raw source for `import`/`export` lines, so a
code sample in a template literal or a comment counted as a real
statement. The website's playground samples became a ReactCompat
boundary, and a module that mentioned `octane` only in a sample counted
toward Strong coverage. Both scanners now read the source with comment
and template literal text blanked, keeping quoted strings so specifiers
survive.

`--strong-dependencies` stopped at a dependency module that imports a
binding and exports it under another name, so the component's own
module never appeared. `@octanejs/tanstack-devtools`, whose entry does
`export const TanStackDevtools = Devtools.TanStackDevtools`, was missing
from the website's report. An export that only renames an imported
binding (`= binding`, `= ns.member`, `export { binding as X }`,
`export default binding`) now passes the import's names on, as a
re-export does. An export that builds a new value from an import still
stops there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Oct 14, 2026
@trueadm
trueadm marked this pull request as ready for review October 14, 2026 18:32

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Blanking a template literal's backticks made `export const X = tag`…``
and `export default tag`…`` read as a rename of `tag`, so the module
that builds the value dropped out of the Strong dependency walk and the
tag's module was followed instead. The backticks now stay, so a tagged
template never reads as a bare name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Comment backticks survive source blanking
    • The blanking regex now checks whether the matched text starts with a backtick (template literal) or slash (comment), preserving backticks only for template literals so comment backticks are correctly blanked to spaces.

Create PR

Or push these changes by commenting:

@cursor push b83276be26
Preview (b83276be26)
diff --git a/packages/cli/src/commands/analyze/strong-coverage.js b/packages/cli/src/commands/analyze/strong-coverage.js
--- a/packages/cli/src/commands/analyze/strong-coverage.js
+++ b/packages/cli/src/commands/analyze/strong-coverage.js
@@ -156,15 +156,17 @@
 /**
  * `source` with comment and template literal text blanked, so a statement
  * scanner never reads code that is only text, such as a code sample in a
- * template string. Line breaks stay, and so do backticks, so a tagged template
- * never reads as a bare name. Quoted strings stay: a specifier is one, and one
- * ends at its line, so it cannot hold a statement.
+ * template string. Line breaks stay; backticks stay only in template literals
+ * so a tagged template never reads as a bare name. Quoted strings stay: a
+ * specifier is one, and one ends at its line, so it cannot hold a statement.
  *
  * @param {string} source
  */
 export function codeOnly(source) {
 	return source.replace(TEXT, (text) =>
-		text[0] === "'" || text[0] === '"' ? text : text.replace(/[^\n`]/g, ' '),
+		text[0] === "'" || text[0] === '"'
+			? text
+			: text.replace(text[0] === '`' ? /[^\n`]/g : /[^\n]/g, ' '),
 	);
 }

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit 8ae6ecd. Configure here.

Keeping every backtick left a comment's backticks inside an import or
export clause, which corrupted the specifier beside it, so a rename
through that import was not followed. Only a template literal keeps its
backticks, which is all a tagged template needs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
⚠️ Deployment skipped
View logs
octane-website-mcp c7ee9f4 Oct 14 2026, 06:31 PM

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark report

🟢 No byte growth, no added work, and no timing changes beyond ±3%.

Compares d8e2d9fce, the merge commit's first parent with fae53850d on the same runner. Any increase in a js-framework work counter fails this check; byte changes are a report. Wall time is a report: base and head samples alternate in one browser, and an operation is called slower or faster only when the 95% confidence interval of its ratio excludes ±3%. Workflow run

js-framework: 1k/10k row operations

All 20 timed operations (20 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 3.367 3.758 +3.2% −0.0% … +15.6% ⚪ within noise
octane-tsrx replace 9.725 9.892 +3.4% −1.2% … +14.0% ⚪ within noise
octane-tsrx add 3.367 3.375 ±0.0% −13.9% … +6.1% ⚪ within noise
octane-tsrx update 0.164 0.162 +4.1% −6.6% … +7.8% ⚪ within noise
octane-tsrx select 0.006 0.006 +0.3% −3.4% … +1.5% ⚪ within noise
octane-tsrx swap 0.021 0.021 −2.5% −6.4% … +5.5% ⚪ within noise
octane-tsrx remove 0.022 0.022 +1.2% −5.5% … +10.1% ⚪ within noise
octane-tsrx runlots 31.117 33.175 −1.5% −9.6% … +8.7% ⚪ within noise
octane-tsrx select_lots 0.007 0.007 +0.3% −1.8% … +1.6% ⚪ within noise
octane-tsrx clear 53.525 53.533 −3.8% −7.9% … +4.4% ⚪ within noise
octane-jsx run 4.625 4.208 −9.0% −12.7% … −2.4% ⚪ within noise
octane-jsx replace 8.875 8.475 −4.0% −6.7% … +1.7% ⚪ within noise
octane-jsx add 3.983 3.975 −1.3% −5.7% … +2.7% ⚪ within noise
octane-jsx update 0.329 0.327 +0.7% −8.5% … +4.6% ⚪ within noise
octane-jsx select 0.141 0.140 −2.5% −4.9% … +0.6% ⚪ within noise
octane-jsx swap 0.192 0.199 −1.8% −4.4% … +2.8% ⚪ within noise
octane-jsx remove 0.217 0.203 −1.0% −12.0% … +2.1% ⚪ within noise
octane-jsx runlots 33.442 32.750 −0.7% −5.2% … +3.6% ⚪ within noise
octane-jsx select_lots 2.164 2.118 −2.6% −10.2% … +10.2% ⚪ within noise
octane-jsx clear 57.408 60.317 −0.8% −7.0% … +7.4% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

No changes across 93 measured values.

Public-import reachability bundles (bytes)

No changes across 120 measured values.

@trueadm
trueadm merged commit a133016 into main Oct 14, 2026
31 of 33 checks passed
@trueadm
trueadm deleted the fix/strong-dependencies-report branch October 14, 2026 19:13
trueadm added a commit that referenced this pull request Oct 15, 2026
Brings in #2047-#2051 (Strong literal stabilisation), #2054 (checked
compiled boundaries and a compiled router entry), #2055/#2057 (Strong
rejects descriptor APIs and .tsx/.jsx), #2056/#2060/#2061 (CLI Strong
reports), #2062 (Strong in the website and devtools), #2065 (no
browser-translation DOM accommodations) and Version Packages.

Conflicts, resolved so main's behaviour lands on the redesign's commit model:
- runtime.ts, #2065: setText keeps main's legacy host-only convention and the
  redesign's hydration writeText. The translator recovery is gone from
  renderText/commitText, setRenderText/commitSetText, commitHole,
  childTextHoleUpdate, recordHole and bindSignalChild; removeOnlyChildText
  still removes a committed Text at commit. resetOnlyChildHost and
  PENDING_HOST_TEXTS (which served only the host-only text writes) are deleted.
- compile.js, #2065: text updates call setRenderText(_txt, v), commit
  functions setText(_txt, v), and commitHole takes no host.
- runtime.server.ts, #2054: a compiled-only frame checks its output;
  ordinary frames keep the redesign's returned-value normalization.
- codes.json: main's 344-346 (CompiledContext, CompiledOutlet) keep their
  numbers; the redesign's codes move to 347 (server boundary error), 348
  (hydration protocol skew) and 349 (frontier rehome). Generated tables and
  CLI data are regenerated; docs/ssr.md names #348.

Adaptations:
- compiled-boundaries.test.ts: the server runs no error boundary (React's
  model), so an invalid CompiledOutlet under a catch-only @Try fails
  renderToString with the CompiledOutlet error; the client still shows the
  catch arm.
- scripts/render-writers.mjs drops resetOnlyChildHost.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant