Skip to content

fix(cli): make POI parameters optional for action queue commands#1194

Merged
tmigone merged 4 commits intomainfrom
rotarur/fix-cli-arguments
Apr 23, 2026
Merged

fix(cli): make POI parameters optional for action queue commands#1194
tmigone merged 4 commits intomainfrom
rotarur/fix-cli-arguments

Conversation

@rotarur
Copy link
Copy Markdown
Contributor

@rotarur rotarur commented Apr 16, 2026

Summary

Make publicPOI and poiBlockNumber truly optional when queuing UNALLOCATE, REALLOCATE, or PRESENT_POI actions through the indexer CLI. Previously, omitting these positional arguments caused the action to be rejected by the server's isValidActionInput check because GraphQL serialization strips undefined fields from the payload.

CLI normalization (packages/indexer-cli/src/actions.ts)

  • default publicPOI to zero-filled bytes when not provided
  • default poiBlockNumber to 0 when blockNumber is not provided
  • check blockNumber for explicit undefined instead of truthiness so "0" is parsed correctly

Server-side validation (packages/indexer-common/src/actions.ts)

  • relax UNALLOCATE / REALLOCATE / PRESENT_POI validation to only require the poi field when a POI is supplied
  • treat publicPOI and poiBlockNumber as optional fields

Tests

  • update CLI normalize test to expect poiBlockNumber of 0
  • update server validation test to accept poi without publicPOI

Test plan

  • CLI unit tests pass for normalizes zero POI values for PRESENT_POI
  • Server validation tests pass for the relaxed POI input checks
  • Manual: graph indexer actions queue unallocate <deploymentID> <allocationID> 0x0 true --network arbitrum-one succeeds without specifying a block number
  • Manual: same command with an explicit block number argument still works

@github-project-automation github-project-automation Bot moved this to 🗃️ Inbox in Indexer Apr 16, 2026
@rotarur rotarur force-pushed the rotarur/fix-cli-arguments branch 3 times, most recently from 59557c7 to a1e259d Compare April 16, 2026 20:55
CLI normalization:

- default publicPOI to zero-filled bytes when not provided
- default poiBlockNumber to 0 when blockNumber is not provided
- check blockNumber for explicit undefined instead of truthiness

Server-side validation:

- relax UNALLOCATE validation to only require 'poi' field when provided
- relax REALLOCATE validation to only require 'poi' field when provided
- relax PRESENT_POI validation to only require 'poi' field when provided
- treat publicPOI and poiBlockNumber as optional fields

GraphQL serialization strips undefined fields from the action payload,
which previously caused the server's isValidActionInput check to reject
queued actions when the user omitted optional POI arguments.

Tests:

- update CLI normalize test to expect poiBlockNumber of 0
- update server validation test to accept poi without publicPOI
@rotarur rotarur force-pushed the rotarur/fix-cli-arguments branch from e00024b to 6431fad Compare April 16, 2026 21:20
@rotarur rotarur changed the title fix(cli): add debug logging for unallocate parameter mapping fix(cli): make POI parameters optional for action queue commands Apr 16, 2026
rotarur and others added 3 commits April 20, 2026 15:32
Block number normalization:

- use && instead of || so TypeScript narrows blockNumber to string before parseInt
- rename poiBlockNumber to normalizedBlockNumber and type as number | undefined
- skip parsing when blockNumber is '0' to preserve the default

Public POI normalization:

- switch condition to check publicPOI !== undefined for consistent handling
Public POI handling:

- default normalizedPublicPoi to zeroPOI
- only use the provided publicPOI when the main POI is non-zero and a real value is given

Block number handling:

- skip parsing when the main POI is zero so metadata stays at default
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
@tmigone tmigone requested review from Maikol and MoonBoi9001 April 22, 2026 15:48
@github-project-automation github-project-automation Bot moved this from 🗃️ Inbox to ✅ Approved in Indexer Apr 23, 2026
@tmigone tmigone merged commit 693111f into main Apr 23, 2026
7 checks passed
@tmigone tmigone deleted the rotarur/fix-cli-arguments branch April 23, 2026 12:32
@github-project-automation github-project-automation Bot moved this from ✅ Approved to 🚗 Merged in Indexer Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🚗 Merged

Development

Successfully merging this pull request may close these issues.

2 participants