Skip to content

feat(compat): the profile half of boot and onboarding: S02 signed in, S07, S10, S11, S27 and the onboard route - #81

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

aRustyDev merged 1 commit into
mainfrom
feat/compat-boot-onboarding-stage

Conversation

@aRustyDev

@aRustyDev aRustyDev commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

What

Stage 3 of #44, first half. The plan had one PR for "boot and onboarding" (S07 to S16, S18, S27). That is too much to review at once, so I split it: this PR is the user and profile half, and the next is the workspace half (S08, S09, S12 to S16, S18). S08 (users/me/settings) reports the user's workspaces, so it belongs with the second half.

Row Route Answer
S02 GET /api/users/me/ signed in the short user, 18 keys
S07 GET /api/users/me/profile/ the profile with the pin's defaults, 29 keys
S10 PATCH /api/users/me/ the long user, 39 keys (what the React store merges in), or DRF's {field: [message]}
S11 PATCH /api/users/me/profile/ the profile after the patch, or DRF's field errors
S27 PATCH /api/users/me/tour-completed/ {"message": "Updated successfully"}
X04 PATCH /api/users/me/onboard/ the same, see below

A route the inventory missed

PATCH /api/users/me/onboard/ is not one of the 48 rows of research/0003 §8.1, but the stock onboarding's last step, finishUserOnboarding (apps/web/store/user/profile.store.ts at the pin), awaits it with no try. A 404 would stop the page from finishing and fail #44's own "no 404 in the network log" criterion. I built it and called it X04. The issue and the plan count 48 + X01 to X03, so that number is now 49 + X01 to X03; you may want to correct the issue text. Recorded as G-17.

How it works

  • user_profiles (migration 0008) is a directory table keyed by the user. Typed columns hold what core acts on; the long tail of settings (theme, language, role, ...) is a JSON preferences object, so a new setting costs no migration. The compat layer fills a missing key with Plane's default.
  • update_profile is one statement. The onboarding page sends several requests at once, each changing different fields of one profile, so a read-modify-write would lose changes.
  • contains_url is Plane's URL regex written by hand, because core carries no regex engine. It is tested differentially against the regex itself (the pattern as a dev-only oracle): 50,000 cases per property, plus the two length limits at their exact edges.
  • Time zones: the 433 names are generated from the oracle container's own pytz 2024.1 (tools/compat-record/gen-timezones.py), not copied from anywhere.
  • Validation follows DRF field by field (fields.rs). The fixtures pin the messages the pin gave.
  • Sign-up now makes the profile; sign-in records when. An account with no profile (older, or seeded by a test) gets one on first read, where the pin answers 404.

What recording corrected

I had derived DRF's boolean message as "maybe" is not a valid boolean.. The pin says Must be a valid boolean. The recording caught it on the first run, which is why messages are recorded where they can be.

Controls, and one that did not fail

Control Result
Postgres update_profile replaces preferences instead of merging first version of the model did not catch it, so the model gained a compound ProfileLife op and a ProfilePrefsMerged class (the coverage control now requires a merge-dependent sequence); with those, it fails
update_profile as read-then-write the new concurrency test fails: 3 of 32 concurrent patches survive
generator-coverage control of the model sample raised from 1000 to 3000: adding ops thinned out an existing rare class (GotDeletedHidden) to one sample from missing
contains_url generator first version never produced a string only the IPv4 alternative matches, so that alternative was not being compared; fixed, and the control now requires each alternative to match alone somewhere
my own expectation 1.2.3.256 is not an address wrong: the pin's regex is unanchored on the right, so it matches. The differential property had agreed with the code all along

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

Scope Result
thrust-compat-plane 177 mutants, first run 25 missed (24 in fields.rs, 1 in users.rs); after tests, 1 left, an equivalent one (a hex check Uuid::parse_str already makes), which I removed; fields.rs rerun 67 of 67 caught
core profile.rs 49: first run 3 missed (the 1000-character boundary, a dot after a non-alphanumeric), now 44 caught, 5 unviable, 0 missed
core auth.rs diff 3: 1 caught, 2 unviable
memory adapter diff 12: 9 caught, 3 unviable

Not mutated: the Postgres adapter, which the generated model and pg_adapter.rs cover (schema, constraints, idempotent migration, concurrency).

Recording

The recorder keeps signed-in sessions and writes as on each request; the harness keeps a jar and sends it. Recordings on two independent fresh stacks are byte-identical, and the six earlier fixtures did not change across four fresh recordings.

Gaps (G-17)

The messages not recorded are read from DRF's source: a number accepted as text, DRF's boolean spellings ("yes", "off", 1), Django's for the flags. Differences kept on purpose: datetimes are always UTC (the pin renders in the user's zone); token in the long user is a string of the pin's shape and is not a credential (the pin rotates a real one on every save); avatar_asset and cover_image_asset are ignored until the asset flow exists; onboarding_step must be a JSON object (the pin stores any JSON); a body that is not a JSON object is a 400 with Thrust's own message.

Verified

  • cargo nextest run --workspace: 1319 passed.
  • scripts/contract.sh native-memory and native-pg: 47 of 47 (EXPECT_MAIN 44 to 47). The Worker targets are for CI.
  • Postgres adapter and model: 16 passed (binary(pg_adapter)).
  • scripts/check-deps.sh clean; cargo check -p thrust-worker --target wasm32-unknown-unknown builds.
  • CI: all 28 reported checks pass and the PR is CLEAN, including the main contract pass on worker-memory and worker-cf and the mutants job (no re-run needed this time).

I did not commit mod.proptest-regressions changes: my deliberately broken builds had appended a seed to it, and mutants.sh disables that persistence for exactly this reason, so I restored it to main's version.

Effort

Modelled for the rows (research/0003 §8.1): S07, S10, S11, S27 at 0.15 pd each (crud/S), 0.6 pd, and X04 unmodelled. Most of this PR is the profile table, a use-case, adapter methods, DRF validation and a model extension, 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

… S07, S10, S11, S27 and the onboard route

Stage 3a of #44. The signed-in user (short shape for GET, long shape for PATCH), the profile with Plane's 29 keys, the
tour and onboarded flags, answered from a new user_profiles table (migration 0008, a directory table keyed by the user:
typed columns for what core acts on, a JSON `preferences` object for the long tail of settings).

PATCH /api/users/me/onboard/ is built too and is NOT one of the 48 rows of research/0003 section 8.1 (called X04 here):
the stock onboarding's last step awaits it (finishUserOnboarding), so a 404 would stop the page finishing and fail the
journey's no-404 criterion. Recorded as an inventory gap in docs/src/testing/status.md (G-17).

Ports and both adapters get user_by_id, insert_profile, profile and update_profile; the update is ONE statement (every
column the patch does not name keeps its value, preferences merge by jsonb ||), because the onboarding page sends several
requests at once. Core gets me, update_me, contains_url (Plane's URL regex by hand, differentially tested against the
regex itself), is_known_timezone (433 names generated from the oracle container's pytz 2024.1), and sign-up makes the
profile and sign-in records when. The compat crate validates the way DRF does (fields.rs); the fixtures pin the messages
the pin gave, which corrected one I had derived ("Must be a valid boolean.").

The recorder now keeps signed-in sessions and records `as` on each request; the harness keeps a jar and sends it.
Recordings on two independent fresh stacks are byte-identical, and the six earlier fixtures did not change.

Controls shown red: Postgres update_profile replacing preferences instead of merging fails the model (after the first
version of the model could NOT see that, which is why a compound ProfileLife op and a ProfilePrefsMerged class now exist);
a read-then-write update_profile loses 29 of 32 concurrent patches and fails the new concurrency test. The model's
generator-coverage control sample goes from 1000 to 3000: adding ops thinned out an existing rare class
(GotDeletedHidden) to one sample from missing.

cargo-mutants: compat crate 177 tested, first run 25 missed (all in fields.rs and one in users.rs), now 0 missed; core
profile.rs 49 tested, 3 missed, now 0; core auth.rs diff 3 (1 caught, 2 unviable); memory adapter diff 12 (9 caught,
3 unviable). Not mutated: the Postgres adapter (covered by the generated model and its own tests).

EXPECT_MAIN 44 -> 47; native-memory and native-pg 47/47; workspace nextest 1319 passed; Postgres adapter tests 16 passed;
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 ae7dfa6 into main Oct 25, 2026
28 checks passed
@aRustyDev
aRustyDev deleted the feat/compat-boot-onboarding-stage branch October 25, 2026 03:07
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