Skip to content

test(desktop): command registry covers the forge wrappers (#258) - #268

Merged
devlint merged 3 commits into
mainfrom
test/command-registry-forge-wrappers
Oct 14, 2026
Merged

devlint merged 3 commits into
mainfrom
test/command-registry-forge-wrappers

Conversation

@devlint

@devlint devlint commented Oct 14, 2026

Copy link
Copy Markdown
Owner

Fixes #258.

What

  • commandRegistry.test.ts scans every src/utils/backend*.ts (directory listing, not a fixed list) and fails if one of the 7 known wrapper files is missing from the scan. The stale-entry check now runs on all 305 invoked commands.
  • findDevServerRoutes also reads case "/api/…" labels, but only inside a url.pathname.startsWith("/api/…") dispatcher block and only when the label starts with that prefix (brace counting; limit documented in the code). This is what lets it see the 8 Gitea read routes; against the current dev-server.mjs it finds main's 186 routes plus exactly those 8.
  • commandRegistry.ts: 138 new entries.
file new commands route of which cliPathOnly desktop-only GAP:
backend-pr.ts 66 27 4 4 35
backend-gitlab.ts 30 2 0 0 28
backend-gitea.ts 21 8 0 0 13
backend-bitbucket.ts 21 0 0 0 21

Each route was taken from the wrapper's web branch and checked against the dev-server handler. cliPathOnly marks gh_merge_pr, gh_enable_auto_merge, gh_disable_auto_merge and pr_files: the route always runs gh, while Rust uses REST when a token is set. Desktop-only: the three keychain commands and open_url. The GitHub device-flow/token routes are mocks, noted in the file.

No new dev-server routes in this PR: the 97 GAP: entries (Azure, Bitbucket PRs, most GitLab MRs, Gitea beyond reads, some GitHub PR actions/reactions/auth) are now listed and measurable.

Found on the way (not fixed here, listed in ROADMAP › Later)

  • backend.ts invokes git_file_diff (getGitFileDiff, used by FileHistoryViewer.vue), but no Rust command by that name exists — that diff likely fails in the desktop app while working under dev:web. The registry can't catch it: it checks dev-server routes, not Rust registration.
  • On a fork, the dev-server /api/gh-pr-comment (create/update/delete) targets origin, and the update/delete web wrappers send no PR number, so dev:web QA of comment edits on forks isn't representative.

Tests

Registry tests 23/23, full desktop vitest green, vue-tsc clean.

The registry test scanned backend.ts, backend-core.ts and backend-ai.ts by
name, so the 138 commands only backend-pr.ts, backend-gitlab.ts,
backend-gitea.ts and backend-bitbucket.ts invoke had no entry. The test now
lists every src/utils/backend*.ts.

findDevServerRoutes also reads case labels: the Gitea read routes live in
the /api/gitea- prefix dispatcher as case "/api/gitea-..." and were
invisible to the url.pathname === scan.

New entries: 37 with a route (4 marked cliPathOnly), 4 desktop-only
(keychain credentials, open_url), 97 GAPs.
…reach it (#258)

findDevServerRoutes accepted any case "/api/..." label as a served route.
It now collects the url.pathname.startsWith("/api/...") dispatchers and
accepts a label only inside that dispatcher's block and under its prefix.

ROADMAP: follow-ups from #258 (gh-pr-comment on forks under dev:web, the
97 forge GAPs, git_file_diff missing from Rust).
@devlint
devlint merged commit 3b0d4ef into main Oct 14, 2026
9 checks passed
@devlint
devlint deleted the test/command-registry-forge-wrappers branch October 14, 2026 12:49
devlint added a commit that referenced this pull request Oct 14, 2026
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.

commandRegistry test does not scan the forge backend wrappers

1 participant