Skip to content

Expose action declaration APIs on Snapshot - #547

Merged
Laimiux merged 2 commits into
masterfrom
laimonas/snapshot-action-receiver
Nov 6, 2026
Merged

Laimiux merged 2 commits into
masterfrom
laimonas/snapshot-action-receiver

Conversation

@Laimiux

@Laimiux Laimiux commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Expose action declaration APIs directly on Snapshot.
  • Update documentation and internal helper receivers to use Snapshot.
  • Deprecate ActionBuilder in favor of Snapshot; retain it as a superinterface for now.

Validation

  • ./gradlew build

@olive-agent

olive-agent Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Olive Review: ✅ Approved

Posted by: GitHub @olive-agent[bot]
Reviewed commit: 1c264892e4ba8dfaf7af844d00de7eadc734f967
Base ref: origin/master
Merge base: 2c7f7b4823854175e357e9a38e168b98ca253b0d

Review Summary

The change makes Snapshot the primary API for declaring actions and updates documentation and helper receivers accordingly. ActionBuilder remains a superinterface for compatibility but is deprecated, guiding callers toward Snapshot. Unique current findings: 0. Selected preexisting concerns: 0.

📣 Human Attention

  • 📣 ActionBuilder is deprecated in favor of Snapshot for action declarations. Snapshot still extends ActionBuilder, preserving existing helpers, but callers referencing ActionBuilder now receive deprecation warnings and may need to migrate their helper receivers.

Component Walkthrough

  • Action declaration API compatibility — formula/src/main/java/com/instacart/formula/ActionBuilder.kt:7 (changed) — ActionBuilder retains its action declaration methods but is now deprecated, directing callers to use Snapshot receivers while preserving compatibility through Snapshot’s existing inheritance.
PR Inbox Meta
{
  "changeComplexity": "complex",
  "hasHumanAttention": true
}

*
* @param transition A function that is invoked when [Action] emits an [Event].
*/
override fun <Event> events(

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding copies of these from ActionBuilder as that interface will be removed.

@carrotkite

Copy link
Copy Markdown
3 Warnings
⚠️ No coverage data found for com/instacart/formula/Action
⚠️ No coverage data found for com/instacart/formula/Snapshot
⚠️ No coverage data found for com/instacart/formula/ActionBuilder

JaCoCo Code Coverage 93.04% ✅

Class Covered Meta Status
com/instacart/formula/runtime/SnapshotImpl 93% 0% ✅
com/instacart/formula/android/internal/NavigationStoreFormula 100% 0% ✅
com/instacart/formula/FormulaContext 84% 0% ✅
com/instacart/formula/Action No coverage data found : -% No coverage data found : -% 🃏
com/instacart/formula/Formula 100% 0% ✅
com/instacart/formula/StatelessFormula 100% 0% ✅
com/instacart/formula/Snapshot No coverage data found : -% No coverage data found : -% 🃏
com/instacart/formula/ActionBuilder No coverage data found : -% No coverage data found : -% 🃏

Generated by 🚫 Danger

@Laimiux

Laimiux commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

olive review

@carrotkite

carrotkite commented Nov 6, 2026 •

Copy link
Copy Markdown
1 Warning
⚠️ ⚠️ Performance regressions detected in benchmarks

📊 Benchmark Comparison Report

Summary

  • Regressions: 24 ⚠️
  • Improvements: 0
  • Unchanged: 1

⚠️ Performance Regressions

Benchmark Baseline Current Change
com.instacart.formula.benchmarks.ChildrenInitializationBenchmark.initializeNewChildren (childrenCount=100) 6.624 ± 0.213 us/op 11.48 ± 0.262 us/op +73.3% 🔴
com.instacart.formula.benchmarks.CallbackInitializationBenchmark.initializeNewCallbacks (callbackCount=50) 3.791 ± 0.385 us/op 6.213 ± 0.971 us/op +63.9% 🔴
com.instacart.formula.benchmarks.GlobalEffectQueueBenchmark.measure10Effects 0.422 ± 0.012 us/op 0.66 ± 0.037 us/op +56.4% 🔴
com.instacart.formula.benchmarks.ChildrenCountBenchmark.stateChanges (childrenCount=100) 10.356 ± 0.112 us/op 15.859 ± 0.197 us/op +53.1% 🔴
com.instacart.formula.benchmarks.ChildrenInitializationBenchmark.initializeNewChildren (childrenCount=25) 2.333 ± 0.33 us/op 3.572 ± 0.308 us/op +53.1% 🔴
com.instacart.formula.benchmarks.ChildrenCountBenchmark.stateChanges (childrenCount=25) 9.48 ± 0.193 us/op 14.292 ± 0.155 us/op +50.8% 🔴
com.instacart.formula.benchmarks.ActionInitializationBenchmark.initializeNewActions (actionCount=1) 0.503 ± 0.052 us/op 0.753 ± 0.108 us/op +49.7% 🔴
com.instacart.formula.benchmarks.TransitionBenchmark.transitions (depth=10) 9.408 ± 0.056 us/op 14.056 ± 0.077 us/op +49.4% 🔴
com.instacart.formula.benchmarks.ChildrenCountBenchmark.stateChanges (childrenCount=1) 9.347 ± 0.501 us/op 13.952 ± 0.114 us/op +49.3% 🔴
com.instacart.formula.benchmarks.TransitionBenchmark.transitions (depth=0) 9.222 ± 0.082 us/op 13.729 ± 0.167 us/op +48.9% 🔴
com.instacart.formula.benchmarks.ActionInitializationBenchmark.initializeNewActions (actionCount=100) 7.388 ± 0.187 us/op 10.954 ± 0.224 us/op +48.3% 🔴
com.instacart.formula.benchmarks.CallbackOverheadBenchmark.transitions (callbackCount=10) 9.737 ± 0.132 us/op 14.381 ± 0.181 us/op +47.7% 🔴
com.instacart.formula.benchmarks.ActionCountBenchmark.stateChanges (actionCount=25) 9.622 ± 0.223 us/op 14.2 ± 0.092 us/op +47.6% 🔴
com.instacart.formula.benchmarks.ActionCountBenchmark.stateChanges (actionCount=1) 9.509 ± 0.144 us/op 13.975 ± 0.243 us/op +47.0% 🔴
com.instacart.formula.benchmarks.CallbackOverheadBenchmark.transitions (callbackCount=50) 10.98 ± 0.352 us/op 16.125 ± 1.068 us/op +46.9% 🔴
com.instacart.formula.benchmarks.ChildrenInitializationBenchmark.initializeNewChildren (childrenCount=1) 0.492 ± 0.093 us/op 0.721 ± 0.095 us/op +46.6% 🔴
com.instacart.formula.benchmarks.ActionCountBenchmark.stateChanges (actionCount=100) 10.362 ± 0.705 us/op 15.11 ± 0.126 us/op +45.8% 🔴
com.instacart.formula.benchmarks.GlobalEffectQueueBenchmark.measure1Effect 0.036 ± 0.0 us/op 0.053 ± 0.001 us/op +45.4% 🔴
com.instacart.formula.benchmarks.CallbackInitializationBenchmark.initializeNewCallbacks (callbackCount=10) 1.241 ± 0.162 us/op 1.786 ± 0.285 us/op +43.8% 🔴
com.instacart.formula.benchmarks.GlobalEffectQueueBenchmark.measure100Effects 6.005 ± 0.26 us/op 8.638 ± 0.068 us/op +43.8% 🔴
com.instacart.formula.benchmarks.TransitionBenchmark.transitions (depth=20) 10.166 ± 1.368 us/op 14.579 ± 0.135 us/op +43.4% 🔴
com.instacart.formula.benchmarks.ActionInitializationBenchmark.initializeNewActions (actionCount=25) 2.426 ± 0.196 us/op 3.268 ± 0.135 us/op +34.7% 🔴
com.instacart.formula.benchmarks.TransitionQueueBenchmark.measure10000 0.316 ± 0.019 us/op 0.355 ± 0.012 us/op +12.6% 🔴
com.instacart.formula.benchmarks.TransitionQueueBenchmark.measure1 0.303 ± 0.004 us/op 0.341 ± 0.007 us/op +12.6% 🔴
No significant changes (1 benchmarks)
Benchmark Baseline Current Change
com.instacart.formula.benchmarks.TransitionQueueBenchmark.measure100 0.317 ± 0.03 us/op 0.347 ± 0.008 us/op +9.4%

Regressions: ±10% with non-overlapping confidence intervals. Improvements: ±10% change only.

Generated by 🚫 Danger

@Zikstar Zikstar left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@Jawnnypoo Jawnnypoo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

surprised no samples were updated for the site or the README, maybe nothing applicable there?

@Laimiux
Laimiux merged commit c96c5c5 into master Nov 6, 2026
9 checks passed
@Laimiux
Laimiux deleted the laimonas/snapshot-action-receiver branch November 6, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants