Skip to content

feat: column scoping — scan --columns / --exclude (0.3.0) - #51

Merged
copyleftdev merged 1 commit into
mainfrom
feat/column-scope
May 31, 2026
Merged

copyleftdev merged 1 commit into
mainfrom
feat/column-scope

Conversation

@copyleftdev

Copy link
Copy Markdown
Owner

What

Adds explicit, deterministic column scoping to scan/explain:

  • --columns C,.. — analyze only these columns (allowlist)
  • --exclude C,.. — analyze every column except these (denylist)

Mutually exclusive. The projection is applied before any detector runs and to the --baseline too, so drift comparison stays consistent.

Why

This is the answer to identifier noise on wide corpora, surfaced by running the installed binary against this machine's real systemd journal. On a 20k-entry journalctl -o json capture, the point detector dutifully flags ~10k statistical outliers across journald's many ID/counter/timestamp fields (JOB_ID, PIDs, __REALTIME_TIMESTAMP, N_RESTARTS) — each real but operationally meaningless. Scoping collapses that:

unscoped                                          → 10,086 findings
--columns PRIORITY,_SYSTEMD_UNIT,_PID             →  9,613 (_PID still noisy)
--exclude JOB_ID,_PID,…timestamps…,N_RESTARTS     →    208 (176 point, 5 collective, 27 structural)
--columns PRIORTY  (typo)                         → exit 2: no such column 'PRIORTY'

Design: explicit, never heuristic

A silent auto-skip ("drop near-unique columns") was rejected as off-ethos — it would itself be a guess (the project's #1 non-negotiable is never guess), and the obvious heuristic would wrongly discard exactly the near-unique numeric measurements the marquee detectors depend on (packet durationNanos, span durations, latencies). You name the scope; the result stays deterministic.

An unknown column name on the primary corpus is a hard error (exit 2) so a typo can't silently scope a scan to nothing and read as "clean". The baseline is projected leniently (different corpus, need not carry every scoped column).

Contract impact

None. Column scope is an input-side projection — no envelope field, no config_version change. Same input + same flags ⇒ byte-identical output.

Gates

  • proptest/unit: full workspace green.
  • cargo-mutants 0 missed on both changed files: ax-core/record.rs 21 mutants (17 caught / 4 unviable), anomalyx/main.rs 43 mutants (38 caught / 5 unviable).

🤖 Generated with Claude Code

Restrict detection to a chosen set of columns (allowlist) or to everything
but a set (denylist), applied before any detector runs and to the baseline
too. This is the answer to identifier noise on wide corpora: on a real 20k
journald capture, `point` flags ~10k mostly-meaningless outliers across
JOB_ID/PIDs/timestamps/counters; --exclude of those fields collapses it to a
couple hundred findings that matter, without touching detector config.

The scope is explicit, never heuristic — on-ethos with the project's "never
guess" rule, and avoids the obvious auto-skip footgun (dropping near-unique
columns would discard exactly the near-unique numeric measurements the marquee
detectors rely on: packet durationNanos, span durations, latencies). An unknown
column name on the primary corpus is a hard error (exit 2) so a typo can't
silently scope a scan to nothing and read as "clean"; the baseline is projected
leniently.

- ax-core: RecordSet::select / RecordSet::without projection primitives.
- anomalyx: --columns/--exclude parsing (mutually exclusive, non-empty),
  scope_columns applied in cmd_scan and cmd_explain, usage() updated.
- No envelope or config_version change — scope is an input-side projection,
  so the determinism contract is unchanged.
- Gates: proptest + cargo-mutants 0-missed on both changed files
  (ax-core record.rs 21/0; anomalyx main.rs 43/0).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@copyleftdev, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 4 minutes and 58 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f2aedc2b-dc34-42fb-a594-08aed0c3f695

📥 Commits

Reviewing files that changed from the base of the PR and between 70bab60 and 1eb96c1.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • CHANGELOG.md
  • Cargo.toml
  • README.md
  • crates/anomalyx/src/main.rs
  • crates/ax-core/src/record.rs
  • docs/src/modes.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/column-scope

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 and usage tips.

@copyleftdev
copyleftdev merged commit de47e51 into main May 31, 2026
2 checks passed
@copyleftdev
copyleftdev deleted the feat/column-scope branch May 31, 2026 23:52
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