fix(subscriptions): reject unscoped batch replacement#436
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
life-ustc | c54e918 | Commit Preview URL Branch Preview URL |
Jul 15 2026, 04:22 PM |
|
E2E HTML report is ready: https://life-ustc.github.io/e2e-snapshot-artifacts/reports/29432033519/index.html |
tiankaima
marked this pull request as ready for review
July 15, 2026 16:31
|
🎉 This PR is included in version 1.51.4 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Prevent an unscoped batch
action=setrequest from replacing every historical section subscription. Production logs for #431 correlate the July 10 deletion with an automated CLI sweep that ranworkspace calendar set 999999using a production credential; the invalid section resolved to an empty target and the compatibility branch replaced the full relation.Changed Surfaces
action=setunlesssemesterIdis present.Evidence
Static/unit/build:
bun run app:preparebunx biome checkbunx svelte-check --tsconfig ./tsconfig.jsontsc --noEmitchecksbunx vitest run— 154 files / 782 testsbun run buildbun run openapi:checkIsolated database/API:
Docs / Contracts
Updated
docs/contracts/subscription.jsonto requiresemesterIdforaction=set. Generated OpenAPI has no drift because the conditional Zod refinement is enforced at runtime; the companion CLI guard is Life-USTC/cli#9.REST/MCP parity was checked. MCP exposes add/remove/append only and has no replace tool. Bot has an unused internal replace wrapper, but no callers; this server guard makes any future unscoped use fail safely.
Risk Areas
This intentionally breaks clients that relied on unscoped batch replacement; they must select a semester. The separate legacy
POST /api/calendar-subscriptionscompatibility endpoint still supports explicit whole-set replacement and is not changed here because removing it is a broader public API break. It was not the caller in this incident.No production data restoration is included. #431 remains open until the affected relations are restored with explicit authorization and the exposed calendar credential is rotated.
Cleanup
No scratch artifacts, Playwright output, generated drift, or unrelated rewrites remain.