Repository navigation
[0.0.28] fix(cli): PowerShell operand completion, profile budget, Lua ledger fixtures - #2613
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Plugin candidate ledger and test setup crates/bitty-terminal/src/candidates.rs, crates/bitty-terminal/tests/cli_completion.rs |
Tests cover sorted, de-duplicated, capped plugin candidates; legacy TOML migration when the Lua ledger is absent; and malformed Lua ledger handling. The CLI test fixtures use Lua for managed state and TOML for legacy state. |
Profile-name scanning and listing crates/bitty-terminal/src/profile.rs |
Profile listing scans up to PROFILE_SCAN_CAP entries and returns at most PROFILE_LIST_CAP names. The truncation message reports both limits. A test checks that unrelated files do not prevent later profiles from being collected within the scan bound. |
Plugin and profile operand completion crates/bitty-terminal/src/completion.rs, crates/bitty-terminal/tests/fixtures/completion/powershell.txt, crates/bitty-terminal/tests/cli_completion.rs |
PowerShell completion checks plugin and profile operand paths before static grammar lookup. Tests cover plugin enable/disable and profile show/use/path operands, including Bash and PowerShell integration tests. The test harness isolates command state and writes shell-specific completion scripts. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Possibly related issues
- bitty-terminal/bitty#2449: The changes cover completion for
config profile show,use, andpath, and adjust profile-list scanning.
Possibly related PRs
- bitty-terminal/bitty#2600: This PR introduces the Lua plugin ledger and TOML migration behavior covered by the candidate tests and fixtures.
- bitty-terminal/bitty#2616: This PR reports a pre-existing failure in the plugin candidate union test that this PR updates and reports passing.
Suggested labels: bug, area:config
Merge Risk: 
Minimal · up to 1b9ef
-
No actionable merge-blocking issue remains in the reviewed changes; merge after normal checks.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 24.24% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 4 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Comment @coderabbitai help to get the list of available commands.
c4e0189 to
140662d
Compare
…ixtures (#2575) PowerShell now evaluates plugin/profile operand paths before the grammar-node lookup, so `plugin enable|disable` and `config profile show|use|path` return local candidates; a pwsh-driven integration test invokes the completion scriptblock against isolated XDG state. Bash gains the same functional operand test. `config profile list` scans the 1024-entry budget while capping output at 256 profiles, so unrelated files cannot hide profiles. Candidate fixtures now write the Lua bitty-plugins.lua ledger, with legacy-TOML fallback and malformed-Lua coverage.
140662d to
1b9eff6
Compare
Priority: P1 | Area: cli | Labels: fix,P1,area:cli,area:plugin | Milestone: v0.0.28 | RFC: OQ-017 | Task: CTX-1486
Follow-up to merged #2610 (
cd1ccc26). Refs #2575. Final head rebased ontomain7628cc64; duplicate changes already on main (candidatesLua fixture via #2614, CHANGELOG consolidation via #2617) were dropped.Defects fixed
Blocker: PowerShell operand completion was unreachable
$pathsonly carries grammar-node keys (plugin,config profile, ...), so the operand branches nested insideelseif ($paths.Contains($path))never ran forplugin enable|disableorconfig profile show|use|path.Fix: compute
$isOperandPathfrom the resolved path and evaluate the dynamic operand branches before the static lookup. Flags still fall through to the static path (empty for operand slots).Minor:
config profile listcounted unrelated files against the profile budgetrun_listpassedPROFILE_LIST_CAP(256) as both the entry limit and the name limit, so 300 unrelated files plus profiles could printstopped at 256 entriesand omit profiles. Fix: scan up toPROFILE_SCAN_CAP(1024) entries while capping emitted names atPROFILE_LIST_CAP.scan_nameswas split intocollect_namesso the entry/name limits are testable with a deterministic ordering.Tests
pwsh_completes_plugin_and_profile_operands_from_local_state: loads the generated PowerShell script (.ps1), invokes$global:_BittyCompletionScriptforplugin enable,plugin disable a,config profile show, andconfig profile path wover isolated XDG state, and asserts exact candidate text. The harness prints diagnostics to stderr (PATH,Get-Command bitty, raw helper output, per-case path/word/element count/results, exceptions) so a future CI failure is actionable. Skips locally whenpwshis absent; Windows/macOS/Linux CI all run it.bash_completes_plugin_and_profile_operands_from_local_state: sources the Bash script and calls_bitty_completewithCOMP_WORDSfor the same four contexts.candidates: bounded sorted/deduped state+store union, legacy TOML fallback (with the one-time migration), malformed Lua -> empty set (no legacy fallback). Main'swrite_stateLua-render fixture is kept unchanged.profile::tests::entry_budget_does_not_count_unrelated_files: 300 unrelated files before three profiles.$paths.Contains.Evidence (head
1b9eff66)cargo fmt --all -- --check— cleanRUSTFLAGS="-D warnings" cargo clippy -p bitty-terminal -p bitty-config --all-targets --locked— cleanRUSTFLAGS="-D warnings" cargo clippy -p bitty-terminal --features dev-tools --all-targets --locked— cleancargo test -p bitty-terminal --test cli_completion— 15 passed (local pwsh skipped:pwshunavailable; Bash functional test ran)cargo test -p bitty-terminal --bin bitty candidates— 21 passed (includesplugins_union_state_and_store_sorted)cargo test -p bitty-terminal --bin bitty profile::— 3 passedcargo test -p bitty-terminal --bin bitty— 1234+ passed on the prior base; rerun pieces above after the final rebase1b9eff66: 17 success, 0 failure, 2 skipped — Quality gates (1/2), Windows, macOS ARM64, Linux X11/Wayland + compat matrices, MSRV, CodeQL, supply chain, VM tier PR, extension pin drift, M1/compat aggregates all green.Earlier red-run evidence (fixed)
The first pwsh run returned four separators only. Diagnostics then showed correct paths/helpers:
Root causes fixed: the completion file was dot-sourced without a
.ps1extension; the expected string missed the leading case separator; Windows stdout is CRLF (now normalized before comparison).Notes
just ci-localremains blocked on this host by the act-runner Nix installer download through the proxy (DNS/HTTP2 failures); the equivalent Rust gates above were run locally. Remote CI is authoritative.