Skip to content

Commit fe2e3bf

Browse files
author
CID Agent
committed
cid(review): PASS — conformance feature gate for iscc-wasm
1 parent b43a91a commit fe2e3bf

File tree

4 files changed

+32
-40
lines changed

4 files changed

+32
-40
lines changed

.claude/context/handoff.md

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,31 @@
1-
## 2026-02-25 — Gate iscc-wasm `conformance_selftest` behind Cargo feature
1+
## 2026-02-25 — Review of: Gate iscc-wasm `conformance_selftest` behind Cargo feature
22

3-
**Done:** Added `conformance` Cargo feature to iscc-wasm that gates the `conformance_selftest` WASM
4-
export. Production WASM binaries no longer include the selftest function (and its embedded JSON
5-
vectors/parsing logic) unless explicitly opted in. CI workflow updated to enable the feature during
6-
testing.
3+
**Verdict:** PASS
74

8-
**Files changed:**
5+
**Summary:** Clean, minimal implementation adding a `conformance` Cargo feature to iscc-wasm that
6+
gates the `conformance_selftest` WASM export. All 54 wasm-pack tests pass with the feature enabled,
7+
CI workflow correctly updated, and no quality gate circumvention.
98

10-
- `crates/iscc-wasm/Cargo.toml`: added `[features]` section with `conformance = []`
11-
- `crates/iscc-wasm/src/lib.rs`: added `#[cfg(feature = "conformance")]` gate on
12-
`conformance_selftest` export
13-
- `crates/iscc-wasm/tests/unit.rs`: added `#[cfg(feature = "conformance")]` gate on
14-
`test_conformance_selftest_returns_true` test
15-
- `.github/workflows/ci.yml`: changed wasm-pack test command to
16-
`wasm-pack test --node crates/iscc-wasm --features conformance`
9+
**Verification:**
1710

18-
**Verification:** All 54 wasm-pack tests pass (9 conformance + 45 unit). Clippy clean. All 14
19-
pre-commit hooks pass. All 5 verification criteria from next.md satisfied:
11+
- [x] `wasm-pack test --node crates/iscc-wasm --features conformance` passes all 54 tests (9
12+
conformance + 45 unit)
13+
- [x] `cargo clippy -p iscc-wasm -- -D warnings` clean
14+
- [x] `grep -q '^\[features\]' crates/iscc-wasm/Cargo.toml` exits 0 — features section exists
15+
- [x] `grep -q 'cfg.*feature.*conformance' crates/iscc-wasm/src/lib.rs` exits 0 — feature gate
16+
present
17+
- [x] `grep -q '\-\-features conformance' .github/workflows/ci.yml` exits 0 — CI updated
2018

21-
- `[x]` `wasm-pack test --node crates/iscc-wasm --features conformance` passes all 54 tests
22-
- `[x]` `cargo clippy -p iscc-wasm -- -D warnings` clean
23-
- `[x]` `grep -q '^\[features\]' crates/iscc-wasm/Cargo.toml` exits 0
24-
- `[x]` `grep -q 'cfg.*feature.*conformance' crates/iscc-wasm/src/lib.rs` exits 0
25-
- `[x]` `grep -q '\-\-features conformance' .github/workflows/ci.yml` exits 0
19+
**Issues found:**
20+
21+
- (none)
2622

2723
**Next:** Remaining `[low]` issues: iscc-wasm stale CLAUDE.md (DataHasher/InstanceHasher documented
28-
as unbound), iscc-jni exception mapping, and TypeScript port evaluation.
29-
30-
**Notes:** The next.md template suggested
31-
`wasm-pack test --node crates/iscc-wasm -- --features conformance` (with `--` separator), but this
32-
is incorrect — `--` in wasm-pack passes args to the test runner binary (wasm-bindgen-test-runner),
33-
not to cargo. The correct syntax is `wasm-pack test --node crates/iscc-wasm --features conformance`
34-
(features as extra options after the path). This was discovered and fixed during implementation. The
35-
issue #3 in issues.md (`conformance_selftest unconditionally exported`) is now resolved by this
36-
change.
24+
as unbound), iscc-jni exception mapping, and TypeScript port evaluation. Define-next should pick the
25+
next highest-value item from the remaining low-priority issues.
26+
27+
**Notes:** The advance agent correctly identified that next.md's suggested CI syntax
28+
`wasm-pack test --node crates/iscc-wasm -- --features conformance` (with `--` separator) is wrong —
29+
`--` in wasm-pack passes args to wasm-bindgen-test-runner, not to cargo. The correct form is
30+
`wasm-pack test --node crates/iscc-wasm --features conformance`. This is now documented in
31+
learnings.md. Issue #3 (`conformance_selftest unconditionally exported`) resolved and deleted.

.claude/context/issues.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,6 @@ state-related errors (finalized hashers, etc.).
9090

9191
**Source:** [human]
9292

93-
## [low] iscc-wasm: `conformance_selftest` unconditionally exported increases binary size
94-
95-
In `crates/iscc-wasm/src/lib.rs:197`, `conformance_selftest()` is exported via `#[wasm_bindgen]`
96-
without a feature gate. This pulls embedded JSON test vectors and parsing logic into every WASM
97-
binary, increasing bundle size for browser consumers who don't need diagnostics.
98-
99-
Fix: gate the export behind a Cargo feature (e.g., `feature = "conformance"`) that is off by default
100-
for production builds.
101-
102-
**Source:** [human]
103-
10493
## [low] iscc-wasm: Stale CLAUDE.md says DataHasher/InstanceHasher not yet bound
10594

10695
In `crates/iscc-wasm/CLAUDE.md:130-131`, the documentation states "DataHasher and InstanceHasher

.claude/context/iterations.jsonl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,3 +293,8 @@
293293
{"ts":"2026-02-25T07:58:01.988026+00:00","iteration":21,"role":"define-next","status":"OK","turns":20,"cost_usd":0.663946,"duration_s":128.9}
294294
{"ts":"2026-02-25T08:02:44.790355+00:00","iteration":21,"role":"advance","status":"OK","turns":42,"cost_usd":1.427565,"duration_s":282.8}
295295
{"iteration":21,"timestamp":"2026-02-25T08:10:00Z","step":"Add __version__ attribute and fix iscc-py module docstring","verdict":"PASS","files_changed":["crates/iscc-py/python/iscc_lib/__init__.py","crates/iscc-py/src/lib.rs","tests/test_smoke.py"],"issues_resolved":["iscc-py: Missing __version__ attribute","iscc-py: Module docstring references wrong package name"],"tests":{"python":159},"notes":"Standard importlib.metadata.version() pattern. 3 docstring references fixed. 2 new tests."}
296+
{"ts":"2026-02-25T08:06:14.269325+00:00","iteration":21,"role":"review","status":"OK","turns":32,"cost_usd":0.978825,"duration_s":209.5}
297+
{"ts":"2026-02-25T08:29:15.536433+00:00","iteration":22,"role":"update-state","status":"OK","turns":19,"cost_usd":0.759989,"duration_s":234.7}
298+
{"ts":"2026-02-25T08:32:29.540531+00:00","iteration":22,"role":"define-next","status":"OK","turns":25,"cost_usd":0.966584,"duration_s":194.0}
299+
{"ts":"2026-02-25T08:36:43.157615+00:00","iteration":22,"role":"advance","status":"OK","turns":38,"cost_usd":1.019102,"duration_s":253.6}
300+
{"iteration":22,"timestamp":"2026-02-25T08:45:00Z","step":"Gate iscc-wasm conformance_selftest behind Cargo feature","verdict":"PASS","files_changed":["crates/iscc-wasm/Cargo.toml","crates/iscc-wasm/src/lib.rs","crates/iscc-wasm/tests/unit.rs",".github/workflows/ci.yml"],"issues_resolved":["iscc-wasm: conformance_selftest unconditionally exported"],"tests":{"wasm_pack":54},"notes":"Clean minimal change. wasm-pack --features goes after path, not after --."}

.claude/context/learnings.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ Accumulated knowledge from CID iterations. Each review agent appends findings he
119119
Error mapping uses `JsError::new(&e.to_string())`
120120
- WASM crate uses `cdylib` crate-type and `publish = false` (published via npm, not crates.io) —
121121
same pattern as the notes/02 architecture document specifies
122+
- wasm-pack `--features` must go AFTER the path argument, NOT after `--`. `--` passes args to the
123+
test runner (wasm-bindgen-test-runner), not to cargo. Correct:
124+
`wasm-pack test --node crates/iscc-wasm --features conformance`
122125
- WASM crate needs `crate-type = ["cdylib", "rlib"]` (not just `cdylib`) to support integration
123126
tests — Rust can't link `cdylib` for the test harness. wasm-pack uses `cdylib` for packaging and
124127
`rlib` for test compilation. This is the standard pattern for WASM crates with tests

0 commit comments

Comments
 (0)