Skip to content

feat(compat): project create and open: S30, S32, S34 to S46 - #84

Merged
aRustyDev merged 1 commit into
mainfrom
feat/compat-project-stage
Oct 25, 2026
Merged

aRustyDev merged 1 commit into
mainfrom
feat/compat-project-stage

Conversation

@aRustyDev

Copy link
Copy Markdown
Owner

What

Stage 5 of #44: a member makes a project, changes it and opens it, and every read the project page makes answers. S17 and S20 are recorded again with a project in the workspace (stage 4 could only show []).

Row Route Answer
S30 POST /api/workspaces/{slug}/projects/ makes the project (201, 44 keys); the caller becomes its admin, and so does a lead who is someone else. Admins and members of the workspace may; a guest and a stranger get the decorator's 403
S32 PATCH .../projects/{id}/ changes it: the workspace's admins and the project's own admins; not an archived project (400)
S34 GET .../projects/{id}/ the project: 404 when missing or archived, 403 {"error": "You do not have permission"} to a non-member of a secret project, 409 to a non-member of a public one
S35 GET .../project-stats/ counts for every project of the workspace (the pin does not filter by membership), narrowed by fields and project_ids
S36 GET .../projects/{id}/project-members/me/ the caller's own row, with who they are, the project and the workspace
S37 GET .../projects/{id}/user-properties/ the caller's list settings for the project, made on the first ask
S38 GET .../projects/{id}/issue-labels/ the labels by sort_order: real, with no route that writes one yet, so [] for every project made through the API
S39 GET .../projects/{id}/members/ the people in it, newest row first
S40 GET .../projects/{id}/states/ its five states, the intake one left out
S41 GET .../projects/{id}/intake-state/ the intake (triage) state
S42, S43, S44, S45, S46 estimates, cycles, workspace modules, project modules, views []: stubs (D-021). Each still asks who the caller is
S17, S20 the project list, the workspace's states now real with a project: S20 lists the states of the projects the caller is in

How it works

  • Migration 0012 gives projects the rest of its columns (description, emoji, icon, views, months, time zone, lead, default assignee, external ids) and makes a project's name and key unique in the workspace (exact match, so Plane and plane are two names). A project member and their settings row get the columns the app reads, and states and labels are new. Idempotent like the files before it (migrate applies every file on every start): each CHECK and foreign key is its own drop and add, a NOT NULL column that needs a backfill is added nullable, filled, then made NOT NULL.
  • A creation is one transaction: the project, its members with their settings rows, and its six states (the pin's five and the intake one). A name or key that is taken is a unique violation, which the adapter makes a Conflict; two creations racing for one name leave exactly one project and nothing behind (16 real tasks in pg_adapter.rs, then a count of every table). A member's place in their own list is 10000 below the lowest they hold in the workspace, or 65535, as on the pin.
  • The rules are the pin's: who may make and change a project, the three answers S34 gives a non-member, the forbidden characters in a name and a key (^.*[&+,:;$^}{*=?@#|'<>.()%!-].*$, including its newline quirk), a name and a key trimmed, and DRF's reading of every kind of value a field may be sent as. That reading was probed against the pinned Plane and recorded (fixture S32 has 49 exchanges): a lead as an integer, a float, a list or an object, "" as null, months as 7.0 or 7 or 1e16, description_html of any type, a relation that is no UUID.
  • S20, S40 and S41 are real, as you chose when I asked about the states table.
  • is_workspace_member is a new port method (memory, Postgres), used for the lead rule below and held by the model.

For your decision

  • D-026 (new): a project's lead must be an active member of the workspace. A creation or a change that names anyone else is a 400 {"project_lead": ["The lead of a project must be a member of its workspace."]}. The pin accepts any user as lead and makes them a project admin without a workspace membership; Thrust's schema ties a project member to a workspace member (migration 0003), which is the rule that keeps a person who left a workspace out of its projects. The model found this when it generated a lead who was not a member. The alternative is to drop that foreign key.
  • D-027 (new): three fields hold less than the pin's. logo_props must be an object (the column has a CHECK; the app only ever sends one), and estimate, default_state and cover_image_asset take null or "" only (no estimate table, no asset table before the asset stage, and no screen sets a default state before M2). The pin accepts any JSON as a logo, and the id of a state as default_state.
  • No outbox event for a project's creation or change. Nothing reads project activity yet. If the activity feed or webhooks should see them, that is one more event kind and a consumer; say if you want it in M1.
  • D-021 (stub list): S42 to S46 and S35's completed_issues, total_cycles and total_modules are added; S20 leaves the list (it is real).
  • D-022, D-023 and D-025 are still waiting for your confirmation.

Controls

43 one-line breakages, each applied from a backup and restored byte for byte (checked with cmp):

Breakage Result
Postgres: a name or a key compared case-insensitively; the clash check not leaving out the project being changed; the member list not leaving out people who left; both orders ascending; a new project's place 5000 below, or 1 for a first one; a member row of another workspace counting; the next work item number off by one; a change that ignores the workspace; is_workspace_member ignoring the active flag; intake states listed; the workspace's states for every project; archived projects counted; labels descending; a settings row overwritten each fails the model or a pg_adapter test
migration 0012: the months CHECK widened; the name index, the key index, the one-default index, the lead foreign key, the states' and labels' unique names dropped; the group CHECK dropped; the member-settings CHECK dropped; the backfill wrong each fails a pg_adapter test
handlers: 201 as 200; the secret 403 body; 409 as 403; the archived message; the months bound 13; the counts' members as issues; the lead check dropped each fails a compat test (parity, the Caller by Row matrix or the project tests)
core: a guest may make a project; the first state's sequence; the creator as a plain member; an archived project may be changed; the secret and not-a-member answers swapped; a project member may change it; the lead check dropped each fails a core or compat test
5 not noticed at first: a key compared case-insensitively; draft work items counted in project_stats; the states group CHECK dropped (I had widened it, which no valid input shows); the race path naming the wrong field; a change that names no lead being asked about the lead each now fails a test I added for it (a model clash for the key's case, a pg_adapter test for the counts, projects_tests.rs, a core case in which the lead has left)
1 equivalent: S30 admitting guests at the decorator the core refuses a guest with the same body

The Postgres model's generator-coverage control reaches all 146 classes (one new); its sample is now 6000, up from 3000, because HomeKept thinned out.

Mutation testing (cargo-mutants 27.1.0, nextest 0.9.140):

Scope Result
core projects.rs 56: 41 caught, 15 unviable, 0 missed. The first run missed 4 (is_workspace_member, workspace_states, project_labels)
compat projects.rs, workspace_load.rs 202: 101 caught, 98 unviable, 3 missed; two of the three (control-character escapes in py_string) were caught after one more recorded case (14 of 14 py_string mutants), the third is equivalent: the clash pre-check's ||, because core's conflict path gives the same answer. The first run missed 17, mostly in the readers of DRF's values
memory adapter project methods, is_workspace_member, seed 120: 109 caught, 11 unviable, 0 missed. The first run missed 9 (is_workspace_member, the ids a settings row is made with, and the XORs that make a seeded member's and a seeded settings row's id)

The first run's 30 survivors were the reason for most of the late work: probing the pin turned up that my user_field and months_field differed from it in several ways ("" as a lead, a float or list as a lead, "7.0" months, description_html of non-text, a null close_in), so those are fixed and recorded. A property that I wrote for the seeded ids failed on the correct code first (the XOR is injective on random ids, not on every pair): its domain is now project ids with every high bit set and small user ids, and its comment says why. Not mutated: the Postgres adapter, which the generated model and pg_adapter.rs cover.

Recording

17 fixtures: S30, S32, S34 to S46, and S17-after, S20-after. S30 records each field wrong in turn, the journey's project, a name or key taken (and one taken once trimmed), the same name in another workspace, and a project in each workspace; each read row is recorded for the creator, someone outside the workspace, no session and a project that does not exist. Recorded on a fresh stack; every earlier fixture did not change. The fixture header gained uses and binds, so a row that names a project carries the id across fixtures; the harness's Ids::preseed and Jar handle them.

Gaps (G-20, docs/src/testing/status.md)

Read from the source, not recorded: what a guest and a workspace member outside the project see for every row (the Caller by Row matrix states it), the order of S17 with more than one project (the pin leaves it undefined; Thrust lists the newest first), a lead who is not a workspace member (D-026). Not built: the archive route, intake, a route that writes labels, sanitising description_html, an estimate / default state / cover image that names a row (D-027). Two limits of reading Python's values: an integer past 2^64 reaches the handler as a float, and months written as "1_0" or with non-ASCII digits are refused (Python's int() reads them). The model cannot reach a creation racing another (pg_adapter.rs does), or a draft work item (the slice never makes one; pg_adapter.rs holds the counts).

Verified

  • cargo nextest run --profile ci --workspace: 2097 passed, 4 skipped. Doctests pass.
  • scripts/contract.sh native-memory and native-pg: 53 of 53 (EXPECT_MAIN 51 to 53). The Worker targets are for CI.
  • Postgres adapter and model: 26 passed (binary(pg_adapter), no test leaky on an idle machine); the model at 256 cases.
  • scripts/check-deps.sh clean; scripts/rs cargo check -p thrust-worker --target wasm32-unknown-unknown builds.
  • mod.proptest-regressions gains two seeds, both real counterexamples (D-026, and the model's own gap in a listing's sort order), both fixed. Seeds that my deliberately broken builds wrote are not committed.

Effort

Modelled for the rows (research/0003 §8.1): S30 0.4, S32 0.4, S34 0.4, S35 1.0, S36 0.15, S37 0.15, S38 0.15, S39 0.15, S40 0.15, S41 0.15, S42 0.15, S43 0.9, S44 2.5, S45 0.4, S46 0.4, which is 7.45 pd (S17 and S20 are counted in stage 4). Most of this PR is the states and labels tables, the project columns, the model extension and probing the pin for DRF's readings, which the model prices separately or not at all. I did not time the work, so there is no actual pd to report.

Refs: plane-byd.12.2

🤖 Generated with Claude Code

Stage 5 of #44. A member makes a project (S30), changes it (S32) and opens it (S34), and every read the project page makes
answers: the counts (S35), the caller's own row (S36), their list settings (S37), the labels (S38), the people (S39), the states
(S40), the intake state (S41), and the estimates, cycles, modules and views (S42 to S46). S17 and S20 are recorded again with a
project in the workspace.

Migration 0012 gives a project the rest of its columns and makes its name and key unique in the workspace, gives a project member
and their settings row the columns the app reads, and adds the `states` and `labels` tables. A creation is one transaction (the
project, its members with their settings, its six states), so two creations racing for one name leave exactly one project and
nothing behind (16 real tasks in `pg_adapter.rs`). A member's place in their own list is 10000 below the lowest they hold in the
workspace, as on the pin. S20, S40 and S41 are real (the states table was built now, not stubbed until a later stage).

S42 to S46 are stubs (D-021, listed), S35's `completed_issues`, `total_cycles` and `total_modules` are 0, and S38 is real with no
route that writes a label yet.

Two deviations, both pending the owner: D-026 (a project's lead must be an active member of the workspace: the pin lets anyone lead
a project, Thrust's schema ties a project member to a workspace member) and D-027 (the logo must be an object; the estimate,
default state and cover image take null or an empty string only).

DRF's reading of each kind of value is the pin's, probed against it and recorded in fixture S32 (49 exchanges): a lead as an
integer, float, list or object, `""` as null, months as `7.0` or ` 7 `, `description_html` of any type, a relation as a non-UUID.
The shared key reader and the `py_repr` that writes a value as Python does came out of the first mutation run, which had missed 30
mutants, 17 of them in these readers.

Fixtures: 17 new, recorded on a fresh stack (the earlier ones did not change); the fixture header gained `uses` and `binds` so a
row that names a project carries the id across fixtures.

Controls shown red: 43 one-line breakages (a SQL clause, a migration constraint, a handler line, a core rule); 37 failed a test
at once, 5 more after the tests they showed missing were added (a key that differs by case, draft work items in the counts, the
states group CHECK, the race path's field choice, a change that names no lead), and one is equivalent (the decorator and the core
both refuse a guest with one body).

cargo-mutants 27.1.0: core projects.rs 56 tested, 41 caught, 15 unviable, 0 missed; compat projects.rs and workspace_load.rs 202
tested, 101 caught, 98 unviable, 3 missed, 2 of them caught after one recorded case (14 of 14 of `py_string`), the third
equivalent (the clash pre-check's `||`: core's conflict path gives the same answer); memory adapter project methods and seed 120
tested, 109 caught, 11 unviable, 0 missed.

Model: ProjectLife, the settings-row sort order of a listing, the new `is_workspace_member`, a project whose member is no member
of the workspace (146 step classes, up from 145; the coverage sample is 6000, up from 3000, for `HomeKept`). The model found D-026
and its own gap in the listing's sort order; both seeds are in `mod.proptest-regressions`.

EXPECT_MAIN 51 -> 53; native-memory and native-pg 53/53; workspace nextest 2097 passed, 4 skipped; doctests pass; Postgres adapter
tests 26 passed with the model at 256 cases; worker builds for wasm32; check-deps clean.

Refs: plane-byd.12.2
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@aRustyDev
aRustyDev merged commit 08278bc into main Oct 25, 2026
28 checks passed
@aRustyDev
aRustyDev deleted the feat/compat-project-stage branch October 25, 2026 19:49
This was referenced Nov 15, 2026
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.

1 participant