ace-test 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.ace-defaults/nav/protocols/agent-sources/ace-test.yml +19 -0
- data/.ace-defaults/nav/protocols/guide-sources/ace-test.yml +19 -0
- data/.ace-defaults/nav/protocols/tmpl-sources/ace-test.yml +11 -0
- data/.ace-defaults/nav/protocols/wfi-sources/ace-test.yml +19 -0
- data/CHANGELOG.md +169 -0
- data/LICENSE +21 -0
- data/README.md +40 -0
- data/Rakefile +12 -0
- data/handbook/agents/mock.ag.md +164 -0
- data/handbook/agents/profile-tests.ag.md +132 -0
- data/handbook/agents/test.ag.md +99 -0
- data/handbook/guides/SUMMARY.md +95 -0
- data/handbook/guides/embedded-testing-guide.g.md +261 -0
- data/handbook/guides/mocking-patterns.g.md +464 -0
- data/handbook/guides/quick-reference.g.md +46 -0
- data/handbook/guides/test-driven-development-cycle/meta-documentation.md +26 -0
- data/handbook/guides/test-driven-development-cycle/ruby-application.md +18 -0
- data/handbook/guides/test-driven-development-cycle/ruby-gem.md +19 -0
- data/handbook/guides/test-driven-development-cycle/rust-cli.md +18 -0
- data/handbook/guides/test-driven-development-cycle/rust-wasm-zed.md +19 -0
- data/handbook/guides/test-driven-development-cycle/typescript-nuxt.md +18 -0
- data/handbook/guides/test-driven-development-cycle/typescript-vue.md +19 -0
- data/handbook/guides/test-layer-decision.g.md +261 -0
- data/handbook/guides/test-mocking-patterns.g.md +414 -0
- data/handbook/guides/test-organization.g.md +140 -0
- data/handbook/guides/test-performance.g.md +353 -0
- data/handbook/guides/test-responsibility-map.g.md +220 -0
- data/handbook/guides/test-review-checklist.g.md +231 -0
- data/handbook/guides/test-suite-health.g.md +337 -0
- data/handbook/guides/testable-code-patterns.g.md +315 -0
- data/handbook/guides/testing/ruby-rspec-config-examples.md +120 -0
- data/handbook/guides/testing/ruby-rspec.md +87 -0
- data/handbook/guides/testing/rust.md +52 -0
- data/handbook/guides/testing/test-maintenance.md +364 -0
- data/handbook/guides/testing/typescript-bun.md +47 -0
- data/handbook/guides/testing/vue-firebase-auth.md +546 -0
- data/handbook/guides/testing/vue-vitest.md +236 -0
- data/handbook/guides/testing-philosophy.g.md +82 -0
- data/handbook/guides/testing-strategy.g.md +151 -0
- data/handbook/guides/testing-tdd-cycle.g.md +146 -0
- data/handbook/guides/testing.g.md +170 -0
- data/handbook/skills/as-test-create-cases/SKILL.md +24 -0
- data/handbook/skills/as-test-fix/SKILL.md +26 -0
- data/handbook/skills/as-test-improve-coverage/SKILL.md +22 -0
- data/handbook/skills/as-test-optimize/SKILL.md +34 -0
- data/handbook/skills/as-test-performance-audit/SKILL.md +34 -0
- data/handbook/skills/as-test-plan/SKILL.md +34 -0
- data/handbook/skills/as-test-review/SKILL.md +34 -0
- data/handbook/skills/as-test-verify-suite/SKILL.md +45 -0
- data/handbook/templates/e2e-sandbox-checklist.template.md +289 -0
- data/handbook/templates/test-case.template.md +56 -0
- data/handbook/templates/test-performance-audit.template.md +132 -0
- data/handbook/templates/test-responsibility-map.template.md +92 -0
- data/handbook/templates/test-review-checklist.template.md +163 -0
- data/handbook/workflow-instructions/test/analyze-failures.wf.md +120 -0
- data/handbook/workflow-instructions/test/create-cases.wf.md +675 -0
- data/handbook/workflow-instructions/test/fix.wf.md +120 -0
- data/handbook/workflow-instructions/test/improve-coverage.wf.md +370 -0
- data/handbook/workflow-instructions/test/optimize.wf.md +368 -0
- data/handbook/workflow-instructions/test/performance-audit.wf.md +17 -0
- data/handbook/workflow-instructions/test/plan.wf.md +323 -0
- data/handbook/workflow-instructions/test/review.wf.md +16 -0
- data/handbook/workflow-instructions/test/verify-suite.wf.md +343 -0
- data/lib/ace/test/version.rb +7 -0
- data/lib/ace/test.rb +10 -0
- metadata +152 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: b1e7e2715b9ce0c40caefcd4352c9d55d4fe48cce56a16608ce2a83422e1c2f1
|
|
4
|
+
data.tar.gz: 2fd404ee96520dceea07be4d826edf3a7dcc460fe9b41d86053ed9e4ef3d071f
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 9c8cd343fceb8f3676d91caa02187408197d8d024681fb463e250ca3d3d0cc5e67a6dddb81c2a1bf51f93851654b0e0839a3e8967975d1e8e6b28664b142e746
|
|
7
|
+
data.tar.gz: 36541ccd8b7a4316db513c36bd56f07ebcea2f819284970fb85e780a6e31b35e837257653312423342147329dee28324284ad9f3bce06cf0ee84a85ab23c2bd8
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
# Agent Sources Protocol Configuration for ace-test gem
|
|
3
|
+
# This enables agent discovery from the installed ace-test gem
|
|
4
|
+
|
|
5
|
+
name: ace-test
|
|
6
|
+
type: gem
|
|
7
|
+
description: Testing agents from ace-test gem
|
|
8
|
+
priority: 10
|
|
9
|
+
|
|
10
|
+
# Configuration for agent discovery within the gem
|
|
11
|
+
config:
|
|
12
|
+
# Relative path within the gem
|
|
13
|
+
relative_path: handbook/agents
|
|
14
|
+
|
|
15
|
+
# Pattern for finding agent files
|
|
16
|
+
pattern: "*.ag.md"
|
|
17
|
+
|
|
18
|
+
# Enable discovery
|
|
19
|
+
enabled: true
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
# Guide Sources Protocol Configuration for ace-test gem
|
|
3
|
+
# This enables guide discovery from the installed ace-test gem
|
|
4
|
+
|
|
5
|
+
name: ace-test
|
|
6
|
+
type: gem
|
|
7
|
+
description: Testing guides from ace-test gem
|
|
8
|
+
priority: 10
|
|
9
|
+
|
|
10
|
+
# Configuration for guide discovery within the gem
|
|
11
|
+
config:
|
|
12
|
+
# Relative path within the gem
|
|
13
|
+
relative_path: handbook/guides
|
|
14
|
+
|
|
15
|
+
# Pattern for finding guide files
|
|
16
|
+
pattern: "*.g.md"
|
|
17
|
+
|
|
18
|
+
# Enable discovery
|
|
19
|
+
enabled: true
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
# WFI Sources Protocol Configuration for ace-test gem
|
|
3
|
+
# This enables workflow discovery from the installed ace-test gem
|
|
4
|
+
|
|
5
|
+
name: ace-test
|
|
6
|
+
type: gem
|
|
7
|
+
description: Testing workflow instructions from ace-test gem
|
|
8
|
+
priority: 10
|
|
9
|
+
|
|
10
|
+
# Configuration for workflow discovery within the gem
|
|
11
|
+
config:
|
|
12
|
+
# Relative path within the gem (default: handbook/workflow-instructions)
|
|
13
|
+
relative_path: handbook/workflow-instructions
|
|
14
|
+
|
|
15
|
+
# Pattern for finding workflow files (default: *.wf.md)
|
|
16
|
+
pattern: "*.wf.md"
|
|
17
|
+
|
|
18
|
+
# Enable discovery
|
|
19
|
+
enabled: true
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.6.0] - 2026-03-24
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- Refreshed README tagline to emphasize knowledge-base role and fast, reliable tests.
|
|
13
|
+
- Fixed verify-suite use-case to reference `ace-test-runner` instead of stale `ace-test` CLI link.
|
|
14
|
+
|
|
15
|
+
## [0.5.2] - 2026-03-23
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Refreshed README structure to match the current package layout pattern, including quick links, use-case framing, and standardized section flow.
|
|
19
|
+
|
|
20
|
+
## [0.5.1] - 2026-03-22
|
|
21
|
+
|
|
22
|
+
### Technical
|
|
23
|
+
- Removed obsolete `docs/demo` recording assets (`ace-test-getting-started.tape` and generated GIF) from the non-CLI documentation package.
|
|
24
|
+
|
|
25
|
+
## [0.5.0] - 2026-03-22
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
- Rewrote README as concise landing page (~57 lines, down from 233)
|
|
29
|
+
- Updated gemspec summary and description to match new tagline
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
- New `docs/getting-started.md` tutorial-style guide
|
|
33
|
+
- New `docs/usage.md` with full CLI reference
|
|
34
|
+
- New `docs/handbook.md` with skills and workflows catalog
|
|
35
|
+
- Demo VHS tape and GIF in `docs/demo/`
|
|
36
|
+
|
|
37
|
+
## [0.4.6] - 2026-03-21
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
- Restored the historical release entries removed during the documentation sweep so the package changelog again preserves prior release traceability.
|
|
41
|
+
|
|
42
|
+
## [0.4.5] - 2026-03-21
|
|
43
|
+
|
|
44
|
+
### Added
|
|
45
|
+
- Added `as-test-improve-coverage` as the canonical workflow skill for coverage gap planning.
|
|
46
|
+
- Added `test/improve-coverage.wf.md` workflow instruction to execute coverage planning from the test domain.
|
|
47
|
+
- Updated package README and handbook references to point to `wfi://test/improve-coverage`.
|
|
48
|
+
|
|
49
|
+
### Changed
|
|
50
|
+
- Removed task-domain ownership of coverage planning workflow artifacts and migrated those responsibilities to `ace-test`.
|
|
51
|
+
|
|
52
|
+
## [0.4.4] - 2026-03-13
|
|
53
|
+
|
|
54
|
+
### Technical
|
|
55
|
+
- Updated canonical test planning skills for direct workflow execution in this project.
|
|
56
|
+
|
|
57
|
+
## [0.4.3] - 2026-03-13
|
|
58
|
+
|
|
59
|
+
### Changed
|
|
60
|
+
- Updated canonical test-planning and suite-health skills to explicitly run bundled workflows in the current project and execute them end-to-end.
|
|
61
|
+
|
|
62
|
+
## [0.4.2] - 2026-03-13
|
|
63
|
+
|
|
64
|
+
### Changed
|
|
65
|
+
- Removed the Codex-specific delegated execution metadata from the canonical `as-test-verify-suite` skill so provider projections now inherit the canonical skill body unchanged.
|
|
66
|
+
|
|
67
|
+
## [0.4.1] - 2026-03-12
|
|
68
|
+
|
|
69
|
+
### Changed
|
|
70
|
+
- Updated README and workflow guidance to use direct `ace-bundle` workflow loading instead of legacy slash-command references.
|
|
71
|
+
|
|
72
|
+
## [0.4.0] - 2026-03-12
|
|
73
|
+
|
|
74
|
+
### Added
|
|
75
|
+
- Added Codex-specific delegated execution metadata to the canonical `as-test-verify-suite` skill so the generated Codex skill runs in fork context on `gpt-5.3-codex-spark`.
|
|
76
|
+
|
|
77
|
+
## [0.3.0] - 2026-03-10
|
|
78
|
+
|
|
79
|
+
### Added
|
|
80
|
+
- Added canonical handbook-owned test planning, optimization, suite verification, performance-audit, and test-review skills.
|
|
81
|
+
- Added package workflows for `wfi://test/performance-audit` and `wfi://test/review` to replace inline legacy skill bodies.
|
|
82
|
+
|
|
83
|
+
## [0.2.2] - 2026-03-04
|
|
84
|
+
|
|
85
|
+
### Changed
|
|
86
|
+
- E2E sandbox checklist template now uses `.ace-local/test-e2e`.
|
|
87
|
+
|
|
88
|
+
## [0.2.1] - 2026-02-24
|
|
89
|
+
|
|
90
|
+
### Changed
|
|
91
|
+
- Strengthen `test/analyze-failures` output contract with autonomous fix decisions, concrete candidate file targets, and explicit no-touch boundaries.
|
|
92
|
+
- Update `test/fix` to consume autonomous analysis decisions directly and proceed without user clarification for normal targeting/scope choices.
|
|
93
|
+
|
|
94
|
+
## [0.2.0] - 2026-02-24
|
|
95
|
+
|
|
96
|
+
### Added
|
|
97
|
+
- Add `test/analyze-failures` workflow to classify failing tests before applying fixes.
|
|
98
|
+
|
|
99
|
+
### Changed
|
|
100
|
+
- Rewrite `test/fix` as an execution-only workflow with a hard gate to prior analysis output.
|
|
101
|
+
- Update testing guide references to use analyze-first then fix workflow sequencing.
|
|
102
|
+
|
|
103
|
+
## [0.1.5] - 2026-02-22
|
|
104
|
+
|
|
105
|
+
### Changed
|
|
106
|
+
- Migrate skill naming and invocation references to hyphenated `ace-*` format (no underscores).
|
|
107
|
+
|
|
108
|
+
## [0.1.4] - 2026-02-20
|
|
109
|
+
|
|
110
|
+
### Technical
|
|
111
|
+
- Update stale wfi://work-on-task references to wfi://task/work
|
|
112
|
+
|
|
113
|
+
## [0.1.3] - 2026-02-19
|
|
114
|
+
|
|
115
|
+
### Technical
|
|
116
|
+
- Namespace workflow instructions into test/ subdirectory with updated wfi:// URIs
|
|
117
|
+
- Update skill name references to use namespaced ace:test-action format
|
|
118
|
+
|
|
119
|
+
## [0.1.2] - 2026-02-18
|
|
120
|
+
|
|
121
|
+
### Changed
|
|
122
|
+
- Remove all MT-format references from guides, workflows, and templates — TS-format is now the only documented E2E test format
|
|
123
|
+
- Update E2E test location references from `test/e2e/*.mt.md` to `test/e2e/TS-*/` across testing-philosophy, testing-strategy, test-layer-decision, test-review-checklist, and test-responsibility-map guides
|
|
124
|
+
- Update create-test-cases, optimize-tests, and plan-tests workflows to use TS-format examples and directory creation instead of MT single-file patterns
|
|
125
|
+
- Update e2e-sandbox-checklist, test-responsibility-map, and test-review-checklist templates to use `TS-` prefix and TS-format paths
|
|
126
|
+
|
|
127
|
+
## [0.1.1] - 2026-02-03
|
|
128
|
+
|
|
129
|
+
### Added
|
|
130
|
+
- Step 3b "Implementation Subprocess Detection" in verify-test-suite workflow
|
|
131
|
+
- Explicit subprocess source file search in molecules checklist
|
|
132
|
+
- Test base class check (Section 6) in test-review-checklist guide
|
|
133
|
+
|
|
134
|
+
### Changed
|
|
135
|
+
- Molecules checklist now requires searching SOURCE files for subprocess patterns
|
|
136
|
+
- Renumbered E2E section to 7 in test-review-checklist guide
|
|
137
|
+
|
|
138
|
+
## [0.1.0] - 2026-01-22
|
|
139
|
+
|
|
140
|
+
### Added
|
|
141
|
+
- Initial release of ace-test gem as pure workflow package
|
|
142
|
+
- Testing guides extracted from docs/testing-patterns.md:
|
|
143
|
+
- `quick-reference.g.md` - TL;DR testing patterns
|
|
144
|
+
- `testing-philosophy.g.md` - Testing pyramid and IO isolation
|
|
145
|
+
- `test-organization.g.md` - Flat structure and naming conventions
|
|
146
|
+
- `mocking-patterns.g.md` - Git, HTTP, subprocess, ENV mocking
|
|
147
|
+
- `test-performance.g.md` - Performance targets and optimization
|
|
148
|
+
- `testable-code-patterns.g.md` - Status codes, exceptions, exit handling
|
|
149
|
+
- Migrated workflow instructions from ace-taskflow:
|
|
150
|
+
- `create-test-cases.wf.md` - Generate structured test cases
|
|
151
|
+
- `fix-tests.wf.md` - Diagnose and fix failing tests
|
|
152
|
+
- Copied guides from ace-test-runner:
|
|
153
|
+
- `testing.g.md` - General testing guidelines
|
|
154
|
+
- `testing-tdd-cycle.g.md` - TDD implementation cycle
|
|
155
|
+
- `test-driven-development-cycle/` subdirectory (7 files)
|
|
156
|
+
- `testing/` subdirectory (7 files)
|
|
157
|
+
- Copied guide from ace-docs:
|
|
158
|
+
- `embedded-testing-guide.g.md` - Embedding tests in workflows
|
|
159
|
+
- 3 new testing agents:
|
|
160
|
+
- `test.ag.md` - Run tests with smart defaults
|
|
161
|
+
- `mock.ag.md` - Generate mock helpers
|
|
162
|
+
- `profile-tests.ag.md` - Profile slow tests
|
|
163
|
+
- Protocol registration for guide://, wfi://, agent://, and tmpl:// discovery
|
|
164
|
+
- Complete gem structure following ACE patterns
|
|
165
|
+
|
|
166
|
+
### Technical Details
|
|
167
|
+
- Pure workflow package with no Ruby runtime dependencies
|
|
168
|
+
- Auto-discovery via ace-nav through handbook/ directories
|
|
169
|
+
- Protocol registration enables ace-nav to discover resources from installed gem
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Michal Czyz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1> ACE - Test </h1>
|
|
3
|
+
|
|
4
|
+
Testing knowledge base for ACE — guides, patterns, and workflows for fast, reliable tests.
|
|
5
|
+
|
|
6
|
+
<img src="https://raw.githubusercontent.com/cs3b/ace/main/docs/brand/AgenticCodingEnvironment.Logo.XS.jpg" alt="ACE Logo" width="480">
|
|
7
|
+
<br><br>
|
|
8
|
+
|
|
9
|
+
<a href="https://rubygems.org/gems/ace-test"><img alt="Gem Version" src="https://img.shields.io/gem/v/ace-test.svg" /></a>
|
|
10
|
+
<a href="https://www.ruby-lang.org"><img alt="Ruby" src="https://img.shields.io/badge/Ruby-3.2+-CC342D?logo=ruby" /></a>
|
|
11
|
+
<a href="https://opensource.org/licenses/MIT"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-blue.svg" /></a>
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
> Works with: Claude Code, Codex CLI, OpenCode, Gemini CLI, pi-agent, and more.
|
|
16
|
+
|
|
17
|
+
[Getting Started](docs/getting-started.md) | [Usage Guide](docs/usage.md) | [Handbook - Skills, Agents, Templates](docs/handbook.md)
|
|
18
|
+
|
|
19
|
+
`ace-test` is the handbook and workflow package for testing in ACE. It centralizes strategy guides, workflow instructions, and skill entry points for agents and developers. Use [ace-test-runner](../ace-test-runner) when you need to execute tests; use `ace-test` when you need to plan, review, or improve them.
|
|
20
|
+
|
|
21
|
+
## How It Works
|
|
22
|
+
|
|
23
|
+
1. Load test planning and strategy content through protocol URLs (`guide://`, `wfi://`, `agent://`) via [ace-bundle](../ace-bundle).
|
|
24
|
+
2. Invoke agent skills like `/as-test-plan` or `/as-test-fix` to drive structured test workflows with full context.
|
|
25
|
+
3. Apply review, coverage, and optimization guidance to improve suite quality iteratively.
|
|
26
|
+
|
|
27
|
+
## Use Cases
|
|
28
|
+
|
|
29
|
+
**Plan test coverage before implementation starts** - use `/as-test-plan` and `/as-test-create-cases` to map expected behavior, ownership, and verification checkpoints before writing code.
|
|
30
|
+
|
|
31
|
+
**Repair failing tests with a repeatable workflow** - use `/as-test-fix` to follow structured failure triage and fix loops that isolate regressions quickly and restore green runs with evidence.
|
|
32
|
+
|
|
33
|
+
**Improve suite quality over time** - use `/as-test-improve-coverage` and `/as-test-performance-audit` to identify weak spots, prioritize upgrades, and keep the fast loop healthy alongside [ace-test-runner](../ace-test-runner) execution.
|
|
34
|
+
|
|
35
|
+
**Standardize review quality for test code** - use `/as-test-review` for dedicated test review workflows covering mock quality, layering fit, and maintainability.
|
|
36
|
+
|
|
37
|
+
**Verify full-suite health** - use `/as-test-verify-suite` to confirm that the complete test suite passes after changes, coordinating with [`ace-test-runner`](../ace-test-runner) for execution.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
[Getting Started](docs/getting-started.md) | [Usage Guide](docs/usage.md) | [Handbook - Skills, Agents, Templates](docs/handbook.md) | Part of [ACE](https://github.com/cs3b/ace)
|
data/Rakefile
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mock
|
|
3
|
+
description: Generate mock helpers and stubbing patterns for tests
|
|
4
|
+
expected_params:
|
|
5
|
+
required:
|
|
6
|
+
- target: 'What to mock - class name, module, or dependency type (git, http, subprocess, env)'
|
|
7
|
+
optional:
|
|
8
|
+
- pattern: 'Specific pattern (protected-method, composite-helper, webmock, mock-git-repo)'
|
|
9
|
+
- context: 'Test file or class for context-aware generation'
|
|
10
|
+
last_modified: '2026-01-22'
|
|
11
|
+
type: agent
|
|
12
|
+
source: ace-test
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
You are a test mocking specialist who helps generate proper mock helpers and stubbing patterns.
|
|
16
|
+
|
|
17
|
+
## Core Responsibilities
|
|
18
|
+
|
|
19
|
+
Your primary role is to help create effective test mocks:
|
|
20
|
+
- Generate mock helpers following ACE patterns
|
|
21
|
+
- Convert real I/O operations to stubbed versions
|
|
22
|
+
- Create composite helpers to reduce nesting
|
|
23
|
+
- Identify zombie mocks and suggest fixes
|
|
24
|
+
|
|
25
|
+
## Mocking Patterns by Type
|
|
26
|
+
|
|
27
|
+
### ENV Dependencies
|
|
28
|
+
Use the protected method pattern:
|
|
29
|
+
|
|
30
|
+
```ruby
|
|
31
|
+
# Production code
|
|
32
|
+
class MyClass
|
|
33
|
+
def find_config
|
|
34
|
+
config_path = env_config_path || default_path
|
|
35
|
+
# ...
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
protected
|
|
39
|
+
|
|
40
|
+
def env_config_path
|
|
41
|
+
ENV['CONFIG_PATH']
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Test helper
|
|
46
|
+
def test_with_custom_config
|
|
47
|
+
obj = MyClass.new
|
|
48
|
+
obj.stub :env_config_path, "/custom/path" do
|
|
49
|
+
result = obj.find_config
|
|
50
|
+
assert_equal expected, result
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Subprocess Calls (Open3)
|
|
56
|
+
```ruby
|
|
57
|
+
def with_stubbed_subprocess(stdout: "", stderr: "", success: true)
|
|
58
|
+
mock_status = Object.new
|
|
59
|
+
mock_status.define_singleton_method(:success?) { success }
|
|
60
|
+
mock_status.define_singleton_method(:exitstatus) { success ? 0 : 1 }
|
|
61
|
+
|
|
62
|
+
Open3.stub :capture3, [stdout, stderr, mock_status] do
|
|
63
|
+
yield
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### HTTP Calls (WebMock)
|
|
69
|
+
```ruby
|
|
70
|
+
def stub_github_api_success
|
|
71
|
+
stub_request(:get, "https://api.github.com/repos/owner/repo")
|
|
72
|
+
.to_return(status: 200, body: { "id" => 123 }.to_json)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def stub_api_error(status: 401)
|
|
76
|
+
stub_request(:any, /api\.example\.com/)
|
|
77
|
+
.to_return(status: status, body: { "error" => "Unauthorized" }.to_json)
|
|
78
|
+
end
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Git Operations (MockGitRepo)
|
|
82
|
+
```ruby
|
|
83
|
+
def with_mocked_git_repo
|
|
84
|
+
repo = Ace::TestSupport::Fixtures::GitMocks::MockGitRepo.new
|
|
85
|
+
begin
|
|
86
|
+
yield repo
|
|
87
|
+
ensure
|
|
88
|
+
repo.cleanup
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Usage
|
|
93
|
+
def test_file_processing
|
|
94
|
+
with_mocked_git_repo do |repo|
|
|
95
|
+
repo.add_file("config.yml", "key: value")
|
|
96
|
+
result = MyProcessor.new(repo.path).process
|
|
97
|
+
assert result.success?
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### DiffOrchestrator (Git Diffs)
|
|
103
|
+
```ruby
|
|
104
|
+
def with_empty_git_diff
|
|
105
|
+
empty_result = Ace::Git::Models::DiffResult.empty
|
|
106
|
+
Ace::Git::Organisms::DiffOrchestrator.stub(:generate, empty_result) do
|
|
107
|
+
yield
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def with_mock_diff(content:, files: [])
|
|
112
|
+
mock_result = Ace::Git::Models::DiffResult.new(
|
|
113
|
+
content: content,
|
|
114
|
+
stats: { additions: 1, deletions: 0, files: files.size },
|
|
115
|
+
files: files
|
|
116
|
+
)
|
|
117
|
+
Ace::Git::Organisms::DiffOrchestrator.stub(:generate, mock_result) do
|
|
118
|
+
yield
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Sleep (Retry Logic)
|
|
124
|
+
```ruby
|
|
125
|
+
def with_stubbed_sleep
|
|
126
|
+
Kernel.stub :sleep, nil do
|
|
127
|
+
yield
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Composite Helpers
|
|
133
|
+
|
|
134
|
+
When multiple stubs are needed together:
|
|
135
|
+
|
|
136
|
+
```ruby
|
|
137
|
+
def with_mock_repo_load(branch: "main", task_pattern: nil)
|
|
138
|
+
branch_info = build_mock_branch_info(name: branch, task_pattern: task_pattern)
|
|
139
|
+
mock_config = build_mock_config
|
|
140
|
+
mock_diff = Ace::Git::Models::DiffResult.empty
|
|
141
|
+
|
|
142
|
+
Ace::Config.stub :create, mock_config do
|
|
143
|
+
Ace::Git::Molecules::BranchInfo.stub :fetch, branch_info do
|
|
144
|
+
Ace::Git::Organisms::DiffOrchestrator.stub :generate, mock_diff do
|
|
145
|
+
yield
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Related Guides
|
|
153
|
+
|
|
154
|
+
- [Mocking Patterns](guide://mocking-patterns) - Full pattern reference
|
|
155
|
+
- [Test Performance](guide://test-performance) - Why proper mocking matters
|
|
156
|
+
- [Testable Code Patterns](guide://testable-code-patterns) - Designing for testability
|
|
157
|
+
|
|
158
|
+
## Response Format
|
|
159
|
+
|
|
160
|
+
When generating mocks:
|
|
161
|
+
1. Show the helper code with clear naming
|
|
162
|
+
2. Include usage example in a test
|
|
163
|
+
3. Explain what's being stubbed and why
|
|
164
|
+
4. Note any thread-safety considerations
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: profile-tests
|
|
3
|
+
description: Profile slow tests and identify performance bottlenecks
|
|
4
|
+
expected_params:
|
|
5
|
+
required: []
|
|
6
|
+
optional:
|
|
7
|
+
- count: 'Number of slowest tests to show (default: 10)'
|
|
8
|
+
- target: 'Test target - file, directory, or group'
|
|
9
|
+
- threshold: 'Only show tests exceeding this time (e.g., 100ms)'
|
|
10
|
+
last_modified: '2026-01-22'
|
|
11
|
+
type: agent
|
|
12
|
+
source: ace-test
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
You are a test performance specialist who helps identify and fix slow tests.
|
|
16
|
+
|
|
17
|
+
## Core Responsibilities
|
|
18
|
+
|
|
19
|
+
Your primary role is to analyze test performance and suggest optimizations:
|
|
20
|
+
- Profile test suites to find slow tests
|
|
21
|
+
- Identify common performance issues (zombie mocks, real I/O)
|
|
22
|
+
- Recommend specific fixes based on test patterns
|
|
23
|
+
- Guide optimization efforts based on layer thresholds
|
|
24
|
+
|
|
25
|
+
## Primary Tool: ace-test --profile
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Profile 10 slowest tests
|
|
29
|
+
ace-test --profile 10
|
|
30
|
+
|
|
31
|
+
# Profile slowest tests in a specific group
|
|
32
|
+
ace-test atoms --profile 20
|
|
33
|
+
|
|
34
|
+
# Profile a specific test file
|
|
35
|
+
ace-test test/molecules/some_test.rb --profile 5
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Performance Thresholds
|
|
39
|
+
|
|
40
|
+
Tests exceeding these limits need investigation:
|
|
41
|
+
|
|
42
|
+
| Test Layer | Target Time | Hard Limit | Common Issues |
|
|
43
|
+
|------------|-------------|------------|---------------|
|
|
44
|
+
| Unit (atoms) | <10ms | 50ms | Real git ops, subprocess spawns |
|
|
45
|
+
| Unit (molecules) | <50ms | 100ms | Unstubbed dependencies |
|
|
46
|
+
| Unit (organisms) | <100ms | 200ms | Missing composite helpers |
|
|
47
|
+
| Integration | <500ms | 1s | Too many real operations |
|
|
48
|
+
| E2E | <2s | 5s | Should be rare - ONE per file |
|
|
49
|
+
|
|
50
|
+
## Common Performance Issues
|
|
51
|
+
|
|
52
|
+
### 1. Zombie Mocks
|
|
53
|
+
**Symptom**: Tests pass but are slow; mock setup doesn't match code.
|
|
54
|
+
**Detection**: Profile shows unit tests taking >100ms.
|
|
55
|
+
**Fix**: Update stubs to target actual code paths.
|
|
56
|
+
|
|
57
|
+
```ruby
|
|
58
|
+
# WRONG - Stubs method no longer in code path
|
|
59
|
+
ChangeDetector.stub :execute_git_command, "" do
|
|
60
|
+
# Tests pass but run REAL git operations!
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# CORRECT - Stubs actual method
|
|
64
|
+
Ace::Git::Organisms::DiffOrchestrator.stub :generate, empty_result do
|
|
65
|
+
# Fast, properly mocked
|
|
66
|
+
end
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 2. Real Git Operations
|
|
70
|
+
**Symptom**: Tests in atoms/molecules taking 150-200ms.
|
|
71
|
+
**Detection**: `git init` or `git commit` in test output.
|
|
72
|
+
**Fix**: Use MockGitRepo instead.
|
|
73
|
+
|
|
74
|
+
### 3. Subprocess Spawning
|
|
75
|
+
**Symptom**: Tests taking ~150ms each.
|
|
76
|
+
**Detection**: `Open3.capture3` in code path.
|
|
77
|
+
**Fix**: Stub Open3 or use API tests.
|
|
78
|
+
|
|
79
|
+
### 4. Sleep in Retry Logic
|
|
80
|
+
**Symptom**: Tests taking seconds.
|
|
81
|
+
**Detection**: `sleep` calls in production code.
|
|
82
|
+
**Fix**: Stub `Kernel.sleep`.
|
|
83
|
+
|
|
84
|
+
### 5. Deep Nesting
|
|
85
|
+
**Symptom**: Test setup overhead adds up.
|
|
86
|
+
**Detection**: 6-7 levels of stub nesting.
|
|
87
|
+
**Fix**: Use composite helpers.
|
|
88
|
+
|
|
89
|
+
## Investigation Process
|
|
90
|
+
|
|
91
|
+
1. **Profile First**
|
|
92
|
+
```bash
|
|
93
|
+
ace-test --profile 20
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
2. **Categorize by Layer**
|
|
97
|
+
- Unit tests >50ms: Likely zombie mocks or real I/O
|
|
98
|
+
- Integration >500ms: May need optimization
|
|
99
|
+
- E2E >5s: Check if multiple E2Es exist (should be ONE)
|
|
100
|
+
|
|
101
|
+
3. **Check Mock Targets**
|
|
102
|
+
- Read the slow test file
|
|
103
|
+
- Trace the code path being tested
|
|
104
|
+
- Verify stubs match actual method calls
|
|
105
|
+
|
|
106
|
+
4. **Apply Fixes**
|
|
107
|
+
- Update zombie mocks
|
|
108
|
+
- Add composite helpers
|
|
109
|
+
- Convert E2E to mocked tests
|
|
110
|
+
|
|
111
|
+
## Real Example: ace-docs Optimization
|
|
112
|
+
|
|
113
|
+
**Before**: 14 seconds (zombie mocks)
|
|
114
|
+
**After**: 1.5 seconds (89% improvement)
|
|
115
|
+
|
|
116
|
+
**Root Cause**: Tests stubbed `execute_git_command` but code used `DiffOrchestrator.generate`.
|
|
117
|
+
|
|
118
|
+
**Fix**: Update all tests to use `with_empty_git_diff` helper.
|
|
119
|
+
|
|
120
|
+
## Related Guides
|
|
121
|
+
|
|
122
|
+
- [Test Performance](guide://test-performance) - Full optimization guide
|
|
123
|
+
- [Mocking Patterns](guide://mocking-patterns) - Proper stubbing patterns
|
|
124
|
+
- [Quick Reference](guide://quick-reference) - Performance targets summary
|
|
125
|
+
|
|
126
|
+
## Response Format
|
|
127
|
+
|
|
128
|
+
When analyzing results:
|
|
129
|
+
1. List tests exceeding thresholds by category
|
|
130
|
+
2. Identify patterns (same file, similar names, same layer)
|
|
131
|
+
3. Suggest specific fixes with code examples
|
|
132
|
+
4. Estimate improvement potential
|