Skip to content

Commit 431b062

Browse files
triage++
1 parent 1293807 commit 431b062

File tree

4 files changed

+141
-1
lines changed

4 files changed

+141
-1
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# TASK-143 — Cross-open modification compatibility (trigger schema interoperability)
2+
3+
## Goal
4+
Enable a database created by one CR-SQLite implementation (Zig vs Rust/C) to be **modified** by the other implementation without errors, and with correct change tracking.
5+
6+
This gap is currently explicitly marked as "known limitation" in `zig/harness/test-cross-open-parity.sh` (XO-003, XO-004, XO-006).
7+
8+
## Status
9+
- State: triage
10+
- Priority: high
11+
12+
## Problem Statement
13+
Cross-open **read-only** works, but cross-open **modification** fails due to trigger schema incompatibility.
14+
15+
Evidence:
16+
- `bash zig/harness/test-cross-open-parity.sh` reports:
17+
- 17 passed
18+
- 0 failed
19+
- 3 known-fail
20+
- Known-fail tests:
21+
- XO-003: Zig creates → Rust modifies → Zig reads
22+
- XO-004: Rust creates → Zig modifies → Rust reads
23+
- XO-006: alternating modification between implementations
24+
25+
Root cause (as described in `zig/harness/test-cross-open-parity.sh`):
26+
- Zig triggers embed `crsql_pack_columns()` directly in SQL.
27+
- Rust/C triggers call helper functions `crsql_after_insert/update/delete()`.
28+
29+
When an implementation opens a DB created by the other and attempts INSERT/UPDATE/DELETE, the triggers call functions that are missing / rejected:
30+
- Rust on Zig DB: "unsafe use of crsql_pack_columns" (or equivalent failure)
31+
- Zig on Rust DB: "no such function: crsql_after_*"
32+
33+
## Files to Modify
34+
(Exact scope to confirm during implementation planning; keep tight.)
35+
- `zig/harness/test-cross-open-parity.sh` (convert known-fail → real assertions once fixed)
36+
- One of:
37+
- `zig/src/as_crr.zig`
38+
- `zig/src/ffi/init.zig`
39+
- `zig/src/*.zig` trigger helper wiring (as needed)
40+
- Potentially (if required): `core/src/*.c` trigger schema / init (only if we decide to unify the schema on the Rust/C side)
41+
42+
## Acceptance Criteria
43+
1. `bash zig/harness/test-cross-open-parity.sh` reports:
44+
- XO-003 PASS
45+
- XO-004 PASS
46+
- XO-006 PASS
47+
- `KNOWN_FAIL: 0`
48+
2. Cross-implementation modification succeeds without relying on sqlite-cr wrapper (must follow `AGENTS.md` rule: Zig tested via clean `nix run nixpkgs#sqlite` + explicit `.load $ZIG_EXT`).
49+
3. Modifications performed by the "other" implementation are correctly reflected in:
50+
- base table data
51+
- `crsql_db_version()`
52+
- `__crsql_clock` / `crsql_changes` outputs, as asserted by the harness
53+
54+
## Parent Docs / Cross-links
55+
- `zig/harness/test-cross-open-parity.sh` (XO-003/004/006 known limitation)
56+
- `AGENTS.md` (Zig testing policy; sqlite-cr wrapper restrictions)
57+
58+
## Progress Log
59+
- 2025-12-21: Created task from known-fail cross-open modification tests.
60+
61+
## Completion Notes
62+
(Empty until done.)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# TASK-144 — Cross-platform wire compat: remove "SKIP: Rust/C extension not found" assumption
2+
3+
## Goal
4+
Ensure the cross-platform compatibility harness is a reliable invalidation tool in CI/dev environments by reducing spurious SKIPs.
5+
6+
Currently `zig/harness/test-cross-platform-compat.sh` can SKIP entirely when it cannot find the Rust/C extension.
7+
8+
## Status
9+
- State: triage
10+
- Priority: medium
11+
12+
## Problem Statement
13+
`zig/harness/test-cross-platform-compat.sh` prints:
14+
- `SKIP: Rust/C extension not found (need lib/crsqlite.dylib or core/dist/crsqlite.dylib)`
15+
16+
This means a key "interop" test can silently not run, making it easier to miss real compatibility regressions.
17+
18+
## Files to Modify
19+
- `zig/harness/test-cross-platform-compat.sh`
20+
- Potentially `zig/harness/test-parity.sh` (if it is responsible for calling compat tests)
21+
22+
## Acceptance Criteria
23+
1. The compat harness runs (not SKIPs) in a fresh checkout after running a small, documented build step.
24+
2. The harness outputs an actionable failure when the oracle cannot be built, instead of silently SKIP.
25+
3. A single documented command exists to provision the Rust/C extension (either build from source, or locate downloaded artifact).
26+
27+
## Parent Docs / Cross-links
28+
- `zig/harness/test-cross-platform-compat.sh`
29+
- `scripts/update-crsqlite-oracle.sh` (may be related)
30+
31+
## Progress Log
32+
- 2025-12-21: Created from observed SKIP in `test-cross-platform-compat.sh`.
33+
34+
## Completion Notes
35+
(Empty until done.)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# TASK-145 — Tighten schema evolution sync semantics (stop accepting SQL logic errors as PASS)
2+
3+
## Goal
4+
Turn the "acceptable error" paths in `zig/harness/test-schema-evolution.sh` into explicit, stable behavior assertions, so schema-evolution sync does not silently mask real compatibility issues.
5+
6+
## Status
7+
- State: triage
8+
- Priority: medium
9+
10+
## Problem Statement
11+
`zig/harness/test-schema-evolution.sh` currently treats some merge/apply failures as passing:
12+
- Scenario 2b: Apply changeset for dropped column
13+
- reports `WARN: SQL error (may be expected behavior)`
14+
- then treats error as acceptable and marks PASS
15+
- Scenario 3a: Merge changesets from different schema evolution paths
16+
- reports error and marks PASS if error message is "column-related"
17+
18+
This is a potential invalidation surface:
19+
- We might be masking a real bug (wrong error class, partial apply, data corruption).
20+
- Behavior may differ between implementations (Zig vs Rust/C).
21+
22+
## Files to Modify
23+
- `zig/harness/test-schema-evolution.sh`
24+
- Potentially: `zig/harness/test-oracle-parity.sh` (if we decide to oracle-compare schema-evolution errors)
25+
26+
## Acceptance Criteria
27+
1. The schema evolution harness encodes explicit expectations, e.g.:
28+
- exact error type/classification (not "SQL logic error" catch-all)
29+
- state invariants after the failed apply (no partial writes; db_version unchanged; table schema unchanged)
30+
2. The test fails if the observed behavior drifts (different error, partial apply, inconsistent clock state).
31+
3. If Rust/C behaves differently, the test records it as a parity gap with clear reproduction.
32+
33+
## Parent Docs / Cross-links
34+
- `zig/harness/test-schema-evolution.sh`
35+
36+
## Progress Log
37+
- 2025-12-21: Task created from observed "PASS with SQL logic error" patterns in schema evolution harness.
38+
39+
## Completion Notes
40+
(Empty until done.)

research/zig-cr/92-gap-backlog.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66

77
- MVP: ✅ complete (154/154 tests passing)
88
- Oracle parity: ✅ **18/18 pass** (all divergences fixed)
9+
- Cross-open modification compatibility: ❌ gap captured (XO-003/XO-004/XO-006) — see `.tasks/triage/TASK-143-cross-open-modification-compat.md`
910
- Zig implementation: `zig/`
1011
- Canonical task queue: `.tasks/{backlog,active,done}/`
1112

1213
## Now (next parallel assignments)
1314

14-
All oracle parity tests pass. Zig implementation is now wire-compatible with Rust/C oracle.
15+
All oracle parity tests pass. Zig implementation is wire-compatible with the Rust/C oracle for sync/wire format and read-only cross-open.
16+
17+
A remaining compatibility gap exists for **cross-open modification** (DB created by Zig modified by Rust/C, or vice versa). This is tracked as a first-class gap: `.tasks/triage/TASK-143-cross-open-modification-compat.md`.
1518

1619
### Hypothesis Invalidation (Done)
1720
- [x] **TASK-127** — Experimentally invalidate "full parity" hypothesis via fuzzing ✓ `.tasks/done/TASK-127-experimental-parity-invalidation.md`

0 commit comments

Comments
 (0)