Skip to content

fix(cll): fix change_analysis state propagation in CLL#1190

Open
danyelf wants to merge 5 commits intomainfrom
worktree-cll-data-propagation
Open

fix(cll): fix change_analysis state propagation in CLL#1190
danyelf wants to merge 5 commits intomainfrom
worktree-cll-data-propagation

Conversation

@danyelf
Copy link
Contributor

@danyelf danyelf commented Mar 7, 2026

Summary

  • Separated changeAnalysisMode from viewOptions to prevent state loss when users click columns after activating Impact Radius. Previously, change_analysis lived inside viewOptions.column_level_lineage and was overwritten on column clicks.
  • Used ?? merge pattern in both CLL API call paths to fall back to the sticky changeAnalysisMode state when change_analysis is absent from the per-request input.
  • Added changeAnalysisModeRef to avoid stale closure reads in the useEffect([lineageGraph]) path.

Closes a bug where toggling Impact Radius, then clicking a column, would silently drop the change_analysis flag from subsequent CLL API calls.

Test plan

  • 10 new state machine tests covering all propagation scenarios (CllChangeAnalysisPropagation.test.ts)
  • All 3346 existing tests pass
  • TypeScript type-check clean (zero errors)
  • Manual verification: activate Impact Radius → click columns → verify change_analysis: true persists in network requests

Reviewer notes

  • Follow-up refactor tracked in DRC-2893: eliminate the lineage refetch cycle entirely by patching the query cache from CLL response data.
  • TDD commit progression: failing tests → fix → green tests → refinement → stale-closure fix.

DCO

  • All commits are signed off

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

danyelf and others added 5 commits March 6, 2026 14:26
Tests demonstrate that change_analysis mode is lost when clicking between
columns during Impact Radius mode. The root cause is that
viewOptions.column_level_lineage is wholesale-replaced by onColumnNodeClick
with { node_id, column }, dropping the change_analysis flag.

4 tests use it.fails (RED) showing the bug; 6 pass documenting baseline.
When the fix lands, change it.fails → it and verify they pass.
See docs/plans/state_model_repair.md for the fix plan.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
…te loss

Column clicks wholesale-replace viewOptions.column_level_lineage via
showColumnLevelLineage(), which dropped change_analysis. This caused
Impact Radius mode to silently disappear when clicking columns.

Fix: Add independent changeAnalysisMode boolean state that column clicks
never touch. The mode is set true on Impact Radius activation, cleared
when CLL is turned off entirely, and injected into API calls at the
call site rather than being carried in the viewOptions object.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
Update test helpers to reflect the new state model where
change_analysis is an independent boolean rather than a field
on the CllInput object. Flip it.fails → it on all 4 bug tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
…osure

When Impact Radius activates, setChangeAnalysisMode(true) and
showColumnLevelLineage({change_analysis: true}) fire in the same
event. The state setter hasn't re-rendered yet, so changeAnalysisMode
is still false in the refreshLayout closure. Use ?? to prefer the
explicit CllInput value, falling back to the state boolean for
column clicks that don't carry it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
The useEffect([lineageGraph]) captured changeAnalysisMode via closure,
causing stale reads on refetch. Use a ref mirror so both the CLL API
call and trackLineageRender read the current value.

Ref: DRC-2893

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
@danyelf danyelf requested a review from gcko March 7, 2026 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant