Skip to content

refactor(indexer): unify build/update/rebuild into single parameterized _run method#438

Merged
jafreck merged 2 commits intomainfrom
refactor/pipeline-context
Mar 28, 2026
Merged

refactor(indexer): unify build/update/rebuild into single parameterized _run method#438
jafreck merged 2 commits intomainfrom
refactor/pipeline-context

Conversation

@jafreck
Copy link
Copy Markdown
Owner

@jafreck jafreck commented Mar 28, 2026

Summary

Replaces three near-identical private methods (_build, _update, _baselineRebuild) in IndexBuilder with a single _run(mode) method using a discriminated union type.

Motivation

The three methods duplicated:

  • DB open/close lifecycle
  • Pipeline stage construction (nearly identical arrays)
  • PipelineContext construction (same 15+ fields)

The only differences were mode-specific: layer, generation, changedFiles, and post-run logging.

Changes

  • Added BuildMode discriminated union type: 'build' | 'update' | 'rebuild'
  • Unified all three methods into _run(mode: BuildMode)
  • Public methods (build(), update(), baselineRebuild()) are now one-liner delegates
  • Net: -71 lines (471 → 400)

Testing

All existing tests pass with identical results to main (17 pre-existing failures unchanged).

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.57%. Comparing base (1f38621) to head (171bc2d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #438      +/-   ##
==========================================
- Coverage   89.58%   89.57%   -0.01%     
==========================================
  Files          83       83              
  Lines        9641     9634       -7     
  Branches     2987     2995       +8     
==========================================
- Hits         8637     8630       -7     
  Misses       1004     1004              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jafreck jafreck merged commit bccb9b0 into main Mar 28, 2026
1 check passed
@jafreck jafreck mentioned this pull request Mar 30, 2026
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