refactor: remove batch configuration mechanism#77
Merged
Conversation
The configure/get_configuration endpoints exposed three upload limits (max_batches, max_chunks, max_bytes), all defaulting to unlimited. Nothing ever set them — the sync-plugin, the only client, never calls configure — so the limits were always inactive and the limit-checking code was dead. Remove the entire surface: the IDL types, the Configuration struct and its stable-state persistence, the limit checks in batch.rs (plus the now-dead chunk_content_total_size bookkeeping and compute_last_chunk_data helper), and the configuration_methods/enforce_limits tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
With the batch limits gone, create_batch has no remaining error path — it always returned Ok. Drop the Result<BatchId, String> wrapper: the State method now returns BatchId directly, the canister-core wrapper builds the response without a match, and the test call sites lose their .unwrap(). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
configure/get_configurationendpoints exposed three upload limits —max_batches,max_chunks,max_bytes— all defaulting toNone(unlimited). Nothing ever set them: the sync-plugin, the only client and the only contract that matters, never callsconfigure. So the limits were always inactive and every limit check was dead code.This removes the whole mechanism rather than keeping a config surface for a feature that did nothing in practice.
What changed
Commit 1 — remove the configuration mechanism (505 deletions)
assets.did: droppedConfigurationResponse/ConfigureArgumentstypes and theget_configuration/configureendpointstypes.rs: removed both IDL structs (including theOption<Option<u64>>tri-state)state.rs: removed theConfigurationstruct, theconfigurationfield, both methods, and the restore linestable.rs: removedStableConfiguration, its twoFromimpls, and theStableStatefieldbatch.rs: removed the three limit checks plus the now-deadchunk_content_total_sizefield andcompute_last_chunk_datahelpertests.rs: removed theconfiguration_methodsandenforce_limitsmodulesCommit 2 — make
create_batchinfallibleWith the limits gone,
create_batchhad no remaining error path. Dropped theResult<BatchId, String>wrapper: the State method returnsBatchIddirectly, the wrapper builds the response without amatch, and the test call sites lose their.unwrap().Behavior
Uploads are now unbounded at the application layer — same as before in practice, since no client set these limits. Only authorized/controller principals can create batches at all, and the IC heap cap remains the backstop.
No backward-compatibility concern: pre-launch, no production instances, no persisted state to migrate.
Verification
cargo test -p canister-core— 87 passedcargo test -p canister— candid-compatibility check passes (hand-editedassets.didmatches generated interface)cargo test -p e2e— 14 passedcargo clippy -p canister-core -p canister --all-targets— clean🤖 Generated with Claude Code