altimate-code icon indicating copy to clipboard operation
altimate-code copied to clipboard

bug: impact_analysis traverses by leaf name instead of unique_id

Open suryaiyer95 opened this issue 8 months ago • 0 comments

Description

In impact-analysis.ts, the findDownstream function matches dependencies by splitting on . and comparing the last segment (leaf name):

const deps = model.depends_on.map((d) => d.split(".").pop())
if (deps.includes(name)) {

depends_on entries are fully qualified like project.stg_orders. Using .split(".").pop() takes only the last segment, which:

  1. Breaks with duplicate leaf names across packages — if two packages have models with the same name, the wrong one may match
  2. Misses fully-qualified matches — passing a fully-qualified name like project.stg_orders will never match the leaf-only comparison

Impact

  • Incorrect downstream dependency graph — blast radius may be over/under-reported
  • False positives/negatives in impact analysis results

Suggested Fix

Match against both the full depends_on entry and the leaf name, or normalize both sides consistently:

const deps = model.depends_on
if (deps.some(d => d === name || d.endsWith(`.${name}`) || d.split('.').pop() === name)) {

Source

Flagged by Codex and MiMo in multi-model code review of PR #429.

Files

  • packages/opencode/src/altimate/tools/impact-analysis.ts — lines 58, 81, 172

suryaiyer95 avatar Mar 24 '26 21:03 suryaiyer95