|
1 | | -## 2026-02-25 — Add 6 Go wrappers (text utils + encode + string-array functions) |
| 1 | +## 2026-02-25 — Review of: Add 6 Go wrappers (text utils + encode + string-array functions) |
2 | 2 |
|
3 | | -**Done:** Implemented 6 new Go wrappers on the `Runtime` type: `TextRemoveNewlines`, `TextCollapse`, |
4 | | -`TextTrim`, `EncodeBase64` (Group A: string-returning, following the `TextClean` pattern), plus |
5 | | -`SlidingWindow` and `IsccDecompose` (Group B: string-array-returning, using new `readStringArray`, |
6 | | -`freeStringArray`, and `callStringArrayResult` helpers). All build on the established WASM bridge |
7 | | -patterns. |
| 3 | +**Verdict:** PASS |
8 | 4 |
|
9 | | -**Files changed:** |
10 | | - |
11 | | -- `packages/go/iscc.go`: Added 6 public methods (TextRemoveNewlines, TextCollapse, TextTrim, |
12 | | - EncodeBase64, SlidingWindow, IsccDecompose) and 3 private helper methods (readStringArray, |
13 | | - freeStringArray, callStringArrayResult) for reading null-terminated C string pointer arrays from |
14 | | - WASM32 memory |
15 | | -- `packages/go/iscc_test.go`: Added 8 test functions (TestTextRemoveNewlines, TestTextCollapse, |
16 | | - TestTextTrim, TestEncodeBase64, TestSlidingWindow, TestSlidingWindowError, TestIsccDecompose) |
17 | | - plus the existing 14 tests continue to pass |
| 5 | +**Summary:** All 6 Go wrappers implemented cleanly following established patterns. Group A |
| 6 | +(TextRemoveNewlines, TextCollapse, TextTrim, EncodeBase64) mirrors the TextClean pattern exactly. |
| 7 | +Group B (SlidingWindow, IsccDecompose) introduces well-structured readStringArray/freeStringArray/ |
| 8 | +callStringArrayResult helpers for null-terminated pointer arrays. All 22 Go tests pass (14 existing |
| 9 | +\+ 8 new), all 14 pre-commit hooks pass, go vet clean. |
18 | 10 |
|
19 | 11 | **Verification:** |
20 | 12 |
|
21 | | -- `CGO_ENABLED=0 go test -v -count=1 ./...` in `packages/go/` passes — 22 tests (14 existing + 8 |
| 13 | +- [x] `CGO_ENABLED=0 go test -v -count=1 ./...` in `packages/go/` passes — 22 tests (14 existing + 8 |
22 | 14 | new), all PASS |
23 | | -- `go vet ./...` in `packages/go/` is clean (no output) |
24 | | -- `grep -c 'func (rt \*Runtime)' packages/go/iscc.go` outputs 32 (23 existing + 9 new — the 6 public |
25 | | - wrappers plus 3 private helpers). Note: next.md expected 17 but undercounted the existing |
26 | | - private helper methods on Runtime |
27 | | -- `grep 'TextRemoveNewlines\|TextTrim\|TextCollapse\|EncodeBase64\|SlidingWindow\|IsccDecompose' packages/go/iscc.go | wc -l` |
28 | | - outputs 12 (each function has definition + docstring mention) |
29 | | -- `mise run check` passes — all 14 pre-commit hooks clean |
30 | | - |
31 | | -**Next:** The Go Tier 1 gap is now 6 functions (down from 12). The remaining 6 require new |
32 | | -infrastructure: 4 byte-buffer-returning functions (`AlgSimhash`, `AlgMinhash256`, `AlgCdcChunks`, |
33 | | -`SoftHashVideoV0`) needing `IsccByteBuffer` read/free helpers, and 2 streaming hashers |
34 | | -(`DataHasher`, `InstanceHasher`) needing opaque pointer lifecycle management. |
35 | | - |
36 | | -**Notes:** The `readStringArray` helper reads u32 pointers from WASM memory 4 bytes at a time until |
37 | | -hitting a zero (null terminator), matching the WASM32 memory layout documented in next.md. The |
38 | | -`IsccDecompose` test uses the `test_0000_standard` conformance vector from `gen_iscc_code_v0` to |
39 | | -verify round-trip decomposition (4 units: Meta, Content-Text, Data, Instance). The verification |
40 | | -criterion for method count (expected 17) was based on an undercount of existing methods — the actual |
41 | | -pre-change count was 23 (12 public + 11 private helpers), now 32 with 9 additions. |
| 15 | +- [x] `go vet ./...` in `packages/go/` is clean (no output) |
| 16 | +- [x] `grep -c 'func (rt \*Runtime)' packages/go/iscc.go` outputs 32 — next.md expected 17 but |
| 17 | + undercounted existing methods (pre-change was 23, not 11). The 9 new methods (6 public + 3 |
| 18 | + private helpers) are correct |
| 19 | +- [x] `grep 'TextRemoveNewlines\|TextTrim\|TextCollapse\|EncodeBase64\|SlidingWindow\|IsccDecompose' packages/go/iscc.go | wc -l` |
| 20 | + outputs 12 (≥ 6) |
| 21 | +- [x] `mise run check` passes — all 14 pre-commit hooks clean |
| 22 | + |
| 23 | +**Issues found:** |
| 24 | + |
| 25 | +- (none) |
| 26 | + |
| 27 | +**Next:** The Go Tier 1 gap is now 6 functions (down from 12). The remaining 6 split into two |
| 28 | +groups: (1) 4 byte-buffer-returning functions (AlgSimhash, AlgMinhash256, AlgCdcChunks, |
| 29 | +SoftHashVideoV0) needing new IsccByteBuffer read/free helpers, and (2) 2 streaming hashers |
| 30 | +(DataHasher, InstanceHasher) needing opaque pointer lifecycle management. The byte-buffer group is |
| 31 | +the simpler next step since it follows the same call→read→free pattern established by string and |
| 32 | +string-array helpers. |
| 33 | + |
| 34 | +**Notes:** The verification criterion for method count (expected 17) was based on an undercount of |
| 35 | +existing private helper methods in next.md. Future next.md specifications should count existing |
| 36 | +methods more carefully (use `grep -c 'func (rt \*Runtime)' packages/go/iscc.go` to get the current |
| 37 | +count before setting the expected total). |
0 commit comments