feat: Phase 8 — Embedded maintenance operations (rebuild, compact, WAL prune)#80
Conversation
Two plans in 2 waves: - Plan 01: Expand EmbeddedSession with callback slots, wire JNA + Panama backends - Plan 02: Integration tests for embedded maintenance in both backends
Add Java lint step (gradle :core:check :jna:check 🇵🇦check) to 08-01 verification and Task 2 verify block per CLAUDE.md compliance. Document D-09 data-seeded test deferral in 08-02 objective and task actions — collection CRUD unavailable until FUTURE-03.
…ce methods - Add 5 BiFunction callback slots for maintenance operations - Add 7 public maintenance methods (5 primary + 2 convenience overloads) - Add ensureOpen() guard pattern matching ServerSession - Constructor expands from 2 to 7 parameters with null checks
…dings - Add 5 chroma_embedded_* symbol declarations to JNA JnaBindings interface - Add 5 MethodHandle fields to Panama Ffi record with eager binding - Both doStartEmbedded methods pass callFfiJson lambdas to expanded constructor - Fix EmbeddedSessionTest to use 7-parameter constructor
- Create 08-01-SUMMARY.md with execution results - Update STATE.md with phase 8 position and decisions - Update ROADMAP.md progress (1/2 plans complete) - Mark EMNT-01 through EMNT-04 complete in REQUIREMENTS.md
- 7 tests covering smoke, error paths, input validation, closed-session guards - Verifies rebuildCollection, compactAll, compactCollection, pruneAllWAL, pruneCollectionWAL
- 7 tests mirroring JNA coverage for smoke, error paths, validation, closed-session guards - Verifies rebuildCollection, compactAll, compactCollection, pruneAllWAL, pruneCollectionWAL
- SUMMARY.md with 14 tests (7 JNA + 7 Panama) coverage - STATE.md updated with phase 08 completion - ROADMAP.md marks phase 08 complete (2/2 plans) - REQUIREMENTS.md marks EMNT-05 complete
…, tests - Remove dead `name` parameter from rebuildCollection and pruneCollectionWAL (options object already carries the name; old API silently discarded it) - Add pruneCollectionWAL(String) convenience overload for API parity - Log readLastError failures in PanamaChromaRuntime instead of silent null - Use addSuppressed for callFfiVoid drain catch in AbstractChromaRuntime - Replace null-returning test stubs with UnsupportedOperationException - Add 13 unit tests: constructor null-rejection (5), input validation (5), convenience overload delegation (2), existing lifecycle (6 unchanged) - Update integration tests and ServerSession stubs for new signatures
|
@claude PTAL |
|
Claude finished @tazarov's task in 2m 39s —— View job Code Review — Phase 8: Embedded Maintenance Operations
Overall the implementation is solid. The callback-injection pattern is consistent with Bugs / Stale State
Phase 8 shipped without wiring server-mode operations (by design), so these should be updated to reflect the correct future phase (Phase 10, same as the others, or whatever the roadmap says). Fix this → API Design Observations
Asymmetric convenience overloads — Test CoverageNo positive smoke test for Integration test boilerplate is repetitive — each of the 7 JNA tests and 7 Panama tests re-initializes the runtime and session inline. A Minor Observations
Panama lambda verbosity — the five maintenance lambdas in SummaryOne actionable bug (stale Phase 8 references in |
- Update 3 stale "Phase 8" stub messages to "Phase 10" in ServerSession - Add compactCollection(String) convenience overload to match rebuild/prune - Add Javadoc on pruneAllWAL noting name field is ignored - Change collectionCount from u32/int to u64/long across Rust, Go, Java - Change WAL prune warning from Option<String>/String to Vec<String>/List
|
@claude PTAL again |
|
Claude finished @tazarov's task in 1m 57s —— View job Re-review — Phase 8: Embedded Maintenance Operations
All actionable items from the first review have been addressed across two fix commits ( ResolvedStale
Asymmetric convenience overloads —
Null-returning test stubs — replaced with Remaining Minor ObservationsThese were noted in the first review and are not blockers; just carried forward for completeness:
SummaryThe implementation is clean. All bugs identified in the first pass are fixed. The two remaining items (missing delegation test, missing smoke tests) are cosmetic/coverage gaps — they do not affect correctness of the FFI wiring or the closed-session guard logic. LGTM. |
…oad smoke tests Complete the symmetric delegation test set in EmbeddedSessionTest and exercise the convenience overload FFI path in JNA/Panama integration tests.
|
Claude finished @tazarov's task in 1m 0s —— View job Re-review — Phase 8: Embedded Maintenance Operations
All three remaining minor observations from the second review have been addressed in ResolvedMissing delegation test for No smoke tests for Still Pending (acknowledged, not blockers)
SummaryThe three actionable items from the second review are all closed. The implementation is correct, the callback wiring is consistent, the delegation tests are now symmetric, and both backends have smoke coverage for all five maintenance operations including the convenience overloads. LGTM. |
Summary
Phase 8: Embedded Maintenance
Goal: Expose 5 embedded-mode maintenance operations (rebuild, compact-collection, compact-all, prune-wal-collection, prune-wal-all) in the Java surface — EmbeddedSession callback slots, JNA + Panama backend wiring, and integration tests.
Status: Verified ✓ | UAT: 5/5 passed
Expands
EmbeddedSessionfrom a 2-parameter constructor to a 7-parameter constructor with 5BiFunction<Long, String, T>callback slots for maintenance operations. Both JNA and Panama backends bind all 5chroma_embedded_*FFI symbols and injectcallFfiJson-based lambdas at construction time. 14 integration tests (7 per backend) verify the wiring end-to-end.Changes
Plan 08-01: EmbeddedSession Callback Slots + Backend Wiring
Expanded EmbeddedSession with 5 BiFunction callback slots and 7 public maintenance methods. Wired both JNA (JnaBindings + lambdas) and Panama (Ffi MethodHandle + Arena-scoped lambdas) backends.
Key files modified:
java/core/src/main/java/tech/amikos/chroma/local/core/EmbeddedSession.javajava/jna/src/main/java/tech/amikos/chroma/local/jna/JnaChromaRuntime.javajava/panama/src/main/java/tech/amikos/chroma/local/panama/PanamaChromaRuntime.javajava/core/src/test/java/tech/amikos/chroma/local/core/EmbeddedSessionTest.javaPlan 08-02: Integration Tests
14 integration tests (7 JNA + 7 Panama) covering smoke tests, error paths, input validation, and closed-session guards for all 5 maintenance operations.
Key files created:
java/jna/src/test/java/tech/amikos/chroma/local/jna/JnaEmbeddedMaintenanceTest.javajava/panama/src/test/java/tech/amikos/chroma/local/panama/PanamaEmbeddedMaintenanceTest.javaRequirements Addressed
EmbeddedSession.rebuildCollection(name, options)returns RebuildCollectionResult in both backendsEmbeddedSession.compactCollection(request)andcompactAll(request)return CompactionResult in both backendsEmbeddedSession.pruneCollectionWAL(name, options)andpruneAllWAL(options)return WALPruneResult in both backendsVerification
Test plan
cd java && gradle :core:compileJava :jna:compileJava :panama:compileJava— all modules compileCHROMA_LIB_PATH=<shim> gradle :jna:test :panama:test— all 19 tests passgradle :core:check :jna:check :panama:check— lint clean