Repository navigation
REF: trial focused benchmark and approval deduplication - #98
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain, and the focused deduplication is supported by targeted regression coverage spanning pricing, rendering, lifecycle cleanup, and preference retention.
No open issues 🎉
What changed in this PR
This PR performs focused deduplication across benchmark cost accounting, monitor button rendering, and benchmark presentation resets while preserving existing behavior. It also adds regression coverage for pricing, rendering geometry, lifecycle state, and preference retention.
Changes:
- Shares API-equivalent cost calculation between built-in benchmarks and DigBench while retaining distinct tool policies.
- Reuses positioned-button row rendering for approval and profile controls.
- Centralizes transient benchmark presentation resets for run start and result clearing.
- Adds targeted regression tests for pricing, telemetry edge cases, UI rendering, and state cleanup.
| File | Summary |
|---|---|
internal/ui/monitor_profile.go |
Reuses shared button-row rendering for profile controls. |
internal/ui/monitor_buttons_test.go |
Verifies button positioning, widths, renderers, themes, and terminal widths. |
internal/ui/monitor_approval.go |
Provides shared positioned monitor button row assembly. |
internal/ui/model.go |
Centralizes transient benchmark presentation resets. |
internal/ui/benchmark_reset_test.go |
Verifies reset cleanup while retaining preferences and lifecycle state. |
internal/codex/digbench.go |
Reuses shared cost calculation for DigBench results. |
internal/codex/benchmark.go |
Adds shared benchmark measurement cost calculation while preserving tool restrictions. |
internal/codex/benchmark_measurements_test.go |
Tests pricing parity, telemetry handling, and distinct tool policies. |
Review effort: Lite
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.
Why
Trial a small, behaviour-preserving cleanup based on the new jscpd report, and exercise the main-owned duplication ratchet on a real application PR. Keep the scope deliberately limited to three well-understood repeated implementations rather than pursuing every normalised match.
Changes
No changes to rollout-log scanning, DigBench interruption/cleanup, pricing data, UI design, commands, dependencies, version, duplication tooling or baseline. The local released binary is not replaced.
Duplication measurements
Same pinned scanner/policy, comparing this branch with main at
36655ec. Every gated metric is equal or lower; no new production clone candidates are reported.Maintained production Go is 28 lines smaller. Add 206 lines of regression tests, with no existing tests removed or weakened. These are modest reuse/correctness-maintenance improvements, not a claim of dramatic binary-size or runtime-performance savings. Scanner duplicated-line spans overlap and are not unique removable LOC. Test duplication remains report-only.
Validation
go test -race -cover -timeout 10m -skip '^TestLocalisedScreens$' ./....go vet ./...andgo build -trimpath ./...pass.make screenshots-check: all seven existing TUI screenshot fixtures are unchanged for v0.27.2.CI retains the complete 17-locale matrix and Linux/macOS/Windows coverage; it is not removed or skipped in the workflow.