Commit 026cb6c
committed
Prevent CI from requiring Atlas on fork PRs (#250)
# Problem
CI was failing on fork PRs because lockfile-only changes (like adding a dependency in one package) would trigger all test targets, which forced `verify-schemas-synced` to run, requiring Atlas Cloud Token that forks don't have access to.
**Example**: Commit f11c32d only changed CLI code and `pnpm-lock.yaml`, but triggered:
1. `core:test:pgtap` (no inputs defined)
2. → `verify-migrations` (dependency)
3. → `verify-schemas-synced` (dependency)
4. → ❌ Atlas required → CI fails on forks
## Solution
Added explicit `inputs` to test targets so they only run when relevant files change, not on lockfile-only changes:
- **Core SQL tests** (`test:pgtap`): Narrow inputs - only schemas, migrations, and test files
- **TypeScript tests** (`test:vitest`, `test:integration`, `test:unit`): Broader inputs - source code and dependency production files
## How It Works
When `pnpm-lock.yaml` changes without source code changes:
1. Test targets check their inputs
2. No matching files changed → use cached results
3. `dependsOn` chain stops → `verify-schemas-synced` never called
4. Atlas not needed → ✅ CI succeeds on forks
## Trade-offs
**Benefit**: Fork contributors can run CI without Atlas/Supabase secrets
**Small risk**: Lockfile-only changes that re-resolve transitive dependencies (e.g., `postgres@3.0.5` → `3.0.6`) won't trigger tests. This is:
- Standard NX practice
- Usually safe (semver patch/minor changes)
- Mitigated by manual testing
- Can force re-run with `--skip-nx-cache`
## Changes
### Modified Files
- `pkgs/core/project.json` - Added narrow inputs to `test:pgtap`, `test:pgtap:watch`
- `pkgs/client/project.json` - Added inputs to `test:vitest`, `test:integration`, `test:unit`, `benchmark`
- `pkgs/edge-worker/project.json` - Added inputs to `test:unit`, `test:integration`, `test:e2e`
### New Documentation
- `.claude/nx_inputs_strategy.md` - Explains input strategy and trade-offs
- `TODO.md` - Future optimization for `dump-realtime-schema` caching
## Testing
Verified with commit f11c32d (CLI + lockfile changes):
- ✅ Core SQL tests would skip (no schemas/migrations changed)
- ✅ Client tests would skip (no client/dependency code changed)
- ✅ Edge-worker tests would skip (no edge-worker/dependency code changed)
- ✅ Atlas never called
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)1 parent 0d4623e commit 026cb6c
File tree
4 files changed
+59
-3
lines changed- pkgs
- client
- core
- edge-worker
4 files changed
+59
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
147 | 148 | | |
148 | 149 | | |
149 | 150 | | |
| |||
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
| 157 | + | |
156 | 158 | | |
157 | 159 | | |
158 | 160 | | |
| |||
163 | 165 | | |
164 | 166 | | |
165 | 167 | | |
| 168 | + | |
166 | 169 | | |
167 | 170 | | |
168 | 171 | | |
| |||
177 | 180 | | |
178 | 181 | | |
179 | 182 | | |
| 183 | + | |
180 | 184 | | |
181 | 185 | | |
182 | 186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
| |||
200 | 204 | | |
201 | 205 | | |
202 | 206 | | |
| 207 | + | |
| 208 | + | |
203 | 209 | | |
204 | 210 | | |
205 | 211 | | |
| |||
220 | 226 | | |
221 | 227 | | |
222 | 228 | | |
| 229 | + | |
| 230 | + | |
223 | 231 | | |
224 | 232 | | |
225 | 233 | | |
226 | | - | |
227 | | - | |
| 234 | + | |
228 | 235 | | |
229 | 236 | | |
230 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| 135 | + | |
135 | 136 | | |
136 | 137 | | |
137 | 138 | | |
| |||
144 | 145 | | |
145 | 146 | | |
146 | 147 | | |
| 148 | + | |
147 | 149 | | |
148 | 150 | | |
149 | 151 | | |
| |||
156 | 158 | | |
157 | 159 | | |
158 | 160 | | |
| 161 | + | |
159 | 162 | | |
160 | 163 | | |
161 | 164 | | |
| |||
0 commit comments