Skip to content

refactor(lint): migrate orchestration to application layer - #101

Merged
TFM-HITESH merged 1 commit into
envaar:mainfrom
TFM-HITESH:refactor/migrate-lint
Sep 8, 2026
Merged

TFM-HITESH merged 1 commit into
envaar:mainfrom
TFM-HITESH:refactor/migrate-lint

Conversation

@TFM-HITESH

@TFM-HITESH TFM-HITESH commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Closes #95

Summary

Migrate lint orchestration from the legacy Runner into the layered lint application service while preserving existing CLI behavior.

Why

The refactor requires lint execution, safe fix application, post-fix reload/reanalysis, finding reconciliation, and result handling to flow through the application boundary defined by Discussion #58.

Type

  • Bug fix
  • New rule
  • Parser change/fix
  • Reporter change/fix
  • Documentation
  • CI / Release
  • Build
  • Performance improvement/change
  • Internal refactor
  • Hotfix

Breaking change

  • No
  • Yes (describe required migration)

Changes

  • Migrated CLI lint execution from internal/lint.Runner to internal/application/lint.Service.
  • Added the complete --fix lifecycle: initial analysis, mutation planning, safe application, reload, reanalysis, and finding reconciliation.
  • Reused the same selected rule plan across the initial and post-fix passes.
  • Skipped reload and reanalysis when no mutation changes were planned.
  • Preserved fixed-finding markers, remaining findings, shifted line numbers, deterministic ordering, text output, JSON output, output-file behavior, and exit codes.
  • Removed obsolete Runner, direct file-loading, and direct fix-application orchestration.
  • Moved reconciliation tests and the lint benchmark to the application layer.
  • Updated Makefile to benchmark the migrated application path.

User-visible changes

None.

The CLI implementation moved to the layered application path, but command syntax, output formats, finding behavior, exit codes, and existing user-visible behavior remain unchanged.

Validation

Commands run:

  • gofmt -w <touched Go files>
  • make lint
  • go test ./...
  • go run ./cmd/vaar lint ...

Additional commands:

GOCACHE=/tmp/vaar-go-cache go vet ./...
GOCACHE=/tmp/vaar-go-cache make bench
GOCACHE=/tmp/vaar-go-cache make build
GOCACHE=/tmp/vaar-go-cache GOOS=windows GOARCH=amd64 go vet ./...
GOCACHE=/tmp/vaar-go-cache GOOS=windows GOARCH=amd64 go build -buildvcs=false -o /tmp/vaar-windows.exe ./cmd/vaar
git diff --check

go run ./cmd/vaar lint ... was not run separately because the existing CLI integration test suite exercises the migrated command path and preserves the existing behavior.

Tests

  • Added tests
  • Updated existing tests
  • No tests needed

Tests cover successful fixes, mixed fixed and remaining findings, no-change fix runs, selected and skipped rules, shifted line-number reconciliation, JSON fixed markers, mutation failures, reload failures, provenance validation, arbitrary dotenv suffix discovery, CLI behavior, output handling, and secret non-disclosure.

Documentation

  • Updated documentation
  • Not applicable

Updated directly affected package comments to reflect the application boundary and the removal of legacy Runner orchestration.

Release notes

Migrates lint execution and safe-fix orchestration to the layered application pipeline without changing CLI behavior.

Reviewer notes

Please pay particular attention to:

  • Reuse of the same selected RulePlan across both lint passes.
  • The no-op path, which avoids unnecessary reload and reanalysis.
  • Mutation planning and application remaining delegated to internal/mutations.
  • Fixed and remaining finding reconciliation when line numbers shift.
  • Preservation of deterministic finding ordering and existing text/JSON output.
  • Preservation of scope, output-path collision, and exit-code behavior.
  • Removal of obsolete Runner and direct filesystem orchestration.
  • The intentional deferral of diff migration (refactor(diff): compare analysis key inventories #96), diff CLI migration (refactor(diff): migrate the diff command to shared loading and reporting #97), architecture documentation updates, and internal/envfile removal.

Checklist

  • PR title follows Conventional Commits
  • Code is formatted
  • Tests pass
  • Documentation is updated
  • Release note added
  • No real secrets, credentials or sensitive data is included

@coderabbitai

coderabbitai Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: b8831c19-d592-42ed-b5be-0a38d9085c73

📥 Commits

Reviewing files that changed from the base of the PR and between aaa5d31 and 0080530.

📒 Files selected for processing (14)
  • Makefile
  • internal/application/lint/application.go
  • internal/application/lint/application_benchmark_test.go
  • internal/application/lint/application_test.go
  • internal/application/lint/reconciliation.go
  • internal/application/lint/reconciliation_test.go
  • internal/cli/lint.go
  • internal/lint/engine.go
  • internal/lint/fix.go
  • internal/lint/fix_test.go
  • internal/lint/fixability.go
  • internal/lint/rule.go
  • internal/lint/runner.go
  • internal/lint/runner_test.go
💤 Files with no reviewable changes (3)
  • internal/lint/runner_test.go
  • internal/lint/fix_test.go
  • internal/lint/runner.go

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The lint runner moved to the application layer. The application service now supports optional safe fixes, reloads and reanalyzes changed files, reconciles fixed findings, and reports changes. The CLI and benchmark use the new service API.

Changes

Lint application migration and safe fixes

Layer / File(s) Summary
Application service lifecycle
internal/application/lint/application.go, internal/application/lint/reconciliation.go, internal/application/lint/*_test.go
The application service adds mutation planning, application, reload, reanalysis, changed results, and fixed-finding reconciliation. Tests cover discovery, successful fixes, no-op fixes, mutation failures, and reload failures.
Lint engine boundary cleanup
internal/lint/engine.go, internal/lint/fix.go, internal/lint/fixability.go, internal/lint/rule.go
Rule selection validation and finding sorting are exported. Legacy runner and fix application APIs are removed. Package documentation reflects the layered architecture.
CLI, benchmark, and lifecycle validation
internal/cli/lint.go, internal/application/lint/application_benchmark_test.go, Makefile
The CLI and benchmark use the application lint service and its renamed benchmark. The Makefile targets the new benchmark path.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 00805

The lint orchestration migration preserves the planned safe-fix lifecycle and existing command behavior without an identified merge-blocking regression.

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant ApplicationLint
  participant MutationPlanner
  participant MutationPlan
  participant LintEngine
  CLI->>ApplicationLint: RunWithSelection(options, selection)
  ApplicationLint->>LintEngine: Load and analyze selected scope
  ApplicationLint->>MutationPlanner: BuildPlan(documents, rules)
  MutationPlanner-->>ApplicationLint: Mutation plan
  ApplicationLint->>MutationPlan: Apply changed files
  MutationPlan-->>ApplicationLint: Applied changes
  ApplicationLint->>LintEngine: Reload and rerun rules
  LintEngine-->>ApplicationLint: Final findings
Loading
🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR adds post-fix reload and reanalysis, finding reconciliation, and fixed-finding reporting. Issue #94 explicitly lists post-fix lint reruns and finding reconciliation as non-goals. Remove the post-fix reload, reanalysis, reconciliation, and related result behavior from this PR, or link a separate issue that authorizes these requirements. Keep issue #94 limited to mutation planning and safe application.
Out of Scope Changes check ⚠️ Warning The post-fix rerun and reconciliation logic are outside issue #94. The CLI migration and legacy runner removal also extend beyond the linked issue's bounded mutation-pipeline scope, while the objectiv… Remove or separately track the post-fix/reconciliation changes and the CLI/legacy-runner migration. Alternatively, link issues that explicitly authorize this broader application-layer migration.
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 10 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: moving lint orchestration to the application layer.
Full details: Out of Scope Changes check

Explanation

The post-fix rerun and reconciliation logic are outside issue #94. The CLI migration and legacy runner removal also extend beyond the linked issue's bounded mutation-pipeline scope, while the objectives state that CLI migration is deferred to #95.

Full details: Docstring Coverage

Explanation

Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 10 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@TFM-HITESH
TFM-HITESH merged commit f29356f into envaar:main Sep 8, 2026
9 checks passed
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.

refactor(lint): migrate lint orchestration to the layered pipeline

1 participant