Skip to content

Conversation

@tk-o
Copy link
Contributor

@tk-o tk-o commented Feb 11, 2026

Lite PR

Tip: Review docs on the ENSNode PR process

Summary

  • This PR introduces structural changes only (no logical changes were intended).
  • Updates in this PR will enable creating an independent validation layer for OmnichainIndexingStatusSnapshot data model.

Why

  • Indexing Status Builder has to able to build an object like Unvalidated<OmnichainIndexingStatusSnapshot> and have it validated with validateOmnichainIndexingStatusSnapshot.

Testing

  • Ran lint, typecheck, and test.
  • Tested /api/indexing-status on local ENSIndexer instance.
  • Tested /api/indexing-status on local ENSApi instance connected to ENSIndexer Alpha in the Green env.

Notes for Reviewer (Optional)

  • Review commit-by-commit is encouraged.
  • Please focus on the WHYs, this PR won't be optimising any business logic. If any of such updates are required, please share feedback and let's log it in issue tracker.
  • This change represents a slice of a larger updated initially proposed in PR refactor(ensnode-sdk): improve Indexing Status data model #1615.
    • Hoping this smaller PR approach with granular commits enables more straightforward review process.
  • If changes proposed in this PR for Omnichain Indexing Status Snapshot data model are approved, I'll create another two PRs, just like this one, for the remaining data models in ENSIndexer Indexing Status module:
    • CrossChainIndexingStatusSnapshot
    • RealtimeIndexingStatusProjection

Pre-Review Checklist (Blocking)

  • This PR does not introduce significant changes and is low-risk to review quickly.
  • Relevant changesets are included (or are not required)

tk-o added 14 commits February 11, 2026 13:07
Replace `./types` with `./omnichain-indexing-status-snapshot`
Replace `./helpers` with `./omnichain-indexing-status-snapshot`
Replace `./serialized-types` with `./serialize/omnichain-indexing-status-snapshot`
Replace `./serialize` with `./serialize/omnichain-indexing-status-snapshot`
Replace `./zod-schemas` with `./zod-schema/omnichain-indexing-status-snapshot`
Replace `./deserialize` with `./deserialize/omnichain-indexing-status-snapshot`
Copilot AI review requested due to automatic review settings February 11, 2026 12:31
@vercel
Copy link
Contributor

vercel bot commented Feb 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
admin.ensnode.io Ready Ready Preview, Comment Feb 11, 2026 0:31am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
ensnode.io Skipped Skipped Feb 11, 2026 0:31am
ensrainbow.io Skipped Skipped Feb 11, 2026 0:31am

@changeset-bot
Copy link

changeset-bot bot commented Feb 11, 2026

⚠️ No Changeset found

Latest commit: f5f1848

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Feb 11, 2026

📝 Walkthrough

Walkthrough

This pull request refactors the indexing-status module by extracting omnichain indexing snapshot types, serialization/deserialization, and validation logic into dedicated, focused modules. Previously scattered logic is consolidated into dedicated files for types, serializers, deserializers, and Zod schemas, while simplifying helpers and updating import paths across the codebase.

Changes

Cohort / File(s) Summary
Omnichain Indexing Status Type Module
omnichain-indexing-status-snapshot.ts, omnichain-indexing-status-snapshot.test.ts
New module defining OmnichainIndexingStatusIds, status variant interfaces, and helper functions (getOmnichainIndexingStatus, getOmnichainIndexingCursor, type guards). Test updated to import from new module location.
Serialization Module
serialize/omnichain-indexing-status-snapshot.ts, serialize.ts, serialized-types.ts
New serialize module with serialized variant types and serializeOmnichainIndexingStatusSnapshot function. Removed from main serialize.ts; serialized-types.ts now imports unified SerializedOmnichainIndexingStatusSnapshot from dedicated module.
Deserialization Module
deserialize/omnichain-indexing-status-snapshot.ts, deserialize.ts
New deserialize module with deserializeOmnichainIndexingStatusSnapshot function. Removed from main deserialize.ts.
Zod Schema Module
zod-schema/omnichain-indexing-status-snapshot.ts, zod-schemas.ts
New zod-schema module defining makeOmnichainIndexingStatusSnapshotSchema and invariant checks. Removed from zod-schemas.ts which now imports from dedicated module.
Validation Simplification
validations.ts
Removed all omnichain-specific invariant functions (~234 lines); omnichain validation now handled in zod-schema module.
Helper Function Refactoring
helpers.ts
Replaced six omnichain-related helper functions with single getLatestIndexedBlockRef function. Narrowed imports to BlockRef, ChainId, and CrossChainIndexingStatusSnapshot.
Public API Reorganization
index.ts, types.ts
Added public exports for new omnichain modules in index.ts. Removed omnichain type definitions from types.ts; now imports from omnichain-indexing-status-snapshot.ts.
Test Import Updates
conversions.test.ts, projection.test.ts
Updated import paths to reference new omnichain module locations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

ensnode-sdk

Poem

🐰 Types hop to their new homes so neat,
Schemas and serializers, each in their suite,
Validations move to zod-schema's care,
Helpers simplified with elegant flair,
Organization blooms where chaos once was! 🌿

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title mentions 'improve of' which is grammatically awkward, and it's unclear what specific improvement is being made to the data model. Consider revising to 'refactor(ensnode-sdk): reorganize OmnichainIndexingStatusSnapshot data model' or similar for clarity about the structural restructuring involved.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 88.24% which is sufficient. The required threshold is 80.00%.
Description check ✅ Passed The PR description follows the template structure with all required sections completed: Summary, Why, Testing, Notes for Reviewer, and Pre-Review Checklist. It provides clear rationale and context.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/ensnode-omnichain-indexing-status-snapshot

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.

@tk-o tk-o marked this pull request as ready for review February 11, 2026 12:36
@tk-o tk-o requested a review from a team as a code owner February 11, 2026 12:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors the ENSNode SDK’s ENSIndexer indexing-status area to split the OmnichainIndexingStatusSnapshot model/serialization/deserialization/Zod schema into dedicated modules, paving the way for an independent validation layer.

Changes:

  • Moved the OmnichainIndexingStatusSnapshot data model + helper logic into a new omnichain-indexing-status-snapshot.ts module.
  • Extracted omnichain snapshot Zod schema + invariants into zod-schema/omnichain-indexing-status-snapshot.ts and wired it into the existing zod-schemas entrypoint.
  • Extracted omnichain snapshot serialization/deserialization types + functions into serialize/omnichain-indexing-status-snapshot.ts and deserialize/omnichain-indexing-status-snapshot.ts.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/ensnode-sdk/src/ensindexer/indexing-status/zod-schemas.ts Switched omnichain snapshot schema import to the new dedicated zod-schema module.
packages/ensnode-sdk/src/ensindexer/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts New: omnichain snapshot Zod schema + related invariants and chain-map transform.
packages/ensnode-sdk/src/ensindexer/indexing-status/validations.ts Removed omnichain snapshot invariants from the shared validations module.
packages/ensnode-sdk/src/ensindexer/indexing-status/types.ts Removed omnichain snapshot types from types.ts; now references the new omnichain model module.
packages/ensnode-sdk/src/ensindexer/indexing-status/serialized-types.ts Redirected omnichain snapshot serialized type usage to the new serialize module.
packages/ensnode-sdk/src/ensindexer/indexing-status/serialize/omnichain-indexing-status-snapshot.ts New: omnichain snapshot serialization + serialized type definitions.
packages/ensnode-sdk/src/ensindexer/indexing-status/serialize.ts Delegates omnichain snapshot serialization to the new serialize module.
packages/ensnode-sdk/src/ensindexer/indexing-status/projection.test.ts Updated imports to reference the new omnichain model module.
packages/ensnode-sdk/src/ensindexer/indexing-status/omnichain-indexing-status-snapshot.ts New: omnichain snapshot data model + helper functions (status/cursor derivation, checks).
packages/ensnode-sdk/src/ensindexer/indexing-status/omnichain-indexing-status-snapshot.test.ts Updated imports to reference the new omnichain model module.
packages/ensnode-sdk/src/ensindexer/indexing-status/index.ts Barrel exports updated to include new omnichain serialize/deserialize/model modules.
packages/ensnode-sdk/src/ensindexer/indexing-status/helpers.ts Removed omnichain helper logic now housed in the omnichain model module.
packages/ensnode-sdk/src/ensindexer/indexing-status/deserialize/omnichain-indexing-status-snapshot.ts New: omnichain snapshot deserialization helper using the new schema module.
packages/ensnode-sdk/src/ensindexer/indexing-status/deserialize.ts Removed omnichain snapshot deserializer from the shared deserialize module.
packages/ensnode-sdk/src/ensindexer/indexing-status/conversions.test.ts Updated imports to use the new omnichain serialize/deserialize modules.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@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: 4

🤖 Fix all issues with AI agents
In
`@packages/ensnode-sdk/src/ensindexer/indexing-status/omnichain-indexing-status-snapshot.ts`:
- Around line 264-272: The local variable allChainsHaveValidStatuses in function
checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing is
misleading because it uses chains.some(...) (checks at least one Following);
rename it to reflect that behavior (e.g., anyChainFollowing or
hasFollowingChain) and update the return to use the new name so the code and
identifier semantics match (referencing ChainIndexingStatusIds.Following).
- Around line 329-331: Add an explicit type guard to narrow
ChainIndexingStatusSnapshot at compile time: implement a function named
isChainIndexedOrBetter(chain: ChainIndexingStatusSnapshot): chain is
Exclude<ChainIndexingStatusSnapshot, ChainIndexingStatusSnapshotQueued> that
returns chain.chainStatus !== ChainIndexingStatusIds.Queued, then use
chains.filter(isChainIndexedOrBetter).map(chain =>
chain.latestIndexedBlock.timestamp) to populate latestIndexedBlockTimestamps so
TypeScript knows latestIndexedBlock is present.

In
`@packages/ensnode-sdk/src/ensindexer/indexing-status/serialize/omnichain-indexing-status-snapshot.ts`:
- Around line 65-98: The switch in serializeOmnichainIndexingStatusSnapshot
repeats identical runtime logic for every OmnichainIndexingStatusIds branch;
extract the common object creation into one shared value and return it once
(e.g., build a const base = { omnichainStatus: indexingStatus.omnichainStatus,
chains: serializeChainIndexingSnapshots(indexingStatus.chains),
omnichainIndexingCursor: indexingStatus.omnichainIndexingCursor }), then perform
a single type assertion or conditional satisfies for the specific
SerializedOmnichainIndexingStatusSnapshot* variant if needed; update references
to OmnichainIndexingStatusIds and serializeChainIndexingSnapshots accordingly
and remove the duplicated case bodies in
serializeOmnichainIndexingStatusSnapshot.

In
`@packages/ensnode-sdk/src/ensindexer/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts`:
- Around line 313-318: The Following variant schema produced by
makeOmnichainIndexingStatusSnapshotFollowingSchema is missing the object-level
invariant that enforces chain invariants; update
makeOmnichainIndexingStatusSnapshotFollowingSchema to call
.check(invariant_omnichainStatusSnapshotFollowingHasValidChains as (v:
ParsePayload<OmnichainIndexingStatusSnapshotFollowing>) => boolean, ...) on the
returned z.strictObject so the specific invariant
invariant_omnichainStatusSnapshotFollowingHasValidChains is applied at the
snapshot (object) level rather than on the chains field; ensure you use the
ParsePayload<OmnichainIndexingStatusSnapshotFollowing> typing when casting the
predicate to satisfy the invariant's expected input type.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 11, 2026

Greptile Overview

Greptile Summary

This PR refactors the ENSNode SDK indexing-status model by extracting OmnichainIndexingStatusSnapshot into a dedicated model module and splitting its (de)serialization and Zod schema layers into per-model files. The public export surface is updated accordingly, while tests are adjusted to import from the new module paths.

One merge-blocking issue: invariant_slowestChainEqualsToOmnichainSnapshotTime now contains a console.log, which will produce unexpected stdout output during validation failures for any downstream consumer using these schemas/deserializers.

Confidence Score: 4/5

  • Mostly safe to merge once the stray debug logging is removed.
  • Changes are primarily structural refactors (module extraction and import path updates) with tests updated accordingly. The only definite behavior-impacting issue found is a console.log added inside a Zod invariant, which would leak stdout output to consumers on validation failures.
  • packages/ensnode-sdk/src/ensindexer/indexing-status/validations.ts

Important Files Changed

Filename Overview
packages/ensnode-sdk/src/ensindexer/indexing-status/deserialize/omnichain-indexing-status-snapshot.ts Introduced dedicated omnichain snapshot deserializer using omnichain zod schema; centralizes snapshot validation.
packages/ensnode-sdk/src/ensindexer/indexing-status/index.ts Re-export surface updated to include new serialize/deserialize modules and snapshot model location.
packages/ensnode-sdk/src/ensindexer/indexing-status/omnichain-indexing-status-snapshot.ts Moved/centralized OmnichainIndexingStatusSnapshot model + helpers; one prior docstring issue already noted in PR threads.
packages/ensnode-sdk/src/ensindexer/indexing-status/serialize/omnichain-indexing-status-snapshot.ts Extracted omnichain indexing status snapshot serialization into dedicated file.
packages/ensnode-sdk/src/ensindexer/indexing-status/validations.ts Removed omnichain snapshot invariants (moved to zod-schema file) and retained cross-chain/projection invariants; introduces a console.log in an invariant (merge-blocking).
packages/ensnode-sdk/src/ensindexer/indexing-status/zod-schema/omnichain-indexing-status-snapshot.ts New internal zod schema module encapsulating omnichain snapshot schema + invariants previously in validations/zod-schemas.
packages/ensnode-sdk/src/ensindexer/indexing-status/zod-schemas.ts Refactored to import omnichain snapshot schema from dedicated zod-schema module; behavior preserved.

Sequence Diagram

sequenceDiagram
  participant Consumer as SDK Consumer
  participant Deserialize as deserialize*()
  participant Zod as Zod Schemas
  participant Validate as invariants/checks
  participant Model as OmnichainIndexingStatusSnapshot
  participant Serialize as serialize*()

  Consumer->>Deserialize: deserializeOmnichainIndexingStatusSnapshot(serialized)
  Deserialize->>Zod: makeOmnichainIndexingStatusSnapshotSchema().safeParse(serialized)
  Zod->>Validate: .check(invariants...)
  Validate-->>Zod: issues[] (if invariant fails)
  Zod-->>Deserialize: parsed.data or error
  Deserialize-->>Consumer: OmnichainIndexingStatusSnapshot

  Consumer->>Serialize: serializeOmnichainIndexingStatusSnapshot(model)
  Serialize->>Model: read omnichainStatus/chains/cursor
  Serialize-->>Consumer: SerializedOmnichainIndexingStatusSnapshot
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

15 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 11, 2026

Additional Comments (1)

packages/ensnode-sdk/src/ensindexer/indexing-status/omnichain-indexing-status-snapshot.test.ts
Broken test description string

This test name is missing the closing ' after following (it currently ends with ... is 'following). It doesn’t break runtime, but it’s a clear typo in a newly added test label and makes test output harder to read.

    it("can correctly derive 'following' status if at least one chain is 'following'", () => {

@tk-o
Copy link
Contributor Author

tk-o commented Feb 11, 2026

No AI agents feedback requires action in this PR.

@tk-o
Copy link
Contributor Author

tk-o commented Feb 11, 2026

@greptile review

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

15 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 11, 2026

Additional Comments (1)

packages/ensnode-sdk/src/ensindexer/indexing-status/validations.ts
Unexpected console output

invariant_slowestChainEqualsToOmnichainSnapshotTime logs to stdout via console.log(...) when the invariant fails. Since this runs during Zod validation, this will leak noisy debug output into any consumer that validates/deserialize these types. Consider removing the console.log (or gating it behind an explicit debug flag/logger injection) and rely on the validation issue message instead.

Copy link
Member

@lightwalker-eth lightwalker-eth left a comment

Choose a reason for hiding this comment

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

@tk-o Looks good. Thanks

@tk-o tk-o merged commit b72dc88 into main Feb 11, 2026
25 of 26 checks passed
@tk-o tk-o deleted the refactor/ensnode-omnichain-indexing-status-snapshot branch February 11, 2026 15:33
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