Skip to content

Rename inMemoryStore to indexerState for clarity - #1331

Merged
DZakh merged 1 commit into
mainfrom
claude/jolly-hamilton-8ri4oq
Jun 17, 2026
Merged

Rename inMemoryStore to indexerState for clarity#1331
DZakh merged 1 commit into
mainfrom
claude/jolly-hamilton-8ri4oq

Conversation

@DZakh

@DZakh DZakh commented Jun 17, 2026

Copy link
Copy Markdown
Member

Rename the inMemoryStore parameter and variable throughout the codebase to indexerState to better reflect its actual purpose and scope.

Summary

This refactoring improves naming clarity by renaming inMemoryStore to indexerState across the event processing pipeline. The IndexerState type manages more than just in-memory storage—it coordinates the entire indexer state including load managers, persistence, and checkpoint tracking. The new name better communicates this broader responsibility.

Changes

  • Renamed parameter ~inMemoryStore to ~indexerState in:

    • LoadLayer.loadById, LoadLayer.loadByFilter, LoadLayer.loadEffect
    • EventProcessing.runEventHandlerOrThrow, EventProcessing.runHandlerOrThrow, EventProcessing.preloadBatchOrThrow, EventProcessing.runBatchHandlersOrThrow, EventProcessing.processEventBatch
    • UserContext.contextParams type and related handler context functions
    • BatchProcessing.processNextBatch
    • Test helpers in MockIndexer.InMemoryStore
  • Updated all call sites and variable bindings to use the new name

  • Updated a comment in LoadLayer.res from "inMemoryStore" to "in-memory store" for consistency

  • Updated a comment in BatchProcessing.res from "inMemoryStore.isProcessing" to "state.isProcessing"

Implementation Details

This is a pure rename with no functional changes. All references to the parameter have been updated consistently across the codebase, including test files and interface definitions (.resi files).

https://claude.ai/code/session_01736gwmXs4qXZ1ujzF1C8nk

Summary by CodeRabbit

  • Refactor
    • Improved internal state management consistency and parameter naming throughout the indexer processing pipeline to enhance code clarity and maintainability.

The binding carries IndexerState.t — the whole indexer state, not just a
store — so the inMemoryStore name misled readers. Rename the parameter,
contextParams field, and local bindings across EventProcessing,
UserContext, LoadLayer, and BatchProcessing (and the affected tests). The
InMemoryStore module and the in-memory-store concept are unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01736gwmXs4qXZ1ujzF1C8nk
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fc373b81-3019-4c98-aa1c-c5a626c32677

📥 Commits

Reviewing files that changed from the base of the PR and between ddc4653 and fb897ab.

📒 Files selected for processing (8)
  • packages/envio/src/BatchProcessing.res
  • packages/envio/src/EventProcessing.res
  • packages/envio/src/LoadLayer.res
  • packages/envio/src/LoadLayer.resi
  • packages/envio/src/UserContext.res
  • scenarios/test_codegen/test/EventOrigin_test.res
  • scenarios/test_codegen/test/LoadLayer_test.res
  • scenarios/test_codegen/test/helpers/MockIndexer.res

📝 Walkthrough

Walkthrough

Renames the parameter inMemoryStore to indexerState uniformly across the loading, context, and event-processing pipeline. Updated files include LoadLayer.resi/.res, UserContext.res, EventProcessing.res, BatchProcessing.res, and all associated test helpers and test cases.

Changes

inMemoryStore → indexerState rename

Layer / File(s) Summary
Public interface contracts updated
packages/envio/src/LoadLayer.resi, packages/envio/src/UserContext.res
LoadLayer.resi updates the three exported loader signatures (loadById, loadByFilter, loadEffect) to use indexerState: IndexerState.t. UserContext.res replaces the inMemoryStore field with indexerState in the contextParams record type.
LoadLayer and UserContext implementation rewired
packages/envio/src/LoadLayer.res, packages/envio/src/UserContext.res
LoadLayer.res updates loadById, loadEffect, and loadByFilter to accept ~indexerState and derive inMemTable and committedCheckpointId from it. UserContext.res rewires all LoadLayer call sites, in-memory mutation helpers (Entity.set, Delete), and entityContextParams construction to use params.indexerState.
EventProcessing and BatchProcessing call sites updated
packages/envio/src/EventProcessing.res, packages/envio/src/BatchProcessing.res
EventProcessing.res renames ~inMemoryStore to ~indexerState in all five public functions; processEventBatch additionally switches backpressure (awaitCapacity) and batch commit (commitBatch) to operate on indexerState. BatchProcessing.res updates a comment and reorders the argument in the processEventBatch call.
Test helper and tests updated
scenarios/test_codegen/test/helpers/MockIndexer.res, scenarios/test_codegen/test/LoadLayer_test.res, scenarios/test_codegen/test/EventOrigin_test.res
MockIndexer.res renames the created value to indexerState in InMemoryStore.make and reads committedCheckpointId from it in setEntity. All test cases in LoadLayer_test.res and EventOrigin_test.res are updated to construct indexerState, pass ~indexerState to loaders, and seed via indexerState->setEntity(...).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • enviodev/hyperindex#1269: Modifies processEventBatch in EventProcessing.res to change its backpressure and commit flow, directly overlapping with this PR's wiring changes to the same function.
  • enviodev/hyperindex#1291: Refactors batch-processing tracking (isProcessing, processedBatchesCount) to live on the in-memory store, which is the same state object being renamed here.
  • enviodev/hyperindex#1306: Updates LoadLayer.res and UserContext.res loadBy*/getWhereHandler plumbing, the same files and call paths updated by this rename.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: renaming inMemoryStore to indexerState throughout the codebase for improved naming clarity.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

@DZakh
DZakh enabled auto-merge (squash) June 17, 2026 10:18
@DZakh
DZakh disabled auto-merge June 17, 2026 10:18
@DZakh
DZakh merged commit 85c1d17 into main Jun 17, 2026
20 of 22 checks passed
@DZakh
DZakh deleted the claude/jolly-hamilton-8ri4oq branch June 17, 2026 11:15
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