feat: main libraries porting from ScaFi (2)#249
Open
cric96 wants to merge 12 commits into
Open
Conversation
…ities Add three minimal sensor capability traits mirroring DistanceSensor: TimeSensor (deltaTime/timestamp), LagSensor[Lag] (senseLag), and RandomGenerator (nextRandom), each with a static using-based facade and unit tests covering facade delegation, SharedData iteration, and random range/advancement. Implements migration task 01. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…elector, mergeHood Port the genuinely-missing FieldUtils primitives: argmin/argmax neighbour selectors (excluding self, with tie-breaking by device id) and key-wise map merging. Document idiomatic scafi3 replacements for legacy sumHood, anyHood, everyHood, reifyField, etc. Exported from All.scala. Implements migration task 02. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t blocks Implements migration/03: roundCounter, remember, constant, keep, keepTrue, captureChange, countChanges, goesUp, goesDown, delay, once — all built on evolve with no captured vars and no default arguments (overloads instead). Also fixes wildcard import violations in sensor tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…stanceBetween, channel Implements migration/05: gradientCast, sensorGradientCast, broadcast, sensorBroadcast, distanceBetween, channel, sensorChannel — all built on share + distanceTo + minHoodSelector. Uses decomposed approach (separate potential and value shares) to keep Format constraint on V alone. 8 network-convergence and single-device tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…CastLibrary sensor variants - TimeLibrary: decay, timer, limitedMemory, cyclicTimer/WithDecay, sharedTimerWithDecay[Format,T], clock, impulsesEvery, exponentialBackoffFilter, sharedTimer, recentlyTrue, evaporation, cyclicFunction — no default args, no TimeUnit, FiniteDuration-safe. - GradientCastLibrary: replace sensor* prefix functions with same-name overloads (gradientCast/broadcast/distanceBetween/channel). Internal cross-calls route through a single private castImpl to avoid Scala 3 overload-resolution failures on path-dependent SharedData types. - Export TimeLibrary from All.scala. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ibrary (migration/06) Port hopGradient, crfGradient, bisGradient and flexGradient plus the meanCounter helper, each with sensor* overloads. Fix an alignment bug where the source branch returned before neighborValues/senseLag, so the gradient never propagated and stayed at the Infinity sentinel: hoist all neighbour communication above the source branch (mirroring distanceTo). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Port the collection operator: collect, findParent/findParentOpt, and the collectCount/Mean/Maps/Sets/IntoSet/ValuesByDevices reducers. Abstract DeviceId is handled via Ordering/UpperBounded context bounds and a DeviceId codec for parent-pointer gossip. Fold neighbour contributions via withoutSelf: the full-field iterator reflects the live alignment scope (not the field's captured devices) and collapses neighbours that share a value, which would undercount sums. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…igration/08) Port the S block: sparseChoice/breakUsingUids/randomUid/minId. Devices compete via UIDs (random seed, deviceId) latched by evolve; a device abdicates to a lower nearby UID, "near" decided by distanceTo against grain. UIDs ordered lexicographically; grain/2 checks done by doubling to keep D a plain Numeric. neighborValues hoisted above the branch for alignment; self folded explicitly to avoid the full-field iterator. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ted (migration/10)
Add ConditionalExportLanguage/Context — a snapshot/rollback primitive that gates
exchange-state participation so devices outside a process bubble remain invisible
to in-bubble neighbours (equivalent to legacy vm.newExportStack + mergeExport /
discardExport). Wire it into ExchangeAggregateContext and OutboundMessage.
ProcessLibrary implements:
- ProcessStatus enum (External / Bubble / Output / Terminated)
- ProcessOutput[+R] case class
- sspawn: dynamic, keyed spatial bubbles with per-key conditionallyExport gating
and gossip-based handleTermination propagation
- replicated: time-rotating window of replicates process instances driven by
sharedTimerWithDecay
14 new tests; 191/191 pass.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e API ergonomics
- sspawn -> spawn, with the process as a trailing lambda so call sites
read like a control structure: spawn(generation, args) { key => a => ... }
- add ProcessOutput smart constructors (output/bubble/external/terminated)
- replicated reshaped to replicated(period, replicates, argument)(proc)
and now evaluates proc unconditionally so replicas stay aligned
- keep the K key and A args as distinct process inputs
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mechanical only: import reordering, line rewrapping, end markers, and stray-whitespace cleanup. No behavioral changes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Shrink ConnectWithinDistance radius (5 -> 0.2) and grid/point spacing to 0.1 so the example deploys in a compact coordinate range. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #249 +/- ##
==========================================
+ Coverage 59.76% 68.29% +8.53%
==========================================
Files 58 69 +11
Lines 758 1066 +308
Branches 54 85 +31
==========================================
+ Hits 453 728 +275
- Misses 305 338 +33 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Tick the box to add this pull request to the merge queue (same as
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.