Skip to content

bench: add commander, the first JavaScript target, and record its baseline - #74

Merged
Rinkia merged 1 commit into
masterfrom
bench/typescript-target
Jul 23, 2026
Merged

Rinkia merged 1 commit into
masterfrom
bench/typescript-target

Conversation

@Rinkia

@Rinkia Rinkia commented Jul 23, 2026

Copy link
Copy Markdown
Owner

What

Closes #63. The five existing targets are Python, so the ranking had never been measured on a second language. commander 14.0.2 asks that question — and the answer is recorded, not tuned away.

Target Candidates Labels Rank of each label recall@10
commander 14.0.2 25 2 11, 15 0/2

Aggregate 9/20 → 9/22. Both labelled seams land just outside the top ten.

The finding

TypeScript interface declarations are scored as abstract classes. The front-end treats an interface as "a pure contract to implement" — reasonable in the abstract, wrong in practice. commander's top eight are ParseOptions, HelpContext, OutputConfiguration, AddHelpTextContext and friends — option bags from typings/index.d.ts — each at 0.70 with "meant to be subclassed", while the two classes the documentation actually tells you to subclass score 0.10.

Deliberately not fixed here. Changing it is a ranking change, judged against a baseline in its own PR. Fixing it in the same change that introduces the labels is exactly the circularity the gate on this directory exists to prevent — so this PR touches no front-end and no weights, and the gate passes on its own terms.

Labels, from commander's own Readme

  • commander/lib/help:Help — "or by subclassing Help using .createHelp()". Subclassing named outright.
  • commander/lib/command:Command — "you may override it to customise the new subcommand".

Option and Argument are deliberately not labelled: the docs present them as things you construct explicitly, which is calling, not extending — and the labelling rule excludes "merely calls".

Scorer changes

  • "language" field per target; JS/TS resolve under benchmarks/js/node_modules, version read from the package's own package.json, skipped with a notice on a version mismatch.
  • Ids are target-qualified path form (commander/lib/help:Help), keeping the "an id belongs to its target" invariant the label self-check enforces — I hit that assertion and fixed the id form rather than weakening the test.
  • package.json + lockfile committed; node_modules gitignored and confirmed not staged.

Test plan

  • tests/test_benchmark_labels.py passes (ids belong to their target, justifications present).
  • Suite 25/25.
  • benchmark-labels-untouched gate: this PR changes labels but no ranking/front-end code.
  • Python targets unchanged: click 4/4, pluggy 3/3, sqlalchemy 1/5, pygments 0/5, marshmallow 1/3.

Next, separately: judge interface → abstract against this baseline.

🤖 Generated with Claude Code

…eline

Closes #63. The five existing targets are Python, so the ranking had never been
measured on a second language. commander 14.0.2 asks that question, and the
answer is recorded rather than tuned away: 0/2, both labelled seams at ranks 11
and 15, aggregate 9/20 -> 9/22.

What sits above them is the finding. TypeScript interface declarations are
scored as abstract classes - the front-end treats an interface as a pure
contract to implement, which is reasonable in the abstract and wrong in
practice. commander's top eight are ParseOptions, HelpContext,
OutputConfiguration and friends, option bags from typings/index.d.ts, each
scoring 0.70 with "meant to be subclassed", while the two classes the
documentation actually tells you to subclass score 0.10.

That is left alone here on purpose. Changing it is a ranking change, and a
ranking change is judged against a baseline in its own pull request - fixing it
in the same change that introduces the labels is precisely the circularity the
gate on this directory exists to prevent. This commit therefore touches no
front-end and no weights.

Labels come from commander's own Readme: Help is named as subclassable ("or by
subclassing Help using .createHelp()"), and createCommand is presented as an
override point ("you may override it to customise the new subcommand").
Option and Argument are deliberately NOT labelled - the docs present them as
things you construct explicitly, which is calling, not extending.

The scorer gains a "language" field per target: JS/TS targets resolve under
benchmarks/js/node_modules, take their version from the package's own
package.json, and are skipped with a notice when the installed version is not
the pinned one. Ids are target-qualified path form (commander/lib/help:Help),
keeping the "an id belongs to its target" invariant the label self-check
enforces. package.json and the lockfile are committed; node_modules is not.

Suite 25/25.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

MODScan attack-surface diff — modscan

No new execution sinks

New attack surface to review — NOT a vulnerability verdict. This compares enumerated execution sinks between two snapshots. It does not trace whether input reaches them (no taint analysis), match CVEs, or detect secrets. An empty diff means no new catalogued sinks — not that the change is safe.

The two snapshots enumerate the same execution sinks.

@github-actions

Copy link
Copy Markdown

MODScan extension-point diff

No breaking changes to extension points

@Rinkia
Rinkia merged commit 520a06d into master Jul 23, 2026
7 checks passed
@Rinkia
Rinkia deleted the bench/typescript-target branch July 23, 2026 14:57
Rinkia added a commit that referenced this pull request Jul 23, 2026
Judged against the commander baseline recorded in #74. Two candidate fixes were
swept before either was written, and they turned out identical:

  variant                              commander        aggregate
  baseline                             0/2 (11, 15)     9/22
  B  interface no longer abstract      2/2 (3, 7)       11/22
  C  skip *.d.ts                       2/2 (3, 7)       11/22
  D  both                              2/2 (3, 7)       11/22

That they are identical is itself the finding: both describe the same
phenomenon, and combining them adds nothing.

C is adopted, because B is right about commander for the wrong reason. A
hand-written TypeScript interface genuinely is a contract to implement - the
front-end's own fixture has RenderPlugin, and B would demote it. What was
actually wrong was reading a declaration file at all. A .d.ts declares types for
code defined elsewhere, so commander's Command and Help were each counted twice,
and option bags existing only as declarations (ParseOptions, HelpContext,
OutputConfiguration) became candidates and outranked the classes the
documentation tells you to subclass.

Skipping declaration files also matches the rule the labels already follow: a
seam is recorded where it is defined, in the module holding the class statement.

commander's candidates drop 25 -> 11 as the phantom copies disappear, its median
rank goes 13 -> 5, and no Python target moves: click stays 4/4, pluggy 3/3.
Aggregate 9/22 -> 11/22.

This changes ranking behaviour, so per the gate on benchmarks/ it deliberately
carries no label change. Suite 25/25.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@Rinkia Rinkia mentioned this pull request Jul 23, 2026
3 of 5 tasks
Rinkia added a commit that referenced this pull request Jul 23, 2026
Bump to 0.1.7 and move the [Unreleased] entries under [0.1.7]. Ships the Java
front-end, the security lens over MCP and for TypeScript/JavaScript, the process
sinks the Bandit cross-check exposed, and two TypeScript front-end fixes.

Also adds the two CHANGELOG entries that were missing: recognising CommonJS
exports (#73) and no longer scanning .d.ts declaration files (#76). Both change
what `--language typescript` returns, so both belong in a user-facing changelog.
The cross-check harnesses (#70, #72) and benchmark targets (#74, #78) stay out:
they are repository artifacts, not shipped in the wheel.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.

Add a TypeScript moddability benchmark target (test cross-language ranking)

1 participant