Skip to content

test(copilot): replace the adapter's unit tests with scenarios - #198

Merged
pgermishuys merged 1 commit into
mainfrom
test/copilot-scenario-migration
Sep 20, 2026
Merged

pgermishuys merged 1 commit into
mainfrom
test/copilot-scenario-migration

Conversation

@pgermishuys

Copy link
Copy Markdown
Contributor

Part of #183 — task group 14. Second adapter migrated, same method as the claude-code pilot in #195.

Before After
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.

What stays, and why

Kept Why it is not observable from a config
marketplace.test.ts (13) A distribution-snapshot guard — the committed plugins/copilot bundle must match what the adapter generates. Repo integrity rather than unit behaviour, and closer in kind to a scripts/ guard
delegation-prompt.test.ts Pure text transformation: regex metacharacter escaping, bare references. The observable outcomes moved to scenarios; these edges aren't reachable from a .weave file
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:

Mutation Result
Bash reclassified execute → read caught
Stale-file cleanup disabled caught
Delegation qualifier not passed to the prompt adapter caught

A 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 as weave:<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 fail
  • bun 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

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
Copilot AI lite review requested due to automatic review settings September 20, 2026 20:11
@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 25 minutes.

Check out review usage here.

View limit details

Limit 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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: a01ba0f0-c8c3-4f4e-90a1-e3b6615fef53

📥 Commits

Reviewing files that changed from the base of the PR and between 30c848a and 93da329.

⛔ Files ignored due to path filters (2)
  • .codesight/CODESIGHT.md is excluded by !.codesight/**
  • .codesight/coverage.md is excluded by !.codesight/**
📒 Files selected for processing (5)
  • packages/adapters/copilot/src/__tests__/adapter.test.ts
  • packages/adapters/copilot/src/__tests__/agent-translation.test.ts
  • packages/adapters/copilot/src/__tests__/integration.test.ts
  • packages/adapters/copilot/src/__tests__/tool-classification.test.ts
  • tests/adapters/copilot.scenario.test.ts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pgermishuys
pgermishuys merged commit f6f85b9 into main Sep 20, 2026
3 checks passed
@pgermishuys
pgermishuys deleted the test/copilot-scenario-migration branch September 20, 2026 20:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Medium severity

Open (5)
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.

Comment on lines 35 to +36
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);
Comment on lines +196 to +200
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");
Comment on lines +297 to +301
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"] },
});
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