Repository navigation
feat(review): --all-projects reviews every dbt project a PR touches in one run - #1773
RaghwendraSingh wants to merge 5 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
There was a problem hiding this comment.
9 issues found across 8 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/opencode/src/altimate/review/verdict.ts">
<violation number="1" location="packages/opencode/src/altimate/review/verdict.ts:222">
P3: The per-project AI status bypasses the envelope's fixed AI-state contract by accepting any string. Use the same four-value enum as `ai.state` so malformed or unsupported project statuses cannot enter signed envelopes.</violation>
</file>
<file name="packages/opencode/test/altimate/review-all-projects.test.ts">
<violation number="1" location="packages/opencode/test/altimate/review-all-projects.test.ts:44">
P3: This suite leaks every synthetic git repository it creates. Track fixture roots and remove them in `afterEach` (including failed tests) so repeated CI and watch runs do not accumulate repositories.</violation>
<violation number="2" location="packages/opencode/test/altimate/review-all-projects.test.ts:49">
P2: The new discovery tests do not cover the required ignored directories. Add projects under `dbt_packages/`, `target/`, and `node_modules/`, then assert they are absent from discovered and reviewed roots.</violation>
<violation number="3" location="packages/opencode/test/altimate/review-all-projects.test.ts:166">
P2: The AI aggregation test never verifies addition across nonzero project lanes. Give both projects distinct nonzero calls, cost, and token counts, then assert their sums.</violation>
</file>
<file name="packages/opencode/src/altimate/review/format.ts">
<violation number="1" location="packages/opencode/src/altimate/review/format.ts:76">
P2: The project list is unbounded even though this renderer promises a character budget for the posted comment. With enough touched projects, this line alone can exceed 5,000 characters and the later finding-budget loop cannot trim it; cap the displayed roots and retain the full list in `scope.projects`.</violation>
<violation number="2" location="packages/opencode/src/altimate/review/format.ts:76">
P2: Project roots are repository-controlled strings, but this line inserts them raw into Markdown. A project directory containing a backtick or newline can break the summary's formatting or inject content; render each root with `codeSpan` (or otherwise escape Markdown) before joining them.</violation>
</file>
<file name="packages/opencode/src/altimate/review/git.ts">
<violation number="1" location="packages/opencode/src/altimate/review/git.ts:173">
P2: `--cached` includes tracked files deleted from the working tree, so a fully removed dbt project is still discovered and reviewed from a nonexistent `cwd`; filter the combined list to paths that still exist before discovering projects.</violation>
</file>
<file name="packages/opencode/src/cli/cmd/review.ts">
<violation number="1" location="packages/opencode/src/cli/cmd/review.ts:111">
P2: `--all-projects` can silently skip a dbt project deleted by the PR because discovery only scans the head tree. Discover projects from both head and merge-base, or retain base roots that own deleted paths.</violation>
</file>
<file name="packages/opencode/src/altimate/review/multi-project.ts">
<violation number="1" location="packages/opencode/src/altimate/review/multi-project.ts:118">
P2: `scopeToProject` supports custom `*-paths` outside a project root, but this passes every unassigned file to every project run. Shared-path files can therefore be reviewed repeatedly or remain marked outside after one project reviewed them; assign external layout files to their owning projects before constructing runs.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| findings: [shared], | ||
| tier: "lite", | ||
| mode: "gate", | ||
| ai: { state: "skipped", reason: "x", calls: 0 }, |
There was a problem hiding this comment.
P2: The AI aggregation test never verifies addition across nonzero project lanes. Give both projects distinct nonzero calls, cost, and token counts, then assert their sums.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/opencode/test/altimate/review-all-projects.test.ts, line 166:
<comment>The AI aggregation test never verifies addition across nonzero project lanes. Give both projects distinct nonzero calls, cost, and token counts, then assert their sums.</comment>
<file context>
@@ -0,0 +1,225 @@
+ findings: [shared],
+ tier: "lite",
+ mode: "gate",
+ ai: { state: "skipped", reason: "x", calls: 0 },
+ scope: { projectRoot: "a", notReviewed: [{ path: "b/models/x.sql", reason: "outside the dbt project (a)" }] },
+ }),
</file context>
There was a problem hiding this comment.
Partly fixed in 622f430: the new AI-state test sums nonzero calls across two lanes. Distinct nonzero tokens and cost are a low-priority follow-up.
| await g(root, "config", "user.email", "t@test") | ||
| await g(root, "config", "user.name", "t") | ||
| await g(root, "config", "commit.gpgsign", "false") | ||
| const projects = ["proj_a", "proj_b", ...(opts.nested ? ["proj_a/integration_tests"] : [])] |
There was a problem hiding this comment.
P2: The new discovery tests do not cover the required ignored directories. Add projects under dbt_packages/, target/, and node_modules/, then assert they are absent from discovered and reviewed roots.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/opencode/test/altimate/review-all-projects.test.ts, line 49:
<comment>The new discovery tests do not cover the required ignored directories. Add projects under `dbt_packages/`, `target/`, and `node_modules/`, then assert they are absent from discovered and reviewed roots.</comment>
<file context>
@@ -0,0 +1,225 @@
+ await g(root, "config", "user.email", "t@test")
+ await g(root, "config", "user.name", "t")
+ await g(root, "config", "commit.gpgsign", "false")
+ const projects = ["proj_a", "proj_b", ...(opts.nested ? ["proj_a/integration_tests"] : [])]
+ for (const p of projects) {
+ await write(root, `${p}/dbt_project.yml`, `name: ${p.replace("/", "_")}\nversion: '1.0'\nprofile: x\n`)
</file context>
There was a problem hiding this comment.
Follow-up, together with r4627041814.
|
|
||
| const lines: string[] = [REVIEW_MARKER, "", `## ${verdictHeadline(env)}`, ""] | ||
| const projects = env.scope?.projects ?? [] | ||
| if (projects.length > 1) lines.push(`Reviewed ${projects.length} dbt projects: ${projects.map((p) => p.root || ".").join(", ")}`, "") |
There was a problem hiding this comment.
P2: The project list is unbounded even though this renderer promises a character budget for the posted comment. With enough touched projects, this line alone can exceed 5,000 characters and the later finding-budget loop cannot trim it; cap the displayed roots and retain the full list in scope.projects.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/opencode/src/altimate/review/format.ts, line 76:
<comment>The project list is unbounded even though this renderer promises a character budget for the posted comment. With enough touched projects, this line alone can exceed 5,000 characters and the later finding-budget loop cannot trim it; cap the displayed roots and retain the full list in `scope.projects`.</comment>
<file context>
@@ -72,6 +72,8 @@ export function renderSummary(env: VerdictEnvelope, opts: RenderOptions = {}): s
const lines: string[] = [REVIEW_MARKER, "", `## ${verdictHeadline(env)}`, ""]
+ const projects = env.scope?.projects ?? []
+ if (projects.length > 1) lines.push(`Reviewed ${projects.length} dbt projects: ${projects.map((p) => p.root || ".").join(", ")}`, "")
if (env.summary.degraded) {
</file context>
There was a problem hiding this comment.
Follow-up: low priority, tracked. We'll cap it at RENDER_CAP with "+N more".
|
|
||
| const lines: string[] = [REVIEW_MARKER, "", `## ${verdictHeadline(env)}`, ""] | ||
| const projects = env.scope?.projects ?? [] | ||
| if (projects.length > 1) lines.push(`Reviewed ${projects.length} dbt projects: ${projects.map((p) => p.root || ".").join(", ")}`, "") |
There was a problem hiding this comment.
P2: Project roots are repository-controlled strings, but this line inserts them raw into Markdown. A project directory containing a backtick or newline can break the summary's formatting or inject content; render each root with codeSpan (or otherwise escape Markdown) before joining them.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/opencode/src/altimate/review/format.ts, line 76:
<comment>Project roots are repository-controlled strings, but this line inserts them raw into Markdown. A project directory containing a backtick or newline can break the summary's formatting or inject content; render each root with `codeSpan` (or otherwise escape Markdown) before joining them.</comment>
<file context>
@@ -72,6 +72,8 @@ export function renderSummary(env: VerdictEnvelope, opts: RenderOptions = {}): s
const lines: string[] = [REVIEW_MARKER, "", `## ${verdictHeadline(env)}`, ""]
+ const projects = env.scope?.projects ?? []
+ if (projects.length > 1) lines.push(`Reviewed ${projects.length} dbt projects: ${projects.map((p) => p.root || ".").join(", ")}`, "")
if (env.summary.degraded) {
</file context>
| if (projects.length > 1) lines.push(`Reviewed ${projects.length} dbt projects: ${projects.map((p) => p.root || ".").join(", ")}`, "") | |
| if (projects.length > 1) lines.push(`Reviewed ${projects.length} dbt projects: ${projects.map((p) => codeSpan(p.root || ".")).join(", ")}`, "") |
There was a problem hiding this comment.
Follow-up: low priority, tracked (codeSpan).
| /** Tracked and untracked (not ignored) files in the working tree, repo-root relative; undefined when git can't list them. */ | ||
| export async function listWorkingTreeFiles(cwd: string): Promise<string[] | undefined> { | ||
| try { | ||
| const out = await git(["ls-files", "--cached", "--others", "--exclude-standard", "--full-name"], cwd) |
There was a problem hiding this comment.
P2: --cached includes tracked files deleted from the working tree, so a fully removed dbt project is still discovered and reviewed from a nonexistent cwd; filter the combined list to paths that still exist before discovering projects.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/opencode/src/altimate/review/git.ts, line 173:
<comment>`--cached` includes tracked files deleted from the working tree, so a fully removed dbt project is still discovered and reviewed from a nonexistent `cwd`; filter the combined list to paths that still exist before discovering projects.</comment>
<file context>
@@ -167,6 +167,16 @@ export async function listFilesAt(cwd: string, ref?: string): Promise<string[] |
+/** Tracked and untracked (not ignored) files in the working tree, repo-root relative; undefined when git can't list them. */
+export async function listWorkingTreeFiles(cwd: string): Promise<string[] | undefined> {
+ try {
+ const out = await git(["ls-files", "--cached", "--others", "--exclude-standard", "--full-name"], cwd)
+ return out.split("\n").filter(Boolean)
+ } catch {
</file context>
There was a problem hiding this comment.
Agreed, low priority (cubic, git.ts:173, --cached lists files deleted from the working tree). Leaving this for a follow-up PR rather than widening this one.
| let env | ||
| try { | ||
| env = await reviewPullRequest({ | ||
| const review = args.allProjects === true ? reviewAllProjects : reviewPullRequest |
There was a problem hiding this comment.
P2: --all-projects can silently skip a dbt project deleted by the PR because discovery only scans the head tree. Discover projects from both head and merge-base, or retain base roots that own deleted paths.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/opencode/src/cli/cmd/review.ts, line 111:
<comment>`--all-projects` can silently skip a dbt project deleted by the PR because discovery only scans the head tree. Discover projects from both head and merge-base, or retain base roots that own deleted paths.</comment>
<file context>
@@ -100,7 +108,8 @@ export const ReviewCommand = cmd({
let env
try {
- env = await reviewPullRequest({
+ const review = args.allProjects === true ? reviewAllProjects : reviewPullRequest
+ env = await review({
...prContext,
</file context>
There was a problem hiding this comment.
Follow-up: low priority, tracked. Discovering roots at the merge-base as well would cover it.
| for (const root of touched) { | ||
| const own = byProject.get(root)! | ||
| process.stderr.write(`ℹ️ reviewing dbt project ${root || "."} (${own.length} changed file(s))\n`) | ||
| const env = await reviewPullRequest({ ...optsFor(root), changedFiles: [...own, ...unassigned], prFiles }) |
There was a problem hiding this comment.
P2: scopeToProject supports custom *-paths outside a project root, but this passes every unassigned file to every project run. Shared-path files can therefore be reviewed repeatedly or remain marked outside after one project reviewed them; assign external layout files to their owning projects before constructing runs.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/opencode/src/altimate/review/multi-project.ts, line 118:
<comment>`scopeToProject` supports custom `*-paths` outside a project root, but this passes every unassigned file to every project run. Shared-path files can therefore be reviewed repeatedly or remain marked outside after one project reviewed them; assign external layout files to their owning projects before constructing runs.</comment>
<file context>
@@ -0,0 +1,226 @@
+ for (const root of touched) {
+ const own = byProject.get(root)!
+ process.stderr.write(`ℹ️ reviewing dbt project ${root || "."} (${own.length} changed file(s))\n`)
+ const env = await reviewPullRequest({ ...optsFor(root), changedFiles: [...own, ...unassigned], prFiles })
+ runs.push({ root, paths: own.map((f) => f.path), env })
+ }
</file context>
There was a problem hiding this comment.
Follow-up: low priority, tracked. In the normal layout they're scoped out as outside each project and de-duplicated on merge; custom *-paths outside a root is the edge case.
| calls: z.number().int().nonnegative().optional(), | ||
| /** Multi-project review (`--all-projects`): each project's AI lane state. */ | ||
| projects: z | ||
| .array(z.object({ root: z.string(), state: z.string(), calls: z.number().int().nonnegative().optional() })) |
There was a problem hiding this comment.
P3: The per-project AI status bypasses the envelope's fixed AI-state contract by accepting any string. Use the same four-value enum as ai.state so malformed or unsupported project statuses cannot enter signed envelopes.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/opencode/src/altimate/review/verdict.ts, line 222:
<comment>The per-project AI status bypasses the envelope's fixed AI-state contract by accepting any string. Use the same four-value enum as `ai.state` so malformed or unsupported project statuses cannot enter signed envelopes.</comment>
<file context>
@@ -214,6 +217,10 @@ export const VerdictEnvelope = z.object({
calls: z.number().int().nonnegative().optional(),
+ /** Multi-project review (`--all-projects`): each project's AI lane state. */
+ projects: z
+ .array(z.object({ root: z.string(), state: z.string(), calls: z.number().int().nonnegative().optional() }))
+ .optional(),
/** Generator findings replayed from an earlier envelope: tokens, cost and calls are that run's. */
</file context>
There was a problem hiding this comment.
Fair nit; we'll tighten it to the lane-state enum in a follow-up. (cubic, verdict.ts:222, ai.projects[].state is z.string())
|
|
||
| /** Two dbt projects (proj_a, proj_b), each with a model and a macro, plus a workflow file; returns the base sha. */ | ||
| async function fixture(opts: { nested?: boolean } = {}): Promise<{ root: string; base: string }> { | ||
| const root = await fs.realpath(await fs.mkdtemp(path.join(tmpdir(), "review-all-projects-"))) |
There was a problem hiding this comment.
P3: This suite leaks every synthetic git repository it creates. Track fixture roots and remove them in afterEach (including failed tests) so repeated CI and watch runs do not accumulate repositories.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/opencode/test/altimate/review-all-projects.test.ts, line 44:
<comment>This suite leaks every synthetic git repository it creates. Track fixture roots and remove them in `afterEach` (including failed tests) so repeated CI and watch runs do not accumulate repositories.</comment>
<file context>
@@ -0,0 +1,225 @@
+
+/** Two dbt projects (proj_a, proj_b), each with a model and a macro, plus a workflow file; returns the base sha. */
+async function fixture(opts: { nested?: boolean } = {}): Promise<{ root: string; base: string }> {
+ const root = await fs.realpath(await fs.mkdtemp(path.join(tmpdir(), "review-all-projects-")))
+ await g(root, "init", "-q", "-b", "main")
+ await g(root, "config", "user.email", "t@test")
</file context>
There was a problem hiding this comment.
Fair nit; we'll add cleanup in a follow-up.
| const optsFor = (root: string): ReviewPullRequestOptions => ({ | ||
| ...opts, | ||
| cwd: path.join(gitRootReal, root), | ||
| manifestPath: root === manifestOwner ? manifestAbs : undefined, |
There was a problem hiding this comment.
WARNING: --manifest is silently dropped whenever it does not resolve inside a discovered project root.
repoRel() returns undefined for a manifest outside the git root (the common CI shape --manifest "$RUNNER_TEMP/manifest.json"), and owningProject() returns undefined for a repo-level manifest that sits outside every project. In both cases manifestOwner is undefined, so root === manifestOwner is false for every project (including the "" root project) and every run falls back to auto-discovery. reviewPullRequest honours an absolute --manifest (run.ts:277-279), so adding --all-projects silently degrades every project to lint-only with no diagnostic. Pass the manifest through when only one project is touched, or warn/fail instead of ignoring it.
There was a problem hiding this comment.
Fixed in 622f430: a manifest outside every project (CI's $RUNNER_TEMP/manifest.json) now goes to the touched project when the PR changes only one. When it can't be attributed (several touched projects, or it lies inside an untouched project), a warning says no project uses it. Previously each project silently fell back to lint-only. A test covers both cases.
| const seenIds = new Set<string>() | ||
| const findings = envs.flatMap((e) => e.findings).filter((f) => !seenIds.has(f.id) && !!seenIds.add(f.id)) | ||
|
|
||
| const mode = modeOverride ?? (envs.some((e) => e.mode === "gate") ? "gate" : first.mode) |
There was a problem hiding this comment.
WARNING: Mixed per-project modes can turn a non-blocking project's findings into a blocking verdict.
mode is gate if any project uses gate, and the merged verdict is applyMode(max(idealVerdict), mode). A project whose own policy is the default comment already softened its REQUEST_CHANGES to COMMENT, but its idealVerdict is still REQUEST_CHANGES, so a sibling project configured gate promotes it back to a blocking REQUEST_CHANGES. Merge the post-mode per-project verdicts (envs.map((e) => e.verdict)) and keep applyMode out of the merge. The mergeProjectEnvelopes test only covers the both-gate case, so this is untested.
There was a problem hiding this comment.
Fixed in 622f430: the merged verdict is the worst of the projects' post-mode verdicts, so a comment-mode project's REQUEST_CHANGES no longer blocks because a sibling uses gate mode. Each project's mode is recorded in scope.projects, with a mixed-mode test.
| } | ||
|
|
||
| const merged: VerdictEnvelope = { | ||
| ...first, |
There was a problem hiding this comment.
WARNING: ...first leaves first-project-only fields in the signed merged envelope.
manifestHash (rendered in the comment footer, format.ts:118), policy (including posting, which drives the inline budget and silentWhenClean), scope.projectRoot, generatedAt and tierClassified are never overridden, so a multi-project verdict claims the first project's manifest hash, policy hash and posting policy for a run that used several manifests. That is misleading audit data in a signed artifact and changes how the merged comment is posted. Build the envelope explicitly (or clear these fields) and record per-project manifest/policy detail in scope.projects.
There was a problem hiding this comment.
Same issue as r4626966398; fixed in 622f430.
| cacheRead: a.cacheRead + b.cacheRead, | ||
| })) | ||
| : undefined | ||
| const base = ok ?? first |
There was a problem hiding this comment.
WARNING: base = ok ?? first reports the merged AI lane as ok whenever any project succeeded, dropping a sibling project's error/timeout and its reason.
With proj_a error and proj_b ok, the merged envelope says state: "ok" with no reason; ai.projects[] keeps only state/calls, so the failure is unrecoverable from the signed envelope (the top-level events and format notices no longer show the AI lane degraded). Promote the worst state (error > timeout > skipped/ok) and keep the failing lane's reason, or add a per-project reason.
There was a problem hiding this comment.
Same issue as r4626966388; fixed in 622f430.
| */ | ||
|
|
||
| const PROJECT_FILE = /(^|\/)dbt_project\.ya?ml$/ | ||
| const IGNORED_DIR = /(^|\/)(dbt_packages|target|node_modules)\// |
There was a problem hiding this comment.
WARNING: IGNORED_DIR re-implements a subset of the existing skip list and is incomplete.
diff-filter.ts:13-23 (SKIP_DIR_PATTERNS, used by shouldReview) also excludes dbt_modules/, compiled/, run/, logs/ and .venv/. A committed dbt_modules/<pkg>/dbt_project.yml is therefore discovered as a project: its changed files are assigned to that phantom root instead of the enclosing project, they get their own review run (extra AI lane calls), and the summary lists vendored packages as reviewed dbt projects. Export and reuse SKIP_DIR_PATTERNS/shouldReview instead of keeping a second, divergent list.
There was a problem hiding this comment.
Follow-up: low priority, tracked. We'll reuse SKIP_DIR_PATTERNS from diff-filter.ts so vendored dbt_modules/ projects aren't discovered.
| const manifestOwner = manifestRel !== undefined ? owningProject(manifestRel, roots) : undefined | ||
| const optsFor = (root: string): ReviewPullRequestOptions => ({ | ||
| ...opts, | ||
| cwd: path.join(gitRootReal, root), |
There was a problem hiding this comment.
WARNING: Project roots are discovered from the head tree but each project's cwd is taken from the working tree.
With --head pointing at a ref that is not checked out (a documented CLI mode), a project added or renamed by the PR has no directory at path.join(gitRootReal, root). findDbtProject then returns undefined, so run.ts:312 computes projectRootRel = undefined and scopeToProject treats every file as in scope (the unassigned files, already passed to every project, get re-reviewed by this one) while dbtProjectName/dbtProjectLayout silently degrade. Verify the directory exists (or derive the layout from the ref) and pass the project root explicitly so scoping cannot collapse to undefined.
There was a problem hiding this comment.
Follow-up: low priority, tracked. This only happens with a --head that isn't checked out.
| calls: z.number().int().nonnegative().optional(), | ||
| /** Multi-project review (`--all-projects`): each project's AI lane state. */ | ||
| projects: z | ||
| .array(z.object({ root: z.string(), state: z.string(), calls: z.number().int().nonnegative().optional() })) |
There was a problem hiding this comment.
SUGGESTION: ai.projects[].state is z.string() while the parent ai.state (line 211) is z.enum(["ok", "skipped", "timeout", "error"]).
The weaker field lets a replayed or hand-built signed envelope carry an arbitrary project state, and any future switch on it silently falls through. Reuse the same enum.
There was a problem hiding this comment.
Fair nit; we'll tighten it to the lane-state enum in a follow-up. (kilo, same)
|
|
||
| const lines: string[] = [REVIEW_MARKER, "", `## ${verdictHeadline(env)}`, ""] | ||
| const projects = env.scope?.projects ?? [] | ||
| if (projects.length > 1) lines.push(`Reviewed ${projects.length} dbt projects: ${projects.map((p) => p.root || ".").join(", ")}`, "") |
There was a problem hiding this comment.
SUGGESTION: The project list is unbounded, unlike the other multi-entry renders (RENDER_CAP = 8 at line 96, LEDGER_MAX_PATHS = 30 at line 283).
On a monorepo with many (or long-named) projects this single fixed line can consume most of SUMMARY_BUDGET_CHARS (5,000), after which fit drops every finding bullet into the "N more finding(s)" notice. Cap the roots shown and append (+N more var); wrapping/escaping the roots like the rest of the renderer (codeSpan, ledger escaping) would also be safer.
There was a problem hiding this comment.
Same as r4626966319; tracked.
| // A relative --manifest resolves against --cwd, as in the single-project path. | ||
| const rel = await reviewAllProjects({ cwd: root, base, head: "HEAD", noAi: true, manifestPath: "proj_a/artifacts/manifest.json" }) | ||
| expect(rel.manifestHash).toBeDefined() | ||
| expect((await run("proj_b")).manifestHash).toBeUndefined() |
There was a problem hiding this comment.
SUGGESTION: This assertion cannot observe whether proj_b received the manifest.
The merged envelope's manifestHash is always the first project's, and for this call the first project is proj_a, which has no manifest — so the value is undefined whether or not the manifest was applied to proj_b. Both manifest bodies are also identical, so even a per-project check could not distinguish them. Assert on the owning project's own envelope (reviewPullRequest with that project's cwd + manifest) or expose manifestHash in scope.projects, and use distinct manifest contents. A mixed mode: comment + mode: gate case is also untested and is where the merge logic is wrong.
There was a problem hiding this comment.
Fixed in 622f430: the manifest test now checks each project's manifestHash (and that the top level carries none when they differ), and a mixed comment/gate test was added.
Code Review SummaryStatus: 11 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (10 files)
No commits landed after the previous pass (HEAD Fix these issues in Kilo Cloud Previous Review Summaries (5 snapshots, latest commit 0daab2a)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 0daab2a)Status: 10 Issues Found | Recommendation: Address before merge Overview
Incremental pass at Inline comments could not be posted: the sandbox rejected both the atomic review call and its one retry before reaching GitHub, so every finding is detailed below. Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (10 files)
Previous review (commit 24e925a)Status: 7 Issues Found | Recommendation: Address before merge Overview
Incremental pass at Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (10 files)
Fix these issues in Kilo Cloud Previous review (commit a3689b6)Status: 7 Issues Found | Recommendation: Address before merge Overview
Incremental pass at Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (10 files)
Previous review (commit 676c803)Status: 6 Issues Found | Recommendation: Address before merge Overview
Incremental pass: the branch was rebased onto a newer base, and Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (9 files)
Fix these issues in Kilo Cloud Previous review (commit 5e2440e)Status: 6 Issues Found | Recommendation: Address before merge Overview
Reviewed the incremental change Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (9 files)
Fix these issues in Kilo Cloud Additional previous summary content was truncated to keep this comment within platform limits. Reviewed by deepseek-v4.1-flash-1017 · Input: 175.7K · Output: 58.7K · Cached: 3.5M Review guidance: REVIEW.md from base branch |
dev-punia-altimate
left a comment
There was a problem hiding this comment.
🤖 Code Review — OpenCodeReview (Gemini) — 5 finding(s)
- 5 anchored to a line (posted inline when the comment stream is on)
- 0 without a line anchor
All findings (full text)
1. packages/opencode/src/altimate/review/git.ts (L173-L174)
[🟠 MEDIUM] Using git ls-files without -z can cause bugs when file paths contain non-ASCII or special characters (like spaces or newlines). By default, Git enables core.quotePath, which encloses such paths in double quotes and C-style escapes them (e.g., folder-with-ümlaut/dbt_project.yml becomes "folder-with-\303\274mlaut/dbt_project.yml").
When the path ends with a double quote \", subsequent operations in multi-project.ts using regex like /(^|\/)dbt_project\.ya?ml$/ will fail to match because the string ends with a quote rather than yml.
To ensure robust path handling, it is highly recommended to use the -z flag and split by \0, which safely separates entries and disables git path quoting. (Note: A similar update would be beneficial for listFilesAt as well.)
Suggested change:
const out = await git(["ls-files", "-z", "--cached", "--others", "--exclude-standard", "--full-name"], cwd)
return out.split("\0").filter(Boolean)
2. packages/opencode/src/altimate/review/multi-project.ts (L70-L72)
[🟠 MEDIUM] The condition rel.startsWith("..") incorrectly matches valid file or directory names that begin with .. (e.g., ..foo), wrongly identifying them as being outside the git root. This causes valid files in the repository to be ignored.
Consider checking for exact match or directory separator to correctly identify paths outside the git root.
Suggested change:
const rel = path.relative(gitRootReal, abs).replace(/\\/g, "/")
if (rel === ".." || rel.startsWith("../") || path.isAbsolute(rel)) return undefined
return rel
3. packages/opencode/src/altimate/review/multi-project.ts (L54-L55)
[🟠 MEDIUM] Inside the loop, byProject.set(root, [...(byProject.get(root) ?? []), f]) creates and spreads a new array for every file assigned to a project. This results in O(n^2) time complexity, which can cause significant performance degradation and high memory allocation when reviewing pull requests that touch a large number of files.
You should use .push() on an existing array to optimize this assignment.
Suggested change:
if (root === undefined) {
unassigned.push(f)
} else {
let filesForRoot = byProject.get(root)
if (!filesForRoot) {
filesForRoot = []
byProject.set(root, filesForRoot)
}
filesForRoot.push(f)
}
4. packages/opencode/src/altimate/review/multi-project.ts (L114-L120)
[🟠 MEDIUM] The await reviewPullRequest(...) calls are executed sequentially inside a for...of loop for each touched project. Since reviews involve network I/O or heavy computation, sequential execution unnecessarily blocks concurrency, leading to longer overall wait times for multi-project pull requests.
Consider using Promise.all to execute the project reviews concurrently.
Suggested change:
const runs: ProjectRun[] = await Promise.all(
touched.map(async (root) => {
const own = byProject.get(root)!
process.stderr.write(`ℹ️ reviewing dbt project ${root || "."} (${own.length} changed file(s))\n`)
const env = await reviewPullRequest({ ...optsFor(root), changedFiles: [...own, ...unassigned], prFiles })
return { root, paths: own.map((f) => f.path), env }
})
)
5. packages/opencode/src/altimate/review/multi-project.ts (L161-L163)
[🟠 MEDIUM] Unassigned files are passed to every project's review. If they fail verification, they will be returned in each project's envelope and subsequently duplicated by envs.flatMap without deduplication. This causes the final envelope to contain duplicated unverified file entries.
Consider deduplicating the unverified entries based on their path and reason.
Suggested change:
const outsideCount = notReviewed.filter((n) => OUTSIDE_PROJECT.test(n.reason)).length
const movedCount = envs.reduce((s, e) => s + (e.scope?.movedUnchangedFiles ?? 0), 0)
const unverifiedRaw = envs.flatMap((e) => e.scope?.unverified ?? [])
const unverified = [...new Map(unverifiedRaw.map((u) => [`${u.path}\0${u.reason}`, u])).values()]
| const out = await git(["ls-files", "--cached", "--others", "--exclude-standard", "--full-name"], cwd) | ||
| return out.split("\n").filter(Boolean) |
There was a problem hiding this comment.
[🟠 MEDIUM] Using git ls-files without -z can cause bugs when file paths contain non-ASCII or special characters (like spaces or newlines). By default, Git enables core.quotePath, which encloses such paths in double quotes and C-style escapes them (e.g., folder-with-ümlaut/dbt_project.yml becomes "folder-with-\303\274mlaut/dbt_project.yml").
When the path ends with a double quote \", subsequent operations in multi-project.ts using regex like /(^|\/)dbt_project\.ya?ml$/ will fail to match because the string ends with a quote rather than yml.
To ensure robust path handling, it is highly recommended to use the -z flag and split by \0, which safely separates entries and disables git path quoting. (Note: A similar update would be beneficial for listFilesAt as well.)
Suggested change:
| const out = await git(["ls-files", "--cached", "--others", "--exclude-standard", "--full-name"], cwd) | |
| return out.split("\n").filter(Boolean) | |
| const out = await git(["ls-files", "-z", "--cached", "--others", "--exclude-standard", "--full-name"], cwd) | |
| return out.split("\0").filter(Boolean) |
There was a problem hiding this comment.
Thanks, this is a real bug. Without -z, git C-quotes non-ASCII paths, so a dbt_project.yml under a directory like projé/ was never discovered. Fixed in 622f430: listWorkingTreeFiles and listFilesAt (as you suggested) both use -z and split on \0, with a test for a non-ASCII project directory on both the head tree and the working tree.
| const rel = path.relative(gitRootReal, abs).replace(/\\/g, "/") | ||
| if (rel.startsWith("..") || path.isAbsolute(rel)) return undefined | ||
| return rel |
There was a problem hiding this comment.
[🟠 MEDIUM] The condition rel.startsWith("..") incorrectly matches valid file or directory names that begin with .. (e.g., ..foo), wrongly identifying them as being outside the git root. This causes valid files in the repository to be ignored.
Consider checking for exact match or directory separator to correctly identify paths outside the git root.
Suggested change:
| const rel = path.relative(gitRootReal, abs).replace(/\\/g, "/") | |
| if (rel.startsWith("..") || path.isAbsolute(rel)) return undefined | |
| return rel | |
| const rel = path.relative(gitRootReal, abs).replace(/\\/g, "/") | |
| if (rel === ".." || rel.startsWith("../") || path.isAbsolute(rel)) return undefined | |
| return rel |
There was a problem hiding this comment.
Good catch, thanks. A directory named ..foo inside the repo was treated as outside it. Fixed in 622f430: the check is now rel === ".." || rel.startsWith("../").
| if (root === undefined) unassigned.push(f) | ||
| else byProject.set(root, [...(byProject.get(root) ?? []), f]) |
There was a problem hiding this comment.
[🟠 MEDIUM] Inside the loop, byProject.set(root, [...(byProject.get(root) ?? []), f]) creates and spreads a new array for every file assigned to a project. This results in O(n^2) time complexity, which can cause significant performance degradation and high memory allocation when reviewing pull requests that touch a large number of files.
You should use .push() on an existing array to optimize this assignment.
Suggested change:
| if (root === undefined) unassigned.push(f) | |
| else byProject.set(root, [...(byProject.get(root) ?? []), f]) | |
| if (root === undefined) { | |
| unassigned.push(f) | |
| } else { | |
| let filesForRoot = byProject.get(root) | |
| if (!filesForRoot) { | |
| filesForRoot = [] | |
| byProject.set(root, filesForRoot) | |
| } | |
| filesForRoot.push(f) | |
| } |
There was a problem hiding this comment.
Thanks, that's fair. It's quadratic only in the number of changed files per project, so it doesn't matter in practice, but push is just as clear. We'll switch it in a follow-up cleanup.
| const runs: ProjectRun[] = [] | ||
| for (const root of touched) { | ||
| const own = byProject.get(root)! | ||
| process.stderr.write(`ℹ️ reviewing dbt project ${root || "."} (${own.length} changed file(s))\n`) | ||
| const env = await reviewPullRequest({ ...optsFor(root), changedFiles: [...own, ...unassigned], prFiles }) | ||
| runs.push({ root, paths: own.map((f) => f.path), env }) | ||
| } |
There was a problem hiding this comment.
[🟠 MEDIUM] The await reviewPullRequest(...) calls are executed sequentially inside a for...of loop for each touched project. Since reviews involve network I/O or heavy computation, sequential execution unnecessarily blocks concurrency, leading to longer overall wait times for multi-project pull requests.
Consider using Promise.all to execute the project reviews concurrently.
Suggested change:
| const runs: ProjectRun[] = [] | |
| for (const root of touched) { | |
| const own = byProject.get(root)! | |
| process.stderr.write(`ℹ️ reviewing dbt project ${root || "."} (${own.length} changed file(s))\n`) | |
| const env = await reviewPullRequest({ ...optsFor(root), changedFiles: [...own, ...unassigned], prFiles }) | |
| runs.push({ root, paths: own.map((f) => f.path), env }) | |
| } | |
| const runs: ProjectRun[] = await Promise.all( | |
| touched.map(async (root) => { | |
| const own = byProject.get(root)! | |
| process.stderr.write(`ℹ️ reviewing dbt project ${root || "."} (${own.length} changed file(s))\n`) | |
| const env = await reviewPullRequest({ ...optsFor(root), changedFiles: [...own, ...unassigned], prFiles }) | |
| return { root, paths: own.map((f) => f.path), env } | |
| }) | |
| ) |
There was a problem hiding this comment.
Thanks for the suggestion. We're keeping these sequential on purpose. Each project review starts its own AI lane (up to two concurrent model calls, plus the optional verifier's tool loop), so running projects in parallel would multiply concurrent LLM calls and rate-limit pressure by the number of projects. They also share the native dispatcher, and their stderr progress lines would interleave into an unreadable CI log. Wall time is usually dominated by the model calls, which already run concurrently within each project.
| const outsideCount = notReviewed.filter((n) => OUTSIDE_PROJECT.test(n.reason)).length | ||
| const movedCount = envs.reduce((s, e) => s + (e.scope?.movedUnchangedFiles ?? 0), 0) | ||
| const unverified = envs.flatMap((e) => e.scope?.unverified ?? []) |
There was a problem hiding this comment.
[🟠 MEDIUM] Unassigned files are passed to every project's review. If they fail verification, they will be returned in each project's envelope and subsequently duplicated by envs.flatMap without deduplication. This causes the final envelope to contain duplicated unverified file entries.
Consider deduplicating the unverified entries based on their path and reason.
Suggested change:
| const outsideCount = notReviewed.filter((n) => OUTSIDE_PROJECT.test(n.reason)).length | |
| const movedCount = envs.reduce((s, e) => s + (e.scope?.movedUnchangedFiles ?? 0), 0) | |
| const unverified = envs.flatMap((e) => e.scope?.unverified ?? []) | |
| const outsideCount = notReviewed.filter((n) => OUTSIDE_PROJECT.test(n.reason)).length | |
| const movedCount = envs.reduce((s, e) => s + (e.scope?.movedUnchangedFiles ?? 0), 0) | |
| const unverifiedRaw = envs.flatMap((e) => e.scope?.unverified ?? []) | |
| const unverified = [...new Map(unverifiedRaw.map((u) => [`${u.path}\0${u.reason}`, u])).values()] |
There was a problem hiding this comment.
Thanks for looking at this. It turns out not to happen in the normal case: scope.unverified only ever holds a project's own in-scope models (orchestrate.ts ~1842-1889). The unassigned files every project receives are scoped out as "outside the dbt project" before any engine lane sees them, and the merge already de-duplicates those notReviewed entries. The one edge case is custom *-paths pointing outside a project root (cubic's r4626966425), which we're tracking; de-duplicating unverified by path is cheap extra hardening we may add with it.
🤖 Code Review — OpenCodeReview (Gemini) — No Issues FoundNo supported files changed. |
1acd5d8 to
31cb5c4
Compare
1161598 to
622f430
Compare
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
| scope: { | ||
| baseRef: first.scope?.baseRef, | ||
| baseSha: first.scope?.baseSha, | ||
| baseSource: first.scope?.baseSource, |
There was a problem hiding this comment.
CRITICAL: The rebuilt scope drops headSha, which permanently disables the stale-run guard for multi-project reviews.
postGitHubReview computes const onCurrentHead = !headSha || !commitId || headSha === commitId (post-github.ts:191-192) from env.scope?.headSha (verdict.ts:140). With the field absent, onCurrentHead is always true, so an older --all-projects run that finishes after a newer push can call dismissStale() and dismiss the newer run's CHANGES_REQUESTED block — the exact case the code comment says must never happen: "A run on an older push (its head is no longer the PR's head) never clears the block a newer push's run may have posted."
Every per-project envelope resolves the same head (run.ts:252, headSha at run.ts:486), so carry it through:
| baseSource: first.scope?.baseSource, | |
| headSha: first.scope?.headSha, |
| const env = await reviewPullRequest({ ...optsFor(root), changedFiles: [...own, ...unassigned], prFiles }) | ||
| runs.push({ root, paths: own.map((f) => f.path), env }) | ||
| } | ||
| return mergeProjectEnvelopes(runs, opts.mode) |
There was a problem hiding this comment.
WARNING: Passing the raw --mode flag as modeOverride can soften the verdict that the base policy refused to relax.
reviewPullRequest ignores --mode comment when the base .altimate/review.yml sets mode: gate (run.ts:278-282), so each project envelope is mode: "gate" with a REQUEST_CHANGES verdict. mergeProjectEnvelopes(runs, opts.mode) then sets the merged mode back to "comment" and applyMode(...) rewrites that REQUEST_CHANGES into COMMENT, yielding a non-blocking verdict and exit code. That defeats the documented tighten-only guard (docs: --mode "cannot turn mode: gate into comment").
Each per-project verdict already has its own effective mode applied, so the override should be dropped (or derived from the envelopes) rather than taken from the raw flag:
| return mergeProjectEnvelopes(runs, opts.mode) | |
| return mergeProjectEnvelopes(runs) |
| source: all.map((p) => p.source).reduce((a, b) => (POLICY_SOURCE_RANK[b] > POLICY_SOURCE_RANK[a] ? b : a)), | ||
| hash: createHash("sha256").update(all.map((p) => p.hash).join("\n")).digest("hex").slice(0, 16), | ||
| changedInPr: changed.length ? changed : undefined, | ||
| posting: postings.every((x) => x === postings[0]) ? all[0].posting : undefined, |
There was a problem hiding this comment.
SUGGESTION: When projects' posting policies differ, the merged envelope records none, and postingPolicy() silently falls back to the permissive defaults.
postingPolicy(env) returns env.policy?.posting ?? DEFAULT_POSTING_POLICY (format.ts:388-389): inlineBudget: 10, inlineSeverityFloor: "warning", silentWhenClean: true. If one project opts out of inline comments (inlineBudget: 0) or raises its severity floor, a sibling at defaults makes posting undefined here and the stricter project's settings are discarded for the posted review. Merge to the most restrictive combination (lowest inlineBudget, highest inlineSeverityFloor) instead of dropping the policy.
31cb5c4 to
ddc4333
Compare
622f430 to
5470bfe
Compare
hkaltai
left a comment
There was a problem hiding this comment.
Panel: lead + Codex + Claude (independent). All findings premise-checked against the code. Single-project path (0 or 1 project, run from inside it) is unchanged and the 10 new tests plus typecheck pass.
Counts: CRITICAL 0, MAJOR 3, MINOR 2, NIT 6.
Nits
multi-project.ts:17const IGNORED_DIR = /(^|\/)(dbt_packages|target|node_modules)\//- without--headthe working-tree listing includes untracked non-ignored files, so a.venv/.../site-packages/dbt/include/starter_project/dbt_project.ymlis discovered as a project. Add.venv,venv,site-packages.multi-project.ts:26-33discoverDbtProjectslists the head side only: files of a project deleted wholesale by the PR end up "outside the dbt projects reviewed" and get no deletion check. Consider also discovering at the merge-base to assign deleted files.multi-project.ts:289const AI_STATE_RANK = ...is declared at the bottom of the file after its use; move it next toVERDICT_RANK/TIER_RANK.multi-project.ts:154comment "a comment-mode project never blocks" stops being accurate with the mode override; update together with the fix. The header comment (line 9-13) should say the policy now comes from the project directory.multi-project.ts:21OUTSIDE_PROJECTis a regex butOUTSIDE_ALLa string; considerOUTSIDE_PROJECT_RE. InmergeAi, the localworstholds a lane, not a state, and shadows the verdict-helper name used elsewhere.- Test gaps: CLI flag wiring (
--all-projectsselectsreviewAllProjects),dbt_project.yamland ignored-dir discovery, andlistFilesAtwith a non-ASCII directory (the-zchange has no direct test); a merged envelope throughpostGitHubReview.
| const seenIds = new Set<string>() | ||
| const findings = envs.flatMap((e) => e.findings).filter((f) => !seenIds.has(f.id) && !!seenIds.add(f.id)) | ||
|
|
||
| const mode = modeOverride ?? (envs.some((e) => e.mode === "gate") ? "gate" : first.mode) |
There was a problem hiding this comment.
[MAJOR] --mode override is re-applied after each project enforced the base policy
const mode = modeOverride ?? (envs.some((e) => e.mode === "gate") ? "gate" : first.mode)reviewPullRequest deliberately ignores --mode comment when the base branch's policy says mode: gate (run.ts, "may only tighten"). The merge then applies the raw CLI flag again. Scenario: project A is gate with a critical finding (child verdict REQUEST_CHANGES), project B is comment, the PR-editable workflow passes --mode comment. Merged result is mode: comment, verdict COMMENT (while scope.projects[0].mode is still gate), so the CLI gate check passes and no blocking review is posted. Reproduced independently by two reviewers.
Fix: do not take modeOverride in the merge; use envs.some(e => e.mode === "gate") ? "gate" : "comment" with the worst post-mode verdict. Add a regression test.
There was a problem hiding this comment.
Agreed, fixed in 5e2440e. mergeProjectEnvelopes no longer takes the override. The merged mode is gate if any project ended up in gate, otherwise comment, and the verdict is the worst post-mode project verdict. Each project's mode already includes --mode, but only where reviewPullRequest allowed it to tighten the base policy. Regression tests:
- a unit test: a gate project with a critical finding plus a comment project stays
REQUEST_CHANGESingate; - an end-to-end test: a repo whose base root policy says
mode: gate, run with--mode comment, keeps proj_a ingateand the merged envelope ingate.
There was a problem hiding this comment.
✅ Fixed at 676c803 — multi-project.ts:172-173 no longer takes modeOverride; merged mode is derived from the children's post-mode modes. The end-to-end test (review-all-projects.test.ts:110, --mode comment against a base gate) keeps mode: gate and fails against the previous merge code. (The unit test at :280 would also pass on the old code, so the integration test is the real guard.)
| scope: { | ||
| baseRef: first.scope?.baseRef, | ||
| baseSha: first.scope?.baseSha, | ||
| baseSource: first.scope?.baseSource, |
There was a problem hiding this comment.
[MAJOR] Merged scope drops headSha, disabling the stale-run guard in the poster
baseSource: first.scope?.baseSource,The merged scope copies baseRef/baseSha/baseSource but not headSha. post-github.ts:191-192 computes onCurrentHead = !headSha || !commitId || headSha === commitId, so a missing headSha is always "current". Scenario (gate mode): the run for push 1 finishes after push 2's blocking review was posted; with a single-project envelope it refuses to dismiss, with the merged envelope it dismisses the newer block and the PR becomes mergeable.
Fix: add headSha (and projectRoot handling, see below) to the merged scope; keep it only when all child heads agree and otherwise fail/handle explicitly. Assert in a test.
There was a problem hiding this comment.
Fixed in 5e2440e. The merged scope carries headSha and headParents (the merge-commit parents from #1723), so the poster's reviewedPrHead guard works on merged envelopes. All projects are reviewed at one head. If they ever disagree (for example HEAD moved during a working-tree run), the merge throws instead of guessing. Tests: the end-to-end merged envelope has scope.headSha equal to HEAD; a unit test checks that both fields are carried and that different heads throw.
There was a problem hiding this comment.
✅ Fixed at 676c803 — merged scope carries headSha/headParents (multi-project.ts:234-235) and differing child heads throw. Probed through the poster: stale or unknown head keeps the earlier block; test at :296 fails without the fix.
| root === manifestOwner || (manifestOwner === undefined && touched.length === 1) ? manifestAbs : undefined | ||
| const optsFor = (root: string): ReviewPullRequestOptions => ({ | ||
| ...opts, | ||
| cwd: path.join(gitRootReal, root), |
There was a problem hiding this comment.
[MAJOR] Per-project cwd silently drops a repo-root .altimate/review.yml policy
cwd: path.join(gitRootReal, root),reviewPullRequest loads the base policy from cwd only (loadReviewPolicy({ cwd: opts.cwd, ... })). optsFor moves cwd into the project directory, including on the single-touched-project path (reviewPullRequest(optsFor(touched[0]))). Scenario: a repo-root .altimate/review.yml with mode: gate, run from the repo root. Plain reviewPullRequest gives mode=gate, policy.source=base; reviewAllProjects gives mode=comment, policy.source=default. A mono-repo CI job that gates merges silently loses gating, severity and rule settings when --all-projects is added, with no warning.
Fix: fall back to the policy at opts.cwd/repo root when a project has none of its own (e.g. pass the resolved policy directory through the options), or at minimum warn when a root policy exists that no project uses. Add a test.
There was a problem hiding this comment.
Thanks, this would have silently ungated mono-repos. Fixed in 5e2440e. ReviewPullRequestOptions gains policyFallbackDirs, and --all-projects passes the invocation directory and then the repo root. The first directory with a policy file wins: the project's own .altimate/review file, else the invocation directory's, else the repo root's. Each is read from the base branch exactly as before, so a PR still cannot add a project-level file to loosen the root policy. If a PR does add one, it is listed in changedInPr. The precedence is documented in the multi-project.ts header. The test sets a root mode: gate policy and a proj_b mode: comment policy, and checks:
- proj_a gets
gatefrom the root policy; - proj_b gets
commentfrom its own policy; - the single-touched-project path from the repo root gets
mode: gate,policy.source: base.
There was a problem hiding this comment.
policyFallbackDirs (multi-project.ts:118, run.ts:264-281) restores the root policy when run from the repo root, and a PR-added project policy cannot loosen the base policy. But the shortcut at multi-project.ts:124 (and :102) still calls reviewPullRequest(opts) without fallbacks. Repro with a root mode: gate policy and one touched project: cwd=repo root gives gate/base, cwd=proj_a gives comment/default. See the new inline comment.
There was a problem hiding this comment.
The rest of this is done in 24e925a. Every return path now carries the fallback dirs, and the order is per project (nearest enclosing policy, up to the root), so it no longer depends on where the command runs. Details are in the replies on the three new inline threads.
| movedUnchangedFiles: movedCount || undefined, | ||
| unverified: unverified.length ? unverified : undefined, | ||
| notReviewed, | ||
| projects: runs.map((r) => ({ |
There was a problem hiding this comment.
[MINOR] Merged envelope has no projectRoot, so earlier per-project blocking reviews are never reconciled
projects: runs.map((r) => ({The poster identifies prior bot reviews by the project=<root> marker (post-github.ts:97-102). The merged scope omits projectRoot while the single-project fallback keeps it, so the marker changes with the number of touched projects. Scenario: a previous run left a project=a CHANGES_REQUESTED review; a later --all-projects run touching A and B posts under the root marker and never dismisses it (and vice versa), so a fixed PR can stay blocked.
Fix: give the all-projects review a stable identity, and let it dismiss prior blocks for the projects it covers (keeping the completeness and head-SHA safeguards). Add a test.
There was a problem hiding this comment.
Fixed in 5e2440e. Every --all-projects envelope now records scope.coveredProjects. That is every discovered project, because a project the PR does not touch has nothing to flag. This includes the single-touched-project paths, so a later run that touches fewer projects can still clear an earlier block.
- Such envelopes post under a
projects=<dir>,<dir>marker. Each root is URI-component-encoded, with.for the repo root. - The poster treats an earlier bot review as its own when every project its marker names is in the covered set.
- So an all-projects run dismisses earlier
project=a,project=bandprojects=a,bblocks, but notproject=corprojects=a,c. A plain single-project run still never touches a review that names other projects.
The completeness and head-SHA guards are unchanged. The test sends a merged envelope through postGitHubReview and asserts both the dismissals and the new marker.
There was a problem hiding this comment.
✅ Fixed at 676c803 — scope.coveredProjects plus a projects=<a>,<b> marker (post-github.ts:91-100,139-140). Marker round-trips for commas, spaces, percent signs, non-ASCII and the root; a single-project run never dismisses a review covering more projects; head/completeness safeguards still apply. Test at :346 fails with the old matcher.
| const worst = lanes.reduce((a, b) => (AI_STATE_RANK[b.env.ai!.state] > AI_STATE_RANK[a.env.ai!.state] ? b : a)) | ||
| const state = worst.env.ai!.state | ||
| const reason = worst.env.ai!.reason | ||
| const base = ok ?? first |
There was a problem hiding this comment.
[MINOR] AI coverage and verifier metadata keep only one project's values
const base = ok ?? first...base carries one project's input, unsent and verifier; ai.projects only records state/reason/calls. Two projects each with one input file and verifier cost 2 merge to one input file and verifier cost 2, not two and 4, so coverage notes and verifier telemetry omit sibling activity.
Fix: union coverage records and sum verifier usage/counters, or attribute them per project in ai.projects.
There was a problem hiding this comment.
Fixed in 5e2440e:
ai.inputrecords andai.unsentare now the union across projects.ai.verifiersums usage (tokens, cost, duration) and counters (turns, tool calls, reviewed/kept/discarded/summary/unreviewed). Its state is the worst one, prefixed with that project's root.dropped(still capped at 20) anddecisionsare concatenated.
The test merges two projects that each have one input file and a verifier cost of 2, and gets two input records, cost 4 and the error state of the failing project.
There was a problem hiding this comment.
✅ Fixed at 676c803 — input/unsent are unioned and the verifier usage/counters summed (multi-project.ts:289-348); test at :314 checks two input records and cost 4, and fails on the old code.
ddc4333 to
7b5bb4b
Compare
5470bfe to
5e2440e
Compare
|
Thanks Harish for the careful premise-checked review. All three MAJORs and both MINORs are fixed in 5e2440e ("fix(review): address review feedback: --all-projects mode, head, policy, reconciliation, AI merge"), each with a regression test. Details are in the threads. Nits:
Not in this commit:
|
| if (touched.length === 1) { | ||
| // Invoked from inside the touched project: exactly the single-project review. | ||
| const cwdRel = repoRel(gitRootReal, await canonical(opts.cwd)) | ||
| if (cwdRel !== undefined && owningProject(cwdRel + "/", roots) === touched[0]) return covered(await reviewPullRequest(opts)) |
There was a problem hiding this comment.
WARNING: This early return bypasses the --manifest attribution guard added just below it.
manifestAbs/manifestOwner/manifestFor() are computed before this branch (lines 105-113), but the "belongs to , which this PR does not change" warning is emitted at lines 126-131 — after the return. So when the PR touches exactly one project and the CLI runs from inside it:
cd proj_a && altimate review --all-projects --manifest ../proj_b/target/manifest.jsontouched == ["proj_a"], this branch returns reviewPullRequest(opts) with the raw opts.manifestPath, and proj_b's manifest is silently used to analyse proj_a — wrong nodes/dialect, no diagnostic. That contradicts the guard below, which is the only place the misattribution is reported.
Hoist the attribution check above this branch (it only needs manifestAbs and manifestFor), or pass manifestPath: manifestFor(touched[0]) here so a foreign manifest is dropped and warned about.
7b5bb4b to
a2d91ce
Compare
5e2440e to
676c803
Compare
hkaltai
left a comment
There was a problem hiding this comment.
Re-review at 676c803 (previous review at 5470bfe, since rebased: 04b5104). Panel: Claude + Codex + lead.
Request changes. Of the three prior MAJORs, two are fixed (--mode re-applied; stale-run guard) and one is partially fixed (repo-root policy). Both prior MINORs are fixed. 16/16 tests in review-all-projects.test.ts pass, and 7 of them fail on the previous code, so the fixes have regression tests.
Counts: CRITICAL 0, MAJOR 1 (open, prior #3 remainder), MINOR 2 (new), NIT 5. Replies posted in each prior thread.
| Prior finding | Status |
|---|---|
--mode re-applied after per-project policy (MAJOR) |
Fixed |
Merged scope drops headSha (MAJOR) |
Fixed |
| Repo-root policy ignored by per-project cwd (MAJOR) | Partially fixed: root invocation works, invocation from inside the sole touched project still loses it (inline) |
No projectRoot, prior blocks not reconciled (MINOR) |
Fixed (coveredProjects / projects= marker) |
| AI input/unsent/verifier keep one project (MINOR) | Fixed |
| Prior nit | Status |
|---|---|
| venv dirs in discovery | Fixed, tested |
AI_STATE_RANK placement, header/mode comments, OUTSIDE_PROJECT_RE, worstLane |
Fixed |
| Deleted-wholesale project not discovered (head-only discovery) | Not fixed; safe for dismissal (not in coveredProjects) |
| Test gaps | Merged envelope through the poster and dbt_project.yaml/ignored dirs now tested; CLI flag wiring and listFilesAt with non-ASCII still have no direct test |
Nits
multi-project.ts:209-211const heads = new Set(envs.map(...))/ throw: each project resolvesopts.head ?? "HEAD"itself, so a head that moves mid-run fails only after all AI work is spent. Resolve the head once inreviewAllProjectsand pass it down; the throw becomes an assertion.multi-project.ts:327if (present.length === 1) return present[0].v: the single verifier'sreasonlacks theroot:prefix used in the multi case; alsoai.replayed/ai.replayIncompletecome only from...base, so a sibling'sreplayIncomplete: trueis lost. OR them.verdict.ts:162coveredProjectsis another new signed field: an older CLI that strips unknown keys will fail signature verification of such envelopes (same pre-existing pattern asprojects); worth a changelog note.multi-project.ts:96const covered = (env) => ...shares its name with thecoveredSet inpost-github.ts; considerwithCovered. LikewisepolicyFallbackDirsbecomespolicyAncestorDirsif the ancestor fix above is taken.- Test: the unit test "a gate project's block survives the merge" (:280) also passes on the old code; keep the integration test as the guard, and add negative poster tests (merged envelope with
headSha!= PR head, or incomplete, must not dismiss) and a CLI wiring test for--all-projects.
| if (touched.length === 1) { | ||
| // Invoked from inside the touched project: exactly the single-project review. | ||
| const cwdRel = repoRel(gitRootReal, await canonical(opts.cwd)) | ||
| if (cwdRel !== undefined && owningProject(cwdRel + "/", roots) === touched[0]) return covered(await reviewPullRequest(opts)) |
There was a problem hiding this comment.
[MAJOR] Single-touched-project shortcut still drops the repo-root .altimate/review.yml (remainder of the earlier policy finding)
if (cwdRel !== undefined && owningProject(cwdRel + "/", roots) === touched[0]) return covered(await reviewPullRequest(opts))This branch (and the zero-touched branch at line 102) calls reviewPullRequest(opts) without policyFallbackDirs, so the root policy is not consulted. Reproduced with a root .altimate/review.yml of mode: gate, one touched project, same base/head:
| invocation dir | result |
|---|---|
| repo root | mode=gate, policy.source=base |
proj_a |
mode=comment, policy.source=default |
A workflow using --all-projects with working-directory: proj_a (or a PR touching one project today and two tomorrow) silently loses the gate, severity and rule settings, so a finding that should be REQUEST_CHANGES is downgraded to COMMENT. The added test only covers invocation from the repo root.
Fix: pass the same policyFallbackDirs (project ancestors up to the repo root) on every return path, and add a test invoking from inside the sole touched project.
There was a problem hiding this comment.
Good catch, fixed in 24e925a. Both shortcuts (multi-project.ts:117 with no touched project, :139 for the sole touched project) now pass policyFallbackDirs with the invocation dir's ancestors up to the repo root. New test review-all-projects.test.ts:134 runs from inside proj_a with a root mode: gate and gets gate/base on both paths. It fails on the old code.
There was a problem hiding this comment.
✅ Fixed at 24e925a — inPlace (multi-project.ts:102) carries policyFallbackDirs and is used on the zero-touched (:117) and sole-touched (:139) paths. Re-ran the repro on fresh repos: root mode: gate, one touched project, run from proj_a, proj_a/models, via a symlink, and with zero touched projects all give gate/base (old code: comment/default). Test review-all-projects.test.ts:134 fails on the pre-fix code.
| ...opts, | ||
| cwd: path.join(gitRootReal, root), | ||
| manifestPath: manifestFor(root), | ||
| policyFallbackDirs: [...new Set([opts.cwd, gitRootReal])], |
There was a problem hiding this comment.
[MINOR] Fallback order lets a sibling project's policy govern another project
policyFallbackDirs: [...new Set([opts.cwd, gitRootReal])],The invocation directory is tried before the repo root for every project, not only for projects inside it. Setup: base root mode: gate, base proj_a/.altimate/review.yml mode: comment, PR touches proj_a and proj_b. From the repo root proj_b runs in gate; with cwd=proj_a, proj_b runs in comment with proj_a's policy hash, so its gating is silently off.
Fix: fall back along the project's own ancestor directories up to the repo root (nearest enclosing policy); use the invocation directory only when it is an ancestor of that project. Add a test invoking from a sibling project.
There was a problem hiding this comment.
Agreed, fixed in 24e925a. Each project now falls back only along its own ancestors up to the repo root (ancestorsUpToRoot, multi-project.ts:87,133), so the invocation dir only counts when it encloses the project. Test review-all-projects.test.ts:151 runs your setup from the root, proj_a and proj_b: proj_a stays comment and proj_b stays gate every time.
There was a problem hiding this comment.
✅ Fixed at 24e925a — each project now falls back along its own ancestors (ancestorsUpToRoot, multi-project.ts:133). Root gate + proj_a comment, PR touches both: from the root, proj_a and proj_b all give [proj_a: comment, proj_b: gate], top-level gate (old code from proj_a: proj_b=comment). Test :151 fails on the old code.
| policy = await policyAt(dir) | ||
| } | ||
| // A policy file the PR adds next to the project would replace the fallback: list it too. | ||
| if (policyChangedHere.length && policy.changedInPr !== policyChangedHere) |
There was a problem hiding this comment.
[MINOR] A PR-added project policy that overrides an inherited one is diffed against defaults, not the inherited policy
if (policyChangedHere.length && policy.changedInPr !== policyChangedHere)policyChangedHere was computed by policyAt(opts.cwd) against the default config. Scenario: base root policy is mode: gate; the PR adds proj_a/.altimate/review.yml with mode: comment. Nothing is reported (changedInPr empty, no stderr notice) because comment equals the default, yet once merged that file replaces the root policy for proj_a and turns gating off. The reverse also happens: an added file identical to the inherited policy is reported as a change.
Fix: when a fallback policy was applied, diff the PR's project file against the applied fallback config, and always flag a newly added project-level policy file that overrides an inherited one.
There was a problem hiding this comment.
Fixed in 24e925a. When an inherited policy is applied, run.ts:279 diffs the PR's project file against that policy using the new headPolicyChanges (config.ts). Test review-all-projects.test.ts:167: adding proj_a mode: comment over the root gate now reports ["mode"], and an added file identical to the root policy reports nothing.
There was a problem hiding this comment.
gate + PR-added proj_a/.altimate/review.yml mode: comment now reports changedInPr: ["mode"] from the root and from inside either project, and an identical or semantically equal added file reports nothing (test :167 fails on old code). The same blind spot remains one level up: a policy file the PR adds in a directory between the project and the applied ancestor is not reported (see the new inline comment on run.ts:285).
a2d91ce to
845f31a
Compare
676c803 to
a3689b6
Compare
| // no directory has one on the base branch). | ||
| const addedHere = | ||
| policy.source === "base" ? await headPolicyChanges(opts.cwd, policy.config) : policyHere.changedInPr | ||
| policy.changedInPr = [...new Set([...policy.changedInPr, ...addedHere])] |
There was a problem hiding this comment.
WARNING: A PR-added policy file in a non-project ancestor directory is never reported in policy.changedInPr.
The fallback walk visits every ancestor between the reviewed project and the repo root, but each policyAt(dir) result is discarded unless it is the last non-default one. Scenario: project dbt/a has no policy of its own and the base root policy is mode: gate; the PR adds dbt/.altimate/review.yml with mode: comment. policyAt(<root>/dbt) returns source: "default" with changedInPr: ["mode"], the loop continues to the root, and this block only unions headPolicyChanges(opts.cwd, policy.config) (i.e. dbt/a's own file), so the dbt file's change is dropped. That file is not assigned to any project either (only dbt/a is a project root), so the merged envelope has no changedInPr, the "This PR changes the review policy" note is missing, and the file only shows up in the not-reviewed ledger — yet after merge it is exactly the file --all-projects resolution applies to dbt/a.
Diff the nearest visited directory that has a head-side policy file against the applied policy (not only opts.cwd), or union the changedInPr of every visited directory that has one.
845f31a to
d8cfb39
Compare
a3689b6 to
aa6041d
Compare
d8cfb39 to
b3247d1
Compare
aa6041d to
24e925a
Compare
hkaltai
left a comment
There was a problem hiding this comment.
Re-review at 24e925a (previous review at 676c803). Panel: Claude + Codex + lead.
Approving. All three prior findings reproduce as fixed on fresh repos at this head, no policy-gate bypass remains, and each fix has a regression test that fails on the pre-fix code (review-all-projects.test.ts 19/19 pass; the full review suite passes). One new MINOR (policy-change reporting only, not enforcement) and a few nits are left; none block.
Counts: CRITICAL 0, MAJOR 0, MINOR 1 (new), NIT 6.
| Prior finding | Status |
|---|---|
| MAJOR: single/zero-touched shortcut skipped repo-root policy | Fixed (multi-project.ts:102,117,139; test :134) |
| MINOR: invocation dir tried before repo root, sibling inherits policy | Fixed (ancestorsUpToRoot, :133; test :151) |
| MINOR: PR-added project policy diffed against defaults | Fixed for the project dir (headPolicyChanges; test :167); intermediate-dir gap is the new MINOR |
| Prior nit | Status |
|---|---|
| Deleted-wholesale project not discovered (head-only discovery) | Not fixed (safe for dismissal; tracked) |
CLI flag wiring test for --all-projects |
Not fixed |
listFilesAt non-ASCII test |
Fixed (review-all-projects.test.ts:271) |
| Unit test "a gate project's block survives the merge" passes on old code | Unchanged; the integration test is the guard |
Head resolved per project, mismatch thrown after AI spend (multi-project.ts:225) |
Not fixed |
Single verifier reason lacks root prefix; ai.replayed/replayIncomplete not OR-ed |
Not fixed |
coveredProjects new signed field, changelog note |
Not fixed |
Nits
multi-project.ts:102,117const inPlace = { ...opts, policyFallbackDirs: ancestorsUpToRoot(...) }: on the zero-touched path the invocation directory's own policy still applies even when it is a sibling or non-project dir (run fromservices/with acommentpolicy and rootgategivescomment), contradicting the doc "A sibling directory's policy never applies, whichever directory the command runs from". Nothing is reviewed on that path so impact is nil; use the repo-root policy there or soften the doc.inPlacecould be namedfromInvocationDir.config.ts:265if (headText === appliedText) return []/structuredClone(DEFAULT_REVIEW_CONFIG): when the PR deletes a project-level policy file and an ancestor policy exists, the change is measured against defaults instead of the policy inherited afterwards. Rootgate+ baseproj_amode: gate, severityThreshold: warningdeleted by the PR reports["mode","severityThreshold"]although nothing effective changes. Compare against the next ancestor's config when the head file is missing.multi-project.ts:17"whichever directory the command runs from": the single-project shortcut still lets a project-level policy under the invocation dir (e.g.proj_a/models) win over the project's ancestor policy; document or align.- Tests: no test for
--all-projectsCLI parsing/dispatch (the boolean-flags test omits it), a PR-added intermediate-directory policy, nested-project policy inheritance, or running from a non-project subdirectory. multi-project.ts:93-96const covered = (env) => ...shares its name with thecoveredSet inpost-github.ts; considerwithCovered.verdict.tscoveredProjects: older CLIs that strip unknown signed keys fail verification of such envelopes; worth a changelog line.
| // no directory has one on the base branch). | ||
| const addedHere = | ||
| policy.source === "base" ? await headPolicyChanges(opts.cwd, policy.config) : policyHere.changedInPr | ||
| policy.changedInPr = [...new Set([...policy.changedInPr, ...addedHere])] |
There was a problem hiding this comment.
[MINOR] A policy file the PR adds in a directory between the project and the applied ancestor is not reported in changedInPr
const addedHere =
policy.source === "base" ? await headPolicyChanges(opts.cwd, policy.config) : policyHere.changedInPr
policy.changedInPr = [...new Set([...policy.changedInPr, ...addedHere])]While the fallback loop walks up, policy is replaced by each ancestor's result, which discards the intermediate directory's changedInPr; headPolicyChanges is then called only for opts.cwd. Reproduced by Claude and Codex on fresh repos: base root policy mode: gate, projects at services/proj_a and services/proj_b, the PR adds services/.altimate/review.yml with mode: comment. Both projects correctly stay gated, but changedInPr is absent (no stderr notice, nothing in the envelope), although once merged the added file silently turns gating off for both. Same when no base policy exists and the PR adds services/.altimate/review.yml. Editing an existing intermediate policy is reported correctly. This is not an enforcement bypass (the base policy still applies), only the audit trail from the earlier finding, one directory higher.
Fix: for every directory skipped on the way up ([cwd, ...policyFallbackDirs] before the applied one) add headPolicyChanges(dir, policy.config), or resolve the effective head policy across the whole ancestor chain and diff it against the applied one. Add a regression test with a PR-added services/.altimate/review.yml.
b3247d1 to
140737c
Compare
24e925a to
0daab2a
Compare
|
Heads-up: one small commit added on top after rebasing onto #1772's latest fix: 0daab2a. In |
A mono-repo PR can change several dbt projects; until now the review only covered the project found from `--cwd` and listed every other project's files as "outside the dbt project". - `reviewAllProjects` (new `multi-project.ts`) collects the changed files once, discovers every `dbt_project.yml` at the head side (skipping `dbt_packages/`, `target/`, `node_modules/`), and assigns each file to the deepest project containing it. Each touched project is reviewed sequentially with `reviewPullRequest` (its own policy, layout and manifest auto-discovery; `--manifest` applies only to the project that contains it), seeing only its own files plus files outside every project. - The results merge into one signed envelope: findings concatenated and de-duplicated by id, the most severe verdict and highest tier, summary recomputed, the not-reviewed ledger unioned (other projects' files are no longer "outside"), engine errors combined, AI usage summed, and per-project roots/verdicts/AI states in `scope.projects` / `ai.projects`. - With 0 or 1 touched projects the single-project envelope is returned. - `altimate review --all-projects` wires it into the CLI; the summary adds a "Reviewed N dbt projects" line only when more than one was reviewed. - `reviewPullRequest` gains an optional `prFiles` (the full PR file list when `changedFiles` is a subset); the default path is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…envelope, AI state, path listing - An explicit `--manifest` outside every project (CI `$RUNNER_TEMP/manifest.json`) now goes to the touched project when the PR touches only one; when it can't be attributed (several touched projects, or it belongs to an untouched one) a warning says no project uses it instead of silently degrading to lint-only. - Merged verdict: the worst of each project's post-mode verdict, so a comment-mode project's REQUEST_CHANGES no longer blocks because a sibling uses gate mode. `scope.projects[]` records each project's `mode`. - Merged envelope is built explicitly instead of spreading the first project: `manifestHash` and `policy` are kept only when every project agrees (otherwise `policy` carries the least-trusted source, a combined hash, the union of `changedInPr` and a shared posting policy); `scope.projectRoot` is dropped; each project's `manifestHash` and `policyHash` go in `scope.projects[]`; `tierClassified` is the highest classified tier. - Merged AI state is the worst project state (`error` > `timeout` > `ok` > `skipped`) with that project's reason, so a sibling's failure is not hidden by another project's `ok`; `ai.projects[]` carries each `reason`. - `listFilesAt` / `listWorkingTreeFiles` use `-z`, so `dbt_project.yml` under non-ASCII directory names is discovered (git C-quoted those paths). - `repoRel` rejects only `..` and `../…`, not in-repo names such as `..foo`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cy, reconciliation, AI merge - Mode: the merge no longer re-applies `--mode`; each project's mode already carries it only where it tightens the base policy, so a gate project's block survives a PR-editable `--mode comment` - Head: the merged scope carries the shared `headSha` / `headParents` (the poster's stale-run guard); projects reviewed at different heads fail the run - Policy: each project loads its own `.altimate/review` file, else the invocation directory's, else the repository root's (new `policyFallbackDirs`, read from the base branch); precedence documented in the module header - Reconciliation: `--all-projects` envelopes record `scope.coveredProjects` (every discovered project) and post under a `projects=<dir>,...` marker; the poster treats an earlier bot review as its own when every project it names is covered, so per-project blocks are dismissed (completeness and head guards unchanged) - AI metadata: input records and unsent files are unioned; verifier usage and counters are summed with the worst state and its project's reason - Nits: discovery skips `.venv`, `venv`, `site-packages`; `AI_STATE_RANK` moved up; `OUTSIDE_PROJECT_RE`; `worstLane`; comments updated - Tests for each, including a merged envelope through `postGitHubReview` Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… ancestors - every return path of `reviewAllProjects` passes `policyFallbackDirs`, so the repo-root `.altimate/review.yml` applies when invoked from inside the sole touched project (and when no project is touched) - per project, fall back to the nearest policy above the project up to the repo root; the invocation directory no longer lends a sibling project its policy - when an inherited policy was applied, diff a PR-added project policy file against that policy (`headPolicyChanges`), so a file that would loosen it is listed in `changedInPr` and one identical to it is not - tests for invocation from the sole touched project, from a sibling project, and for a PR-added project policy over an inherited one Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ch project's verifier In `--all-projects` mode each project's run gets only its own changed files, so the `prRenames` map `runReview` uses to refuse credential-like files was built from that subset. A credential file renamed unedited in a sibling project (e.g. `proj_b/profiles.yml` -> `proj_b/settings.txt`) kept its new, innocuous name in `prFiles` and was readable by the other project's verifier. - `ReviewPullRequestOptions.prRenames`: every rename in the PR (new -> old) when `changedFiles` is a subset; merged into the run's `prRenames` map - `reviewAllProjects` passes it from the full collected file list Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
140737c to
a7fe84b
Compare
0daab2a to
45795f6
Compare
Changes since review: 1b5264f (review comments): an explicit
--manifestoutside every project is attributed or warned about, the merged verdict is the worst post-mode verdict, the merged envelope and AI state are built explicitly. 5e2440e (review feedback):--modeis not re-applied on merge, the merged scope carries the shared head (mixed heads fail), each project loads its own policy with documented fallbacks,--all-projectsreviews dismiss per-project blocks for covered projects, and AI metadata is unioned.Issue for this PR
Part of #1792
Type of change
What does this PR do?
Stacked on #1772.
altimate review --all-projectsreviews every dbt project a PR touches in one run and posts one combined comment. Before, a monorepo PR needed one run per project.What changed
multi-project.ts:dbt_project.ymlon the head side, skippingdbt_packages/,target/andnode_modules/.scope.projects/ai.projects.Results
How did you verify your code works?
bun test test/altimate/review: 754 pass.bunx tsc --noEmit: clean.test/altimate/review-all-projects.test.ts.Cost side effects
None by default:
--all-projectsis opt-in. When used, the review runs once per touched dbt project, so any enabled AI-lane calls and opt-indbt_preparework scale with the number of touched projects (one run per project, as before, but now in one invocation). Single-project PRs are unchanged.Screenshots / recordings
Not a UI change.
Checklist
🤖 Generated with Claude Code
Summary by cubic
Adds
altimate review --all-projectsso a mono-repo PR touching multiple dbt projects is reviewed in one run and gets one combined comment. Previously, each project needed a separate review run.New Features
dbt_project.ymlthe PR touches (git listing uses-z, so non-ASCII directory names work), assigns each changed file to the deepest containing project, and reviews each with its own policy, layout, and manifest — each project sees only its own changed files plus files outside every project, so a credential-like file renamed in another project is still refused to its verifier.--manifestapplies only to the project containing it; when it can't be attributed to a touched project, a warning says no project uses it.scope.projects/ai.projects. Shared envelope fields (manifestHash,policy) are kept only when every project agrees..altimate/reviewfile, else the nearest ancestor's up to the repository root, read from the base branch; a sibling directory never lends its policy, and the invocation directory doesn't either once a project has its own. A PR-added project policy is diffed against the inherited policy it would replace.Written for commit 45795f6. Summary will update on new commits.