Skip to content

fix(spec): deduplicate derived completers - #1072

Merged
jdx merged 1 commit into
agent/unit-argsfrom
agent/dedupe-derived-completers
Aug 19, 2026
Merged

jdx merged 1 commit into
agent/unit-argsfrom
agent/dedupe-derived-completers

Conversation

@jdx

@jdx jdx commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Emits each identical built-in completion node only once per command. Multiple fields sharing a completion name and type (for example path-valued flags with value_name = "PATH") no longer produce repeated complete "path" nodes. Distinct names or types retain declaration order.

The parser and facade test suites pass, including a regression that parses both fields and asserts one emitted completer. PLAN now records this portion of the broader canonical-KDL gap as complete.

Stacked on #1071.


Note

Low Risk
Cold-path spec emission and tests only; parsing and binding behavior are unchanged.

Overview
Derived KDL emission now writes each identical built-in complete node only once per command. When several flags or arguments share the same completion name and type (for example two value_name = "PATH" fields with a path hint), write_completion_types tracks what was already emitted instead of repeating complete "path" type="path".

A facade regression test (CompletionDedup) parses both flags and asserts a single matching completer line in to_kdl(). PLAN.md records that this slice of the broader canonical-KDL work is done; full parse/serialize canonicalization is still open.

Reviewed by Cursor Bugbot for commit cda8d65. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: d8725d38-a338-43d6-97ab-3edfb7b16b76

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jdx
jdx force-pushed the agent/dedupe-derived-completers branch from bbd9312 to 4615168 Compare August 19, 2026 19:56
@jdx
jdx force-pushed the agent/dedupe-derived-completers branch from 4615168 to cda8d65 Compare August 19, 2026 21:16
@github-actions

Copy link
Copy Markdown
Contributor

Instruction counts

benchmark trend instructions Δ wall (min) Δ
markdown ▁█▇█▇▇▇▇▇ 198,757,447 → 198,508,246 -0.13% 18.56 → 18.93ms +2.00%
startup ▁████████ 1,214,963 → 1,214,976 +0.00% 1.36 → 1.46ms +7.62%

No instruction-count regression above 1%.

Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run.

Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.

Shadow comparison

Parsing mise use -g node@20 against a shadow of mise's committed spec.
Reported, not gated: the shadow grows as the derive learns to express more, so
what to watch is the ratio rather than either column.

framework instructions, cold parse vs usage
usage 4253
argh 6292 1.5x
clap 5893640 1385x
bpaf 21917948 5153x
                                              min       p01       p10    median
usage-rs: argv -> struct                      195       198       202       210  ns
argh: argv -> struct                          269       274       282       297  ns
clap: build tree + parse -> struct         481454    482899    489073    500192  ns
bpaf: build parser + parse -> struct      1644794   1644794   1654953   1682691  ns

usage: argv -> struct                             209 ns      0.21 µs
clap: build tree + parse -> struct             491458 ns    491.46 µs
clap: parse -> struct, tree reused              23599 ns     23.60 µs
clap: build tree only                          307962 ns    307.96 µs

cda8d65d4b65 vs 0b137759b66b · measured on the runner, not pushed to the history.

@jdx
jdx merged commit ad6963d into main Aug 19, 2026
10 of 16 checks passed
@jdx
jdx deleted the agent/dedupe-derived-completers branch August 19, 2026 23:51
jdx added a commit that referenced this pull request Aug 19, 2026
Documents `parse_from`/`parse_from_argv` as the explicit interception
point for applications that need work before rendering help or version
output, and the successful-value path for work before dispatch. This
confirms the existing API covers Aube’s customized version handling and
hk’s pre-dispatch re-exec without adding a hidden hook lifecycle.

Marks the corresponding PLAN gap complete. Stacked on #1072.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Documentation and planning updates only; no runtime or API changes in
this diff.
> 
> **Overview**
> **Documents** that post-parse behavior is intentionally
application-owned: `parse_from` / `parse_from_argv` return `Error::Help`
and `Error::Version` instead of exiting, and successful parses hand back
a value so embedders can run notifiers, customize version output, or
re-exec (e.g. hk `--cd`) before dispatch. The help guide now calls out
the `match` on those errors as the interception point and states there
is no hidden hook lifecycle—`parse()` stays the print-and-exit shortcut.
> 
> **PLAN** marks the “no home for post-parse hooks” gap **done**,
replacing the open question with the decided pattern.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
9ec5460. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant