[PR #3744] [MERGED] fix(noodle): make account settings patches atomic #6085

Closed
opened 2026-10-23 04:06:56 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3744
Author: @Gunterlie
Created: 7/17/2026
Status: ✅ Merged
Merged: 7/17/2026
Merged by: @SpicyMarinara

Base: staging ← Head: noodl-split-1a-typed-settings


📝 Commits (6)

  • e97575a fix(noodle): make account settings patches atomic
  • d947649 docs(noodle): add PR stack plan
  • 870edd4 fix(noodle): address atomic settings review
  • f834157 refactor(noodle): trust typed follow timestamps
  • eb3bb97 docs: align Noodle settings acceptance criteria
  • 04c93c3 fix(noodle): close settings review gaps

📊 Changes

12 files changed (+1172 additions, -155 deletions)

View changed files

➕ .github/plans/noodl-split/coderabbit-dont-review-plans.md (+1 -0)
➕ .github/plans/noodl-split/noodler-pr-stack-plan-v2.md (+463 -0)
➕ .github/plans/noodl-split/paseo-slice-kickoff-prompt.md (+80 -0)
📝 packages/client/src/components/noodle/NoodleView.tsx (+46 -61)
📝 packages/client/src/hooks/use-noodle.ts (+56 -1)
📝 packages/server/src/routes/noodle.routes.ts (+55 -42)
📝 packages/server/src/services/noodle/noodle-profile-selection.ts (+1 -6)
📝 packages/server/src/services/storage/noodle.storage.ts (+215 -35)
📝 packages/shared/src/schemas/noodle.schema.ts (+63 -4)
📝 packages/shared/src/types/noodle.ts (+25 -1)
📝 scripts/regressions/noodle-prompt.regression.ts (+2 -2)
📝 scripts/regressions/noodle-settings.regression.ts (+165 -3)

📄 Description

Linked issue

Related implementation discussion: #3618

The oversized NoodleR approach was closed after maintainer acknowledgment that the work should be rebuilt as a focused PR stack from current staging. This PR is Slice 1A of that stack and resolves P1 Finding 1: account settings can silently overwrite one another.

Why this change

NoodleAccount.settings was an untyped JSON record, and the generic account update path replaced the entire object. Independent profile, follow, notification, avatar-sync, and generated-follow writers could read stale snapshots and silently erase one another.

Later NoodleR slices will add more independent writers, so the stack needs a typed ownership boundary and an atomic patch operation before those features land. The committed stack plan keeps the remaining slices, dependencies, findings, and acceptance criteria visible from staging after this PR merges.

What changed

  • Add a strict NoodleAccountSettings contract with required profile, social, scheduler, and privacy subtrees.
  • Keep scheduler and privacy as strict empty containers for their later owning slices.
  • Add PATCH /noodle/accounts/:id/settings with a discriminated subtree patch schema.
  • Add transactional patchAccountSettings() storage behavior that reads and merges against the latest persisted row.
  • Normalize all eight existing flat settings fields into the canonical nested shape without a database migration.
  • Remove raw settings replacement from the generic account-update schema, storage method, client hook, and all current call sites.
  • Preserve avatarCrop as settings-backed storage with its existing top-level account projection.
  • Add controlled concurrency, persistence, legacy-normalization, and negative schema regression coverage.
  • Add the NoodleR PR-stack v2 plan and reusable Paseo slice kickoff prompt under .github/plans/noodl-split/.

Architecture

Current ownership is:

  • profile: avatar crop, banner, location, generated-profile marker, manual-edit marker
  • social: following IDs, follow timestamps, notification read cursor
  • scheduler: reserved empty container
  • privacy: reserved empty container

patchAccountSettings() opens a serialized file-store transaction, reads the latest row, normalizes legacy or canonical data, merges only the requested subtree, persists the canonical object, and returns the updated account.

The generic account-update route is now column-only and strictly rejects settings, closing the previous whole-object replacement escape path.

The committed v2 stack plan defines the dependency graph and acceptance criteria for subsequent slices. The kickoff prompt gives future agents the same scope and proof instructions.

Known limitations

  • scheduler and privacy intentionally define no fields yet. Slices 6, 7, and 8 will extend their owned contracts when those behaviors are designed.
  • This prevents lost updates between owned subtrees. It does not define same-field conflict semantics within one subtree.
  • Account column updates and settings patches remain separate typed operations; this slice does not add a transaction spanning both.
  • pnpm smoke:ui could not execute because Chromium could not load the environment dependency libnspr4.so.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed
  • Read and followed CONTRIBUTING.md

Automated commands run during implementation:

  • pnpm regression:noodle
  • pnpm regression:prompt
  • pnpm check
  • pnpm guard:installer-artifacts

The concurrency regression was first run against the old replacement path and failed because the competing social write erased bannerUrl. With the new operation, concurrent profile, social, scheduler, and privacy patches survive live-state inspection and storage reopen.

Manual verification notes

  • Edit Noodle profile identity and presentation fields, reload, and confirm persistence.
  • Upload an avatar and banner, reload, and confirm persistence and crop behavior.
  • Follow and unfollow an account, reloading after each action.
  • Open notifications, reload, and confirm the read cursor persists.
  • Trigger a generated follow and confirm it persists after reload.
  • Verify the generic account-update endpoint rejects a raw settings payload.
  • Run pnpm smoke:ui on a machine with Chromium runtime dependencies installed.

Docs and release impact

  • No docs changes needed
  • Updated docs as needed
  • Version/release files updated

Docs added:

  • .github/plans/noodl-split/noodler-pr-stack-plan-v2.md
  • .github/plans/noodl-split/paseo-slice-kickoff-prompt.md

No user-facing README, configuration, FAQ, changelog, or release metadata changes are required for this internal contract slice.

UI evidence

Not applicable. No visual UI changes are introduced.

Summary by CodeRabbit

  • New Features

    • Added structured account settings for profiles, social activity, scheduling, and privacy.
    • Added targeted settings updates (including subtree-scoped banner/notification-read and follow/unfollow) for more precise changes.
    • Updated profile generation metadata handling to use typed profile settings.
  • Bug Fixes

    • Improved concurrent settings updates and persistence across database reloads.
    • Corrected generated-profile detection and follow-state handling.
  • Tests

    • Expanded regression coverage for schema validation, legacy normalization, concurrent patch/update flows, and persistence.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/3744 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 7/17/2026 **Status:** ✅ Merged **Merged:** 7/17/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `noodl-split-1a-typed-settings` --- ### 📝 Commits (6) - [`e97575a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e97575a3bb5c18d8f92192c6745e276f88dd4bd1) fix(noodle): make account settings patches atomic - [`d947649`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d947649be38b9bda292190ba9a2d79c126ff63b5) docs(noodle): add PR stack plan - [`870edd4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/870edd4fcf8b8caa15f16151e1025af78e4d48a5) fix(noodle): address atomic settings review - [`f834157`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f834157a9d7ed99d9bdd20c8eb32689eefa96c7e) refactor(noodle): trust typed follow timestamps - [`eb3bb97`](https://github.com/Pasta-Devs/Marinara-Engine/commit/eb3bb97cdaeb7d64282416af5b2cfdf3aed9a59c) docs: align Noodle settings acceptance criteria - [`04c93c3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/04c93c3b9f3639697bcbde5a7de91b6879d1f412) fix(noodle): close settings review gaps ### 📊 Changes **12 files changed** (+1172 additions, -155 deletions) <details> <summary>View changed files</summary> ➕ `.github/plans/noodl-split/coderabbit-dont-review-plans.md` (+1 -0) ➕ `.github/plans/noodl-split/noodler-pr-stack-plan-v2.md` (+463 -0) ➕ `.github/plans/noodl-split/paseo-slice-kickoff-prompt.md` (+80 -0) 📝 `packages/client/src/components/noodle/NoodleView.tsx` (+46 -61) 📝 `packages/client/src/hooks/use-noodle.ts` (+56 -1) 📝 `packages/server/src/routes/noodle.routes.ts` (+55 -42) 📝 `packages/server/src/services/noodle/noodle-profile-selection.ts` (+1 -6) 📝 `packages/server/src/services/storage/noodle.storage.ts` (+215 -35) 📝 `packages/shared/src/schemas/noodle.schema.ts` (+63 -4) 📝 `packages/shared/src/types/noodle.ts` (+25 -1) 📝 `scripts/regressions/noodle-prompt.regression.ts` (+2 -2) 📝 `scripts/regressions/noodle-settings.regression.ts` (+165 -3) </details> ### 📄 Description ## Linked issue Related implementation discussion: #3618 The oversized NoodleR approach was closed after maintainer acknowledgment that the work should be rebuilt as a focused PR stack from current `staging`. This PR is Slice 1A of that stack and resolves P1 Finding 1: account settings can silently overwrite one another. ## Why this change `NoodleAccount.settings` was an untyped JSON record, and the generic account update path replaced the entire object. Independent profile, follow, notification, avatar-sync, and generated-follow writers could read stale snapshots and silently erase one another. Later NoodleR slices will add more independent writers, so the stack needs a typed ownership boundary and an atomic patch operation before those features land. The committed stack plan keeps the remaining slices, dependencies, findings, and acceptance criteria visible from `staging` after this PR merges. ## What changed - Add a strict `NoodleAccountSettings` contract with required `profile`, `social`, `scheduler`, and `privacy` subtrees. - Keep `scheduler` and `privacy` as strict empty containers for their later owning slices. - Add `PATCH /noodle/accounts/:id/settings` with a discriminated subtree patch schema. - Add transactional `patchAccountSettings()` storage behavior that reads and merges against the latest persisted row. - Normalize all eight existing flat settings fields into the canonical nested shape without a database migration. - Remove raw settings replacement from the generic account-update schema, storage method, client hook, and all current call sites. - Preserve `avatarCrop` as settings-backed storage with its existing top-level account projection. - Add controlled concurrency, persistence, legacy-normalization, and negative schema regression coverage. - Add the NoodleR PR-stack v2 plan and reusable Paseo slice kickoff prompt under `.github/plans/noodl-split/`. ## Architecture Current ownership is: - `profile`: avatar crop, banner, location, generated-profile marker, manual-edit marker - `social`: following IDs, follow timestamps, notification read cursor - `scheduler`: reserved empty container - `privacy`: reserved empty container `patchAccountSettings()` opens a serialized file-store transaction, reads the latest row, normalizes legacy or canonical data, merges only the requested subtree, persists the canonical object, and returns the updated account. The generic account-update route is now column-only and strictly rejects `settings`, closing the previous whole-object replacement escape path. The committed v2 stack plan defines the dependency graph and acceptance criteria for subsequent slices. The kickoff prompt gives future agents the same scope and proof instructions. ## Known limitations - `scheduler` and `privacy` intentionally define no fields yet. Slices 6, 7, and 8 will extend their owned contracts when those behaviors are designed. - This prevents lost updates between owned subtrees. It does not define same-field conflict semantics within one subtree. - Account column updates and settings patches remain separate typed operations; this slice does not add a transaction spanning both. - `pnpm smoke:ui` could not execute because Chromium could not load the environment dependency `libnspr4.so`. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed - [ ] Read and followed `CONTRIBUTING.md` Automated commands run during implementation: - `pnpm regression:noodle` - `pnpm regression:prompt` - `pnpm check` - `pnpm guard:installer-artifacts` The concurrency regression was first run against the old replacement path and failed because the competing social write erased `bannerUrl`. With the new operation, concurrent profile, social, scheduler, and privacy patches survive live-state inspection and storage reopen. ### Manual verification notes - [ ] Edit Noodle profile identity and presentation fields, reload, and confirm persistence. - [ ] Upload an avatar and banner, reload, and confirm persistence and crop behavior. - [ ] Follow and unfollow an account, reloading after each action. - [ ] Open notifications, reload, and confirm the read cursor persists. - [ ] Trigger a generated follow and confirm it persists after reload. - [ ] Verify the generic account-update endpoint rejects a raw `settings` payload. - [ ] Run `pnpm smoke:ui` on a machine with Chromium runtime dependencies installed. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs as needed - [ ] Version/release files updated Docs added: - `.github/plans/noodl-split/noodler-pr-stack-plan-v2.md` - `.github/plans/noodl-split/paseo-slice-kickoff-prompt.md` No user-facing README, configuration, FAQ, changelog, or release metadata changes are required for this internal contract slice. ## UI evidence Not applicable. No visual UI changes are introduced. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added structured account settings for profiles, social activity, scheduling, and privacy. * Added targeted settings updates (including subtree-scoped banner/notification-read and follow/unfollow) for more precise changes. * Updated profile generation metadata handling to use typed `profile` settings. * **Bug Fixes** * Improved concurrent settings updates and persistence across database reloads. * Corrected generated-profile detection and follow-state handling. * **Tests** * Expanded regression coverage for schema validation, legacy normalization, concurrent patch/update flows, and persistence. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:06:56 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6085
No description provided.