Skip to content

feat(compat): port Plane's workspace_seed, so a new workspace is not empty #138

Open

Description

@aRustyDev

Context

Follow-up of #44 (closed). Deviation D-024 (owner, 2026-10-24): creating a workspace in Thrust makes the workspace and its creator's membership and nothing else, and the port of Plane's workspace_seed was left for after M1, with an issue to be filed when M1 closed. This is that issue.

What the pin does (tag oracle/v1-pin-20261018, apps/api/plane/bgtasks/workspace_seed_task.py): POST /api/workspaces/ answers 201 and then dispatches workspace_seed.delay(id) to Celery. The task, in this order:

  1. creates a bot user (username and email bot_user_<workspace id>@<host of WEB_URL, else plane.so>, display_name "Plane", is_bot, bot_type = WORKSPACE_SEED, an unusable random password) and makes it a workspace admin (role 20);
  2. creates one project named after the workspace, with the identifier set to the first five alphanumeric characters of the name, cycle_view, module_view and issue_views_view on, a ProjectMember and a ProjectUserProperty (display filters and properties, fixed) for every workspace member at that moment;
  3. then states, labels, cycles, modules, work items, views and pages from eight JSON files in apps/api/plane/seeds/data/ (projects, states, labels, cycles, modules, issues, views, pages). Each work item also gets an IssueSequence, an IssueActivity ("created the issue"), its IssueLabels, a CycleIssue and ModuleIssues. The current cycle runs now to now + 14 days, an upcoming one starts the day after the last cycle ends and runs 14 days, and module n starts 2n days from now and runs 14 days.

Everything is created by the bot. The task is not part of the request's transaction: a failure is logged and re-raised, and the workspace stays unseeded with its 201 already sent.

Problem

On the pin, the first GET /api/workspaces/{slug}/projects/ and .../members/ after sign-up are not empty, and the member list contains the bot. On Thrust both are empty (D-024). The oracle is recorded with its workers stopped (tools/compat-record/fresh-oracle.sh runs dc stop worker beat-worker), so the fixtures agree with Thrust, and the parity tests do not see the difference; a real user of the stock app does. PQ-117 and PQ-609 (research/0007) mark this as breaks-clients/affects-parity-tests.

Interactions to check before building, not assumed:

Proposal

  • Reproduce the seed's observable result: the bot (a user with is_bot, a workspace admin, in members/), the sample project and its members, states, labels, cycles, modules, work items with their sequences and activity, views and pages, in the shapes the acceptance-list routes return.
  • Source of the seed data: Plane's eight JSON files, copied as data with a SOURCE note, as web/ and tools/oracle-v1 were (no NOTICE is needed, ADR-0140; the repo is AGPL). I have not counted their rows; counting them is the first step, because it sets the size of the job.
  • How it runs is open, and is the owner's call: as a workspace.seed queue job on the jobs table of feat(jobs): exports and seeding as queue jobs with a jobs table (no workflow engine) #56 (ADR-0073 maps workspace_seed to a queue job, and the pin seeds after the 201, so a reader can see an empty workspace for a moment there too), or inline in S14's transaction (simpler, and no empty moment, which differs from the pin and would be a new deviation). The lean is the job, for fidelity with the pin and to keep the seed's many inserts out of the creation request; it then waits for feat(jobs): exports and seeding as queue jobs with a jobs table (no workflow engine) #56.
  • Seeding must be idempotent per workspace (a redelivered message cannot make a second project or bot), and a failed seed must not fail or roll back the workspace.
  • Record S09, S14, S18 (and the projects and work-item reads that now find rows) again with the workers running, so the parity fixtures show the seeded workspace; fresh-oracle.sh gains a way to leave the workers up. The recorder must wait until the seed has finished (it is eventually consistent), as record_corpus.py waits for the Celery worker for another quirk (G-25).

Acceptance criteria

  • After a workspace is created and the seed has run, projects/, members/, the project's states, labels, work items and the bot's membership match the pin's recording made with the workers running (ids, timestamps and the clock-derived dates normalised), as parity_ tests with a mutated-fixture control.
  • Seeding twice (a redelivery) leaves one bot, one sample project and one set of rows; a seed that fails leaves the workspace created and the failure visible (logged and retried per the job machinery), with a contract test on all four targets.
  • The seed's clock is injected, and a hermetic test fixes the dates it derives.
  • The feat(compat): the 48-route minimum slice with the auth-client JSON change #44 journey still passes (renamed or re-keyed where it collides), on worker-memory and worker-cf.
  • D-024 is revised in DEVIATIONS.md: closed if the seed is complete, narrowed to what is left if not; G-28's "PQ-117's seed is not run" and the plan row are updated.
  • fresh-oracle.sh's comment about the stopped workers is corrected.

References

  • D-024 (.agents/plans/contrail/DEVIATIONS.md), PQ-117 and PQ-609 (research/0007), research/0003 lines 397-401 and 580, ADR-0073 (line 83), ADR-0071 (line 138)
  • The pin: apps/api/plane/bgtasks/workspace_seed_task.py, apps/api/plane/seeds/data/*.json
  • tools/compat-record/fresh-oracle.sh; docs/src/testing/status.md G-28, G-30

Blocked by: #56 (for the job form; not for the inline form)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions