feat(api): list bean batches across beans - #646
Merged
Conversation
Add a conditional collection endpoint backed by one Drift query so inventory clients no longer need one batch request per bean. Keep archived filtering aligned with the existing per-bean route and update the REST contract.
ODevStudio
marked this pull request as ready for review
August 22, 2026 14:07
tadelv
approved these changes
Aug 24, 2026
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
What changed, and why?
GET /api/v1/bean-batchesso inventory clients can fetch batches forevery bean with one request instead of one request and SQLite query per bean.
includeArchived=true, and support the same conditionalETagbehavior asthe existing bean and per-bean batch collection routes.
matching the motivating beans-then-batches workflow.
multi-ID filter or embedded-bean response was added.
Change Type (select all)
Scope (select all touched areas)
Linked Issues
Fixes #564
Root Cause (if bug fix)
N/A - this adds a bulk read route for existing bean-batch data.
Regression Test Plan (if bug fix or refactor)
N/A - feature coverage in
test/webserver/beans_handler_test.dartandtest/database/bean_dao_test.dartlocks in cross-bean results, archivedbatch and parent-bean filtering, one-query behavior, and conditional GET.
Documentation Obligations (required)
assets/api/rest_v1.ymlorassets/api/websocket_v1.yml(if REST/WebSocket changed)doc/Api.md(if user-facing endpoint changed)doc/Plugins.md(if events/API changed)doc/Skins.md(if skin behavior changed)doc/Profiles.md(if profile handling changed)doc/DeviceManagement.md(if device flows changed)Security Impact (required)
Yes; adds read-onlyGET /api/v1/bean-batches.No.No.No.No.No.through per-bean routes, remains read-only, excludes archived batches and
parent beans by default, and supports
ETagvalidation.User-Visible Changes
of issuing one request per bean.
Verification
Local gates (run before pushing)
dart format lib test- no remaining candidate changesflutter analyze- cleanflutter test- 3,181 passed, 1 skipped./scripts/fetch_dye2_plugin.sh- not rerun for this local draftManual verification (if applicable)
simulate=1):No; CMake stopped the build first.No, not applicable.through integration tests.
includeArchived=true, cross-bean ordering,ETag, and304 Not Modified.Evidence
Detailed evidence:
404before the route existed,then passed with cross-bean results, archived filtering, and
304handling.before the follow-up and passes at the DAO and API-handler levels afterward.
flutter test test/webserver/beans_handler_test.dart test/database/bean_dao_test.dart(36 passed)flutter analyze(no issues)flutter testwith the package-matched QuickJS DLL onPATHand therepository's temporary LF normalization for the line-ending-sensitive
AsyncAPI assertion (3,181 passed, 1 skipped)
git diff --cached --checkbefore commit (clean)flutter run --no-pub -d windows --dart-define=simulate=1for alive curl smoke. The local build stopped before launch because Flutter
selected CMake 3.20 while the Firebase SDK requires CMake 3.22 or newer.
Compatibility & Migration
Yes; this is an additive route.No.No; the existingbeanBatchestable is queried.Risks & Mitigations
inventories.
excluded by default, and support conditional requests with
ETag.Contributor Responsibility
AI-assisted development is allowed. The submitter remains responsible for the submitted work.