Repository navigation
feat(limits): raise Staryl's free limits and add Reddit - #129
Conversation
Staryl now enforces its per-guild limits through Ring. The free values become 10 YouTube, 15 Twitch live and 30 Reddit subscriptions, and the paid tiers move above them. The migration sets the new column defaults, adds the Reddit limit, and raises a guild stored with less than the new free value. A guild stored with more keeps it.
|
Architecture Data flow Data model Review ✨ Nothing flagged · reviewed Tip The diagrams are links. Click one to open it on the canvas, then press W or click play to walk through the change 🪧 More tips
Thanks for using PR Lens! It's free for OSS. If it helped, a star helps other teams find it. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes: the full diff of the single commit, checked for consistency between the schema, the migration and LimitDefinitions.
- Migration
20261117180000_raise_staryl_limits: sets the new column defaults, addsmaximum_reddit_subscriptions, and raises stored YouTube and Twitch values below the new free floor. Guilds stored above it keep their value. - Schema
prisma/schema.prisma: new defaults (10/15/30) and@tiercomments (20/30, 25/35, 45/60) match the PR table. - Limit definitions
src/lib/common/limits.ts:default,minandmaxagree with the schema defaults, andmaximumRedditSubscriptionsis added forstaryl. - Types
src/lib/types/limits.ts:StarylLimitsgainsmaximumRedditSubscriptions.Mappings,getAllDefaults,GuildLimitFieldsand/configall derive fromLimitDefinitions, so nothing else needs updating.
Two operational points from the PR description still apply. prisma migrate deploy has to run against Ring's database, and the failing Continuous Delivery (the Dockerfile missing .husky/install.mjs) has to be fixed before this reaches production.
claude-sonnet-5-5 | 𝕏
### 🔗 Linked issue No issue. Found while adding Staryl's limits (#129), which need Ring deployed and answering. ### 🧭 Context Ring has not shipped since 23 October, and the code on `main` would not answer if it did. Staryl and WolfStar read their per-guild limits from `GET /guilds/:id`. ### 📚 Description Two fixes, one commit each: - **The image build.** `tsconfig.base.json` extends `.stars/tsconfig.app.json`, which `stars prepare` writes and git ignores. CI runs that step, but the Dockerfile did not, so `prisma generate` stopped at "File './.stars/tsconfig.app.json' not found" and every Continuous Delivery run failed. The builder stage now runs `pnpm exec stars prepare` first. - **The routes.** Every route sets its own `name`. plugin-api takes the path and the method of a named route from its options, not from its file name. With none given, all ten routes matched nothing and answered 404. Each now sets `route` and `methods` to what its file implied. Checked by hand, with the image built locally and a throwaway Postgres: | Request | Before | After | | --- | --- | --- | | `GET /` | 404 | 200 | | `GET /guilds/:id` without a token | 404 | 401 | | `GET /guilds/:id` with Staryl's token, a stored guild | 404 | 200, its stored limits | | `GET /guilds/:id` with Staryl's token, an unknown guild | 404 | 200, the defaults | | `GET /guilds/:id` with WolfStar's token | 404 | 200, WolfStar's fields only | | `GET /experiments` | 404 | 500 locally, which had no Redis | > 🤖 AI disclosure: [Wolfstar Agent Kit](https://github.com/wolfstar-project/wolfstar-agent-kit) modified this description. [AI open source policy](https://harlanzw.com/blog/ai-in-open-source). <!-- pr-lens:description --> <br> <p align="center"><a href="https://prlens.dev/s/wolfstar-project/ring/130?utm_source=github&utm_medium=pr_description#architecture&s=1"><picture><source media="(prefers-color-scheme: dark)" srcset="https://prlens.dev/comment/cta/read-pr-faster-outline-dark.svg"><img alt="Read this PR faster" src="https://prlens.dev/comment/cta/read-pr-faster-outline-light.svg"></picture></a></p> <!-- /pr-lens:description --> <!-- greptile_comment --> <!-- greptile_summary --> <h2><a href="https://app.greptile.com/api/retrigger?id=110078889&sig=dc558ab398cf56e29a84be4ae90428d3f55708933b68da0bf69c53a4a72b3b1d"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a><a href="https://app.greptile.com/-/switch-tenant?tenant=wolfstar-project&next=%2Fwolfstar-project%2Fring%2Fpull%2F130&utm_source=greptile_review&utm_medium=github&utm_campaign=view_in_greptile"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img alt="View in Greptile" src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2" align="right"></picture></a>Confidence Score: 5/5</h2> <!-- greptile-impact-verdict --> The PR appears safe to merge; no actionable defects were found. <!-- greptile_confidence_score:5 --> <sub>Reviews (1) · Last reviewed commit: ["fix(routes): give each named route its p..."](7fbd7ef) · [Reviewed by Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=wolfstar-project/ring)</sub> <!-- /greptile_comment --> --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
### Context Weekly AGENTS.md review of PRs merged into `main` in the last 7 days (#128–#131). ### What changed and why - **`.github/copilot-instructions.md`** — the "Internal API" key pattern and "API Route Structure" section said plugin-api infers a route's path and method from its file location. That's no longer accurate (if it ever was): #130 found all ten existing routes were missing explicit `route`/`methods` options and were 404ing in production as a result. Corrected the description, the code example, and added a second "non-obvious gotcha" entry for it, since this is exactly the kind of silent failure the existing gotcha about route `name` collisions already warns about. - Noted that the Dockerfile's builder stage also runs `pnpm exec stars prepare` before `prisma:generate`/`build` now (#130), next to the existing Troubleshooting entry about that same step in CI. - Noted the new `semantic-pull-requests.yml` workflow (#128): PR titles follow Conventional Commits with a lowercase subject, and CI posts/removes a sticky comment on failures. Added a one-line mention to both `AGENTS.md`'s quick reference and `copilot-instructions.md`'s commit message section. #129 (raising Staryl's free limits, adding a Reddit limit) and #131 (dropping an unused Kodiak config block) didn't need any documentation changes — the existing `limits.ts` file reference already covers #129, and #131 is internal CI config with no agent-facing convention. --- _Generated by [Claude Code](https://claude.ai/code)_ <!-- greptile_comment --> <!-- greptile_summary --> <h2><a href="https://app.greptile.com/api/retrigger?id=116062713&sig=607b14af4cc34dd06434b097ba641b2e1f1ae80f4fc53e0f305f1670fcc962a3"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a><a href="https://app.greptile.com/-/switch-tenant?tenant=wolfstar-project&next=%2Fwolfstar-project%2Fring%2Fpull%2F136&utm_source=greptile_review&utm_medium=github&utm_campaign=view_in_greptile"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img alt="View in Greptile" src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2" align="right"></picture></a>Confidence Score: 5/5</h2> <!-- greptile-impact-verdict --> This documentation-only PR appears safe to merge. <!-- greptile_confidence_score:5 --> <sub>Reviews (1) · Last reviewed commit: ["docs: update AGENTS.md to reflect recent..."](3446e3b) · [Reviewed by Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=wolfstar-project/ring)</sub> <!-- /greptile_comment -->

🔗 Linked issue
No issue. Staryl starts reading these limits in a pull request of its own.
🧭 Context
Staryl is about to enforce per-guild limits on its subscriptions, read from Ring. The free values change to 10 YouTube, 15 Twitch live and 30 Reddit subscriptions, and the paid tiers move above them.
📚 Description
/config setrangemaximumYouTubeSubscriptionsmaximumTwitchSubscriptions(Twitch live)maximumRedditSubscriptions(new)LimitDefinitionsand the@defaultof each column change together, as the schema comment asks.StarylLimits, so Staryl's token reads it fromGET /guilds/:id./config showand/config setpick it up fromLimitDefinitions.📝 Migration
20261117180000_raise_staryl_limitssets the new column defaults and addsmaximum_reddit_subscriptions. It also raises every stored guild below the new free value to that value. A guild stored with more keeps its value.Checked on a throwaway Postgres. After the old migrations, three guilds were stored: one with the old free values, one at YouTube 5 and Twitch 10, and one at YouTube 10 and Twitch 20. After this migration they read 10/15/30, 10/15/30 and 10/20/30.
prisma migrate difffrom that database to the schema is empty.Nothing applies migrations in the image. Run
prisma migrate deployagainst Ring's database before or with the deploy.pnpm installruns thepreparescript, which needs.husky/install.mjs, and the Dockerfile does not copy it. This change does not reach production until #130 fixes it.