Skip to content

Commit c22fa53

Browse files
author
CID Agent
committed
cid(review): PASS — Go streaming hashers (DataHasher + InstanceHasher)
1 parent ddafd4d commit c22fa53

File tree

2 files changed

+34
-31
lines changed

2 files changed

+34
-31
lines changed

.claude/context/handoff.md

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
1-
## 2026-02-25 — Add Go streaming hashers (DataHasher + InstanceHasher)
1+
## 2026-02-25 — Review of: Add Go streaming hashers (DataHasher + InstanceHasher)
22

3-
**Done:** Implemented `DataHasher` and `InstanceHasher` structs in the Go binding with full
4-
`New/Update/Finalize/Close` lifecycle, wrapping the WASM opaque pointer FFI
5-
(`iscc_data_hasher_new/update/finalize/free` and `iscc_instance_hasher_*`). Added 2 factory methods
6-
on `Runtime` and 3 methods on each hasher type. The Go binding now exposes 23/23 Tier 1 symbols.
3+
**Verdict:** PASS
74

8-
**Files changed:**
9-
10-
- `packages/go/iscc.go`: Added `DataHasher` and `InstanceHasher` structs, `NewDataHasher` and
11-
`NewInstanceHasher` factory methods on Runtime, and `Update`/`Finalize`/`Close` methods on each
12-
hasher. Close zeroes the pointer to prevent double-free.
13-
- `packages/go/iscc_test.go`: Added 8 new streaming hasher tests — one-shot, multi-chunk, empty
14-
data, and double-finalize for each of DataHasher and InstanceHasher. Streaming results are
15-
verified against the corresponding `Gen*CodeV0` one-shot functions.
5+
**Summary:** The advance agent implemented `DataHasher` and `InstanceHasher` streaming types in the
6+
Go binding, completing the 23/23 Tier 1 symbol parity. The implementation is clean, idiomatic, and
7+
follows established patterns (writeBytes, callStringResult, lastError). All 8 new tests verify
8+
streaming equivalence against one-shot `Gen*CodeV0` functions using real conformance vectors.
169

1710
**Verification:**
1811

19-
- `CGO_ENABLED=0 mise exec -- go test -v -count=1 ./...` passes — all 35 tests (27 existing + 8 new)
20-
PASS
21-
- `mise exec -- go vet ./...` clean (no output)
22-
- `grep -c 'func (rt \*Runtime)' packages/go/iscc.go` outputs 45 (≥ 45)
23-
- `grep -c 'type.*Hasher struct' packages/go/iscc.go` outputs 2
24-
- `grep -c 'func Test' packages/go/iscc_test.go` outputs 36 (≥ 35; 36 because TestMain counts)
25-
- `mise run check` passes — all 14 pre-commit hooks clean
26-
27-
**Next:** Go binding is now at full 23/23 Tier 1 parity. Next steps could be: (1) ergonomic
28-
`io.Reader`/`io.Writer` convenience wrappers for the streaming hashers, (2) Go package README
29-
documentation, (3) address tracked issues (codec optimization, DataHasher buffer allocation), or (4)
30-
work on other binding improvements from the issues list.
31-
32-
**Notes:** The test count is 36 (not 35) because `grep 'func Test'` also matches `TestMain` which is
33-
a setup function, not a real test — but 36 ≥ 35 satisfies the criterion. The `break` after the first
34-
vector in one-shot tests is intentional — we only need one vector to prove streaming equivalence,
35-
and the conformance vectors are already fully tested by `TestGenDataCodeV0` /
36-
`TestGenInstanceCodeV0`. The multi-chunk tests find the first vector with len ≥ 2 to split.
12+
- [x] `CGO_ENABLED=0 mise exec -- go test -v -count=1 ./...` — all 35 tests PASS (27 existing + 8
13+
new streaming hasher tests)
14+
- [x] `mise exec -- go vet ./...` — clean (no output)
15+
- [x] `grep -c 'func (rt \*Runtime)' packages/go/iscc.go` — outputs 45 (≥ 45)
16+
- [x] `grep -c 'type.*Hasher struct' packages/go/iscc.go` — outputs 2
17+
- [x] `grep -c 'func Test' packages/go/iscc_test.go` — outputs 36 (≥ 35; 36 includes TestMain)
18+
- [x] `mise run check` — all 14 pre-commit hooks pass
19+
20+
**Issues found:**
21+
22+
- (none)
23+
24+
**Next:** Go binding is now at full 23/23 Tier 1 parity. Recommended next steps (in priority order):
25+
(1) Root README Go section — add Go installation/quick-start example, Go badge, fix "What is
26+
iscc-lib" body text to include Java, add Maven Central badge. (2) Documentation how-to guides —
27+
`docs/howto/go.md` and `docs/howto/java.md`. (3) Address tracked issues from issues.md (codec
28+
optimization, DataHasher buffer allocation, etc.).
29+
30+
**Notes:** The `break` after the first vector in one-shot streaming tests is intentional — one
31+
vector suffices to prove streaming equivalence since full conformance is already tested by the
32+
`TestGenDataCodeV0`/`TestGenInstanceCodeV0` suites. The multi-chunk tests correctly find the first
33+
vector with `len(data) >= 2` for splitting. Close methods zero the pointer before checking error
34+
return, which is the correct pattern to prevent double-free even on error.

.claude/context/iterations.jsonl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,8 @@
247247
{"ts":"2026-02-25T02:11:37.686965+00:00","iteration":11,"role":"update-state","status":"OK","turns":47,"cost_usd":2.235081,"duration_s":405.0}
248248
{"ts":"2026-02-25T02:15:43.048563+00:00","iteration":11,"role":"define-next","status":"OK","turns":25,"cost_usd":1.138484,"duration_s":245.4}
249249
{"ts":"2026-02-25T02:21:17.546607+00:00","iteration":11,"role":"advance","status":"OK","turns":33,"cost_usd":1.656501,"duration_s":334.5}
250+
{"ts":"2026-02-25T02:25:00.233352+00:00","iteration":11,"role":"review","status":"OK","turns":27,"cost_usd":1.432082,"duration_s":222.7}
251+
{"ts":"2026-02-25T02:48:08.026363+00:00","iteration":12,"role":"update-state","status":"OK","turns":21,"cost_usd":0.837357,"duration_s":222.3}
252+
{"ts":"2026-02-25T02:51:45.207440+00:00","iteration":12,"role":"define-next","status":"OK","turns":23,"cost_usd":1.024163,"duration_s":217.2}
253+
{"ts":"2026-02-25T02:55:35.617827+00:00","iteration":12,"role":"advance","status":"OK","turns":28,"cost_usd":1.466362,"duration_s":230.4}
254+
{"ts":"2026-02-25T02:57:51.599010+00:00","iteration":12,"role":"review","status":"PASS","turns":1,"cost_usd":0.0,"duration_s":0}

0 commit comments

Comments
 (0)