Skip to content

fix(examples): runnable dart 04_files + java Example03Files; add java Example03Chunks#94

Merged
Nic-dorman merged 1 commit into
mainfrom
feat/v2-297-runnable-jvm-dart-examples
May 19, 2026
Merged

fix(examples): runnable dart 04_files + java Example03Files; add java Example03Chunks#94
Nic-dorman merged 1 commit into
mainfrom
feat/v2-297-runnable-jvm-dart-examples

Conversation

@Nic-dorman

Copy link
Copy Markdown
Collaborator

Summary

Audit of csharp/dart/swift/java/kotlin against `ant dev example all` against a live devnet (2026-05-18) showed 23 of 25 cells green out of the box. This PR closes the 2 real gaps and the 1 silent fail-through:

  • dart/files: was passing in 2s with hardcoded `/path/to/file.txt` — the example caught `AntdError` and exited 0, so the runner reported PASS while the daemon was returning HTTP 400. Rewrite to use `Directory.systemTemp.createTemp`, real bytes, byte-equal round-trip assertion, and `exitCode = 1` on mismatch. Drop the dir_upload step (broken in the daemon, separate ticket).

  • java/files: `Example03Files.java` had the same `/path/to/file.txt` stub pattern, errored at `fileUploadPublic` with HTTP 400. Rewrite to use `Files.createTempDirectory` + `Files.writeString` + `Files.readString` round-trip assertion, mirroring the post-fix(antd-go): make 03-files example self-contained and runnable #91 antd-go pattern and fix(examples): make 04-files runnable across cpp/rust/elixir/lua/php/ruby/zig #93's antd-py reference.

  • java/chunks: didn't exist — the runner adapter only dispatched connect/data/files/errors/private, no chunks example was ever written. Author `Example03Chunks.java` mirroring `Example02PublicData`'s shape but using `chunkPut`/`chunkGet` with a byte-equal round-trip assertion. Wire `chunks` into the java adapter in `ant-dev/cmd_example.py`.

What changes

  • `antd-dart/example/04_files.dart` — rewritten (real tempfile, assertion, exit-1 on mismatch).
  • `antd-java/examples/src/main/java/com/autonomi/examples/Example03Files.java` — rewritten (real tempfile, assertion).
  • `antd-java/examples/src/main/java/com/autonomi/examples/Example03Chunks.java` — new file, mirrors Example02PublicData.
  • `ant-dev/src/ant_dev/cmd_example.py` — add `"chunks": "com.autonomi.examples.Example03Chunks"` to the java adapter. Existing `"errors"` key preserved (Example05ErrorHandling still ships).

What does not change

  • antd-csharp, antd-swift, antd-kotlin examples — already green for all 5 canonical examples. No changes needed.
  • The other 4 java examples (Connect, PublicData, ErrorHandling, PrivateData) — already green.

Test plan

  • dev2 sweep with `ant dev example -l ` for every `(lang, name)` pair in {csharp, dart, swift, java, kotlin} × {connect, data, chunks, files, private}. 25/25 PASS. Per-language summary:

    SDK connect data chunks files private
    csharp ✅ 4s ✅ 6s ✅ 3s ✅ 5s ✅ 4s
    dart ✅ 2s ✅ 8s ✅ 3s ✅ 6s ✅ 4s
    swift ✅ 50s ✅ 21s ✅ 21s ✅ 21s ✅ 22s
    java ✅ 13s ✅ 12s ✅ 13s ✅ 14s ✅ 16s
    kotlin ✅ 12s ✅ 16s ✅ 12s ✅ 16s ✅ 13s
  • Reviewer: re-run the sweep on a fresh devnet to confirm.

Why now

v1.0 ship target this week or next. After this lands together with #91 (antd-go), #92 (graph removal), and #93 (cross-SDK files runnable), every shipping SDK has a green 5-example sweep — except for any per-SDK quirks that surface during the post-merge full sweep. That's the v1.0 gate.

🤖 Generated with Claude Code

… Example03Chunks

V2-297 audit on dev2 (2026-05-18) found three gaps in the 5 SDKs with
existing example scaffolding:

* antd-dart/example/04_files.dart was silently passing despite hardcoded
  /path/to/file.txt placeholders — the example catches AntdError and
  exits 0, so the runner reported PASS while the daemon was returning
  400. Rewrite to use Directory.systemTemp.createTemp, real bytes,
  byte-equal round-trip assertion, exit non-zero on mismatch. Drop the
  dir_upload step (separate daemon bug).

* antd-java Example03Files.java had the same /path/to/file.txt stub
  pattern. Rewrite to use Files.createTempDirectory + Files.writeString
  + Files.readString round-trip assertion. Same pattern as V2-294 for
  antd-go and V2-299 for the other SDKs.

* antd-java had no Example03Chunks — the runner adapter only dispatched
  connect/data/files/errors/private. Author Example03Chunks.java
  mirroring Example02PublicData's shape but using chunkPut/chunkGet,
  with a byte-equal round-trip assertion. Wire it into the java adapter
  in ant-dev/cmd_example.py.

After these, csharp/dart/swift/java/kotlin all run green for the
canonical 5 examples (connect, data, chunks, files, private) against
a live devnet.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Nic-dorman
Nic-dorman merged commit e9d34ff into main May 19, 2026
Nic-dorman added a commit that referenced this pull request May 19, 2026
… + 15 SDKs + docs)

Resolved against origin/main (which now contains #91/#92/#93/#94/#96) using
dev2 integration HEAD aa94940 as the canonical post-merge state. Net of the
example-file overlap with #93/#94, V2-300 reduces to 99 files / 44+ / 1694-.
Nic-dorman added a commit that referenced this pull request May 19, 2026
… + 15 SDKs + docs) (#95)

Resolved against origin/main (which now contains #91/#92/#93/#94/#96) using
dev2 integration HEAD aa94940 as the canonical post-merge state. Net of the
example-file overlap with #93/#94, V2-300 reduces to 99 files / 44+ / 1694-.
Nic-dorman added a commit that referenced this pull request May 21, 2026
Cuts v0.8.0 atop v0.7.1. Substantial breaking-change roll-up of the
put/get rename, the private-file PUT/GET gap close, and several minor
surface cleanups -- bundled here so the v1.0 cut can ship stable on top.

## Breaking (antd daemon)

- feat(antd)!: bind to 127.0.0.1 by default on REST and gRPC (#107).
  Previously bound 0.0.0.0; use --bind-rest / --bind-grpc to override.
- chore: remove dead graph_entry surface from antd proto + 5 SDKs (#92).
  GraphService and its 4 RPCs are gone; REST mounts dropped.
- chore: remove dir_upload_public / dir_download_public surface (#95).
  Use file_put_public on a directory path instead; the daemon recurses.
- feat(antd)!: normalize put/get convention + close private-file PUT and
  GET gaps (#115). Method renames across proto + REST + SDKs:
    data_put_private    -> data_put
    data_get_private    -> data_get
    file_upload_public  -> file_put_public
    file_download_public -> file_get_public
  New: file_put / file_get for the private file path (previously only
  the public variant existed). New typed results: DataPutResult,
  DataPutPublicResult, FilePutResult, FilePutPublicResult; PutResult
  is now annotated as chunk_put only.

## Additive

- feat(antd): honor payment_mode on gRPC put/cost paths and REST cost
  endpoints (#114). Optional kwarg threaded through every put/cost
  signature; empty/omitted maps to "auto" so older clients keep working.
- feat: external-signer public uploads + single-chunk prepare/finalize
  across 15 SDKs (#90).
- docs+spec: openapi.yaml refreshed for the v1.0 surface, including
  POST /v1/chunks/prepare and /v1/chunks/finalize for single-chunk
  external-signer publish (#126).

## SDK fan-out (PaymentMode + put/get convention, all 15)

#116 antd-go, #117 antd-py/ruby/elixir, #118 antd-rust, #119 antd-csharp,
#120 antd-java, #121 antd-swift, #122 antd-dart, #123 antd-kotlin,
#124 antd-cpp, #125 antd-js/php/zig/lua, #127 antd-mcp.

## SDK example + build fixes

- fix(antd-go): make 03-files example self-contained and runnable (#91)
- fix(examples): make 04-files runnable across cpp/rust/elixir/lua/php/ruby/zig (#93)
- fix(examples): runnable dart 04_files + java Example03Files; add java Example03Chunks (#94)
- feat: gRPC transport example for antd-py and antd-rust (#113)
- feat(antd-py): 07_external_signer example + ant-dev dispatcher entry (#98)
- feat(antd-js): 07-external-signer example + antd-py empty-payments fix (#99)
- feat(rust/go): 07-external-signer examples (#100)
- feat(antd-csharp): 07_external_signer example (#101)
- feat(antd-java): 07_external_signer example (#102)
- feat(antd-kotlin): 07_external_signer example (#103)
- feat(antd-dart): 07_external_signer example (#104)
- feat(antd-ruby): 07_external_signer example (#105)
- feat(antd-php): 07_external_signer example (#106)
- chore(antd-kotlin): drop stale GraphDescendant from local proto copy (#108)

## Docs / infra

- docs: external-signer flow reference + ABI + python smoke test (#97)
- docs: add SECURITY.md with threat model and disclosure policy (#109)
- docs!: refresh per-SDK READMEs + llms-full.txt + openapi.yaml for v1.0 surface (#126)
- ci: add Go lint + test + vuln scanning for antd-go (#112)
- ci: extend antd-rust to sibling-repo parity (fmt + clippy + audit + doc) (#111)
- ci: skip antd/openapi.yaml and llms-full.txt from triggering CI (#128)
- chore(scripts): add full-stack + integration sweep helpers (#96)
- fix(antd-rust): regenerate Cargo.lock to unbreak --locked CI (#110)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant