Skip to content

refactor(core): enforce internal root-barrel boundary - #8139

Closed
yiliang114 wants to merge 5 commits into
QwenLM:mainfrom
yiliang114:lane3-core-root-barrel
Closed

refactor(core): enforce internal root-barrel boundary#8139
yiliang114 wants to merge 5 commits into
QwenLM:mainfrom
yiliang114:lane3-core-root-barrel

Conversation

@yiliang114

Copy link
Copy Markdown
Collaborator

Summary

  • Replace all production self-imports through packages/core/src/index.ts with direct owner imports.
  • Add a narrow ESLint architecture rule for core production modules, excluding tests and fixtures.
  • Preserve the public root export surface; this is dependency-boundary cleanup, not public API reduction.

Motivation

Root-barrel self-imports couple internal modules to the aggregate public entrypoint and can create avoidable loading cycles. Direct owner imports make dependency ownership explicit without changing downstream exports.

Closes #4063

Verification

  • npm ci --ignore-scripts
  • npx vitest run --config ./scripts/tests/vitest.config.ts scripts/tests/no-core-root-barrel-import.test.js (5 passed)
  • npm run typecheck --workspace=@qwen-code/qwen-code-core
  • npm run build --workspace=@qwen-code/qwen-code-core
  • Targeted ESLint on all migrated production files
  • Inventory check reports zero production core root-barrel self-imports

Reviewer behavior plan

Reviewers can add a direct ../index.js/deeper equivalent to a core production module and run the focused rule test or ESLint; the rule reports the import while allowing tests, fixtures, and cross-package consumers.

@yiliang114
yiliang114 force-pushed the lane3-core-root-barrel branch from b22ade4 to b423e20 Compare August 12, 2026 09:28
@github-actions

Copy link
Copy Markdown
Contributor

Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration.

中文

请勿对活跃的 PR 执行 rebase 或 force-push,因为这会使已有的评审评论失效。另外,供日后参考:作为集成流程的一部分,机器人始终会自动将所有改动压缩(squash)为单个提交。

The root-barrel boundary rule moved extensionManager's telemetry imports
from '../index.js' to '../telemetry/loggers.js'. The test's
vi.mock('../telemetry/loggers.js') only returned Enable + UpdateEvent,
so InstallEvent/Uninstall/Disable threw 'No export is defined' under
vitest's strict mock resolution. Add the three missing keys.
@yiliang114

Copy link
Copy Markdown
Collaborator Author

Superseded by #9635 — the root-barrel boundary work in this branch (remove self-imports, activate the no-core-root-barrel-import rule, visitor tests, unused-constant cleanup) was squash-merged into main via #9635 (10c647f). Closing; no further changes needed here.

@yiliang114 yiliang114 closed this Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: core + cli 架构 Review — 12 项结构性问题清单

1 participant