Repository navigation
test(copilot): replace the adapter's unit tests with scenarios - #198
Conversation
Second adapter migrated, same method as the claude-code pilot.
unit cases 102 in 9 files -> 41 in 5 files
scenario cases 6 -> 13
total 108 -> 54
Deleted whole, all subsumed by scenarios asserting the same promises in
the generated bundle: adapter.test.ts, agent-translation.test.ts,
integration.test.ts, tool-classification.test.ts.
Kept, with the reason in each file:
marketplace.test.ts a distribution-snapshot guard — the committed
plugins/copilot bundle must match what the
adapter generates. Repo integrity, not unit
behaviour, and closer to a scripts/ guard
delegation-prompt.test.ts pure text transformation: regex
metacharacter escaping, bare references. The
observable outcomes moved to scenarios; these
edges are not reachable from a config
model-resolution.test.ts the adapter/engine ModelResolutionInput
contract, which no generated file reveals
skill-discovery.test.ts a filesystem scanner; harness resource
discovery is adapter-owned
Proven by mutation, with every deleted test already gone:
Bash reclassified execute -> read caught
stale-file cleanup disabled caught
delegation qualifier not passed to the prompt adapter caught
One correction to my own first draft, worth recording. A scenario
asserted that an agent which cannot delegate is "left unqualified", and
failed: every agent's frontmatter name is qualified as weave:<name>,
because that is the plugin id, not delegation adaptation. Delegation
qualification applies to prose in the prompt body. The scenario now
checks the body, which is what the promise was always about.
Refs #183 (task group 14)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DisVZW27sd6Pe7uhbjXNve
|
Warning Review limit reachedNext included review available in 25 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (5)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Several user-visible Copilot behaviors remain inadequately covered, including delegate/network tools, YAML-safe descriptions, Tapestry commands, and prompt qualification.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 5
Open (5)
Missing coverage for creating a missing output directory · New Missing YAML serialization coverage for special descriptions · New Missing agent and web capability coverage · New Test does not verify qualification of prompt target references · New Missing config-driven Tapestry materialization and cleanup scenarios · New
What changed in this PR
Migrates Copilot adapter coverage from white-box tests to configuration-driven scenarios as part of #183, following the Claude Code migration pattern.
Changes:
- Adds bundle scenarios for policies, delegation, descriptions, and stale files.
- Removes four redundant adapter unit/integration test files.
- Updates Codesight test-file metadata.
| File | Description |
|---|---|
tests/adapters/copilot.scenario.test.ts |
New Copilot black-box scenarios |
packages/adapters/copilot/src/__tests__/adapter.test.ts |
Removed adapter unit tests |
packages/adapters/copilot/src/__tests__/agent-translation.test.ts |
Removed translation tests |
packages/adapters/copilot/src/__tests__/integration.test.ts |
Removed integration tests |
packages/adapters/copilot/src/__tests__/tool-classification.test.ts |
Removed classification tests |
.codesight/coverage.md |
Updated test-file count |
.codesight/CODESIGHT.md |
Updated scan metadata |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| function build(config: string): Promise<Record<string, string>> { | ||
| return generateBundle( | ||
| config, | ||
| (hooks) => | ||
| new CopilotAdapter({ | ||
| projectRoot: PROJECT_ROOT, | ||
| homeDir: "/home/user", | ||
| outDir: OUT_DIR, | ||
| ...hooks, | ||
| }), | ||
| ); | ||
| return generateBundle(config, adapterFor); |
| describe("a user writes only the minimum for an agent", () => { | ||
| it("omits the description rather than inventing one", async () => { | ||
| const files = await build(` | ||
| agent bare { | ||
| prompt "You are bare." |
|
|
||
| // Copilot names several concrete tools per capability; one representative | ||
| // of each is enough to prove the capability reached the file. | ||
| for (const tool of ["read", "edit", "execute"]) { |
|
|
||
| // An unqualified "shuttle" in the prose would let Copilot pick a built-in | ||
| // of that name instead of the Weave agent. | ||
| expect(loom).toContain("weave:shuttle"); |
| describe("a user regenerates after removing an agent", () => { | ||
| it("deletes the agent file the previous run left behind", async () => { | ||
| const { removed } = await regenerate(SHUTTLE_ONLY, { | ||
| existing: { agents: ["shuttle.agent.md", "retired.agent.md"] }, | ||
| }); |

Part of #183 — task group 14. Second adapter migrated, same method as the claude-code pilot in #195.
Deleted whole — all subsumed by scenarios asserting the same promises in the generated bundle:
adapter.test.ts,agent-translation.test.ts,integration.test.ts,tool-classification.test.ts.What stays, and why
marketplace.test.ts(13)plugins/copilotbundle must match what the adapter generates. Repo integrity rather than unit behaviour, and closer in kind to ascripts/guarddelegation-prompt.test.ts.weavefilemodel-resolution.test.tsModelResolutionInputcontract, which no generated file revealsskill-discovery.test.tsProven by mutation
With every deleted test already gone:
Bashreclassifiedexecute→readA correction to my own first draft
One scenario asserted that an agent which cannot delegate is "left unqualified" — and failed. Every agent's frontmatter
name:is qualified asweave:<name>, because that's the plugin id, not delegation adaptation. Delegation qualification applies to prose in the prompt body. The scenario now checks the body, which is what the promise was always about.Verification
bun run test: 6,036 across 190 files, 0 failbun run typecheck,bun run lint,bun run verify:test-coverage,bun run docs:check-links: pass🤖 Generated with Claude Code
https://claude.ai/code/session_01DisVZW27sd6Pe7uhbjXNve