[PR #927] [MERGED] refactor(slurp2): add the event and modifier seam (slice 6) #1195

Closed
opened 2026-10-21 05:05:10 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/927
Author: @Gunterlie
Created: 9/18/2026
Status: ✅ Merged
Merged: 9/18/2026
Merged by: @Gunterlie

Base: modular-simping ← Head: slurp2-slice6-event-modifier-seam


📝 Commits (4)

  • aa7979a docs(slurp2): record slice 6 start and the staging merge gate
  • a65f8cf refactor(slurp2): add the cross-feature event and modifier seam (slice 6)
  • 7af1775 chore(slurp2): rebuild 0.0.29 and record the slice 6 handoff
  • d6bd86e fix(slurp2): keep a lapsed subscription renewing at its agreed price

📊 Changes

27 files changed (+1100 additions, -384 deletions)

View changed files

📝 SLURP-MODULE-PLAN.md (+22 -5)
📝 SLURP-MODULE-STATUS.md (+146 -27)
➕ artifacts/slurp2-0.0.29.zip (+0 -0)
📝 catalog/catalog.json (+8 -8)
📝 catalog/notes.json (+6 -6)
📝 catalog/v2/catalog.json (+8 -8)
📝 catalog/v2/notes.json (+6 -6)
📝 catalog/v3/catalog.json (+8 -8)
📝 catalog/v3/notes.json (+6 -6)
📝 packages/slurp2/CHANGELOG.md (+4 -0)
📝 packages/slurp2/client.js (+28 -28)
📝 packages/slurp2/docs/architecture/DECISIONS.md (+23 -0)
📝 packages/slurp2/docs/architecture/README.md (+6 -0)
📝 packages/slurp2/manifest.json (+5 -5)
📝 packages/slurp2/server.mjs (+239 -239)
📝 packages/slurp2/src/engine/packages/client/src/components/slurp/SlurpPlatformEventsSettings.tsx (+4 -0)
📝 packages/slurp2/src/engine/packages/client/src/components/slurp/slurp2-release.ts (+6 -8)
➕ packages/slurp2/src/engine/packages/server/src/slp/base/modifiers/slp-active-modifier-provider.ts (+27 -0)
➕ packages/slurp2/src/engine/packages/server/src/slp/base/modifiers/slp-modifier-resolver.ts (+38 -0)
➕ packages/slurp2/src/engine/packages/server/src/slp/base/modifiers/slp-modifier-schema.ts (+69 -0)

...and 7 more files

📄 Description

Closes #926. Slice 6 of the Slurp2 modular refactor (parent #914). Targets the modular-simping integration branch.

The human verification items at the bottom are not done.

What changed

Platform events could only colour prompt text. They can now also move one number in another feature, through a small pure contract rather than an event bus.

  • base/modifiers/ (new, 4 files): modifier types, a bounded schema, a deterministic resolver, and the active-modifier provider. Nothing is stored and nothing holds a clock — the evaluation time always comes from the caller. Resolution sorts by source, then applies multiplies before adds, so two overlapping events give the same answer in either save order and again after a restart.
  • Platform events gain kind: "calendar" and modifiers. Both are .default()ed, so every event saved before this change parses unchanged and with no effect. Activation moved into an ACTIVATION_BY_KIND dispatch table; the UTC and year-wrap arithmetic is untouched.
  • A saved event stores the effect only. The producing source stamps source on at activation, so an event cannot claim a modifier for another event or drift from its own id.
  • Economy applies the provider when it prices a new subscription, rounding once and clamping to the existing 0..9999 range. An existing subscription is not re-priced: renewal still charges the stored agreed price from the wallet.
  • Only the synthetic regression modifier exists. No default event carries one and no sale was added. The new test asserts both.
  • Version: Slurp2 0.0.29, a builder-generated unit.

Two plan corrections (both recorded in DECISIONS.md)

  1. Plan §4 said the server entry constructs the provider. It cannot: the only new-subscription charge is inside one storage transaction, and Backstage edits the event list at runtime, so an entry-built provider would serve a frozen list until the next restart. The consumer now builds it from the settings snapshot its own transaction already read. The seam is unchanged — Economy depends on SlpActiveModifierProvider, never on World.
  2. Plan §4 also said features/world/events/ owns calendar activation, contradicting §3's allocation ledger. Under the Slice 5 layer model activation is a pure rule, and three client files import it directly, so it stays in modules/world/events/. No file moved, so no client import and no ownership entry changed.

The only client change is the Backstage event editor's new-event literal, which gains the two defaulted fields because .default() makes them required on the inferred type.

Merge gate

  • Slice 5 PR #925 re-verified, not assumed: state MERGED into modular-simping at c945b4a0, and git merge-base --is-ancestor confirms it is on the branch. Its 0.0.28 payload, manifest, ZIP (sha256 and byte size both matching the ledger), and three catalog lanes are present. Its focused regressions and typecheck-packages slurp2 pass on the merged branch.
  • modular-simping was 4 behind origin/staging. With maintainer approval I made an ordinary --no-ff merge and pushed it as 7324d634. No conflicts, so nothing generated was rebuilt.
  • This branch starts from 7324d634. No slice commit went to modular-simping directly, and nothing was reset, rebased, or force-pushed.

Validation

  • New tests/slurp2-event-modifiers.regression.ts covers every bullet of plan §8 "Modifier behaviour": the active 0.5 multiplier halves the charge and the inactive one does not, rounding happens once, the result clamps at both ends, multiplies precede adds, overlapping events resolve identically in either order, evaluation mutates nothing, the same timestamp survives a settings round-trip, all eight schema rejections fail, a broken modifier is dropped without dropping its event or the list, and renewSubscriptions still charges the stored price.
  • Not vacuous: four mutants, each caught — resolver ignores multiply, provider skips sorting, charge skips the clamp, activation ignores enabled. Baseline green again after restoring all four.
  • slurp2-platform-events.regression.ts is unchanged and still passes, which is the proof the eight default events kept their ids, dates, durations, and guidance.
  • Architecture regression passes with 0 violations and no new exception. Route inventory 179 and storage methods pass.
  • Full per-file suite compared against the branch point 7324d634 (the suite exits at its first failure, so each file ran alone): 25 failures before, 25 after, an identical set — 0 new, 0 fixed. The 22 unique failures are pre-existing.
  • npm run check passes with 0 errors. typecheck-packages slurp2, catalog lanes, locales, catalog, release notes, and git diff --check all pass.
  • npm run test:browser:slurp2 produced no result. It needs MARINARA_ENGINE_ROOT, and with it the Engine dev servers did not start inside a 400s budget. This is the same unresolved environment gap as Slices 0–5.
  • No live install, restart, or uninstall test was performed, and no dev box was used.

Full evidence is in the "Slice 6 (0.0.29)" section of SLURP-MODULE-STATUS.md.

CodeRabbit review fixes

  • Major, accepted (d6bd86e5). subscribe() computed one priced value and used it in two branches. The second renews an existing subscription whose paid period lapsed, so an active event would have changed what an existing subscription costs and stored that event price as the new agreed price. basePrice (the Creator's own price, no modifier) is now what that branch spends, stores, credits, notifies, and records on the audience tie — the same behaviour as before Slice 6 — and only a genuinely new subscription calls slurpSubscriptionCharge. The automatic sweep renewSubscriptions was never affected; it charges subscription.price from the wallet and is untouched.
    • The regression now pins both branches, and two more mutants confirm it bites (renewal re-prices through the event; renewal stores a different price).
    • Rebuilt 0.0.29 in place rather than bumping again: the plan allows one integration patch bump per PR, and Slice 5 handled its own review fix the same way. New archive sha256 66559923bee9ec2c683805731b6776c1e2cbe4792d756810ce6e462a5ce46d08, 6725244 bytes.
    • Full suite re-run after the fix: still an identical failure set against the branch point — 0 new, 0 fixed.
  • Minor, skipped with reason. The claim that validate-package-locales.mjs and validate-catalog.mjs fail on missing repository files is not reproducible; all three validators pass on the committed tree before and after the fix. It appears to be an artifact of the review sandbox's checkout. Details in the thread.

Human verification

  • Live install/update/restart of 0.0.29 on a dev Engine
  • Subscribe to a Creator with the wallet enabled and confirm the charge
  • Edit platform events in Backstage and confirm the saved list round-trips
  • Browser suite in CI or on a host with Playwright system libraries

Summary by CodeRabbit

  • New Features

    • Active calendar events can now apply modifiers to new subscription prices during their configured date ranges.
    • Subscription price modifiers support percentage-based and fixed adjustments, with deterministic ordering and safe bounds.
    • Event modifiers are attributed to their originating event for clearer tracking.
  • Bug Fixes

    • Subscription prices now reflect the latest event settings instead of potentially outdated information.
    • New calendar events automatically receive the required default settings.
  • Release

    • Updated Slurp Remastered to version 0.0.29.

🔄 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-Agents/pull/927 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 9/18/2026 **Status:** ✅ Merged **Merged:** 9/18/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `modular-simping` ← **Head:** `slurp2-slice6-event-modifier-seam` --- ### 📝 Commits (4) - [`aa7979a`](https://github.com/Pasta-Devs/Marinara-Agents/commit/aa7979ad895135e74dda661de887f58fa8a04fbd) docs(slurp2): record slice 6 start and the staging merge gate - [`a65f8cf`](https://github.com/Pasta-Devs/Marinara-Agents/commit/a65f8cf72c4250bbb593ff27a6937ecdbcc4ae87) refactor(slurp2): add the cross-feature event and modifier seam (slice 6) - [`7af1775`](https://github.com/Pasta-Devs/Marinara-Agents/commit/7af177565c93eccb24b97702451bf1bc5c6c7821) chore(slurp2): rebuild 0.0.29 and record the slice 6 handoff - [`d6bd86e`](https://github.com/Pasta-Devs/Marinara-Agents/commit/d6bd86e5fbe523aa9bd6ae6815777f41b0208612) fix(slurp2): keep a lapsed subscription renewing at its agreed price ### 📊 Changes **27 files changed** (+1100 additions, -384 deletions) <details> <summary>View changed files</summary> 📝 `SLURP-MODULE-PLAN.md` (+22 -5) 📝 `SLURP-MODULE-STATUS.md` (+146 -27) ➕ `artifacts/slurp2-0.0.29.zip` (+0 -0) 📝 `catalog/catalog.json` (+8 -8) 📝 `catalog/notes.json` (+6 -6) 📝 `catalog/v2/catalog.json` (+8 -8) 📝 `catalog/v2/notes.json` (+6 -6) 📝 `catalog/v3/catalog.json` (+8 -8) 📝 `catalog/v3/notes.json` (+6 -6) 📝 `packages/slurp2/CHANGELOG.md` (+4 -0) 📝 `packages/slurp2/client.js` (+28 -28) 📝 `packages/slurp2/docs/architecture/DECISIONS.md` (+23 -0) 📝 `packages/slurp2/docs/architecture/README.md` (+6 -0) 📝 `packages/slurp2/manifest.json` (+5 -5) 📝 `packages/slurp2/server.mjs` (+239 -239) 📝 `packages/slurp2/src/engine/packages/client/src/components/slurp/SlurpPlatformEventsSettings.tsx` (+4 -0) 📝 `packages/slurp2/src/engine/packages/client/src/components/slurp/slurp2-release.ts` (+6 -8) ➕ `packages/slurp2/src/engine/packages/server/src/slp/base/modifiers/slp-active-modifier-provider.ts` (+27 -0) ➕ `packages/slurp2/src/engine/packages/server/src/slp/base/modifiers/slp-modifier-resolver.ts` (+38 -0) ➕ `packages/slurp2/src/engine/packages/server/src/slp/base/modifiers/slp-modifier-schema.ts` (+69 -0) _...and 7 more files_ </details> ### 📄 Description Closes #926. Slice 6 of the Slurp2 modular refactor (parent #914). Targets the `modular-simping` integration branch. The human verification items at the bottom are not done. ## What changed Platform events could only colour prompt text. They can now also move one number in another feature, through a small pure contract rather than an event bus. - **`base/modifiers/`** (new, 4 files): modifier types, a bounded schema, a deterministic resolver, and the active-modifier provider. Nothing is stored and nothing holds a clock — the evaluation time always comes from the caller. Resolution sorts by source, then applies multiplies before adds, so two overlapping events give the same answer in either save order and again after a restart. - **Platform events** gain `kind: "calendar"` and `modifiers`. Both are `.default()`ed, so every event saved before this change parses unchanged and with no effect. Activation moved into an `ACTIVATION_BY_KIND` dispatch table; the UTC and year-wrap arithmetic is untouched. - **A saved event stores the effect only.** The producing source stamps `source` on at activation, so an event cannot claim a modifier for another event or drift from its own id. - **Economy** applies the provider when it prices a *new* subscription, rounding once and clamping to the existing `0..9999` range. An existing subscription is not re-priced: renewal still charges the stored agreed price from the wallet. - **Only the synthetic regression modifier exists.** No default event carries one and no sale was added. The new test asserts both. - **Version:** Slurp2 `0.0.29`, a builder-generated unit. ### Two plan corrections (both recorded in `DECISIONS.md`) 1. Plan §4 said the server entry constructs the provider. It cannot: the only new-subscription charge is inside one storage transaction, and Backstage edits the event list at runtime, so an entry-built provider would serve a frozen list until the next restart. The consumer now builds it from the settings snapshot its own transaction already read. The seam is unchanged — Economy depends on `SlpActiveModifierProvider`, never on World. 2. Plan §4 also said `features/world/events/` owns calendar activation, contradicting §3's allocation ledger. Under the Slice 5 layer model activation is a pure rule, and three client files import it directly, so it stays in `modules/world/events/`. No file moved, so no client import and no ownership entry changed. The only client change is the Backstage event editor's new-event literal, which gains the two defaulted fields because `.default()` makes them required on the inferred type. ## Merge gate - Slice 5 PR #925 re-verified, not assumed: `state MERGED` into `modular-simping` at `c945b4a0`, and `git merge-base --is-ancestor` confirms it is on the branch. Its `0.0.28` payload, manifest, ZIP (sha256 and byte size both matching the ledger), and three catalog lanes are present. Its focused regressions and `typecheck-packages slurp2` pass on the merged branch. - `modular-simping` was 4 behind `origin/staging`. With maintainer approval I made an ordinary `--no-ff` merge and pushed it as `7324d634`. No conflicts, so nothing generated was rebuilt. - This branch starts from `7324d634`. No slice commit went to `modular-simping` directly, and nothing was reset, rebased, or force-pushed. ## Validation - **New `tests/slurp2-event-modifiers.regression.ts`** covers every bullet of plan §8 "Modifier behaviour": the active `0.5` multiplier halves the charge and the inactive one does not, rounding happens once, the result clamps at both ends, multiplies precede adds, overlapping events resolve identically in either order, evaluation mutates nothing, the same timestamp survives a settings round-trip, all eight schema rejections fail, a broken modifier is dropped without dropping its event or the list, and `renewSubscriptions` still charges the stored price. - **Not vacuous:** four mutants, each caught — resolver ignores `multiply`, provider skips sorting, charge skips the clamp, activation ignores `enabled`. Baseline green again after restoring all four. - `slurp2-platform-events.regression.ts` is unchanged and still passes, which is the proof the eight default events kept their ids, dates, durations, and guidance. - Architecture regression passes with 0 violations and **no new exception**. Route inventory 179 and storage methods pass. - **Full per-file suite compared against the branch point `7324d634`** (the suite exits at its first failure, so each file ran alone): 25 failures before, 25 after, an **identical** set — 0 new, 0 fixed. The 22 unique failures are pre-existing. - `npm run check` passes with 0 errors. `typecheck-packages slurp2`, catalog lanes, locales, catalog, release notes, and `git diff --check` all pass. - **`npm run test:browser:slurp2` produced no result.** It needs `MARINARA_ENGINE_ROOT`, and with it the Engine dev servers did not start inside a 400s budget. This is the same unresolved environment gap as Slices 0–5. - **No live install, restart, or uninstall test was performed, and no dev box was used.** Full evidence is in the "Slice 6 (0.0.29)" section of `SLURP-MODULE-STATUS.md`. ## CodeRabbit review fixes - **Major, accepted (`d6bd86e5`).** `subscribe()` computed one priced value and used it in two branches. The second renews an existing subscription whose paid period lapsed, so an active event would have changed what an existing subscription costs and stored that event price as the new agreed price. `basePrice` (the Creator's own price, no modifier) is now what that branch spends, stores, credits, notifies, and records on the audience tie — the same behaviour as before Slice 6 — and only a genuinely new subscription calls `slurpSubscriptionCharge`. The automatic sweep `renewSubscriptions` was never affected; it charges `subscription.price` from the wallet and is untouched. - The regression now pins both branches, and two more mutants confirm it bites (renewal re-prices through the event; renewal stores a different price). - Rebuilt `0.0.29` in place rather than bumping again: the plan allows one integration patch bump per PR, and Slice 5 handled its own review fix the same way. New archive sha256 `66559923bee9ec2c683805731b6776c1e2cbe4792d756810ce6e462a5ce46d08`, 6725244 bytes. - Full suite re-run after the fix: still an identical failure set against the branch point — 0 new, 0 fixed. - **Minor, skipped with reason.** The claim that `validate-package-locales.mjs` and `validate-catalog.mjs` fail on missing repository files is not reproducible; all three validators pass on the committed tree before and after the fix. It appears to be an artifact of the review sandbox's checkout. Details in the thread. ## Human verification - [ ] Live install/update/restart of `0.0.29` on a dev Engine - [ ] Subscribe to a Creator with the wallet enabled and confirm the charge - [ ] Edit platform events in Backstage and confirm the saved list round-trips - [ ] Browser suite in CI or on a host with Playwright system libraries <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Active calendar events can now apply modifiers to new subscription prices during their configured date ranges. - Subscription price modifiers support percentage-based and fixed adjustments, with deterministic ordering and safe bounds. - Event modifiers are attributed to their originating event for clearer tracking. - **Bug Fixes** - Subscription prices now reflect the latest event settings instead of potentially outdated information. - New calendar events automatically receive the required default settings. - **Release** - Updated Slurp Remastered to version 0.0.29. <!-- 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-21 05:05:10 +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-Agents#1195
No description provided.