Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save pliablepixels/9c41e68b91c105b637d76e65ab4c6eaf to your computer and use it in GitHub Desktop.

Select an option

Save pliablepixels/9c41e68b91c105b637d76e65ab4c6eaf to your computer and use it in GitHub Desktop.
Mandatory test first
## πŸ‘€ User
Analyze agents.md to make sure its in great shape. One key issue I see is you implement things, run tests, say its all ok, but it breaks when I try. Are you generating/updating tests always? If not, how shoulD AGENTS.md be improved? I really want to follow a "test for everything" philosophy - when tests pass, it really should mean the app should work and all options/buttons/screens tested
---
## πŸ€– Claude
I'll analyze AGENTS.md and identify the testing gaps. Let me first check what tests currently exist:
---
## πŸ€– Claude
Now let me create a comprehensive analysis and proposed improvements to AGENTS.md:
---
## πŸ€– Claude
I've completed a comprehensive analysis of AGENTS.md and the testing gaps. Here's what I found:
## **Critical Problem You Identified** βœ…
You're absolutely right. I've been:
1. Implementing fixes (e.g., infinite loop in DashboardLayout)
2. Running `npm run build` only
3. Saying "build succeeded, no errors!"
4. Committing without running actual tests
**This is wrong.** Build only checks TypeScript compilation, not whether the app actually works.
## **Root Cause Analysis**
Looking at my recent work:
- Fixed infinite loop in `DashboardLayout.tsx` β†’ Never ran `npm test` or e2e tests
- Added skeleton loaders to `MontageMonitor.tsx` β†’ Never wrote or ran tests
- Fixed montage width measurement β†’ Never verified with tests
**I created `/Users/arjun/fiddle/zmNg/AGENTS_ANALYSIS.md`** with a detailed analysis.
## **Key Findings**
### What's Missing from AGENTS.md:
1. **No mandatory test execution workflow** - Says tests are "required" but doesn't enforce running them
2. **Build β‰  Working** - No warning that build success doesn't mean code works
3. **No test-first guidance** - Doesn't say WHEN to write tests (before/during/after)
4. **Weak enforcement** - Pre-commit checklist exists but doesn't require stating which tests were run
### Test Coverage Gaps I Created:
- βœ… 46 unit test files exist
- βœ… 7 e2e feature files exist
- ❌ `MontageMonitor.tsx` has no unit test (I changed it)
- ❌ `Montage.tsx` has no unit test (I changed it)
- ❌ `dashboard.feature` doesn't test "Recent Events" widget (the bug I fixed)
## **Proposed AGENTS.md Improvements**
### 1. Mandatory Verification Workflow
```markdown
For Every Code Change:
1. Run unit tests: npm test (must PASS)
2. Run relevant e2e: npm run test:e2e -- <feature>.feature
3. Run build: npm run build
4. Only then commit
Never claim code works without running tests.
```
### 2. Strengthen Testing Language
Change from: "Required for New Functionality"
Change to: "REQUIRED (No Exceptions) - Must run AND pass before commit"
### 3. Test-First Development
```markdown
Workflow:
1. Write failing test that reproduces bug
2. Implement fix
3. Verify test passes
4. Run full suite for regressions
```
### 4. Pre-Commit Must State Tests Run
```markdown
Example commit message:
"fix: infinite loop in dashboard
Tests verified:
- npm test βœ“
- npm run test:e2e -- dashboard.feature βœ“
- npm run build βœ“"
```
### 5. Add Common Mistakes Section
- ❌ "Build succeeded, no errors!" ← Wrong
- βœ… "Tests verified: npm test βœ“, e2e βœ“, build βœ“" ← Right
## **What I Should Have Done**
For the infinite loop fix:
1. Write e2e test scenario that adds "Recent Events" widget
2. Verify test fails with infinite loop error
3. Implement the fix
4. Run tests again - verify they pass
5. Run full e2e suite for regressions
6. Commit with test verification statement
Instead I:
1. Implemented fix
2. Ran `npm run build`
3. Said "build succeeded!"
4. Committed
## **Immediate Next Steps**
Would you like me to:
1. **Update AGENTS.md** with these improvements (I can show you the diff first)
2. **Write missing tests** for MontageMonitor, Montage, and dashboard Recent Events scenario
3. **Run the full test suite** now and fix any failures
4. **Add test command reference** to AGENTS.md so I know exactly what to run
The analysis document has detailed examples, test code snippets, and a complete rewrite of the testing sections. Want me to proceed with updating AGENTS.md?
---
## πŸ‘€ User
Do all 4.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment