Skip to content

Update from task 22461441-e0ef-4fe2-9c6d-42b6e38d3f0f - #2

Open
khalidalsaqa wants to merge 1 commit into
mainfrom
building-glyph-saas-system-d3f0f
Open

Update from task 22461441-e0ef-4fe2-9c6d-42b6e38d3f0f#2
khalidalsaqa wants to merge 1 commit into
mainfrom
building-glyph-saas-system-d3f0f

Conversation

@khalidalsaqa

@khalidalsaqa khalidalsaqa commented May 18, 2026

Copy link
Copy Markdown
Owner

This PR was created by qwen-chat coder for task 22461441-e0ef-4fe2-9c6d-42b6e38d3f0f.

Summary by Sourcery

Update pricing utilities to support more robust feature limit handling and add deployment and production readiness documentation for the SaaS app.

New Features:

  • Add helper functions to compute remaining usage and check boolean feature availability per pricing tier.
  • Export typed database models for core entities from the schema for use across the application.
  • Add deployment guide and production readiness checklist documentation for the GLYPH SaaS project.

Enhancements:

  • Extend pricing tier configuration to distinguish monthly and yearly Stripe price IDs and improve feature limit checks to handle missing features safely.

Documentation:

  • Introduce a detailed production deployment guide outlining setup, scaling, and troubleshooting.
  • Add a production readiness checklist covering code quality, security, performance, and launch preparation.

@sourcery-ai

sourcery-ai Bot commented May 18, 2026

Copy link
Copy Markdown

Reviewer's Guide

Refines pricing utilities to support monthly/yearly Stripe price IDs and richer feature-limit helpers, exports typed Drizzle models from the DB schema, and adds production deployment and readiness documentation plus Vercel configuration scaffolding.

File-Level Changes

Change Details Files
Extend pricing utilities to better type feature access and handle feature limits/remaining usage, while preparing for monthly/yearly Stripe pricing IDs.
  • Split Stripe price identifiers on tiers into stripeMonthlyPriceId and stripeYearlyPriceId fields (currently null for free tier).
  • Adjusted TierFeatures type definition to use the indexed access form for improved type inference.
  • Updated checkFeatureLimit to treat missing feature limits as non-allowed and to support undefined limits safely.
  • Added getRemainingUsage helper to compute remaining quota or -1 for unlimited tiers and guard against undefined limits.
  • Added isFeatureEnabled helper to check boolean feature flags on tiers.
glyph-saas/api/src/utils/pricing.ts
Export strongly typed Drizzle ORM models for core entities for wider use in the application layer.
  • Imported InferSelectModel from drizzle-orm for deriving row types from table definitions.
  • Defined exported type aliases (User, Subscription, UsageTracking, Note, etc.) based on the corresponding Drizzle tables for select-model typing across the app.
glyph-saas/api/src/db/schema.ts
Add production-focused operational documentation for deployment and readiness, and introduce Vercel configuration scaffolding for the web app.
  • Added DEPLOYMENT.md describing environment setup, database and service dependencies, deployment paths (Vercel and self-hosted), cron jobs, scaling, and troubleshooting steps.
  • Added PRODUCTION_CHECKLIST.md capturing code quality, security, infra, monitoring, performance, deployment, and go-to-market readiness items, including an MVP critical path timeline.
  • Introduced a web/vercel.json file (currently empty/placeholder in the diff) to hold Vercel configuration for the web app.
  • Ensured gitignore is present/updated at repo root (no content changes shown in diff).
glyph-saas/DEPLOYMENT.md
glyph-saas/PRODUCTION_CHECKLIST.md
glyph-saas/web/vercel.json
.gitignore

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • In checkFeatureLimit and getRemainingUsage, treating a missing feature (undefined) as "no access" in one case (returns false) and "unlimited" in the other (returns -1) is inconsistent and could be confusing—consider aligning the semantics or explicitly documenting the intended behavior.
  • The new vercel.json file under glyph-saas/web is empty in this PR; either populate it with the intended Vercel configuration or remove it to avoid confusion and accidental overrides.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `checkFeatureLimit` and `getRemainingUsage`, treating a missing feature (`undefined`) as "no access" in one case (returns `false`) and "unlimited" in the other (returns `-1`) is inconsistent and could be confusing—consider aligning the semantics or explicitly documenting the intended behavior.
- The new `vercel.json` file under `glyph-saas/web` is empty in this PR; either populate it with the intended Vercel configuration or remove it to avoid confusion and accidental overrides.

## Individual Comments

### Comment 1
<location path="glyph-saas/api/src/utils/pricing.ts" line_range="124" />
<code_context>
+): number {
+  const limit = PRICING_TIERS[tier].features[feature] as number | undefined;
+  
+  if (limit === undefined || limit === -1) {
+    return -1; // Unlimited
+  }
</code_context>
<issue_to_address>
**issue:** Treating an undefined feature limit as unlimited may be misleading.

In `getRemainingUsage`, `limit === undefined` returns `-1` ("Unlimited"). For a feature not present on a tier, this is misleading and may be interpreted as fully allowed. Consider returning a distinct "not applicable" value instead (e.g. `0`, `null`, `NaN`, or a union type) or aligning this behavior with `checkFeatureLimit`'s handling of undefined limits.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

): number {
const limit = PRICING_TIERS[tier].features[feature] as number | undefined;

if (limit === undefined || limit === -1) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Treating an undefined feature limit as unlimited may be misleading.

In getRemainingUsage, limit === undefined returns -1 ("Unlimited"). For a feature not present on a tier, this is misleading and may be interpreted as fully allowed. Consider returning a distinct "not applicable" value instead (e.g. 0, null, NaN, or a union type) or aligning this behavior with checkFeatureLimit's handling of undefined limits.

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.

2 participants