Skip to content

Commit 69cce77

Browse files
authored
Merge pull request #3 from iscc/develop
Fix WASM howto package name and merge release fixes
2 parents 4bdc899 + 53ecc6c commit 69cce77

File tree

21 files changed

+1335
-212
lines changed

21 files changed

+1335
-212
lines changed

.claude/agent-memory/advance/MEMORY.md

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,13 @@ iterations.
6666
Cargo.toml changes needed. The cdylib target produces the `.wasm` file
6767
- `iscc_alloc`/`iscc_dealloc` are the WASM host memory management pair — host allocates via
6868
`iscc_alloc`, writes data, calls FFI functions, then frees via `iscc_dealloc`
69-
- Debug WASM binary is ~10.5MB; release + wasm-opt would reduce significantly
69+
- Debug WASM binary is ~10.5MB; release + wasm-opt reduces significantly
70+
- wasm-opt release config in `crates/iscc-wasm/Cargo.toml`:
71+
`[package.metadata.wasm-pack.profile.release]` with
72+
`wasm-opt = ["-O", "--enable-bulk-memory", "--enable-nontrapping-float-to-int"]`. Rust's LLVM
73+
emits `memory.copy` (bulk-memory) and `i32.trunc_sat_f64_s/u` (nontrapping-float-to-int) — both
74+
must be enabled for wasm-opt to accept the binary. If future Rust versions emit more post-MVP
75+
ops, add specific `--enable-*` flags (or switch to `--enable-all` as last resort)
7076
- Install target: `rustup target add wasm32-wasip1`
7177
- Build: `cargo build -p iscc-ffi --target wasm32-wasip1`
7278
- Output: `target/wasm32-wasip1/debug/iscc_ffi.wasm`
@@ -110,10 +116,11 @@ iterations.
110116
- Go streaming hasher pattern: `DataHasher`/`InstanceHasher` structs hold `rt *Runtime` +
111117
`ptr uint32` (opaque WASM pointer). Factory methods on Runtime call `iscc_*_hasher_new()` and
112118
check for NULL. `Update` writes bytes via `writeBytes`, calls `iscc_*_hasher_update` (returns
113-
i32 as bool: 0=error, nonzero=ok). `Finalize` calls `iscc_*_hasher_finalize` (returns string
114-
pointer) and uses `callStringResult`. `Close` calls `iscc_*_hasher_free` and zeroes `h.ptr` to
115-
prevent double-free (fire-and-forget, safe to call multiple times). No sret ABI needed — all
116-
streaming hasher FFI functions use simple i32 params/returns
119+
i32 as bool: 0=error, nonzero=ok). `UpdateFrom` reads from `io.Reader` in 64 KiB chunks and
120+
delegates to `Update`. `Finalize` calls `iscc_*_hasher_finalize` (returns string pointer) and
121+
uses `callStringResult`. `Close` calls `iscc_*_hasher_free` and zeroes `h.ptr` to prevent
122+
double-free (fire-and-forget, safe to call multiple times). No sret ABI needed — all streaming
123+
hasher FFI functions use simple i32 params/returns
117124
- Byte-buffer-returning WASM functions use sret ABI: caller allocates 8 bytes (IsccByteBuffer or
118125
IsccByteBufferArray struct), passes ptr as first arg. Function writes struct fields to that ptr.
119126
The free functions (iscc_free_byte_buffer, iscc_free_byte_buffer_array) take the struct by
@@ -156,8 +163,37 @@ iterations.
156163
via regex `r'^version\s*=\s*"(.+?)"'`, updates `package.json` (json stdlib) and `pom.xml` (regex
157164
replacement). Supports `--check` flag. mise tasks: `version:sync`, `version:check`
158165

166+
## Release Workflow
167+
168+
- PR merge: `gh pr merge N --merge` (merge commit, not squash) preserves commit history
169+
- Tag on main: `git tag vX.Y.Z && git push origin vX.Y.Z` triggers `.github/workflows/release.yml`
170+
- Release workflow matches pattern `push: tags: [v*.*.*]`
171+
- After tagging, switch back to develop: `git checkout develop`
172+
- If local changes block branch switch, `git stash push -m "reason" <file>` then `git stash pop`
173+
after switching back
174+
- OIDC trusted publishing for crates.io requires crate to exist first (first publish needs API
175+
token). PyPI supports pending trusted publishers. npm uses `NPM_TOKEN` secret
176+
- Release workflow has 4 `workflow_dispatch` inputs: `crates-io`, `pypi`, `npm`, `maven` (all
177+
boolean, default false). Jobs: `publish-crates-io`, `build-wheels`, `build-sdist`,
178+
`publish-pypi`, `build-napi`, `publish-npm-lib`, `build-wasm`, `publish-npm-wasm`, `build-jni`,
179+
`assemble-jar`
180+
- `build-jni` matrix: 5 platforms with `native-dir` and `lib-name` matrix vars matching NativeLoader
181+
conventions. Artifacts named `jni-{native-dir}` (e.g., `jni-linux-x86_64`)
182+
- `assemble-jar` downloads `jni-*` artifacts into `jni-staging/`, iterates subdirectories to copy
183+
native libs to `src/main/resources/META-INF/native/{native-dir}/`. Uses
184+
`mvn package -DskipTests` and uploads JAR as `iscc-lib-jar` artifact
185+
- `actions/download-artifact@v4` default behavior (no `merge-multiple`) creates per-artifact
186+
subdirectories named after the artifact — useful for iterating platform-specific downloads
187+
159188
## Documentation
160189

190+
- Ecosystem page: `docs/ecosystem.md` — covers official (iscc-core, iscc-lib) and community
191+
(iscc-core-ts) implementations. Uses `icon: lucide/globe`. Nav entry in `zensical.toml` placed
192+
between "Explanation" and "Reference" as a top-level entry
193+
- `branciard/iscc-core-ts`: TypeScript port, Apache-2.0, v0.3.0, all 9 gen\_\*\_v0 and
194+
gen_iscc_id_v0/v1 and gen_flake_code_v0. Vendors official `data.json` (66KB). 263 tests across
195+
18 suites. Author: François Branciard. NGI Zero Core / NLnet funded. Status: active development,
196+
not production-ready
161197
- How-to guide structure: YAML front matter (`icon`, `description`) → title → intro → installation →
162198
code generation (9 subsections: Meta, Text, Image, Audio, Video, Mixed, Data, Instance,
163199
ISCC-CODE) → streaming → text utilities → conformance testing → error handling
@@ -172,12 +208,18 @@ iterations.
172208
AlgCdcChunks, AlgSimhash) not present in Python/Node.js guides
173209
- All 6 how-to guides complete: Rust (356 lines), Python (353), Node.js (281), WASM (338), Go (388),
174210
Java (321)
211+
- `docs/architecture.md` and `docs/development.md` include all 6 binding crates (Python, Node.js,
212+
WASM, C FFI, JNI, Go) in diagrams, layout trees, and tables. Go uses dotted arrow (`-.->`) in
213+
Mermaid to indicate indirect WASM dependency via `iscc-ffi`
175214
- Java guide key differences from Go: no runtime object (static methods), "Setup" section replaces
176215
"Runtime setup", streaming uses opaque `long` handles with try-finally (not defer),
177216
`genIsccCodeV0` exposes `boolean wide` parameter (Go hardcodes to false)
178217
- docs/index.md landing page: 6 Quick Start tabs (Rust, Python, Node.js, Java, Go, WASM) + 7
179218
Available Bindings table rows. All tabs use `gen_text_code_v0("Hello World")`. mdformat
180219
auto-reformats JS imports to multi-line style in code blocks inside tabbed markdown
220+
- WASM how-to (`docs/howto/wasm.md`) uses `@iscc/wasm` throughout (20 occurrences). Always verify
221+
npm package names against `docs/index.md` and `crates/*/README.md` — the wasm-pack howto
222+
originally had `@iscc/iscc-wasm` (wrong)
181223

182224
## Codec Internals
183225

.claude/agent-memory/define-next/MEMORY.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,18 @@ iterations.
122122
state.md's CI section for the latest status. When CI is red, that's always the first priority
123123
regardless of what the handoff "Next" section suggests. Formatting fixes are trivial single-file
124124
steps — don't over-scope them.
125+
- **Release milestone steps** (iteration 2, second loop): When all code is complete and CI is green,
126+
the remaining work is operational (merge PRs, tag releases). These are zero-file-change steps
127+
that use `gh` and `git` commands exclusively. Verify preconditions (PR mergeable, CI green)
128+
before scoping, and call out what NOT to do (don't squash, don't delete develop, don't wait for
129+
release workflow). When an existing PR already covers the merge, update its title/body rather
130+
than creating a new one.
131+
- **Post-release build fixes** (iteration 3, second loop): When a release workflow partially fails,
132+
the fix often belongs in crate-level config (e.g., `Cargo.toml` metadata sections) rather than
133+
the workflow YAML. wasm-pack supports `[package.metadata.wasm-pack.profile.release]` for
134+
configuring wasm-opt flags — this is the portable, documented approach that works both locally
135+
and in CI. Prefer crate-config fixes over workflow-command-line fixes for reproducibility. After
136+
fixing, don't re-trigger the release in the same step — that's a separate human-gated operation.
125137

126138
## Architecture Decisions
127139

@@ -186,4 +198,38 @@ iterations.
186198
- Maven's working directory is the pom.xml parent directory, not the workspace root.
187199
- ISCC Foundation URL is `https://iscc.io` — not iscc.foundation or other variants.
188200
- WASM howto guide at `docs/howto/wasm.md` has wrong package name `@iscc/iscc-wasm` — correct name
189-
is `@iscc/wasm` per learnings. Pre-existing issue not yet fixed.
201+
is `@iscc/wasm` per learnings. Being fixed in iteration 5 (second CID loop).
202+
- **Pairing doc fixes with PRs** (iteration 5, second loop): When the next step is creating a PR
203+
(develop → main), pair it with any pending doc fixes that would ship in that merge. The WASM
204+
howto package name fix was a known issue sitting in agent memory — fixing it before the PR means
205+
the corrected docs deploy from main immediately. This avoids an extra iteration just for the
206+
fix. Good pairing criteria: same branch, no code risk, verifiable by grep.
207+
- **Remaining state→target gaps after v0.0.1**: Maven Central publishing, crates.io OIDC, npm token
208+
setup — all require human action on external services. The TypeScript port evaluation (low
209+
issue) is CID-actionable but low priority.
210+
- **Go io.Reader streaming** (iteration 7, second loop): When the handoff says "maintenance mode"
211+
but the target architecture description mentions a feature ("io.Reader support for streaming")
212+
that isn't implemented, that's still a valid gap to close. `UpdateFrom(ctx, io.Reader)` is 2
213+
methods + 3 tests, well under the 3-file limit. It delegates to existing `Update`, so no WASM
214+
changes. Prefer concrete code improvements over research tasks (TypeScript evaluation) even when
215+
the handoff suggests the latter.
216+
- **Research + docs hybrid steps** (iteration 8, second loop): When the only remaining CID-
217+
actionable item is a research task (evaluating an external repo), combine it with a concrete
218+
deliverable (a new docs page) so the step is verifiable. The advance agent uses
219+
WebFetch/deepwiki to examine the external repo, then creates a documentation page with findings.
220+
Scope: 1 create (docs page) + 1 modify (nav config) = well under the 3-file limit. Key: be
221+
factual and neutral about third-party conformance — state what was observed, not assumptions.
222+
- **Java native bundling in release workflow** (iteration 5, second loop): The `build-jni` +
223+
`assemble-jar` pattern mirrors the existing `build-napi` + `publish-npm-lib` pattern. Key
224+
differences: (1) NativeLoader expects `META-INF/native/{os}-{arch}/{libname}` directory
225+
convention, (2) Maven `src/main/resources/` is auto-included in JAR (no pom.xml changes), (3)
226+
the assemble-jar step collects artifacts and runs `mvn package -DskipTests`. This is CID-
227+
actionable — no human credentials needed for the build step. Maven Central publishing is a
228+
separate future step (requires GPG + Sonatype credentials).
229+
- **Stale documentation pages after binding additions** (iteration 9, second loop): When new
230+
bindings are added over multiple iterations (JNI in iter 5, Go in iter 6-7), docs pages written
231+
earlier (architecture.md, development.md) become stale — they miss the new crates in diagrams,
232+
layout trees, and summary tables. The state assessment may say "Documentation: met" because
233+
top-level target verification criteria are met, but detailed spec gaps remain. These are safe,
234+
docs-only steps (2 files, no code changes). Check for: mermaid diagrams, workspace layout trees,
235+
crate summary tables, streaming pattern tables, conformance test matrix tables.

.claude/agent-memory/review/MEMORY.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,19 @@ Review patterns, quality gate knowledge, and common issues accumulated across CI
4747
- Python-only changes: `mise run check` + `pytest` is sufficient; skip `cargo test` and `mvn test`
4848
unless Rust/Java code was also modified
4949

50-
- Go-only changes: `mise run check` + `mise exec -- go test ./...` is sufficient
50+
- Go-only changes: `mise run check` + `cd packages/go && mise exec -- go test ./...` is sufficient
51+
(must `cd` into the Go module directory — running from repo root with `./packages/go/` path
52+
fails with "cannot find main module")
5153

5254
- Full test suite (159 tests) runs in \<1s — always run it for Python changes
5355

5456
- Script-only changes (new Python scripts, mise task additions): `mise run check` + direct script
5557
invocation is sufficient — skip all test suites unless the script modifies test infrastructure
5658

59+
- Config-only changes (Cargo.toml metadata, wasm-pack profiles, CI workflow YAML): `mise run check`
60+
\+ `cargo check -p <crate>` is sufficient. If wasm-pack config changed, also run
61+
`wasm-pack build --target web --release crates/iscc-wasm` to verify end-to-end
62+
5763
## Verification Patterns
5864

5965
- `grep -c` counts ALL matching lines including function definitions — when next.md specifies "4

.claude/agent-memory/update-state/MEMORY.md

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ Codepaths, patterns, and key findings accumulated across CID iterations.
6363

6464
## Gotchas
6565

66-
- `packages/go/` (iteration 13, commit c22fa53): `iscc.go` now 1,165 lines — 23/23 Tier 1 symbols
67-
including `DataHasher` + `InstanceHasher` streaming types (New\*/Update/Finalize/Close lifecycle
68-
wrapping WASM FfiDataHasher/FfiInstanceHasher). `iscc_test.go` 1,069 lines — 36 func
69-
declarations (TestMain + 35 tests including 8 streaming hasher tests). Update takes `[]byte`,
70-
NOT `io.Reader` — architecture gap noted. WASM binary gitignored; TestMain skips if missing.
66+
- `packages/go/` (iteration 13, commit c22fa53; updated iteration 7, commit 84ddb1b): `iscc.go` now
67+
1,220 lines — 23/23 Tier 1 symbols including `DataHasher` + `InstanceHasher` with
68+
`New*/Update/UpdateFrom/Finalize/Close` lifecycle. `iscc_test.go` now 1,208 lines — 39 test
69+
functions, 93 subtests including `TestDataHasherUpdateFrom` and `TestInstanceHasherUpdateFrom`.
70+
`io.Reader` gap resolved in iteration 7. WASM binary gitignored; TestMain skips if missing.
7171
- Per-crate READMEs: all 7 done (iscc-lib, iscc-py, iscc-napi, iscc-wasm, iscc-jni, packages/go,
7272
iscc-ffi). iscc-ffi/README.md created in iteration 29 (123 lines). packages/go/README.md created
7373
in iteration 10 (commit a60a375).
@@ -212,5 +212,56 @@ Codepaths, patterns, and key findings accumulated across CID iterations.
212212
flat-buffer functions `gen_video_code_v0_flat` + `soft_hash_video_v0_flat`; type signatures
213213
updated to `Sequence[Sequence[int]]`; API symbol count in target.md and specs/rust-core.md
214214
updated 22→23 (correcting a pre-existing under-count). **RESULT: CI FAILING** — Python ruff
215-
format check fails (runs 22401304896 + 22401336439). Fix by running
215+
format check fails (runs 22401304896 + 22401336439). Fixed by running
216216
`uv run ruff format crates/iscc-py/python/` and committing.
217+
- **ruff format fix (iteration 31, commit 3c0d70b)**: `_lowlevel.pyi` `gen_video_code_v0` signature
218+
split across multiple lines to satisfy ruff line-length limit. Review PASS. CI now fully green:
219+
all 7 jobs SUCCESS on develop (runs 22401871901 + 22401873404). Python status: MET. All
220+
subsections passing. Next logical step: PR develop → main + tag v0.0.1.
221+
- **v0.0.1 release (iteration 32, commit 56e274d)**: PR #2 merged (develop → main, commit
222+
`4bdc899`). v0.0.1 tag pushed. Release workflow run 22402189532: PyPI published ✅ (all 4 wheel
223+
platforms + sdist), crates.io failed (OIDC not configured on registry — human task), WASM build
224+
failed (wasm-opt rejects `memory.copy` without `--enable-bulk-memory` — fix in release.yml), npm
225+
@iscc/lib + @iscc/wasm skipped. CI on develop: all 7 jobs pass (run 22402375410). CI on main:
226+
all jobs pass (run 22402167393). Docs on main: pass (run 22402167413).
227+
- **WASM release build bug FIXED (iteration 4, commit f1ada07)**:
228+
`[package.metadata.wasm-pack.profile.release]` section added to `crates/iscc-wasm/Cargo.toml`
229+
with `wasm-opt = ["-O", "--enable-bulk-memory", "--enable-nontrapping-float-to-int"]`. Both
230+
flags required: `--enable-bulk-memory` for `memory.copy` (Rust uses bulk memory for memcpy),
231+
`--enable-nontrapping-float-to-int` for DCT/codec float-to-int conversions. Fix verified locally
232+
(29.36s release build success) and in CI WASM job (run 22403019335, SUCCESS). Fix is on
233+
`develop`; needs PR → main + re-release to publish `@iscc/wasm`.
234+
- **wasm-pack profile config**: The correct way to configure wasm-opt flags for wasm-pack is via
235+
`[package.metadata.wasm-pack.profile.release]` in `Cargo.toml`, NOT via command-line args in CI.
236+
This keeps the config close to the code and works for both local and CI builds.
237+
- **docs/howto/wasm.md package name fixed (iteration 5, commit 1023080)**: All 20 occurrences of
238+
`@iscc/iscc-wasm` replaced with `@iscc/wasm`. PR #3 open (develop → main) with both the wasm-opt
239+
fix and this package name fix. CI on develop fully green: all 7 jobs pass (run 22403499473). Two
240+
CI runs in progress: push to develop (22403598203) and PR #3 check (22403597692). Loop is in
241+
maintenance mode — no CID-actionable code work pending. Human actions needed: merge PR #3, then
242+
re-trigger release to publish @iscc/wasm and @iscc/lib to npm; crates.io OIDC setup also human.
243+
- **JNI cross-platform build added to release.yml (iteration 6, commits e6fe6bc+a0f2d3d)**:
244+
`build-jni` job (5-platform matrix: linux-x86_64, linux-aarch64, macos-aarch64, macos-x86_64,
245+
windows-x86_64) and `assemble-jar` job added to `release.yml`. `maven` boolean input checkbox
246+
added to `workflow_dispatch`. `native-dir` values match `NativeLoader.java` path conventions
247+
exactly (`META-INF/native/{os}-{arch}/{libname}`). CI all 7 jobs pass on develop (run
248+
22404197625, HEAD `a0f2d3d`). `NativeLoader.java` path:
249+
`crates/iscc-jni/java/src/main/java/io/iscc/iscc_lib/NativeLoader.java`. Java Bindings status:
250+
partially met (release workflow now has native bundling jobs; Maven Central publishing still
251+
missing). PR #3 still open.
252+
- **io.Reader streaming added to Go bindings (iteration 7, commits 84ddb1b+4c942dd)**:
253+
`UpdateFrom(ctx, io.Reader)` added to both `DataHasher` and `InstanceHasher` in
254+
`packages/go/iscc.go`; 64 KiB buffer, delegates to `Update`. 4 new test functions added
255+
(`TestDataHasherUpdateFrom`, `TestInstanceHasherUpdateFrom`). `iscc.go` now 1,220 lines;
256+
`iscc_test.go` now 1,208 lines; 39 total test functions, 93 subtests. Go Bindings status:
257+
**MET** (was partially met). CI all 7 jobs pass on develop (runs 22404891331 + 22404890215, HEAD
258+
`4c942dd`). **All 7 binding sections now "met"**. Loop is in maintenance mode. PR #3 still open.
259+
Next CID-actionable step: await new target.md goals.
260+
- **Ecosystem docs page added (iteration 8, commits daf2831+de0b17a)**: `docs/ecosystem.md` (100
261+
lines) created with Official Implementations section (iscc-core Python reference, iscc-lib Rust
262+
polyglot) and Community Implementations section (iscc-core-ts TypeScript port by François
263+
Branciard, NGI Zero Core funded, 263 tests, 9 gen\_\*\_v0 functions, not yet production-ready).
264+
"Contributing an Implementation" section with 3-step guide. `icon: lucide/globe` front matter.
265+
`zensical.toml` updated with `{ "Ecosystem" = "ecosystem.md" }` between Explanation and
266+
Reference. Documentation page count: 14 (was 13). CI all 7 jobs pass on develop (runs
267+
22405571444 + 22405570077, HEAD `de0b17a`). PR #3 still open (now includes ecosystem page too).

0 commit comments

Comments
 (0)