Skip to content

Tests: cover the least-tested code (77% → toward 90%), and the bugs they found - #65

Closed
antonarnaudov wants to merge 6 commits into
mainfrom
test/coverage-90
Closed

antonarnaudov wants to merge 6 commits into
mainfrom
test/coverage-90

Conversation

@antonarnaudov

Copy link
Copy Markdown
Contributor

Raises line coverage by testing the least-covered code: the desktop main-process bridges (git, GitHub, AI, CLI, updater), the desktop renderer's UI and dialogs, the extension's graph, blame, views, status bar, rebase, history, PR and Changes surfaces, and git-service, engine, ai, merge-vscode, webview-ui, host-bridge and mcp.

How the tests are written

  • Real temp repositories with a local bare remote. GitHub, the AI providers and the Claude/Codex CLIs are faked, and nothing touches the network (the census guards still pass).
  • Every test asserts behaviour: the git state left behind, what a page is sent, and what the person is asked and told.
  • No fixed sleeps; timers are mocked.
  • Tests that need macOS tooling or POSIX shells are skipped where those aren't available.

Bugs the tests found, fixed here

  • Git: disposing a git that failed to spawn signalled pid 0, which is the whole process group, the extension host. It killed the test runner. Every kill now requires a real pid. The regression test fails by killing its runner, verified in an isolated process group.
  • Desktop AI: a chat cancelled just before its message went out wrote to an ended stdin, an uncaught 'error' in the main process.
  • Desktop AI: the settings started as a shallow copy of EMPTY_AI_SETTINGS, so the first added connection was pushed into the shared constant.
  • AI: an Azure base URL ending in / before ?api-version produced …//chat/completions.
  • Refs: annotated tags (most releases) had no date; the listing now reads %(creatordate).

Bugs found and not yet fixed stay marked test.todo/skip with the correct behaviour written down. They are being fixed in a follow-up PR.

The coverage number itself was wrong. A single c8 npm test over the monorepo merges V8's raw coverage by script URL, assuming every process ran the same code. A package's source is transpiled differently when an app's tests load it through the workspace link, so shared files were measured against the wrong text: host-bridge's scrubber showed 13% on Codecov while its own tests cover every line. scripts/test/coverage.mjs now runs c8 once per workspace and merges the hits line by line, the same way Codecov merges several reports. CI uses it on the Ubuntu leg.

🤖 Generated with Claude Code

antonarnaudov and others added 3 commits September 29, 2026 15:12
- Git: disposing a git that failed to spawn signalled pid 0, the whole
  process group, which is the extension host (it killed the test runner).
  Every kill now needs a real pid.
- Desktop: a chat cancelled just before its message went out wrote to the
  stdin it had just ended, an uncaught 'error' in the main process.
- Desktop: the AI settings started as a shallow copy of a shared constant,
  so the first connection added before any settings file existed was
  pushed into @gitstudio/ai's EMPTY_AI_SETTINGS.
- AI: an Azure base URL ending in "/" before its ?api-version query
  produced ".../gpt//chat/completions".
- Refs: annotated tags (most releases) came back with no date, because
  %(committerdate) is empty for a tag object; %(creatordate) is the
  commit's date for a commit and the tagger's for a tag.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…renderer

Tests written against real temp repositories, a local bare remote and fakes
for GitHub, the AI providers and the CLI — never the network. Every test
asserts behaviour: the git state left behind, what a page is sent, what the
person is asked and told. Bugs they found and that are not fixed yet are
marked test.todo / skip with the correct behaviour written down.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A single c8 run over the whole repo merges V8's raw coverage by script URL
and assumes every process ran the same code. A package's source is
transpiled once for its own tests and differently again when an app's tests
load it through the workspace link, so shared files were read against the
wrong text: host-bridge's scrubber reported 13% with every line tested.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Comment thread apps/desktop/test/ghFakeApi.ts Fixed
antonarnaudov and others added 3 commits September 29, 2026 19:33
…ct" too

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…n Windows

Killing git.exe left the ssh it had started running and holding the clone's
pipes, so the clone never reported that it ended — the test for it hung a
Windows CI runner for four hours. taskkill /T takes the tree. The test is
capped at 30s, and the desktop, extension and git-service suites now fail a
test after five minutes instead of waiting forever.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@antonarnaudov

Copy link
Copy Markdown
Contributor Author

Superseded by #66, which contains every commit here plus the fixes for the bugs these tests found; landing them together.

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.

2 participants