SIGN IN SIGN UP

fix(sqlfluff): always filter, and share one decision between both entry points

sqlfluff exits 1 whenever it finds violations, which is the normal case this
filter exists for. Two changes in the last push read that exit code as failure
and so disabled the filter exactly when it had something to compress:

- `sqlfluff_cmd` used `early_exit_on_failure()`, which dumps the injected JSON
  raw. On a 51-file corpus that is 9.8 KB where plain `sqlfluff lint` is 1.1 KB.
- `lint_cmd` substituted `result.stderr`, which is always empty: sqlfluff writes
  even fatal errors to stdout (verified against 2.3.5 and 4.3.0 - `Error:
  Unknown dialect 'NOPE'` on stdout, stderr empty, exit 2). Every violation was
  discarded in favour of a 25-byte `SQLFluff: failed (exit 1)`.

Both are one bug reached two ways, because both entry points restated the same
routing and format-flag logic and were then edited differently. Extract it into
`sqlfluff_cmd::plan`, which states once how rtk invokes sqlfluff and how it
reads the result back; `lint_cmd` now calls it instead of keeping a copy. The
exit code only disambiguates output the filter could not parse, so a fatal error
reaches the user verbatim while violations are still summarized.

Also in the report:

- Rank the `Violations:` section worst-file-first like every section above it.
  Iterating sqlfluff's emission order and taking the first 50 dropped exactly
  the file the summary ranked first.
- Build only the lines that get printed, instead of every line to keep fifty.
- Omit positions sqlfluff did not report rather than fabricating `:0:0`.
- Keep two path segments when no dbt root matches, so `migrations/orders.sql`
  and `reports/orders.sql` stay distinct in the section meant to be opened.
- Treat a missing `fixes` key as unknown rather than zero. sqlfluff 2.x omits it
  entirely, which silently suppressed the `sqlfluff fix` hint.
- Rename the savings test to the bound it actually asserts.

Tests cover both regressions against real captured output: 4.3.0 for the current
field names and fix data, 2.3.5 for the legacy names and the absent `fixes` key.
T
TheGlitching committed
ebf4cbf5399eed61c7e5f2730f82b01a4036bdd9
Parent: 0db62bd