Skip to content

test: populate the DSL and adapter buckets, fix the drift they exposed - #192

Merged
pgermishuys merged 1 commit into
mainfrom
phase/populate-buckets
Sep 20, 2026
Merged

pgermishuys merged 1 commit into
mainfrom
phase/populate-buckets

Conversation

@pgermishuys

Copy link
Copy Markdown
Contributor

Part of #183 — task group 14. Adds 28 scenarios, and corrects the documentation they proved wrong.

The buckets

Adapters were Claude Code only. tests/support/adapter.ts now drives any flush-based adapter from .weave source to the files a user would find on disk, so Copilot is held to the same promises against a harness with different conventions — one config, many harnesses, the user's intent preserved in each.

The OpenCode adapters register agents with a running harness rather than writing files, so they need a harness of their own and are not covered here.

DSL gains tool_policy resolution (declared, partial, absent, and a category tightening what its shuttle inherits) and prompt composition (plain prompts, template fields, append ordering, delegation loops, failure modes).

What the scenarios found

Writing them against real behaviour surfaced documentation describing Weave as it no longer works.

{{{delegation.section}}} does not exist. ADR 0001 removed it and the automatic fallback append deliberately, and template-context.test.ts asserts both are absent from ALLOWED_TEMPLATE_PATHS — a prompt using the placeholder fails composition. Still documented in:

File
packages/cli/src/prompts/self-modify.md shipped guidance — weave prompt self-modify prints it, telling users to use a placeholder that breaks their config
docs/dsl-reference.md the canonical DSL reference, listing it in the context table
AGENTS.md, CONTEXT.md what agents read to work in this repo
docs/cli.md, docs/prompt-composition.md

I found this because three scenarios I wrote from AGENTS.md failed: the composed prompt was just "You are Loom." with no delegation block, despite delegationTargets being populated. docs/prompt-composition.md then says outright, three lines from where it lists the placeholder, "There is no automatic fallback delegation block."

Object triggers are invalid. AGENTS.md still showed triggers [{ domain "…" trigger "…" }]. The schema takes quoted strings, and docs/dsl-reference.md says object triggers are invalid outright.

{{domains}} is not in the template context.

Each is corrected, with a scenario pinning the real behaviour so it cannot drift again. Historical spec artifacts already carry SUPERSEDED annotations and are left alone.

This is the same drift that produced the patterns → triggers fix in #187: the reference docs and specs were amended when the engine changed, the onboarding documents were not.

Review notes

  • The scenarios are written against observed behaviour, not documented behaviour — that is what made the gap visible.
  • One self-inflicted bug worth knowing about: my first fix to self-modify.md wrote a literal {{#delegation.targets}} into it. That file is itself rendered through Mustache, so it became an unclosed section and broke 30 CLI tests. Reworded without tag syntax.
  • tests/support/adapter.ts is typed against neverthrow's ResultAsync rather than a hand-rolled PromiseLike, after the latter failed to match structurally.

Verification

  • bun test ./tests: 47 pass, 0 fail
  • bun run test: 6,128 across 197 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

Adds 28 scenarios across the DSL and adapter buckets, and corrects the
documentation they proved wrong.

The adapter bucket was Claude Code only. `tests/support/adapter.ts` now
drives any flush-based adapter from `.weave` source to the files a user
would find on disk, so Copilot is covered by the same promises against a
harness with different conventions — which is the point of the bucket.
The OpenCode adapters register agents with a running harness rather than
writing files, so they need a harness of their own and are not covered
here.

The DSL bucket gains tool policy resolution — declared, partial, absent,
and a category tightening what its shuttle inherits — and prompt
composition: plain prompts, template fields, append ordering, delegation
loops, and the failure modes.

Writing those against real behaviour surfaced documentation describing
Weave as it no longer works:

  - `{{{delegation.section}}}` does not exist. ADR 0001 removed it and the
    automatic fallback append deliberately, and template-context.test.ts
    asserts both are absent from ALLOWED_TEMPLATE_PATHS — a prompt using
    the placeholder fails composition. AGENTS.md, CONTEXT.md,
    docs/dsl-reference.md, docs/cli.md and docs/prompt-composition.md all
    still documented it. So did packages/cli/src/prompts/self-modify.md,
    which is shipped guidance `weave prompt self-modify` prints: it told
    users to use a placeholder that breaks their config.
  - Object triggers are invalid. AGENTS.md still showed
    `triggers [{ domain "…" trigger "…" }]`; the schema takes quoted
    strings.
  - `{{domains}}` is not in the template context.

Each is corrected, with a scenario pinning the real behaviour so it
cannot drift again. Historical spec artifacts already carry SUPERSEDED
annotations and are left alone.

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 16:32
@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 27 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: ec222986-8b99-44bc-a43c-223a493e9a09

📥 Commits

Reviewing files that changed from the base of the PR and between c4ccde3 and 0ce26d8.

⛔ 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 (12)
  • AGENTS.md
  • CONTEXT.md
  • docs/cli.md
  • docs/dsl-reference.md
  • docs/prompt-composition.md
  • docs/testing-strategy.md
  • packages/cli/src/prompts/self-modify.md
  • tests/adapters/claude-code.scenario.test.ts
  • tests/adapters/copilot.scenario.test.ts
  • tests/dsl/prompt-composition.scenario.test.ts
  • tests/dsl/tool-policy.scenario.test.ts
  • tests/support/adapter.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 7115c69 into main Sep 20, 2026
7 checks passed
@pgermishuys
pgermishuys deleted the phase/populate-buckets branch September 20, 2026 16:35

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

The new shared adapter test harness hard-codes filesystem behaviors (notably exists) in a way that can mask real adapter regressions and should be made more faithful for the new scenario coverage to be reliable.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

This PR expands the new outside-in test buckets by adding DSL scenarios (tool policy + prompt composition) and adapter scenarios (Copilot alongside Claude Code), and then fixes documentation drift that those scenarios exposed around delegation/template context and triggers.

Changes:

  • Add shared in-memory “flush-based adapter” harness and use it to test both Claude Code and Copilot bundle generation.
  • Add DSL scenarios covering tool_policy resolution and prompt composition/template failure modes.
  • Update shipped/self-modify guidance and multiple docs/onboarding references to remove {{{delegation.section}}} / object triggers / {{domains}} claims and align with current engine behavior.
File Description
tests/​support/​adapter.ts Shared in-memory harness for flush-based adapters to generate bundle outputs from .weave configs.
tests/​dsl/​tool-policy.scenario.test.ts Scenario tests that pin tool_policy resolution behavior and invalid-policy rejection.
tests/​dsl/​prompt-composition.scenario.test.ts Scenario tests that pin prompt templating, append ordering, delegation loops, and failure modes.
tests/​adapters/​copilot.scenario.test.ts Black-box adapter scenarios asserting Copilot bundle layout + agent generation behavior.
tests/​adapters/​claude-code.scenario.test.ts Refactors Claude Code adapter scenarios to use the shared adapter harness.
packages/​cli/​src/​prompts/​self-modify.md Fixes shipped guidance to describe explicit delegation loops and closed template allowlist.
docs/​testing-strategy.md Updates task status and documents the specific doc drift surfaced by the new bucket scenarios.
docs/​prompt-composition.md Aligns guidance to delegation loops without referencing removed delegation.section.
docs/​dsl-reference.md Removes references to non-existent delegation.section / delegation.mermaid template paths.
docs/​cli.md Updates CLI docs to reference {{#delegation.targets}} loops (not delegation.section).
CONTEXT.md Updates repo onboarding context to reflect current delegation/template behavior accurately.
AGENTS.md Updates onboarding DSL examples and template-context documentation to match current schema/context.
.codesight/​coverage.md Auto-updated Codesight coverage metadata (test file count).
.codesight/​CODESIGHT.md Auto-updated Codesight scan metadata (timestamp + test file count).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/support/adapter.ts
Comment on lines +41 to +52
hooks: {
exists: async () => true,
readDir: async () => [],
readFile: async () => "",
writeFile: async (path, content) => {
written[path] = content;
},
removeFile: async (path) => {
delete written[path];
},
mkdir: async () => {},
},
Comment thread tests/support/adapter.ts
Comment on lines +73 to +79
for (const entry of plan.agents) {
const spawned = await adapter.spawnSubagent(entry.descriptor);
expect(spawned.isOk()).toBe(true);
}
const flushed = await adapter.flush();
expect(flushed.isOk()).toBe(true);

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