Skip to content

feat: add plan limit information to plan/get results#150

Merged
volmedo merged 2 commits intomainfrom
vic/feat/plan-get-limit
Jan 26, 2026
Merged

feat: add plan limit information to plan/get results#150
volmedo merged 2 commits intomainfrom
vic/feat/plan-get-limit

Conversation

@volmedo
Copy link
Copy Markdown
Contributor

@volmedo volmedo commented Jan 22, 2026

Ref. storacha/project-tracking#620

Currently, plan/get only returns the name of the plan a given account is subscribed to. This PR adds information about the storage limit for the account, which makes special sense when using the reserved capacity plan in Storacha Forge.

@volmedo volmedo requested review from a team and alanshaw January 22, 2026 13:51
@volmedo volmedo self-assigned this Jan 22, 2026
Comment thread w3-plan.md Outdated
### `plan/get`

Capability can be invoked to get information about the plan that the account is currently signed up for.
Capability can be invoked to get information about the plan that the account is currently signed up for. The plan name and the storage limit are returned. The plan limit is expressed in bytes. Not to be confused with the storage **included** in the plan. A `0` limit indicates that uploads will not be rejected due to hitting a limit (the plan is effectively "unlimited"), which doesn't mean the customer won't be charged for the extra storage.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Optional field that is not present if no limit is set?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mmm, I don't know. The code implementing this will end up calling planLimit in w3infra and that returns 0 for no limit, so it would require removing it from the response explicitly and is probably not worth it.

Copy link
Copy Markdown
Member

@alanshaw alanshaw Jan 23, 2026

Choose a reason for hiding this comment

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

I think it's ok for a function that is explicitly called to get a limit to return 0 to signify no limit, however in the invocation response, sending a value when there is none kinda sucks - it's extra bandwdith for nothing and means that you need to look at the spec to interpret what 0 means. Whereas if there is no limit property when there is no limit makes far more sense to me.

It's also more backward compatible with the existing API to have the field optional - all plans in the hot network currently will not send this property.

This doesn't yet exist in the response, I think simply omiting the property is easy enough, especially in JS.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok, ok, but extra bandwidth? It's a request that will be made in response to a human action, i.e. it won't happen at a high rate. And "limit": 0 doesn't look like huge overhead for being explicit.

And we should discuss what more backward compatible means 😄

Anyways, done!

@volmedo volmedo merged commit 3b67918 into main Jan 26, 2026
2 checks passed
@volmedo volmedo deleted the vic/feat/plan-get-limit branch January 26, 2026 10:26
volmedo added a commit to storacha/upload-service that referenced this pull request Jan 29, 2026
…ult (#645)

Ref. storacha/project-tracking#620

Add a `limit` property to `plan/get` successful result definition, as
recently added to the spec (storacha/specs#150).

It is expressed in bytes, so it has been added as a string because we
expect limits higher than 9PiBs in Forge.
travis pushed a commit to storacha/w3infra that referenced this pull request Jan 30, 2026
Ref. storacha/project-tracking#620

Implements the new `limit` property for `plan/get` successful results,
as specified in storacha/specs#150 and defined
in storacha/upload-service#645.

`limit` is defined as a string to support limits over 9PiB. The result
of `planLimit` has been kept as a number because it is used in other
parts of the code for arithmetics. Those other call sites will be
refactored to use BigInt in a different PR. For now, the result of
`planLimit` is converted to string at the API boundary.
kaf-lamed-beyt added a commit to seetadev/Storacha-Solana-SDK that referenced this pull request Feb 14, 2026
the usage service previously defaults to a 5GiB plan limit which is the free storage limit plan on storacha.

but everywhere in our background jobs controller for the usage report we'd still have to explicitly pass the pass the plan limit or just hardcode the limit when we upgrade to a large storage capacity, which can be quite the hassle — having to edit the code everytime we upgrade.

after a chat with travis, i found out that the `PlanGetSuccess` response from the `plan/get` capability already includes an optional `limit` prop proposed in the [spec: #607](storacha/specs#150)
kaf-lamed-beyt added a commit to seetadev/Storacha-Solana-SDK that referenced this pull request Feb 14, 2026
the usage service previously defaults to a 5GiB plan limit which is the free storage limit plan on storacha.

but everywhere in our background jobs controller for the usage report we'd still have to explicitly pass the pass the plan limit or just hardcode the limit when we upgrade to a large storage capacity, which can be quite the hassle — having to edit the code everytime we upgrade.

after a chat with travis, i found out that the `PlanGetSuccess` response from the `plan/get` capability already includes an optional `limit` prop proposed in the [spec: #607](storacha/specs#150)
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