Summary
Implement and validate the full non-transactional access layer for `fensor` across dense and sparse layouts, including view semantics, sparse iteration order constraints, lifecycle policy for sparse zero writes, and fail-closed persistence behavior.
Scope
- Implement/complete:
- `TensorRead`
- `TensorWrite`
- `TensorReadBulk`
- `TensorWriteBulk`
- `TensorTransform` (`reshape`, `slice`, `transpose`, `broadcast`, `flip`, `squeeze`, `unsqueeze`)
- `TensorBlockStore`
- `TensorSparseIndex`
- `TensorViewSemantics`
- `TensorSparseLifecycle`
- Finalize `read_sparse_elements_in_order` semantics:
- Support valid in-order sparse iteration paths
- Return structured `UnsupportedSparseIterationOrder` on incompatible order requests
- Persist/rehydrate semantics:
- Confirm create/write/reload/read flows
- Corruption handling must fail closed (no auto-recovery behavior)
Explicit Non-Goals
- LSM transactional orchestration (`pending/committed/finalize`) in `tc-collection`
- Full math-op implementation (`TensorMath*`, `TensorReduce*`, `TensorMatMul`) beyond access/transform prerequisites
Acceptance Criteria
- Dense/sparse access parity tests pass for supported operations
- Base/view contract is explicit and tested:
- Which tensors are writable
- Which views support write-through vs read-only behavior
- Sparse zero-write lifecycle policy is implemented and tested:
- nonzero -> zero
- zero -> nonzero
- index/block state transitions are deterministic
- `read_sparse_elements_in_order`:
- Works for supported orderings
- Returns structured error for incompatible ordering with actionable message
- Persistence integration tests pass using real `freqfs` reload boundaries
- Corrupted metadata/data fails with structured errors (fail-closed)
- No `todo!`, `unimplemented!`, or panic-based placeholders in production access paths
Test Plan
- Add/extend tests in:
- `deps/fensor/tests/foundations.rs`
- integration tests for persistence/reload/corruption
- Include:
- dense vs sparse parity matrix for access+transform
- chained transforms (`transpose(slice(x))`, `slice(transpose(x))`, etc.)
- sparse order compatibility/incompatibility cases
Summary
Implement and validate the full non-transactional access layer for `fensor` across dense and sparse layouts, including view semantics, sparse iteration order constraints, lifecycle policy for sparse zero writes, and fail-closed persistence behavior.
Scope
Explicit Non-Goals
Acceptance Criteria
Test Plan