Skip to content

feat: --set KEY=VALUE detector-config overrides (0.9.0)#60

Merged
copyleftdev merged 1 commit into
mainfrom
feat/config-set
Jun 1, 2026
Merged

feat: --set KEY=VALUE detector-config overrides (0.9.0)#60
copyleftdev merged 1 commit into
mainfrom
feat/config-set

Conversation

@copyleftdev

Copy link
Copy Markdown
Owner

What

scan / explain gain --set KEY=VALUE (repeatable) to override any DetectConfig field by name:

$ anomalyx scan --set point_threshold=4.0 --set dist_alpha=0.01 data.csv
$ anomalyx describe | jq .config     # the settable keys + their defaults

The settable keys are exactly what describe's config object reports. An unknown key, or a value that doesn't fit the field's type, is a hard error (exit 2).

Why / design

Five of the config knobs already had dedicated flags (--fdr, --cad-max-cv, --period, --cadence, --no-column-roles); the rest (point_threshold, dist_alpha, mv_alpha, struct_null_rate, the min_ns, …) were compile-time only. --set is the general escape hatch. Implemented as a JSON round-trip over the serialized DetectConfig, so every field is settable with zero per-field code, and value parsing follows each field's current JSON type.

Overrides flow into config_version (e.g. pt=3.5000pt=2.0000), so a tuned run is exactly as reproducible and self-describing as a default one — tuning is never silent. No envelope/PROTOCOL change.

Demo (127k-row parquet)

--set point_threshold= → point findings: 2.0 → 38,102 · 3.5 (default) → 32,893 · 10.0 → 18,432. Unknown key and point_min_n=4.5 both exit 2.

Gate

proptest + cargo-mutants 0 missed on main.rs (77 caught / 6 unviable) — including a test that exercises the string-field override branch (re-setting an already-set cadence_column). Goldens unaffected (they use defaults). CI green.

🤖 Generated with Claude Code

scan/explain gain --set KEY=VALUE (repeatable) to override any DetectConfig
field by name — point_threshold, dist_alpha, mv_alpha, struct_null_rate,
column_roles, etc. The settable keys + defaults are exactly describe's `config`
object. Implemented as a JSON round-trip over the serialized DetectConfig, so
every field is settable with zero per-field code.

Unknown key or type-mismatched value → hard error (exit 2). Overrides flow into
config_version (e.g. pt= changes), so a tuned run is as reproducible and
self-describing as a default one — tuning is never silent. Common knobs keep
their dedicated flags (--fdr/--cad-max-cv/--period/--cadence); --set is the
general escape hatch for the rest.

No envelope/PROTOCOL change. Gates: proptest + cargo-mutants 0-missed on main.rs
(77 caught/6 unviable), incl. a test exercising the string-field override branch.
Demo on the 127k parquet: --set point_threshold {2→38102, 3.5→32893, 10→18432}.

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

coderabbitai Bot commented Jun 1, 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 21 minutes and 29 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: 3bcef1be-3c55-4b9e-af58-a3ed68c9c139

📥 Commits

Reviewing files that changed from the base of the PR and between 47e3cb3 and 76e3c93.

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

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 d4a12f2 into main Jun 1, 2026
2 checks passed
@copyleftdev copyleftdev deleted the feat/config-set branch June 1, 2026 19:41
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