diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-16 10:29:50 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-16 10:29:50 -0500 |
| commit | faf716de7ad4b69486e42de591588d8b750bbdb9 (patch) | |
| tree | f8de513fd719f048cfea54cb320778e8eceacdfc /docs/design | |
| parent | c00167c64cbce7f67e2924a51a236c26d7f8d8f4 (diff) | |
| download | dotemacs-faf716de7ad4b69486e42de591588d8b750bbdb9.tar.gz dotemacs-faf716de7ad4b69486e42de591588d8b750bbdb9.zip | |
fix(coverage): include gptel-tools in instrumentation glob
Undercover now instruments gptel-tools/*.el alongside modules/*.el,
so the new git_status / git_log / git_diff / web_fetch tools (and
their successors) report coverage instead of reading as zero.
The matching pre-coverage clean step deletes gptel-tools/*.elc so
stale byte-compiled artifacts don't shadow the .el sources. If
Emacs loads the .elc first, undercover's source instrumentation
never runs.
docs/design/coverage.org gains an Elisp-coverage-producer subsection
documenting the glob, the :merge-report dependence (SimpleCov merges
cross-process reports, LCOV does not), and the missing-artifact
failure mode.
Diffstat (limited to 'docs/design')
| -rw-r--r-- | docs/design/coverage.org | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/docs/design/coverage.org b/docs/design/coverage.org index b5083f66..acd8b4c4 100644 --- a/docs/design/coverage.org +++ b/docs/design/coverage.org @@ -66,6 +66,37 @@ Three files: =init.el= requires the core and the active backends. +*** Elisp coverage producer + +For the Elisp backend, =make coverage= is the only supported producer of the +coverage artifact. It removes stale compiled files for instrumented sources, +then runs each unit test file in its own batch Emacs process. Before loading +the test file, the Makefile loads =tests/run-coverage-file.el=, which +initializes packages and configures Undercover: + +#+begin_src emacs-lisp +(undercover "modules/*.el" + "gptel-tools/*.el" + (:report-format 'simplecov) + (:report-file ".coverage/simplecov.json") + (:merge-report t) + (:send-report nil)) +#+end_src + +Undercover is therefore the instrumentation layer: it instruments +=modules/*.el= and =gptel-tools/*.el=, records Edebug stop-point hits while +tests execute, and writes the line hit arrays. SimpleCov is the local +interchange format consumed by the rest of this design. The split-per-test-file +Makefile strategy depends on =:merge-report t=; Undercover can merge SimpleCov +reports across separate Emacs processes, while its LCOV writer cannot merge +reports. This is the concrete reason the artifact is +=.coverage/simplecov.json= rather than =coverage.lcov=. + +The Makefile excludes tests that are incompatible with instrumented source +loading, such as byte-compilation checks. If =.coverage/simplecov.json= is not +created, the coverage run is considered failed; downstream report commands +should not infer partial coverage from a missing artifact. + *** Backend protocol Each backend is a plist registered into =cj/coverage-backends=: |
