From 69fd993b79e1cf4ffdd8ffa88e084f0fdc2abc6c Mon Sep 17 00:00:00 2001 From: "d3mlabs-ai-flow[bot]" <305891656+d3mlabs-ai-flow[bot]@users.noreply.github.com> Date: Sat, 15 Aug 2026 16:05:21 -0400 Subject: [PATCH 1/3] ai-flow /build: capture learnings from the build pass Co-authored-by: JPDuchesne <2636122+JPDuchesne@users.noreply.github.com> --- .cursor/rules/learnings-index.mdc | 4 +++ .../patch-coverage-boundary-wrappers/SKILL.md | 32 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 .cursor/skills/learnings/patch-coverage-boundary-wrappers/SKILL.md diff --git a/.cursor/rules/learnings-index.mdc b/.cursor/rules/learnings-index.mdc index 6ff67a0..d54fa7d 100644 --- a/.cursor/rules/learnings-index.mdc +++ b/.cursor/rules/learnings-index.mdc @@ -24,6 +24,10 @@ propose a retirement, a consolidation, or a glob-scoped sub-index split. class they silently assert nothing. → .agents/skills/gem-rspock--rspock/ (ships in the rspock gem; linked by `dev up` / `dev install-deps`) +- [testing/patch-coverage-boundary-wrappers] codecov/patch targets 100% of + added lines — real boundary-wrapper bodies (tests inject fakes) and + `--help`-only builtin blocks need one executing test each. + → .cursor/skills/learnings/patch-coverage-boundary-wrappers/ ## process diff --git a/.cursor/skills/learnings/patch-coverage-boundary-wrappers/SKILL.md b/.cursor/skills/learnings/patch-coverage-boundary-wrappers/SKILL.md new file mode 100644 index 0000000..d086d59 --- /dev/null +++ b/.cursor/skills/learnings/patch-coverage-boundary-wrappers/SKILL.md @@ -0,0 +1,32 @@ +--- +name: patch-coverage-boundary-wrappers +description: >- + MUST be used when adding an injectable boundary wrapper (an + Executor-style shell-out, a --help-only builtin registration) or + diagnosing a failing codecov/patch check: the patch gate targets 100% + of added lines. +--- + +# Patch coverage includes the real boundary wrapper + +The codecov/patch gate targets 100% of added lines, and the lines most +often missed are exactly the ones tests deliberately route around: the +real body of an injectable executor (every unit test injects a fake) and +the block of a builtin registered only to surface in `dev --help`. Give +the real wrapper one test that runs a real subprocess, and execute the +registration block once through `Runner#run` with the accessor mocked. + +Wrong: ship `GhCloner` with tests that only ever inject +`RecordingCloneExecutor` — the real `Executor#system` line is the +patch's only miss and codecov/patch fails at 97.x% while every named +test passes. + +Right: one test runs `Executor.new.system("echo", …)` with a real file +standing in for `$stderr` (plus a `system("false")` false-return case), +and one Runner test runs `runner.run(["clone", …])` against +`Dev::Clone::Accessor.any_instance.expects(:run).with([…])`. + +learned-from: dev#107 (codecov/patch reported 97.61% vs the 100% target; +the two misses were the real gh executor body and the clone builtin's +registration block). +date: 2026-08-15 From f3646ae6ed02d1fafda8c2817b29671c25cde939 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Date: Sat, 15 Aug 2026 16:42:23 -0400 Subject: [PATCH 2/3] Teach the constructor seam, not any_instance, for builtin block coverage dev#110 gave every Runner builtin collaborator an injected seam, so the learning's Right example now shows the injection form and names any_instance as the smell that signals a missing seam. Co-authored-by: Cursor --- .../patch-coverage-boundary-wrappers/SKILL.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.cursor/skills/learnings/patch-coverage-boundary-wrappers/SKILL.md b/.cursor/skills/learnings/patch-coverage-boundary-wrappers/SKILL.md index d086d59..1529f6e 100644 --- a/.cursor/skills/learnings/patch-coverage-boundary-wrappers/SKILL.md +++ b/.cursor/skills/learnings/patch-coverage-boundary-wrappers/SKILL.md @@ -14,7 +14,10 @@ often missed are exactly the ones tests deliberately route around: the real body of an injectable executor (every unit test injects a fake) and the block of a builtin registered only to surface in `dev --help`. Give the real wrapper one test that runs a real subprocess, and execute the -registration block once through `Runner#run` with the accessor mocked. +registration block once through `Runner#run` with a fake accessor +injected through the Runner's constructor seam (never `any_instance` — +a block only reachable that way is missing its seam; add one, as +dev#110 did for every builtin collaborator). Wrong: ship `GhCloner` with tests that only ever inject `RecordingCloneExecutor` — the real `Executor#system` line is the @@ -23,10 +26,12 @@ test passes. Right: one test runs `Executor.new.system("echo", …)` with a real file standing in for `$stderr` (plus a `system("false")` false-return case), -and one Runner test runs `runner.run(["clone", …])` against -`Dev::Clone::Accessor.any_instance.expects(:run).with([…])`. +and one Runner test injects the fake through the constructor — +`build_runner(clone_accessor: fake)` with +`fake.expects(:run).with([…])` — then runs `runner.run(["clone", …])`. learned-from: dev#107 (codecov/patch reported 97.61% vs the 100% target; the two misses were the real gh executor body and the clone builtin's -registration block). +registration block); dev#110 (the any_instance shortcut replaced by +constructor seams). date: 2026-08-15 From ca41284e2ad82b4495ecb7be3697be62952a47c1 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Date: Mon, 17 Aug 2026 13:00:27 -0400 Subject: [PATCH 3/3] Point the seam guidance at plans#37 instead of the superseded dev#110 dev#110 closed unmerged; the constructor seams land via the Runner layering plan (d3mlabs/plans#37), so the Right example teaches injection at the builtin's own constructor rather than a Runner kwarg that never shipped. Co-authored-by: Cursor --- .../patch-coverage-boundary-wrappers/SKILL.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.cursor/skills/learnings/patch-coverage-boundary-wrappers/SKILL.md b/.cursor/skills/learnings/patch-coverage-boundary-wrappers/SKILL.md index 1529f6e..3f2e608 100644 --- a/.cursor/skills/learnings/patch-coverage-boundary-wrappers/SKILL.md +++ b/.cursor/skills/learnings/patch-coverage-boundary-wrappers/SKILL.md @@ -12,12 +12,12 @@ description: >- The codecov/patch gate targets 100% of added lines, and the lines most often missed are exactly the ones tests deliberately route around: the real body of an injectable executor (every unit test injects a fake) and -the block of a builtin registered only to surface in `dev --help`. Give -the real wrapper one test that runs a real subprocess, and execute the -registration block once through `Runner#run` with a fake accessor -injected through the Runner's constructor seam (never `any_instance` — -a block only reachable that way is missing its seam; add one, as -dev#110 did for every builtin collaborator). +the body of a builtin that exists mainly to surface in `dev --help`. +Give the real wrapper one test that runs a real subprocess, and execute +the builtin body once with a fake collaborator injected through its +owning class's constructor (never `any_instance` — a body reachable only +that way is missing its seam; d3mlabs/plans#37 restructures Runner's +builtins so every one has its own). Wrong: ship `GhCloner` with tests that only ever inject `RecordingCloneExecutor` — the real `Executor#system` line is the @@ -26,12 +26,12 @@ test passes. Right: one test runs `Executor.new.system("echo", …)` with a real file standing in for `$stderr` (plus a `system("false")` false-return case), -and one Runner test injects the fake through the constructor — -`build_runner(clone_accessor: fake)` with -`fake.expects(:run).with([…])` — then runs `runner.run(["clone", …])`. +and one dispatch test drives the builtin body end to end with a fake +injected at the constructor (`fake.expects(:run).with([…])`), asserting +the argv reaches the collaborator. learned-from: dev#107 (codecov/patch reported 97.61% vs the 100% target; the two misses were the real gh executor body and the clone builtin's -registration block); dev#110 (the any_instance shortcut replaced by -constructor seams). +registration block); dev#110 (an interim constructor-seam sweep, +superseded by the d3mlabs/plans#37 Runner layering). date: 2026-08-15