fix(cli): add --limit to the enhance command across all three layers#80
Closed
gadievron wants to merge 1 commit into
Closed
fix(cli): add --limit to the enhance command across all three layers#80gadievron wants to merge 1 commit into
gadievron wants to merge 1 commit into
Conversation
The `enhance` command lacked a `--limit` (max-units) capability while its siblings `analyze` and `scan` have it, so a user could not cost-limit or test-run enhancement on N units -- enhance always processed the full dataset. The gap spanned all three layers (a Go-only patch would be inert: the Python CLI rejected --limit and the core could not consume it): - Go (apps/openant-cli/cmd/enhance.go): add a --limit flag (default 0 = no limit) and forward it to the Python args when > 0, mirroring analyze.go. - Python CLI (libs/openant-core/openant/cli.py): add --limit to the enhance subparser and pass limit=args.limit into enhance_dataset, mirroring analyze. - Core (libs/openant-core/core/enhancer.py): add a `limit` parameter to enhance_dataset and slice dataset["units"] to units[:limit] before enhancement, mirroring analyzer.py (limit + units[:limit]). Slicing dataset["units"] (not only the local list) is what makes the limit reach both the agentic and single-shot enhancement paths. Scope: analyze.go / analyze_p / analyzer.py already have --limit (the parity baseline, unchanged here); verify/report/etc. do not enhance units, so they are out of scope. Tests: - libs/openant-core/tests/test_enhance_limit.py: with the LLM stubbed, enhance_dataset(limit=2) on a 5-unit dataset makes the enhancer RECEIVE exactly 2 units (asserting on what the enhancer receives guards the load-bearing dataset["units"] slice -- verified by a mutant: dropping that line makes the enhancer see all 5 and the test fail); and `enhance ... --limit 3` driven through cli.main() forwards limit=3 to enhance_dataset (covers the enhance_p parser + cmd_enhance glue). - apps/openant-cli/cmd/enhance_limit_test.go: enhanceCmd exposes a --limit flag (default 0). RED (pre-fix, via stash): Python "unrecognized arguments: --limit" + Go "missing --limit flag" -> GREEN. Full py suite 178 passed / 63 skipped; go test ./cmd/ ok; ruff + gofmt + go vet clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
gadievron
requested review from
ar7casper,
dgeyshis,
shahar-davidson,
sounil and
yotamleo
as code owners
May 28, 2026 23:53
ar7casper
added a commit
that referenced
this pull request
Jun 22, 2026
These PRs predated #69's llm-provider refactor and were never rebased, so their tests referenced removed APIs (AnthropicClient, ContextEnhancer(client=)) and #69's new registry credential probe. Updated test construction/mocking to the post-#69 API only; no assertions changed, no production code touched. Full suite: 729 passed, 0 failed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Closing as already resolved on current master. This fix's behavior shipped via the parser-fix-stack release (#133/#134); confirmed by independent reproduction — the original bug (reconstructed from its bug-pipeline investigation) no longer manifests on master, not merely by line-presence. Part of a full validated sweep of the open-PR corpus. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
enhancecommand lacked a--limit(max-units) capability while its siblingsanalyzeandscanhave it, so a user could not cost-limit or test-run enhancement on N units -- enhance always processed the
full dataset. The gap spanned all three layers (a Go-only patch would be inert: the Python CLI rejected
--limit and the core could not consume it):
Python args when > 0, mirroring analyze.go.
limit=args.limit into enhance_dataset, mirroring analyze.
limitparameter to enhance_dataset and slicedataset["units"] to units[:limit] before enhancement, mirroring analyzer.py (limit + units[:limit]).
Slicing dataset["units"] (not only the local list) is what makes the limit reach both the agentic and
single-shot enhancement paths.
Scope: analyze.go / analyze_p / analyzer.py already have --limit (the parity baseline, unchanged here);
verify/report/etc. do not enhance units, so they are out of scope.
Tests:
5-unit dataset makes the enhancer RECEIVE exactly 2 units (asserting on what the enhancer receives guards
the load-bearing dataset["units"] slice -- verified by a mutant: dropping that line makes the enhancer
see all 5 and the test fail); and
enhance ... --limit 3driven through cli.main() forwards limit=3 toenhance_dataset (covers the enhance_p parser + cmd_enhance glue).
RED (pre-fix, via stash): Python "unrecognized arguments: --limit" + Go "missing --limit flag" -> GREEN.
Full py suite 178 passed / 63 skipped; go test ./cmd/ ok; ruff + gofmt + go vet clean.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com