-
Notifications
You must be signed in to change notification settings - Fork 3k
refactor(cli): keep acp-integration off serve internals (#8084) #9144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
18772ed
refactor(cli): keep acp-integration off serve internals (#8084)
yiliang114 99a1172
Merge remote-tracking branch 'origin/main' into HEAD
yiliang114 0691cb9
fix(cli): harden the acp/serve boundary guard (round 2)
yiliang114 ac83137
test(cli): pin serve boundary lint rules
yiliang114 ec63477
test(cli): close serve boundary lint gaps
yiliang114 78ead13
fix(lint): close serve-boundary entrances and harden the guard
yiliang114 17d16d5
fix(lint): correct TSImportType selector path and computed-template h…
yiliang114 4abaca1
fix(lint): close the remaining round-6 serve-boundary entrances
yiliang114 6f7a13d
fix(lint): cover vitest serve-boundary calls
yiliang114 0c8c334
fix(lint): close the round-7 serve-boundary entrance classes
yiliang114 1815694
refactor(lint): resolve the serve boundary by resolution, not text (#…
yiliang114 23cf025
Merge branch 'main' into fix/acp-serve-boundary-guard
yiliang114 02e502a
fix(lint): drop the dead serveGuardSyntaxRules helper
yiliang114 3d8be1f
fix(lint): close serve boundary resolver gaps
yiliang114 3cc4298
fix(lint): address serve boundary review suggestions
yiliang114 cf05dd5
fix(lint): close round-11 serve boundary gaps
yiliang114 34fc045
chore: merge main into serve boundary guard
yiliang114 2d59792
fix(cli): restore live session source import
yiliang114 3da80b9
fix(lint): clear the two lint errors breaking CI on the boundary rule
yiliang114 c4758e3
fix(lint): close bounded serve boundary gaps
yiliang114 7112ab4
fix(lint): complete the round-12 boundary escape closures
yiliang114 552bc7c
fix(lint): close the round-12 reviewer escape classes (#8084)
yiliang114 c11b30c
fix(lint): repair corrupted files from the git-API blob upload
yiliang114 8e583a8
Merge remote-tracking branch 'origin/main' into HEAD
yiliang114 ebe1cb5
fix(lint): close the round-13 serve-boundary escape classes (#8084)
yiliang114 9fbd906
fix(lint): close the round-13 binding-hop and callee-opacity escapes …
yiliang114 58d4398
refactor(cli): simplify ACP serve boundary guard
yiliang114 ff4e3b0
Merge remote-tracking branch 'origin/main' into codex/pr-9144-scope-back
yiliang114 210b2e1
fix(lint): close the round-21 contract pins and bare-barrel escape (#…
yiliang114 01475ab
fix(lint): close dynamic-import and js-file holes in the acp/serve gu…
yiliang114 5e7511a
fix(lint): make acp/serve dynamic-import guard case-insensitive
yiliang114 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| /** | ||
| * @license | ||
| * Copyright 2026 Qwen Team | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import { dirname, join } from 'node:path'; | ||
| import { fileURLToPath } from 'node:url'; | ||
| import { ESLint } from 'eslint'; | ||
| import { expect, it } from 'vitest'; | ||
|
|
||
| const root = join(dirname(fileURLToPath(import.meta.url)), '../..'); | ||
|
|
||
| const eslint = new ESLint({ cwd: root }); | ||
|
|
||
| // Static imports are reported by no-restricted-imports; dynamic import() is | ||
| // reported by no-restricted-syntax because the former never sees it. | ||
| const BOUNDARY_RULES = new Set([ | ||
| 'no-restricted-imports', | ||
| 'no-restricted-syntax', | ||
| ]); | ||
|
|
||
| async function restrictedReports(statement) { | ||
| const filePath = join( | ||
| root, | ||
| 'packages/cli/src/acp-integration/boundary-probe.ts', | ||
| ); | ||
| const [result] = await eslint.lintText(`${statement}\n`, { filePath }); | ||
| return result.messages.filter((m) => BOUNDARY_RULES.has(m.ruleId)); | ||
| } | ||
|
|
||
| // Bare-directory specifiers resolve to packages/cli/src/serve/index.ts, a | ||
| // barrel re-exporting the full daemon surface — they must be caught by the | ||
| // same guard that blocks deep serve/ internals (#8084). | ||
| it.each(['../serve', '../../serve'])( | ||
|
yiliang114 marked this conversation as resolved.
|
||
| 'blocks the bare barrel specifier %s from acp-integration', | ||
| async (specifier) => { | ||
| const reports = await restrictedReports( | ||
| `import { createServeApp } from '${specifier}';`, | ||
| ); | ||
| expect(reports).toHaveLength(1); | ||
| expect(reports[0].message).toContain('acp-integration'); | ||
| }, | ||
| ); | ||
|
|
||
| it('blocks a bare barrel re-export from acp-integration', async () => { | ||
| const reports = await restrictedReports( | ||
| `export { createServeApp } from '../serve';`, | ||
| ); | ||
| expect(reports).toHaveLength(1); | ||
| }); | ||
|
|
||
| it('still blocks deep serve/ internals from acp-integration', async () => { | ||
| const reports = await restrictedReports( | ||
| `import { createServeApp } from '../serve/index.js';`, | ||
| ); | ||
| expect(reports).toHaveLength(1); | ||
| }); | ||
|
|
||
| it('blocks type-only imports and re-exports from serve/ from acp-integration', async () => { | ||
| expect( | ||
| await restrictedReports(`import type { ServeAppDeps } from '../serve';`), | ||
| ).toHaveLength(1); | ||
| expect( | ||
| await restrictedReports(`export type { ServeAppDeps } from '../serve';`), | ||
| ).toHaveLength(1); | ||
| }); | ||
|
|
||
| it('blocks a dynamic import() of serve/ from acp-integration', async () => { | ||
| const reports = await restrictedReports( | ||
| `async function probe() { await import('../serve/index.js'); }`, | ||
| ); | ||
| expect(reports).toHaveLength(1); | ||
| expect(reports[0].message).toContain('acp-integration'); | ||
| }); | ||
|
|
||
| it('blocks a case-variant dynamic import() of Serve/ from acp-integration', async () => { | ||
| const reports = await restrictedReports( | ||
| `async function probe() { await import('../Serve/index.js'); }`, | ||
| ); | ||
| expect(reports).toHaveLength(1); | ||
| }); | ||
|
|
||
| it('allows neutral runtime/ contracts from acp-integration', async () => { | ||
| expect( | ||
| await restrictedReports( | ||
| `import { something } from '../runtime/contracts.js';`, | ||
| ), | ||
| ).toHaveLength(0); | ||
| expect( | ||
| await restrictedReports( | ||
| `async function probe() { await import('../runtime/contracts.js'); }`, | ||
| ), | ||
| ).toHaveLength(0); | ||
| // A computed specifier (not a string literal) has no source.value, so the | ||
| // dynamic guard must not reject it — the import target is unknowable at | ||
| // lint time. | ||
| expect( | ||
| await restrictedReports( | ||
| `async function probe() { const target = '../runtime/contracts.js'; await import(target); }`, | ||
| ), | ||
| ).toHaveLength(0); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.