feature: Replace test-setup with SDK-based seeding #70
Labels
No labels
area:api
area:core
area:docs
area:infra
area:ux
dependencies
documentation
duplicate
good first issue
help wanted
invalid
question
rust
status:complete
status:partial
status:planned
type:bug
type:design
type:feature
type:infra
type:refactor
type:research
type:ux
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
icub3d/decentcom#70
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Migrated from GitHub issue icub3d/decentcom#101
Original Author: @icub3d
Original Date: 2026-04-19T01:24:37Z
Feature: Replace
test-setupDatabase Seeding withdecentcom-sdkOverview
Refactor the local development bootstrap process (
make clean setup dev) to use the newdecentcom-sdkfor seeding test data via the REST API, replacing the current approach of directly writing to the SQLite databases.Background
Currently, the
tools/test-setupcrate bypasses the application API and directly executes raw SQL inserts to populate the test environment. While fast, this approach tightly couples the setup tool to the internal database schema. If a schema change occurs, both the server logic and thetest-setupSQL must be updated.With the introduction of the
decentcom-sdkin #85, we now have a typed, async client that speaks the decentcom protocol. By using the SDK to seed the data, we guarantee that the test data is always valid according to the server's business logic, and the setup process becomes an automatic end-to-end integration test of the entire API surface.Requirements
tools/sdk-seed) or repurposetest-setupto use the SDK.decentcom-sdkto create channels, assign roles, join members, and post messages.Makefilemust be updated to orchestrate the new boot sequence: start servers -> wait for readiness -> run seed script -> start frontend.test-setup/src/db.rsandtest-setup/src/migrations.rs) should be removed, as migrations are now handled bysqlxon server boot, and seeding is handled via the API.test-setupshould still be responsible for clearing old state (.sqlitefiles,localStorage) and injecting test identities into the OS keychain.Design
Process Orchestration Changes
The
MakefileandProcfilewill be adjusted to accommodate the new requirement that servers must be running before data can be seeded.Proposed Flow:
make clean: Deletes.sqlitedatabases and clearslocalStorageand keychain.overmind start -f Procfile.servers -D: Starts the 3 test servers in the background.wait-for-it: A simple loop to poll theGET /healthendpoint oflocalhost:8081until the server is ready.cargo run --bin sdk-seed: Executes the SDK script to build the test environment.overmind connect+pnpm tauri dev: Starts the frontend client and connects to the existing overmind session.Implemented Flow (deviation): Rather than running overmind in detached mode and chaining steps in the Makefile, the final design lets overmind run all four processes (3 servers + seed + client) in a single foreground session.
OVERMIND_CAN_DIE=seedlets the one-shot seeder exit cleanly without tearing the session down. This keeps the developer experience as a single attached terminal with combined output.Component Changes
tools/test-setup: Removedb.rsandmigrations.rs. Keep thecleanandkeychainlogic.tools/sdk-seed(New): A small Rust binary that depends ondecentcom-sdkandshared::ServerInfo. It will replicate the data structures fromtest-setup/src/seed/mod.rsusing the SDK'sClient.Makefile: Update targets (clean,setup,dev) to reflect the new orchestration.Procfile: Split intoProcfile.servers(backend only) and maybe a separate entry for the client, or handle the client entirely within the Makefile.Task List
tools/sdk-seedcrate and adddecentcom-sdkas a dependency.sdk-seedlogic to authenticate as Alice and recreate the "Open Server" structure (channels, roles, messages) via SDK calls.tools/test-setupto remove the obsolete raw SQL seeding and migration logic.Makefileto orchestrate the new multi-stepdevboot sequence, including a health check loop.README.mdordocs/) to reflect the new local development workflow if necessary. (No README changes needed —make helpand thetest-setupsummary already describe the new flow.)Test List
make clean setup devand verify the process completes successfully. (Validated:make clean setupruns clean;sdk-seedagainst running servers via the same orchestration completes successfully.)/healthendpoints return OK.)#generalchannel of the Open Server. (Validated by the seeder report: 36 messages across 7 channels on Open Server, including #general.)sqlxmigrations on boot). (Validated:tools/test-setup/src/db.rsandmigrations.rsdeleted; only SDK calls in the seeder.)Open Questions
Makefilemanage the Overmind session so that the developer still gets a clean, combined terminal output for all 4 processes (3 servers + client) after the seed script finishes? (Resolved:OVERMIND_CAN_DIE=seedlets the one-shot seeder exit cleanly while the rest of the session keeps running in a single attached terminal.)