fix(cli): address 5 review findings from PR #234 — legacy flag normalization gaps, hidden alias, robust JSON parsing, portable workspace root#4
Merged
Rahul-2k4 merged 2 commits intofeature/cli-production-smoke-examplefrom Feb 22, 2026
Conversation
Copilot
AI
changed the title
[WIP] Review pull request for implementation verification
review: analyze mofa-org/mofa#234 CLI production smoke PR and document findings
Feb 22, 2026
- normalize_legacy_output_flags: support --output=json equals-sign form (Fix 1) - normalize_legacy_output_flags: add session subcommand awareness so session list -o json normalizes while show/export preserve their local -o (Fix 2) - cli.rs session show --format: use hidden short_alias instead of visible_short_alias (Fix 3) - extract_json_payload: use serde_json streaming Deserializer to tolerate trailing text (Fix 4) - workspace_root(): scan upward for outermost [workspace] Cargo.toml; add MOFA_WORKSPACE_ROOT override (Fix 5) - Extract is_output_format_value() helper to deduplicate format-value matching - Add 9 new unit tests for the normalize fixes" Co-authored-by: Rahul-2k4 <216878448+Rahul-2k4@users.noreply.github.com>
Copilot
AI
changed the title
review: analyze mofa-org/mofa#234 CLI production smoke PR and document findings
fix(cli): address 5 review findings from PR #234 — legacy flag normalization gaps, hidden alias, robust JSON parsing, portable workspace root
Feb 22, 2026
3164e36
into
feature/cli-production-smoke-example
5 checks passed
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.
Five issues identified in the review of PR mofa-org#234 — two blocking regressions in
normalize_legacy_output_flagsplus three minor robustness gaps.📋 Summary
Fixes two silent breakages in the legacy output-flag normalizer (
--output=jsonequals form never rewritten;mofa session list -o jsonnever normalized), plus three minor improvements to CLI alias visibility, JSON payload parsing, and workspace-root detection.🔗 Related Issues
Related to #
🧠 Context
normalize_legacy_output_flagswas introduced in PR mofa-org#234 to rewrite-o/--output→--output-formatfor backward compat. Two cases were missed:--output=json) — clap receives it as-is;output_legacyisglobal = false, so clap errors with no helpful message.session list—sessionwas excluded fromallows_global_after_commandentirely (intentional forshow/exportwhich own a local-o), but that exclusion silently brokesession list -o json, which has no local-oflag.🛠️ Changes
main.rs): the normalizer now rewrites--output=json/-o=json(single-token) in addition to the space-separated form, with the same positional and subcommand guards.session list(main.rs): replaced the flat booleanallows_global_after_commandforsessionwith subcommand-aware logic —showandexportstill skip normalization;listand any future session subcommands without a local-oare normalized.cli.rs):visible_short_alias = 'o'onsession show --formatchanged toshort_alias = 'o'(hidden);-ostill works, only-fappears in--help.lib.rs):extract_json_payloadnow usesserde_json::Deserializer::from_str(...).into_iter()to consume exactly one JSON value, tolerating trailing text or newlines thatfrom_strrejects.workspace_root()(lib.rs): replacesancestors().nth(2)with an upward scan for the outermostCargo.tomlline-matching[workspace]; addsMOFA_WORKSPACE_ROOTenv override; original depth used as fallback.is_output_format_value(s)helper to deduplicate the"text" | "json" | "table"pattern that appeared twice in the normalizer.🧪 How you Tested
cargo test -p mofa-cli— 59 unit + 4 integration tests pass (9 new tests added for fixes 1 & 2).cargo clippy -p mofa-cli --no-deps -- -D warnings— zero warnings.cargo check --manifest-path examples/Cargo.toml -p cli_production_smoke— compiles clean.📸 Screenshots / Logs (if applicable)
New tests exercising the fixes:
🧹 Checklist
Code Quality
cargo fmtruncargo clippypasses without warningsTesting
cargo testpasses locally without any errorDocumentation
PR Hygiene
main🧩 Additional Notes for Reviewers
args[cmd_idx + 1]and skips it if it starts with-, so flag-before-subcommand patterns (mofa session --verbose list -o json) are handled correctly.[workspace]line-level match (line.trim() == "[workspace]") avoids false positives fromworkspace = truemember entries and comments; no new dependencies required.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
cdn.pyke.io/home/REDACTED/work/mofa/.codeql-scratch/dbs/rust/working/target/debug/build/ort-sys-e05be62975cad138/build-script-build /home/REDACTED/work/mofa/.codeql-scratch/dbs/rust/working/target/debug/build/ort-sys-e05be62975cad138/build-script-build ebug/build/eyre--Wl,--version-script=/tmp/rustcYHTyQv/list ebug/build/eyre--Wl,--no-undefined-version cc 72c9��(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.