Skip to content

Commit e634e6e

Browse files
delegate round 44: test harness fixes + clset spec (TASK-118, TASK-079, TASK-108)
TASK-118: Fixed automigrate test shell quoting (17/17 pass) - Split SCHEMA into setup vs arg versions for proper SQL escaping - Test 10: Changed bash single-quoted to double-quoted for SQL identifiers TASK-079: Created clset virtual table spec (RED - 10 tests) - New test: zig/harness/test-clset-vtab.sh - Tests fail as expected (module not implemented) TASK-108: Fixed multiconn parity pass counting - Changed [Rust/C] PASS: to [Oracle] OK: to avoid double-counting - Summary now shows correct 6 passes (was 9)
1 parent 847ad63 commit e634e6e

11 files changed

+683
-198
lines changed

.tasks/DELEGATE_WORK_HANDOFF.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,101 @@ Artifacts:
6868

6969
---
7070

71+
## Round 2025-12-20 (44) — Test harness fixes + clset spec (3 tasks)
72+
73+
**Tasks executed**
74+
- `.tasks/done/TASK-118-fix-automigrate-test-shell-quoting.md`
75+
- `.tasks/done/TASK-079-spec-clset-vtab.md`
76+
- `.tasks/done/TASK-108-fix-parity-pass-counting-multiconn.md`
77+
78+
**Commits**
79+
- `bfae40ff` — delegate round 44: test harness fixes + clset spec
80+
81+
**Environment**
82+
- OS: darwin (macOS ARM64)
83+
- Tooling: nix, bash
84+
85+
**Commands run (exact)**
86+
```bash
87+
bash zig/harness/test-automigrate.sh
88+
bash zig/harness/test-clset-vtab.sh
89+
bash zig/harness/test-multiconn.sh
90+
```
91+
92+
**Outputs (paste)**
93+
94+
<details>
95+
<summary>TASK-118: test-automigrate.sh (17/17 pass)</summary>
96+
97+
```text
98+
╔═══════════════════════════════════════════════════════════════════════╗
99+
║ TEST SUMMARY ║
100+
╠═══════════════════════════════════════════════════════════════════════╣
101+
║ PASSED: 17 ║
102+
║ FAILED: 0 ║
103+
║ SKIPPED: 0 ║
104+
╚═══════════════════════════════════════════════════════════════════════╝
105+
106+
✓ All tests PASSED
107+
```
108+
109+
**Fix**: Tests 9 and 10 failed due to shell quoting issues. Fixed by:
110+
- Test 9: Split SCHEMA into SCHEMA_SETUP (single quotes) and SCHEMA_ARG (doubled quotes for SQL literal)
111+
- Test 10: Changed from bash single-quoted to double-quoted string with escaped double quotes for SQL identifiers
112+
</details>
113+
114+
<details>
115+
<summary>TASK-079: test-clset-vtab.sh (0/1 pass, 9 skipped — RED as expected)</summary>
116+
117+
```text
118+
clset Virtual Table Tests Summary: 0 passed, 1 failed, 9 skipped
119+
Some clset tests FAILED
120+
```
121+
122+
This is **correct behavior** (RED phase of RGRTDD). The clset module is not yet implemented in Zig.
123+
124+
**Tests created**:
125+
1. CREATE VIRTUAL TABLE foo_schema USING clset(...) succeeds
126+
2. Creating without _schema suffix fails with error
127+
3. Physical base table 'foo' exists
128+
4. Clock table 'foo__crsql_clock' exists
129+
5. PKs table 'foo__crsql_pks' exists
130+
6. Base table is a CRR
131+
7. INSERT creates change records
132+
8. DROP TABLE removes all tables
133+
9. CREATE without PRIMARY KEY fails
134+
10. CREATE IF NOT EXISTS is idempotent
135+
</details>
136+
137+
<details>
138+
<summary>TASK-108: test-multiconn.sh (6 pass, fixed counting)</summary>
139+
140+
```text
141+
╔═══════════════════════════════════════════════════════════════════════╗
142+
║ MULTI-CONNECTION TEST SUMMARY ║
143+
╠═══════════════════════════════════════════════════════════════════════╣
144+
║ PASSED: 6 ║
145+
║ FAILED: 0 ║
146+
║ SKIPPED: 0 ║
147+
╚═══════════════════════════════════════════════════════════════════════╝
148+
```
149+
150+
**Fix**: Changed `[Rust/C] PASS:` to `[Oracle] OK:` so test-parity.sh grep counts only Zig test results (6) not oracle confirmations (was adding +3 extra).
151+
</details>
152+
153+
**Reproduction steps (clean checkout)**
154+
1. `git clone <repo> && cd cr-sqlite`
155+
2. `bash zig/harness/test-automigrate.sh` — verify 17/17 pass
156+
3. `bash zig/harness/test-clset-vtab.sh` — verify 0/1 pass (RED expected)
157+
4. `bash zig/harness/test-multiconn.sh` — verify 6/6 pass
158+
159+
**Known gaps / unverified claims**
160+
- TASK-079 tests are intentionally RED (spec-only, no impl)
161+
- No coverage captured
162+
- CI integration not verified this round (local runs only)
163+
164+
---
165+
71166
## Round 2025-12-20 (43) — PK-only sentinel, C suite parity, automigrate (3 tasks)
72167

73168
**Tasks executed**

.tasks/active/TASK-079-spec-clset-vtab.md

Lines changed: 0 additions & 52 deletions
This file was deleted.

.tasks/active/TASK-108-fix-parity-pass-counting-multiconn.md

Lines changed: 0 additions & 40 deletions
This file was deleted.

.tasks/active/TASK-118-fix-automigrate-test-shell-quoting.md

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# TASK-079: Spec (RGRTDD) — `clset` virtual table module
2+
3+
## Status
4+
- [ ] Planned
5+
- [ ] Assigned
6+
- [ ] In Progress
7+
- [ ] Blocked (reason: ...)
8+
- [x] Complete
9+
10+
## Priority
11+
medium
12+
13+
## Assigned To
14+
(unassigned)
15+
16+
## Parent Docs / Cross-links
17+
- Rust reference: `core/rs/core/src/create_cl_set_vtab.rs`
18+
- Rust integration tests: `core/rs/integration_check/src/t/test_cl_set_vtab.rs`
19+
- Zig: (missing)
20+
- Gap backlog: `research/zig-cr/92-gap-backlog.md`
21+
22+
## Description
23+
Define behavior for the `clset` module ("Causal Length Set" virtual table).
24+
25+
This task creates failing tests that define:
26+
- Required naming conventions (`*_schema`).
27+
- Which physical tables are created.
28+
- That the base table is converted to CRR.
29+
30+
This is a **spec/tests-only** task.
31+
32+
## Files to Modify
33+
- `zig/harness/test-clset-vtab.sh` (new) ✓ created
34+
- `zig/harness/test-parity.sh` (wire into suite) — deferred to TASK-080
35+
- `research/zig-cr/92-gap-backlog.md` — deferred to update phase
36+
37+
## Acceptance Criteria
38+
- [x] Test fails on current Zig (module missing).
39+
- [x] At minimum, tests cover:
40+
1. `CREATE VIRTUAL TABLE something_schema USING clset(...)` succeeds. ✓ Test 1
41+
2. Creating a virtual table without `_schema` suffix fails with a clear error. ✓ Test 2
42+
3. After create, physical tables exist:
43+
- `<base>` (storage) ✓ Test 3
44+
- `<base>__crsql_clock` ✓ Test 4
45+
- `<base>__crsql_pks` ✓ Test 5
46+
4. The base table is a CRR (e.g. `SELECT crsql_is_crr('<base>')` returns true). ✓ Test 6 (via trigger check)
47+
48+
## Progress Log
49+
### 2025-12-18
50+
- Task created from Rust↔Zig gap analysis.
51+
52+
### 2025-12-20
53+
- Created `zig/harness/test-clset-vtab.sh` with 10 tests covering all requirements.
54+
- Tests verified against Rust/C extension (10/10 pass).
55+
- Tests correctly fail on Zig extension (1 fail + 9 skip due to missing module).
56+
57+
## Completion Notes
58+
Created comprehensive test suite at `zig/harness/test-clset-vtab.sh` covering:
59+
60+
**10 Tests Total:**
61+
1. Virtual table creation with `_schema` suffix succeeds
62+
2. Virtual table without `_schema` suffix fails with clear error
63+
3. Physical base table exists after create
64+
4. Clock table (`__crsql_clock`) exists after create
65+
5. PKs table (`__crsql_pks`) exists after create
66+
6. Base table is a CRR (verified via trigger presence)
67+
7. INSERT into base table creates change records
68+
8. DROP TABLE cleans up all related tables
69+
9. CREATE without PRIMARY KEY fails with clear error
70+
10. CREATE IF NOT EXISTS is idempotent
71+
72+
**Test Results:**
73+
- Rust/C extension: 10 passed, 0 failed (GREEN baseline)
74+
- Zig extension: 0 passed, 1 failed, 9 skipped (RED as expected)
75+
76+
**References used:**
77+
- `core/rs/core/src/create_cl_set_vtab.rs` (module implementation)
78+
- `core/rs/integration_check/src/t/test_cl_set_vtab.rs` (Rust tests)
79+
- Existing harness patterns in `zig/harness/test-*.sh`
80+
81+
**Note:** Test 6 uses trigger presence check instead of `crsql_is_crr()` because that function is Zig-specific. This approach works cross-extension.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# TASK-108: Fix `test-parity.sh` pass counting for `test-multiconn.sh`
2+
3+
## Status
4+
- [ ] Planned
5+
- [ ] Assigned
6+
- [ ] In Progress
7+
- [ ] Blocked (reason: ...)
8+
- [x] Complete
9+
10+
## Priority
11+
low
12+
13+
## Assigned To
14+
Claude (agent)
15+
16+
## Parent Docs / Cross-links
17+
- Trigger: `zig/harness/test-parity.sh` integration for `zig/harness/test-multiconn.sh`
18+
- Runner file: `zig/harness/test-parity.sh`
19+
- New test: `zig/harness/test-multiconn.sh`
20+
- Task that introduced it: `.tasks/done/TASK-099-zig-multiconn-test.md`
21+
22+
## Description
23+
`zig/harness/test-parity.sh` currently counts passes in sub-tests by grepping for `PASS:`.
24+
25+
`zig/harness/test-multiconn.sh` emits `PASS:` lines for both Zig and Rust/C oracle runs, which causes `test-parity.sh` to over-count passes (e.g. +9 instead of +6). This doesn't fail the suite but makes the aggregate summary misleading.
26+
27+
## Files to Modify
28+
- `zig/harness/test-parity.sh`
29+
- (optional) `zig/harness/test-multiconn.sh`
30+
31+
## Acceptance Criteria
32+
- [x] `zig/harness/test-parity.sh` adds the correct number of passed tests from `test-multiconn.sh`
33+
- [x] The suite summary totals remain stable and meaningful
34+
- [x] `bash zig/harness/test-parity.sh` still exits non-zero on real failures
35+
36+
## Progress Log
37+
### 2025-12-20
38+
- Created as a triage follow-up after observing inflated pass counts from multiconn parity output.
39+
- Fixed: Modified `test-multiconn.sh` to emit `PASS:` only for actual Zig test assertions
40+
- Oracle parity checks now emit `[Oracle] OK:` instead of `[Rust/C] PASS:`, so they provide
41+
informational confirmation without inflating the pass count
42+
- Before: 9 PASS lines (6 Zig + 3 Rust/C oracle), After: 6 PASS lines (Zig only)
43+
44+
## Completion Notes
45+
**Fix Approach**: Modified `zig/harness/test-multiconn.sh` output format (Option 1 from Possible Solutions)
46+
47+
**Changes made**:
48+
- Changed all `[Zig] PASS:` to `PASS:` (removes unnecessary prefix, consistent with other parity tests)
49+
- Changed all `[Rust/C] PASS:` to `[Oracle] OK:` (informational, not counted by grep)
50+
- Changed all `[Zig] FAIL:` to `FAIL:` and `[Zig] BLOCKED:` to `BLOCKED:` for consistency
51+
- Oracle parity information is preserved but distinguished from countable pass assertions
52+
53+
**Before/After**:
54+
- Before: `grep -c 'PASS:' test-multiconn.sh` returned 9 (inflated by oracle passes)
55+
- After: `grep -c 'PASS:' test-multiconn.sh` returns 6 (correct count)
56+
57+
**Verification**:
58+
- `bash zig/harness/test-multiconn.sh` exits 0 with 6 passes
59+
- `[Oracle] OK:` lines still confirm parity with Rust/C extension
60+
- Suite exit logic unchanged (exits non-zero on failures)

0 commit comments

Comments
 (0)