Types: implement collections, caches, and token bucket #31

Closed
opened 2026-08-08 08:16:23 +00:00 by hugo · 1 comment
Owner

Objective

Implement CacheDictionary, DoubleDictionary, MultiValueDictionary, ExpiringCache, TokenBucket, and remaining small Types utilities.

Deliverables

  • Preserve replacement, duplicate, enumeration, expiration, pruning, capacity, and burst/refill behavior.
  • Inject a deterministic clock for cache and token-bucket tests.
  • Begin with standard-library collections and locks; do not hold locks across callbacks.

Validation

  • All remaining Types tests pass deterministically.
  • Concurrency checks cover invariants without sleep-based timing.
  • Milestone coverage reports no generated Types shims and no failing Types parity tests.

Prerequisite

The full API shim and semantic test-suite gates are complete.

Project constraints

  • Implement only in native Rust; no LibreMetaverse/.NET bridge, subprocess, RPC, or fallback.
  • Keep mapped public signatures fixed and do not weaken translated parity assertions.
  • Remove failing bodies only for owned behavior and leave unrelated modules untouched.
  • Update docs, coverage/parity status, and focused plus workspace validation evidence.
## Objective Implement CacheDictionary, DoubleDictionary, MultiValueDictionary, ExpiringCache, TokenBucket, and remaining small Types utilities. ## Deliverables - Preserve replacement, duplicate, enumeration, expiration, pruning, capacity, and burst/refill behavior. - Inject a deterministic clock for cache and token-bucket tests. - Begin with standard-library collections and locks; do not hold locks across callbacks. ## Validation - All remaining Types tests pass deterministically. - Concurrency checks cover invariants without sleep-based timing. - Milestone coverage reports no generated Types shims and no failing Types parity tests. ## Prerequisite The full API shim and semantic test-suite gates are complete. ## Project constraints - Implement only in native Rust; no LibreMetaverse/.NET bridge, subprocess, RPC, or fallback. - Keep mapped public signatures fixed and do not weaken translated parity assertions. - Remove failing bodies only for owned behavior and leave unrelated modules untouched. - Update docs, coverage/parity status, and focused plus workspace validation evidence.
hugo added this to the 04 - Types implementation milestone 2026-08-08 08:16:23 +00:00
hugo added the enhancement label 2026-08-08 08:16:23 +00:00
Author
Owner

Implemented and pushed in commit ae0b796 (Implement Types collections and token bucket).

Implementation:

  • Replaced all remaining LibreMetaverse.Types generated shells with native Rust for CacheDictionary, its enumerator, the empty/LRU/MRU strategies, DoubleDictionary, MultiValueDictionary, ExpiringCache, and TokenBucket.
  • Preserved replacement, nullable/default lookup success, duplicates, first-value removal, access-sensitive eviction, enumeration invalidation, capacity, absolute/sliding expiration, strict pruning boundary, parent throttling, tick rollover, and burst/refill behavior from the pinned C# reference.
  • Added injected monotonic clocks for expiration and token-bucket behavior. The production clock uses portable std::time::Instant; no CLR or platform-specific API is used.
  • Collection predicates/actions are evaluated from snapshots, outside collection locks. Thread-safe state uses standard-library Mutex, RwLock, and atomics.
  • Updated mapping overrides, compile probes, documentation, and coverage. LibreMetaverse.Types now reports 45/45 native types and 942/942 native members with no generated Types shims.

Focused verification:

  • cargo test -p libremetaverse-types --offline: 45 passed, 0 failed, including 6 collection/cache/bucket tests.
  • Deterministic concurrency coverage proves one-winner cache insertion and exact token consumption under 16 simultaneous workers without sleeps.
  • types_utilities confirms all 6 milestone-owned pre-created parity cases pass. Its 11 standardized failures belong to separate LibreMetaverse main-assembly helpers and were intentionally left untouched.

Repository gates:

  • workspace all-target compile and test no-run: pass
  • standalone API compile fixture check/test and strict Clippy: pass
  • workspace strict Clippy: pass
  • rustdoc with warnings denied: pass
  • Rust mapping, shim generation, API coverage, reviewed parity, surface, and audit-tool checks: pass
  • controlled red-suite audit: current at 70 passed / 1,281 expected failures / 0 ignored, all failures standardized across 140 unrelated member IDs

Final review found no remaining failure-only body or generated shim in libremetaverse-types; the implementation satisfies every issue deliverable and the milestone 04 Types surface is complete.

Implemented and pushed in commit `ae0b796` (`Implement Types collections and token bucket`). Implementation: - Replaced all remaining `LibreMetaverse.Types` generated shells with native Rust for `CacheDictionary`, its enumerator, the empty/LRU/MRU strategies, `DoubleDictionary`, `MultiValueDictionary`, `ExpiringCache`, and `TokenBucket`. - Preserved replacement, nullable/default lookup success, duplicates, first-value removal, access-sensitive eviction, enumeration invalidation, capacity, absolute/sliding expiration, strict pruning boundary, parent throttling, tick rollover, and burst/refill behavior from the pinned C# reference. - Added injected monotonic clocks for expiration and token-bucket behavior. The production clock uses portable `std::time::Instant`; no CLR or platform-specific API is used. - Collection predicates/actions are evaluated from snapshots, outside collection locks. Thread-safe state uses standard-library `Mutex`, `RwLock`, and atomics. - Updated mapping overrides, compile probes, documentation, and coverage. `LibreMetaverse.Types` now reports 45/45 native types and 942/942 native members with no generated Types shims. Focused verification: - `cargo test -p libremetaverse-types --offline`: 45 passed, 0 failed, including 6 collection/cache/bucket tests. - Deterministic concurrency coverage proves one-winner cache insertion and exact token consumption under 16 simultaneous workers without sleeps. - `types_utilities` confirms all 6 milestone-owned pre-created parity cases pass. Its 11 standardized failures belong to separate `LibreMetaverse` main-assembly helpers and were intentionally left untouched. Repository gates: - workspace all-target compile and test no-run: pass - standalone API compile fixture check/test and strict Clippy: pass - workspace strict Clippy: pass - rustdoc with warnings denied: pass - Rust mapping, shim generation, API coverage, reviewed parity, surface, and audit-tool checks: pass - controlled red-suite audit: current at 70 passed / 1,281 expected failures / 0 ignored, all failures standardized across 140 unrelated member IDs Final review found no remaining failure-only body or generated shim in `libremetaverse-types`; the implementation satisfies every issue deliverable and the milestone 04 Types surface is complete.
hugo closed this issue 2026-08-08 23:46:20 +00:00
Sign in to join this conversation.