Skip to content

refactor: rename cursor params/returns to actionId on public API (#128)#139

Merged
thedavidmeister merged 3 commits intomainfrom
feat/issue-128-rename-cursor-to-action-index
May 4, 2026
Merged

refactor: rename cursor params/returns to actionId on public API (#128)#139
thedavidmeister merged 3 commits intomainfrom
feat/issue-128-rename-cursor-to-action-index

Conversation

@thedavidmeister
Copy link
Copy Markdown
Contributor

@thedavidmeister thedavidmeister commented May 4, 2026

Summary

Implements #128: rename cursoractionId on the public API, treating the value as an opaque handle (ERC721/1155 tokenId precedent). Also corrects the existing pre-existing actionIndex usage on schedule/cancel — "index" implied sequential array behavior consumers might reason about; "id" makes the opacity contract explicit.

Renames:

  • nextOfType / prevOfType first param: cursorfromId
  • nextOfType return: nextCursornextActionId
  • prevOfType return: prevCursorprevActionId
  • latestActionOfType / earliestActionOfType return: cursoractionId
  • getActionParameters param: cursoractionId
  • schedule / cancel / CorporateActionScheduled / CorporateActionCancelled: actionIndexactionId (pre-existing misnaming)
  • AccountMigrated / ReceiptAccountMigrated event fields: fromCursorfromActionId, toCursortoActionId
  • Errors ActionAlreadyComplete / ActionDoesNotExist: param actionIndexactionId
  • LibCorporateActionNode internal fns matching the interface shape

Out of scope (per #128 carve-out — legitimately called cursor):

  • accountMigrationCursor / accountIdCursor / totalSupplyLatestCursor storage
  • LibRebase / LibReceiptRebase migratedBalance internal params (cursor as local walk variable)
  • Caller code locals (per the issue's "free to assign into a local called cursor" rule)

Bytecode impact

Zero. Event sig keccaks use type strings, not param names. bytecode_hash = "none" + cbor_metadata = false keep param-name changes out of deployment bytecode. The pointer codehash suite (testCodehash* / testCreationCode* / testRuntimeCode*) passes without pointer regen.

Test plan

  • full suite green (497/497 pass)
  • pointer codehash tests confirm no bytecode change
  • static analysis (CI)
  • legal (CI)

🤖 Generated with Claude Code

…128)

The traversal getters in ICorporateActionsV1 named their uint256
param/return as cursor / nextCursor / prevCursor. The value passed in
and out is an action index — "cursor" describes the role of a local
variable holding that index during a walk, not the value itself.

Public surface renames:
- nextOfType / prevOfType first param: cursor → fromIndex
- nextOfType return: nextCursor → nextActionIndex
- prevOfType return: prevCursor → prevActionIndex
- latestActionOfType / earliestActionOfType return: cursor → actionIndex
- getActionParameters param: cursor → actionIndex
- AccountMigrated / ReceiptAccountMigrated event fields:
  fromCursor → fromActionIndex, toCursor → toActionIndex
- LibCorporateActionNode internal fns matching the interface shape

Out of scope (per #128, legitimately called cursor):
- accountMigrationCursor / accountIdCursor / totalSupplyLatestCursor
  (storage variables holding state-machine progress over time)
- LibRebase / LibReceiptRebase migratedBalance internal params
  (cursor as local walk variable)
- Caller code is free to assign returns into a local called cursor

Bytecode-neutral: event sig keccaks use type strings, not param names;
metadata is pinned off via bytecode_hash="none" / cbor_metadata=false.
Pointer codehash tests confirm zero deployment-bytecode change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

Warning

Rate limit exceeded

@thedavidmeister has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 29 minutes and 44 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: dc31350b-3d19-41c7-90e6-d3ba09bfd238

📥 Commits

Reviewing files that changed from the base of the PR and between 662a935 and 0f461e4.

📒 Files selected for processing (7)
  • src/concrete/StoxCorporateActionsFacet.sol
  • src/concrete/StoxReceipt.sol
  • src/concrete/StoxReceiptVault.sol
  • src/error/ErrCorporateAction.sol
  • src/interface/ICorporateActionsV1.sol
  • src/lib/LibCorporateAction.sol
  • src/lib/LibCorporateActionNode.sol
📝 Walkthrough

Walkthrough

A refactoring PR that renames identifiers throughout the corporate actions API to replace generic cursor terminology with more descriptive actionIndex, fromActionIndex, and toActionIndex naming in interfaces, implementations, libraries, and events across five files.

Changes

Corporate Actions Naming Consolidation

Layer / File(s) Summary
Interface Definitions
src/interface/ICorporateActionsV1.sol
Event parameter names and function return variables updated from cursor/nextCursor/prevCursor to actionIndex/nextActionIndex/prevActionIndex; event migration handles renamed fromCursor/toCursor to fromActionIndex/toActionIndex.
Library Core Implementation
src/lib/LibCorporateActionNode.sol
resolve helper parameter renamed cursoractionIndex; internal traversal wrappers (latestActionOfType, earliestActionOfType, nextActionOfType, prevActionOfType) return variables renamed from cursor to actionIndex.
Facet Delegation
src/concrete/StoxCorporateActionsFacet.sol
Function signatures updated: latestActionOfType and earliestActionOfType return actionIndex; nextOfType and prevOfType take fromIndex parameter and return nextActionIndex/prevActionIndex; getActionParameters parameter renamed to actionIndex.
Event Signatures
src/concrete/StoxReceipt.sol, src/concrete/StoxReceiptVault.sol
ReceiptAccountMigrated and AccountMigrated event parameters renamed from fromCursor/toCursor to fromActionIndex/toActionIndex.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~8 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 A cursor once traversed the action line,
but "actionIndex" tells the tale more fine—
Through interfaces and libraries bright,
we rename with care, the API's right.
No logic changed, just clarity gained,
the naming refactor is maintained! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title mentions 'actionId' but the actual changes rename to 'actionIndex', creating a mismatch with the real changeset. Update the title to 'refactor: rename cursor params/returns to actionIndex on public API (#128)' to accurately reflect the changes made.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/issue-128-rename-cursor-to-action-index

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
Review rate limit: 0/1 reviews remaining, refill in 29 minutes and 44 seconds.

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

Switch from "index" (sequential / array-like, implies consumers can
reason about ordering) to "id" (opaque handle, matching ERC721/1155
tokenId precedent). The corporate-action uint256 IS an array index
internally, but externally consumers should treat it as an opaque
handle: cancelled nodes leave gaps, the bootstrap is at idx 0, and
ordering carries no semantic meaning beyond "look up this slot".

This also corrects the existing actionIndex usage on schedule/cancel
(pre-existing misnaming) — those now match the same convention.

Renames:
- actionIndex → actionId (incl. schedule/cancel/error/event params)
- fromIndex → fromId (traversal first param)
- nextActionIndex → nextActionId
- prevActionIndex → prevActionId
- fromActionIndex → fromActionId (event field)
- toActionIndex → toActionId (event field)
- NatSpec: "action index" → "action id" prose

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@thedavidmeister thedavidmeister changed the title refactor: rename cursor params/returns to actionIndex on public API (#128) refactor: rename cursor params/returns to actionId on public API (#128) May 4, 2026
The renamed API uses two terms for the same uint256: actionId (opaque
handle, crosses API boundary) and cursor (local-variable name for a
walking pointer in a traversal loop). The example code uses cursor
without explaining why — add a Naming Convention block to the
QUERYING section so external consumers understand the distinction
rather than guessing from precedent.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@thedavidmeister thedavidmeister merged commit 3fb2345 into main May 4, 2026
4 checks passed
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.

1 participant