Skip to content

♻️ Extract the adapters' decisions into tested, vscode-free modules - #24

Merged
mkarlesky merged 2 commits into
next_versionfrom
refactor/adapter-extraction
Oct 23, 2026
Merged

mkarlesky merged 2 commits into
next_versionfrom
refactor/adapter-extraction

Conversation

@mkarlesky

Copy link
Copy Markdown
Member

Fourth PR in the lint-and-coverage series, stacked on #23. It moves the decisions inside the VS Code adapters into pure modules that unit tests reach, and leaves the adapters as wiring. Fake-Ceedling integration tests for the wiring itself follow in the next PR.

New modules

Module Taken from Covers
testReporting.ts testController.makeReporter Resolving ids to items; dropping results for unknown ids (with a warning) and excluded items; gdb log links resolved against the project directory; failure and error locations. Messages are plain data for a RunSink, and the controller builds TestMessages from them.
debugLaunch.ts testController.handleDebug, resolveLaunchConfig Which file a debug request debugs, and whether it named several; the launch configuration with the executable's path spliced in.
watchPolicy.ts testController What a settings change does (rediscover, clear diagnostics); what a source file event does (reparse, rediscover, nothing); watcher reconciliation; the edit-reparse Debouncer.
diagnosticsStore.ts ProblemMatcher Each run scope's diagnostics by id, shown by file without duplicates. ProblemMatcher now only publishes the store to its DiagnosticCollection.
controllerLabel in testModel.ts main.labelFor The Testing view's name for a folder's tests.

Fix

The launch configuration splice now replaces within string values rather than in serialized JSON. A test written first showed the problem:

  • A " in the executable's path made JSON.parse throw, so debugging failed with only a logged error.
  • A \ would have been read as a JSON escape.

Real paths rarely contain either, since the subpath is built from Ceedling's file list split on separators, but the fix costs nothing.

Coverage

Before (#23) After
All files, statements 72.9% 76.0%
All files, branches 96.9% 97.2%
testController.ts statements (still untested by units) 521 489
problemMatcher.ts statements (still untested by units) 132 117

The five new modules are at 100% statements and branches. That covers 36 new unit tests, for 347 in all, plus 4 integration tests. Lint reports 0 findings.

Docs

docs/Development.md:

  • The module table gains the new modules, and says that an adapter's decisions belong in a pure module.
  • "Staying current", "Reporting" and "Debugging" name the functions that now make each decision.

No CHANGELOG entry: the splice fix has no realistic user-facing trigger.

🤖 Generated with Claude Code

mkarlesky and others added 2 commits October 23, 2026 14:33
The VS Code adapters had logic that no unit test could reach. It now lives in modules that
plain Node tests cover, and the adapters only wire it to the editor:
- testReporting.ts: a reporter's id lookup, dropped and excluded results, gdb log links, and
  failure and error locations, as plain messages for a RunSink.
- debugLaunch.ts: which file a debug request debugs, and the launch configuration with the
  executable's path spliced in.
- watchPolicy.ts: what settings changes and source file events do, watcher reconciliation, and
  the edit-reparse Debouncer.
- diagnosticsStore.ts: each run's diagnostics by id, shown by file without duplicates.
- testModel.ts: controllerLabel, the Testing view's name for a folder's tests.

The launch configuration splice now replaces within string values rather than in serialized
JSON. A quote in the executable's path made the JSON unparseable, and a backslash would have
been read as an escape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Development.md's module table gains testReporting, debugLaunch, watchPolicy, and
diagnosticsStore, and says where an adapter's decisions belong. Staying current, Reporting,
and Debugging name the functions that now make each decision, and the coverage notes say why
the adapters still show 0%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mkarlesky
mkarlesky changed the base branch from perf/async-coverage to next_version October 23, 2026 19:21
@mkarlesky
mkarlesky merged commit 571ae33 into next_version Oct 23, 2026
3 checks passed
@mkarlesky
mkarlesky deleted the refactor/adapter-extraction branch October 23, 2026 19:21
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