Repository navigation
feat(review): add qwen-code repository context manifest #8654
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 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cf6b7a6
feat(review): add qwen-code repository context manifest
wenshao 84c2765
fix(review): keep repo context manifest under relatedPaths budget
wenshao 8af84fb
fix(review): exclude local build artifacts from review context expansion
wenshao 7a907d6
test(review): pin repository context manifest policy
wenshao 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| { | ||
| "version": 1, | ||
|
wenshao marked this conversation as resolved.
Resolved
|
||
| "label": "Qwen Code", | ||
| "rules": [ | ||
| { | ||
| "paths": ["packages/cli/src/commands/review/**"], | ||
| "domains": ["cli", "review"], | ||
| "recommendedTests": ["review"], | ||
| "requiredConfigurations": ["node22"] | ||
| }, | ||
| { | ||
| "paths": ["packages/core/src/**"], | ||
| "domains": ["core"], | ||
| "recommendedTests": ["core"], | ||
| "requiredConfigurations": ["node22"] | ||
| }, | ||
| { | ||
| "paths": ["packages/core/src/config/**"], | ||
| "relatedPaths": ["packages/core/src/config/**"], | ||
| "domains": ["core-config"] | ||
| }, | ||
| { | ||
| "paths": ["packages/core/src/skills/**"], | ||
| "relatedPaths": ["packages/core/src/skills/**"], | ||
| "domains": ["core-skills"] | ||
| }, | ||
| { | ||
| "paths": ["packages/web-shell/client/**"], | ||
| "domains": ["web-shell"], | ||
| "recommendedTests": ["web-shell"], | ||
| "requiredConfigurations": ["node22"] | ||
| }, | ||
| { | ||
| "paths": ["packages/web-shell/client/**"], | ||
| "relatedPaths": [ | ||
| "packages/web-shell/client/adapters/**", | ||
| "packages/web-shell/client/completions/**", | ||
| "packages/web-shell/client/e2e/**", | ||
|
wenshao marked this conversation as resolved.
Resolved
|
||
| "packages/web-shell/client/hooks/**" | ||
| ] | ||
| }, | ||
| { | ||
| "paths": ["integration-tests/**"], | ||
| "domains": ["integration-tests"], | ||
| "recommendedTests": ["integration-tests"], | ||
| "requiredConfigurations": ["node22"] | ||
| }, | ||
| { | ||
| "paths": [".github/workflows/**"], | ||
| "domains": ["ci", "workflows"], | ||
| "recommendedTests": ["helper-tests"], | ||
| "requiredConfigurations": ["github-actions"] | ||
| }, | ||
| { | ||
| "paths": [ | ||
| "scripts/**", | ||
| "eslint-rules/**", | ||
| "eslint.config.js", | ||
| "package.json" | ||
| ], | ||
| "domains": ["build", "lint"], | ||
| "recommendedTests": ["build-lint"], | ||
| "requiredConfigurations": ["node22"] | ||
| } | ||
| ] | ||
| } | ||
92 changes: 92 additions & 0 deletions
92
packages/cli/src/commands/review/lib/manifest-repository-context.committed.test.ts
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,92 @@ | ||
| /** | ||
| * @license | ||
| * Copyright 2026 Qwen Team | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import { existsSync, readFileSync } from 'node:fs'; | ||
| import { dirname, join, resolve } from 'node:path'; | ||
| import { fileURLToPath } from 'node:url'; | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { manifestRepositoryContextProvider } from './manifest-repository-context.js'; | ||
| import { MAX_ARRAY_ITEMS } from './repository-context.js'; | ||
|
|
||
| // The committed manifest is load-bearing review infrastructure: a hand-edit | ||
| // the strict parser rejects would fail every later medium/high-effort review | ||
| // of this repository closed, mid-review. The provider tests use synthetic | ||
| // manifests in temp worktrees, so only these tests catch such an edit — they | ||
| // run the real provider against the committed artifact. | ||
| const repoRoot = resolve( | ||
| dirname(fileURLToPath(import.meta.url)), | ||
| '..', | ||
| '..', | ||
| '..', | ||
| '..', | ||
| '..', | ||
| '..', | ||
| ); | ||
|
|
||
| function readCommittedFile(relativePath: string): string | null { | ||
| const candidate = join(repoRoot, relativePath); | ||
| if (!existsSync(candidate)) return null; | ||
| // The worktree identity reader's contract: CRLF normalised to LF, | ||
| // surrounding whitespace trimmed. | ||
| return readFileSync(candidate, 'utf8').replace(/\r\n/g, '\n').trim(); | ||
| } | ||
|
|
||
| function provideForRepo(changedPaths: string[]) { | ||
| return manifestRepositoryContextProvider.provide({ | ||
| worktree: repoRoot, | ||
| changedPaths, | ||
| readIdentityFile: readCommittedFile, | ||
| }); | ||
| } | ||
|
|
||
| // One representative changed path per manifest rule. The web-shell entry | ||
| // sits outside that rule's relatedPaths subtrees so its expansion stays | ||
| // visible in the merged output. | ||
| const ruleSamples: ReadonlyArray<{ path: string; domain: string }> = [ | ||
|
wenshao marked this conversation as resolved.
Resolved
|
||
| { path: 'packages/cli/src/commands/review/run.ts', domain: 'review' }, | ||
| { path: 'packages/core/src/index.ts', domain: 'core' }, | ||
| { | ||
| path: 'packages/core/src/config/approval-mode.ts', | ||
| domain: 'core-config', | ||
| }, | ||
| { | ||
| path: 'packages/core/src/skills/bundled/batch/SKILL.md', | ||
| domain: 'core-skills', | ||
| }, | ||
| { path: 'packages/web-shell/client/App.tsx', domain: 'web-shell' }, | ||
| { path: 'integration-tests/cli/edit.test.ts', domain: 'integration-tests' }, | ||
| { path: '.github/workflows/ci.yml', domain: 'ci' }, | ||
| { path: 'package.json', domain: 'build' }, | ||
| ]; | ||
|
|
||
| describe('committed review context manifest', () => { | ||
| it('parses and matches every rule for a representative changed path', () => { | ||
| for (const { path, domain } of ruleSamples) { | ||
| const context = provideForRepo([path]); | ||
| expect(context, `no context for ${path}`).not.toBeNull(); | ||
| expect(context?.domains, `domains for ${path}`).toContain(domain); | ||
|
wenshao marked this conversation as resolved.
Resolved
|
||
| } | ||
| }); | ||
|
|
||
| it('expands the web-shell relatedPaths against the real tree', () => { | ||
| const context = provideForRepo(['packages/web-shell/client/App.tsx']); | ||
| expect(context?.relatedPaths.length).toBeGreaterThan(0); | ||
| for (const related of context?.relatedPaths ?? []) { | ||
|
wenshao marked this conversation as resolved.
Resolved
|
||
| expect(related).toMatch(/^packages\/web-shell\/client\//); | ||
| } | ||
| }); | ||
|
|
||
| it('stays under the resolved-file bound when every rule co-matches', () => { | ||
| // The provider merges the relatedPaths of ALL matching rules into one | ||
| // expansion capped at MAX_ARRAY_ITEMS and throws beyond it, aborting | ||
| // `review repo-context` fail-closed. One changed path per rule is the | ||
| // widest co-matching combination a PR can bring; a rule whose | ||
| // relatedPaths glob resolves enough files to break that sum throws here. | ||
| const context = provideForRepo(ruleSamples.map((sample) => sample.path)); | ||
| expect(context).not.toBeNull(); | ||
| expect(context?.relatedPaths.length).toBeLessThanOrEqual(MAX_ARRAY_ITEMS); | ||
| }); | ||
| }); | ||
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.