feat: add opsx:tdd skill — TDD gate between propose and apply#1068
feat: add opsx:tdd skill — TDD gate between propose and apply#1068yuritoledo wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughThis PR introduces the ChangesOPSX TDD Skill Introduction
Sequence DiagramsequenceDiagram
participant User
participant Propose as /opsx:propose
participant Apply as /opsx:apply
participant TDD as /opsx:tdd
participant TestFile as tests.md
User->>Propose: invoke with BDD criteria
Propose->>TestFile: generate with Automated/Manual sections
Propose->>User: "Created tests.md"
User->>Apply: invoke change
Apply->>TestFile: check artifact status
alt tests artifact not present or done
Apply->>User: proceed silently
else tests status incomplete
Apply->>User: warn and prompt
alt user agrees
Apply->>TDD: invoke TDD verification
TDD->>TestFile: generate failing skeletons
TDD->>TDD: run bun test --run
TDD->>TDD: verify RED state
TDD->>TestFile: mark artifact done
TDD->>User: complete
else user declines
Apply->>User: cancel
end
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@openspec/specs/opsx-tdd-skill/spec.md`:
- Around line 53-55: Update the spec wording to clarify that only failures
caused by the absence of the "tests" artifact in the schema are skipped
silently: modify the THEN/AND lines around the openspec command (`openspec done
tests --change "<name>"`) so they state explicitly that if the `tests` artifact
is not defined in the schema, the command should be skipped silently, but any
other error returned by `openspec done tests` must be surfaced (not suppressed).
- Around line 40-42: The current spec step that runs "bun test --run <file>" to
verify RED tests is nondeterministic; change the verification to validate each
generated it() individually by either invoking the test runner with a
name/pattern filter for each new scenario or by parsing the test runner's
output/JSON to map results back to each generated test, and then report per-test
RED/pass status along with the aggregated counts (tests written, RED count,
unexpected passes).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 422e62b0-1700-4838-ae83-cd7c4dcf95b8
📒 Files selected for processing (2)
docs/opsx.mdopenspec/specs/opsx-tdd-skill/spec.md
alfred-openspec
left a comment
There was a problem hiding this comment.
Thanks for pushing on this. The TDD gate direction is real, but I would not merge this as-is because it documents /opsx:tdd before the command is implemented or registered, adds a main spec without the generated workflow/profile/schema wiring, and bakes in Bun-specific test execution plus placeholder RED tests that are not portable across projects.
I’d suggest keeping this as a design/RFC or custom schema experiment first, then landing it with the actual template, profile, schema, and runner-selection contract so users do not get a command reference that cannot run.
Summary
opsx/specs/opsx-tdd-skill/spec.md— BDD spec for a new/opsx:tddskilldocs/opsx.md— adds/opsx:tddto the commands reference tableWhat is opsx:tdd?
A TDD gate that sits between
opsx:proposeandopsx:apply:opsx:propose gains a
tests.mdartifactAfter all
applyRequiresartifacts are done,opsx:proposegeneratestests.md— a human-readable spec of what to test, derived from BDD scenarios inproposal.md/design.md. No user input needed; it's a mechanical extraction pass.opsx:tdd writes failing test skeletons
Reads
tests.md, writes oneit()block per scenario with forced RED (expect(true).toBe(false)). Runsbun test --runto confirm RED. Marks thetestsartifact done.Real assertions are intentionally deferred to
opsx:apply(GREEN phase) — the component doesn't exist yet at TDD time, so writing real assertions would fail with "module not found", indistinguishable from a broken test.opsx:apply gains a soft guard
If
tests.mdexists but thetestsartifact isn't done,opsx:applywarns and prompts before proceeding. Fully backward compatible — notests.md= silent pass-through.Test plan
openspec/specs/opsx-tdd-skill/spec.mdfor completenessdocs/opsx.mdrenders correctlySummary by CodeRabbit
New Features
/opsx:tddcommand to enforce test-driven development. Generates failing test skeletons, validates test execution, and manages test status throughout the workflow.Documentation