Repository navigation
test: populate the DSL and adapter buckets, fix the drift they exposed - #192
Conversation
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
|
Warning Review limit reachedNext included review available in 27 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 (12)
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
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
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_policyresolution 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.
| hooks: { | ||
| exists: async () => true, | ||
| readDir: async () => [], | ||
| readFile: async () => "", | ||
| writeFile: async (path, content) => { | ||
| written[path] = content; | ||
| }, | ||
| removeFile: async (path) => { | ||
| delete written[path]; | ||
| }, | ||
| mkdir: async () => {}, | ||
| }, |
| 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); | ||
|
|


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.tsnow drives any flush-based adapter from.weavesource 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_policyresolution (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, andtemplate-context.test.tsasserts both are absent fromALLOWED_TEMPLATE_PATHS— a prompt using the placeholder fails composition. Still documented in:packages/cli/src/prompts/self-modify.mdweave prompt self-modifyprints it, telling users to use a placeholder that breaks their configdocs/dsl-reference.mdAGENTS.md,CONTEXT.mddocs/cli.md,docs/prompt-composition.mdI found this because three scenarios I wrote from
AGENTS.mdfailed: the composed prompt was just"You are Loom."with no delegation block, despitedelegationTargetsbeing populated.docs/prompt-composition.mdthen says outright, three lines from where it lists the placeholder, "There is no automatic fallback delegation block."Object triggers are invalid.
AGENTS.mdstill showedtriggers [{ domain "…" trigger "…" }]. The schema takes quoted strings, anddocs/dsl-reference.mdsays 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
SUPERSEDEDannotations and are left alone.This is the same drift that produced the
patterns→triggersfix in #187: the reference docs and specs were amended when the engine changed, the onboarding documents were not.Review notes
self-modify.mdwrote 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.tsis typed against neverthrow'sResultAsyncrather than a hand-rolledPromiseLike, after the latter failed to match structurally.Verification
bun test ./tests: 47 pass, 0 failbun run test: 6,128 across 197 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