Port Fig generators to Rust - #391
Conversation
|
This PR was generated with Warp. Comment |
|
@warp-factory /review |
|
Merged by @acarl005 — closing out. The factory's last posted verdict was changes-requested on One item to carry forward: Responding as Warp for OSS: Open session · View run |
There was a problem hiding this comment.
Overview
This replaces the ignored Fig JavaScript generators/generateSpec fields with Rust-backed generatorName registrations, removing all 963 such JSON keys. Requesting changes: the shared parser converts structured command output into invalid completion values, and the new generators ship without the verification evidence this repository requires.
Concerns
fig_parse::linesemits one suggestion per trimmed line, but it is wired to 137 registrations whose removedpostProcessfunctions extracted arguments from JSON or structured text.amplify env list --json,ansible-doc --list --json, andcargo read-manifestwill now offer raw JSON fragments as completion values. Parse per output format and add representative output fixtures for each migrated contract.- The same parser is applied to
git log --oneline,git status --short, andgit branch, all of which emit decorated lines rather than bare values, so the inserted text is not a valid ref or path. These need the format-aware handling noted inline. - No completion-dropdown evidence accompanies 137 new registrations across 90 generator modules. Repository guidance requires a real Warp screenshot showing generated entries for every new or modified generator; please add that before merge.
- Review coverage: correctness carries the blocking findings above; standards could not be verified locally because no Rust toolchain is available in this environment, though CI is green; complexity and comments were examined with no material concern; naming has the inline nit; tests do not cover the newly introduced parsers; security was examined with no applicable finding.
Verdict
Checks: build unverified (cargo unavailable), tests unverified (cargo unavailable), CI green (8/8), visual proof missing
Found: 0 critical, 3 important, 0 suggestions, 1 nit
Recommendation: request changes
Responding as Warp for OSS: Open session · View run
| output | ||
| .lines() | ||
| .map(str::trim) | ||
| .filter(|line| !line.is_empty()) |
There was a problem hiding this comment.
postProcess functions it replaces extracted arguments out of JSON or structured output. amplify env list --json, ansible-doc --list --json, and cargo read-manifest will now surface raw JSON fragments instead of completion values. Parse per output format and add representative output fixtures for each migrated contract.
| .add_generator( | ||
| "branches", | ||
| Generator::script( | ||
| CommandBuilder::single_command("git --no-optional-locks branch --no-color --sort=-committerdate"), |
There was a problem hiding this comment.
git branch marks the checked-out branch with a leading * , so this parser suggests * my-branch rather than the valid ref my-branch. This module already has post_process_branches (git.rs:468), which strips the marker and preserves current-branch semantics — reuse it here. The log, status, and tag generators added just below have the same problem: --oneline, --short, and decorated tag output are not bare values.
| fig_parse::lines, | ||
| ), | ||
| ) | ||
| .add_generator( |
There was a problem hiding this comment.
🧹 [NIT] unknow_dev_null_possible neither describes the values being completed nor spells unknown correctly, which makes the JSON-to-Rust wiring hard to audit. Rename these script-derived identifiers to semantic names such as paging_values, decorations_values, color_values, and wrap_values.
e950930 to
890bd8b
Compare
Superseded by a new review pass at 890bd8b
There was a problem hiding this comment.
Overview
This revision ports the ignored Fig generators fields to Rust generatorName registrations, collapses duplicate script generators, and restores the original generateSpec JSON (15 keys across 13 specs) as unimplemented. Requesting changes: the shared line parser still hands decorated and structured command output to the completion menu as literal values.
Concerns
fig_parse::linessplits raw output on newlines and is the parser for all 137 migrated registrations, including ones whose removedpostProcessextracted values out of JSON.amplify env list --json,ansible-doc --list --json, andcargo read-manifestwill offer JSON fragments where environment, plugin, and binary names belong. See the inline findings for representative paths.- On the stacked-PR split: the description places structured
postProcessparsers on a follow-up PR, which is a reasonable way to divide the work, but the regression ships with this change. Once this merges, those 137 call sites execute and return unusable values until the follow-up lands. Either hold the affected registrations until their parsers exist, or land the two together. - This revision drops the unit tests the PR had added, and the remaining registry test only asserts that a generator name resolves — it never exercises parser output. Add table-driven fixtures per output contract, covering
git branch,git log --oneline,git status --short, and malformed JSON. - The PR body contains no images. Repository guidance requires a real Warp completion dropdown showing generator-produced candidates for every new or modified generator; please add that evidence before merge.
- Review coverage: correctness carries the blocking findings above; standards are unverified locally because no Rust toolchain is available in this environment, though CI is green; complexity and comments were examined with no material concern; naming has the inline nit; security was examined with no applicable finding, as there are no dependency or CI changes and the restored JSON fields are inert.
Verdict
Checks: build unverified (cargo unavailable), tests unverified (cargo unavailable), CI green (8/8), visual proof missing
Found: 0 critical, 4 important, 0 suggestions, 1 nit
Recommendation: request changes
Responding as Warp for OSS: Open session · View run
| output | ||
| .lines() | ||
| .map(str::trim) | ||
| .filter(|line| !line.is_empty()) |
There was a problem hiding this comment.
postProcess functions it replaces extracted command arguments out of JSON or structured output. amplify env list --json, ansible-doc --list --json, and cargo read-manifest will now offer JSON fragments instead of environment, plugin, or binary names. Use a parser per output contract and add representative fixtures for each.
| "branches", | ||
| Generator::script( | ||
| CommandBuilder::single_command("git --no-optional-locks branch --no-color --sort=-committerdate"), | ||
| fig_parse::lines, |
There was a problem hiding this comment.
git branch prints the checked-out branch as * <branch>, so this parser suggests an invalid ref; branches_no, log --oneline, and status --short just below likewise expose decorated records verbatim. This module already has post_process_branches (git.rs:468) for the branch case — reuse it for both branch generators, and add parsers that extract the commit hash and the status path before suggesting them.
| ), | ||
| ) | ||
| .add_generator( | ||
| "unknow_dev_null_possible", |
There was a problem hiding this comment.
🧹 [NIT] unknow_dev_null_possible neither describes the values being completed nor spells unknown correctly, which makes the JSON-to-Rust wiring hard to audit. Rename these script-derived identifiers to semantic names such as paging_values, decorations_values, color_values, and wrap_values.
Replace ignored argument-level generators with generatorName/template wiring and register script-backed completions through shared line parsers. Remove generateSpec after materializing the static python manage.py case. Custom JS generators without a script fall back to filepaths templates.
Keep source JSON byte-stable except surgical generators/generateSpec edits so Unicode and escaping are unchanged. Replace hashed fig_* names with semantic generator names and split the dump module into per-command generator files.
Collapse identical command+script registrations, including amplify env_list, and reuse existing parsers when the script already has one. Register each command in a single CommandSignatureGenerators value. Drop DynamicCompletionData::extend, the extra merge path, numeric-suffix names, and the unit tests this PR added.
Put generateSpec back on the specs that had it, without implementing dynamic command trees.
890bd8b to
9f81e91
Compare
## Description Bump `warp-command-signatures` (and the locked `warp-completion-metadata` from the same git source) from `6a39d62048abbf3885be54a7887f1916ebcf7445` to `d69b340ef622540ac28340ef565dae45287d51d8`. That revision includes [command-signatures#391](warpdotdev/command-signatures#391) and [command-signatures#392](warpdotdev/command-signatures#392) (Rust Fig generators and template filters). Lockfile sources for both packages were updated to the same rev. Unrelated `cargo update` resolution churn was not included. ## Linked Issue - [APP-5776](https://linear.app/warpdotdev/issue/APP-5776/port-fig-javascript-argument-generators-and-template-filters-to-rust) ## Testing Verification was not run, at the requester’s direction. - [ ] I have manually tested my changes locally with `./script/run` ## Agent Mode - [ ] Warp Agent Mode - This PR was created via Warp's AI Agent Mode CHANGELOG-NONE <!-- warp:pr-description-artifacts start --> <!-- warp:pr-description-artifacts end --> Co-authored-by: warp-agent-staging[bot] <240773466+warp-agent-staging[bot]@users.noreply.github.com>



Summary
Port ignored Fig
generatorsto supportedgeneratorNamewiring (APP-5776). Identical command+script generators share one name and oneCommandSignatureGeneratorsvalue. OriginalgenerateSpecJSON is restored from main and left unimplemented.Changes
env_listis one registrationfig_<hash>DynamicCompletionData::extendgenerateSpecfields on 13 specs (15 occurrences)Verification
cargo test: 176 + 10 passedcargo fmt --check,cargo clippy ... -D warnings,npm run format:check: passedOut of scope
Structured
postProcessparsers, token-aware custom generators, and template filters land on the stacked PR above this one.