Skip to content

Conversation

@snawaz
Copy link
Contributor

@snawaz snawaz commented Nov 6, 2025

Summary by CodeRabbit

  • Refactor

    • Renamed commit strategy variant names for improved consistency and clarity across the codebase.
  • Tests

    • Updated test cases to reflect updated commit strategy variant naming.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 6, 2025

📝 Walkthrough

Walkthrough

This pull request renames all variants of the CommitStrategy enum across the codebase. The variants are renamed as follows: Args to StateArgs, ArgsWithLookupTable to StateArgsWithLookupTable, FromBuffer to StateBuffer, and FromBufferWithLookupTable to StateBufferWithLookupTable. Corresponding string mappings in the as_str() method and TryFrom<&str> implementations are updated to reflect the new names. All references to these variants in tests, visitors, and database code are updated to use the new naming convention. No changes to method signatures, control flow, or error handling are introduced.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor Author

snawaz commented Nov 6, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@snawaz snawaz force-pushed the snawaz/rename-optimize branch from 29b3552 to c3bd6e4 Compare November 6, 2025 05:47
@snawaz snawaz force-pushed the snawaz/diff-stragegy branch 2 times, most recently from 7d634cb to 70ad890 Compare November 6, 2025 05:54
@snawaz snawaz force-pushed the snawaz/rename-optimize branch 2 times, most recently from b72b7e3 to bc42634 Compare November 6, 2025 06:47
@snawaz snawaz force-pushed the snawaz/diff-stragegy branch 3 times, most recently from f0e9ab3 to 38e965e Compare November 9, 2025 17:06
@snawaz snawaz force-pushed the snawaz/rename-optimize branch 2 times, most recently from 367959a to f19be9a Compare November 9, 2025 20:45
@snawaz snawaz force-pushed the snawaz/diff-stragegy branch from 38e965e to 54f5b23 Compare November 9, 2025 20:45
@snawaz snawaz force-pushed the snawaz/rename-optimize branch from f19be9a to 2f0b47b Compare November 10, 2025 06:35
@snawaz snawaz force-pushed the snawaz/diff-stragegy branch 2 times, most recently from 536cad3 to 7bdb146 Compare November 10, 2025 07:00
@snawaz snawaz force-pushed the snawaz/rename-optimize branch 2 times, most recently from 53427bb to d0b2f04 Compare November 17, 2025 05:57
@snawaz snawaz force-pushed the snawaz/diff-stragegy branch 2 times, most recently from ba03bde to 761da13 Compare November 17, 2025 05:59
@snawaz snawaz force-pushed the snawaz/rename-optimize branch 2 times, most recently from 26d1806 to ecea86a Compare November 17, 2025 06:16
@snawaz snawaz force-pushed the snawaz/diff-stragegy branch from 761da13 to 381fb3a Compare November 17, 2025 06:16
@snawaz snawaz force-pushed the snawaz/rename-optimize branch from ecea86a to c63d4ff Compare November 17, 2025 10:15
@snawaz snawaz force-pushed the snawaz/diff-stragegy branch from 381fb3a to b62028f Compare November 17, 2025 10:15
@snawaz snawaz force-pushed the snawaz/rename-optimize branch from c63d4ff to 5292303 Compare November 17, 2025 10:31
@snawaz snawaz force-pushed the snawaz/diff-stragegy branch from b62028f to 6d973be Compare November 17, 2025 10:31
@snawaz snawaz force-pushed the snawaz/rename-optimize branch from ec0d2f5 to 68c2b0c Compare November 18, 2025 14:07
@snawaz snawaz force-pushed the snawaz/rename-optimize branch from 68c2b0c to 82708f8 Compare November 21, 2025 18:44
@snawaz snawaz force-pushed the snawaz/diff-stragegy branch 2 times, most recently from 8ecc317 to 3beda6e Compare November 21, 2025 19:23
@snawaz snawaz force-pushed the snawaz/rename-optimize branch from 82708f8 to 0907290 Compare November 21, 2025 19:23
@snawaz snawaz force-pushed the snawaz/diff-stragegy branch from 3beda6e to a01308a Compare November 21, 2025 20:30
@snawaz snawaz force-pushed the snawaz/rename-optimize branch from 0907290 to 1dd9fbd Compare November 21, 2025 20:30
@snawaz snawaz force-pushed the snawaz/diff-stragegy branch 2 times, most recently from d31f0a8 to bac80f0 Compare November 21, 2025 21:24
@snawaz snawaz force-pushed the snawaz/rename-optimize branch from 2980bf2 to fe0e42d Compare November 21, 2025 21:34
@snawaz snawaz force-pushed the snawaz/diff-stragegy branch 2 times, most recently from 4d93f4e to e17f99d Compare November 21, 2025 23:52
@snawaz snawaz force-pushed the snawaz/rename-optimize branch from fe0e42d to db32d00 Compare November 21, 2025 23:52
@snawaz snawaz force-pushed the snawaz/rename-optimize branch from db32d00 to 7b4e2bb Compare December 16, 2025 09:08
@snawaz snawaz force-pushed the snawaz/diff-stragegy branch 2 times, most recently from 4cb8346 to 1e4a115 Compare December 18, 2025 18:01
@snawaz snawaz force-pushed the snawaz/rename-optimize branch from 7b4e2bb to 5e96ff9 Compare December 18, 2025 18:01
@snawaz snawaz force-pushed the snawaz/diff-stragegy branch from 1e4a115 to fff90b3 Compare December 19, 2025 16:44
@snawaz snawaz force-pushed the snawaz/rename-optimize branch 2 times, most recently from 6b7daa1 to e9b6661 Compare December 19, 2025 17:58
@snawaz snawaz force-pushed the snawaz/diff-stragegy branch from fff90b3 to 5de4b20 Compare December 19, 2025 17:58
@snawaz snawaz changed the title feat: Make TaskStrategy more granular feat: Make CommitStrategy more granular Dec 22, 2025
@snawaz snawaz force-pushed the snawaz/diff-stragegy branch from 5de4b20 to 2ba11d8 Compare December 26, 2025 10:28
@snawaz snawaz force-pushed the snawaz/rename-optimize branch from e9b6661 to 99dc29b Compare December 26, 2025 10:28
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
test-integration/test-committor-service/tests/test_ix_commit_local.rs (1)

108-121: Critical: Update missed references to old variant name.

Lines 114 and 119 still reference CommitStrategy::FromBuffer, which no longer exists after the rename to CommitStrategy::StateBuffer. This will cause compilation errors.

🔎 Proposed fix
 #[tokio::test]
 async fn test_ix_commit_order_book_change_680_bytes() {
     // We cannot use 680 as changed_len because that both 679 and 680 produce encoded tx
     // of size 1644 (which is the max limit), but while the size of raw bytes for 679 is within
     // 1232 limit, the size for 680 execeds by 1 (1233). That is why we used
-    // 681 as changed_len where CommitStrategy goes from Args to FromBuffer.
-    commit_book_order_account(681, CommitStrategy::FromBuffer, false).await;
+    // 681 as changed_len where CommitStrategy goes from Args to StateBuffer.
+    commit_book_order_account(681, CommitStrategy::StateBuffer, false).await;
 }
 
 #[tokio::test]
 async fn test_ix_commit_order_book_change_10k_bytes() {
-    commit_book_order_account(10 * 1024, CommitStrategy::FromBuffer, false)
+    commit_book_order_account(10 * 1024, CommitStrategy::StateBuffer, false)
         .await;
 }
magicblock-committor-service/src/persist/types/commit_strategy.rs (1)

44-59: Critical: Update TryFrom to match corrected string representations.

The TryFrom<&str> implementation must be updated to match the corrected string representations from as_str() (after fixing the "Stage"/"State" typos).

🔎 Proposed fix
 impl TryFrom<&str> for CommitStrategy {
     type Error = CommitPersistError;
     fn try_from(value: &str) -> Result<Self, CommitPersistError> {
         match value {
             "StateArgs" => Ok(Self::StateArgs),
-            "StateArgsWithLookupTable" => Ok(Self::StateArgsWithLookupTable),
-            "StageBuffer" => Ok(Self::StateBuffer),
-            "StageBufferWithLookupTable" => {
+            "StateArgsWithLookupTable" => Ok(Self::StateArgsWithLookupTable),
+            "StateBuffer" => Ok(Self::StateBuffer),
+            "StateBufferWithLookupTable" => {
                 Ok(Self::StateBufferWithLookupTable)
             }
             _ => Err(CommitPersistError::InvalidCommitStrategy(
                 value.to_string(),
             )),
         }
     }
 }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 99dc29b and 2ba11d8.

📒 Files selected for processing (5)
  • magicblock-committor-service/src/persist/commit_persister.rs
  • magicblock-committor-service/src/persist/db.rs
  • magicblock-committor-service/src/persist/types/commit_strategy.rs
  • magicblock-committor-service/src/tasks/task_visitors/persistor_visitor.rs
  • test-integration/test-committor-service/tests/test_ix_commit_local.rs
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-11-21T10:22:07.520Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 661
File: magicblock-committor-service/src/intent_executor/single_stage_executor.rs:20-28
Timestamp: 2025-11-21T10:22:07.520Z
Learning: In magicblock-committor-service's SingleStageExecutor and TwoStageExecutor (single_stage_executor.rs and two_stage_executor.rs), the fields transaction_strategy, junk, and patched_errors are intentionally public because these executors are designed to be used independently outside of the IntentExecutor scope, and callers need access to these execution reports for cleanup and error handling.

Applied to files:

  • magicblock-committor-service/src/persist/commit_persister.rs
  • test-integration/test-committor-service/tests/test_ix_commit_local.rs
  • magicblock-committor-service/src/persist/types/commit_strategy.rs
📚 Learning: 2025-12-03T09:33:48.707Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: test-integration/test-committor-service/tests/test_ix_commit_local.rs:867-881
Timestamp: 2025-12-03T09:33:48.707Z
Learning: Repo: magicblock-labs/magicblock-validator PR: 639
Context: test-integration/test-committor-service/tests/test_ix_commit_local.rs (ix_commit_local)
Learning: The PhotonIndexer used for compressed account fetches (get_compressed_account) has built‑in retry logic (defaults to ~10 attempts), so tests should not add separate retry loops around compressed fetches unless there’s a specific need.

Applied to files:

  • magicblock-committor-service/src/persist/commit_persister.rs
  • test-integration/test-committor-service/tests/test_ix_commit_local.rs
📚 Learning: 2025-12-03T09:36:01.527Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: magicblock-chainlink/src/remote_account_provider/mod.rs:1350-1353
Timestamp: 2025-12-03T09:36:01.527Z
Learning: Repo: magicblock-labs/magicblock-validator
File: magicblock-chainlink/src/remote_account_provider/mod.rs
Context: consolidate_fetched_remote_accounts
Learning: For unexpected result counts (>2), the project prefers logging an error and returning an empty Vec over panicking; acceptable during development per maintainer (Dodecahedr0x).

Applied to files:

  • test-integration/test-committor-service/tests/test_ix_commit_local.rs
🔇 Additional comments (7)
magicblock-committor-service/src/persist/db.rs (1)

775-775: LGTM!

Test data correctly updated to use the renamed CommitStrategy variants (StateArgs and StateBuffer).

Also applies to: 910-910

magicblock-committor-service/src/persist/commit_persister.rs (1)

588-588: LGTM!

Test correctly updated to use the renamed CommitStrategy::StateArgs variant.

Also applies to: 595-595

test-integration/test-committor-service/tests/test_ix_commit_local.rs (2)

70-70: LGTM!

Single account tests correctly updated to use renamed variants (StateArgs and StateBuffer).

Also applies to: 75-75, 80-80, 85-85, 90-90, 95-95, 100-100, 105-105


267-268: LGTM!

Multiple account test expectations correctly updated to use the renamed CommitStrategy variants (StateArgs, StateBuffer, StateArgsWithLookupTable, StateBufferWithLookupTable).

Also applies to: 279-280, 291-292, 303-304, 315-316, 324-327, 333-334, 343-348, 358-360, 371-373, 383-384, 393-395, 402-403, 412-415, 424-425, 436-437, 449-450

magicblock-committor-service/src/tasks/task_visitors/persistor_visitor.rs (2)

26-66: LGTM!

Correctly updated to use renamed variants (StateArgsWithLookupTable and StateArgs) in the args task visitor.


68-107: LGTM!

Correctly updated to use renamed variants (StateBufferWithLookupTable and StateBuffer) in the buffer task visitor.

magicblock-committor-service/src/persist/types/commit_strategy.rs (1)

7-14: LGTM!

Enum variants correctly renamed to State-prefixed names.

@snawaz
Copy link
Contributor Author

snawaz commented Dec 26, 2025

changes from this PR are folded into its ancestor.

@snawaz snawaz closed this Dec 26, 2025
@snawaz snawaz deleted the snawaz/diff-stragegy branch December 26, 2025 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants