Skip to content

fix dev failing tests#955

Merged
BilalG1 merged 8 commits intodevfrom
fix-dev-tests
Oct 15, 2025
Merged

fix dev failing tests#955
BilalG1 merged 8 commits intodevfrom
fix-dev-tests

Conversation

@BilalG1
Copy link
Contributor

@BilalG1 BilalG1 commented Oct 15, 2025

High-level PR Summary

This PR fixes database schema issues related to Prisma migrations by setting the correct search_path before applying auto-migrations and removing the SchemaMigration table from the CI workflow to ensure proper schema comparison during migration checks.

⏱️ Estimated Review Time: 5-15 minutes

💡 Review Order Suggestion
Order File Path
1 apps/backend/src/auto-migrations/index.tsx
2 .github/workflows/check-prisma-migrations.yaml

Need help? Join our Discord

Analyze latest changes


Important

Fixes Prisma migration schema issues and a string concatenation error in getUserInfo.

  • Database Schema:
    • Removes SchemaMigration table in .github/workflows/check-prisma-migrations.yaml to ensure correct schema comparison.
    • Sets STACK_SEED_MODE to 'true' in seed() in seed.ts for consistent seeding behavior.
  • Bug Fix:
    • Fixes string concatenation error in getUserInfo in myFunctions.ts by using + instead of obj.displayName.

This description was created by Ellipsis for 5b664a0. You can customize this summary. It will automatically update as commits are pushed.

Summary by CodeRabbit

  • Bug Fixes

    • Corrected user info message to properly display the user’s name in the example app.
  • Chores

    • CI workflow now clears auto-generated migration metadata before comparing schema changes to reduce false positives.
    • Seeding now explicitly sets a seed-mode environment flag and no longer auto-executes on direct invocation, enabling more controlled runs.

@vercel
Copy link

vercel bot commented Oct 15, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
stack-backend Ready Ready Preview Comment Oct 15, 2025 8:31pm
stack-dashboard Ready Ready Preview Comment Oct 15, 2025 8:31pm
stack-demo Ready Ready Preview Comment Oct 15, 2025 8:31pm
stack-docs Ready Ready Preview Comment Oct 15, 2025 8:31pm

@BilalG1 BilalG1 changed the title try fix fix dev failing tests Oct 15, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 15, 2025

Walkthrough

Introduces a CI workflow step to remove Prisma migration metadata before diffing, sets STACK_SEED_MODE in the backend seed script and removes its auto-execution block, and fixes a string concatenation bug in a Convex example function.

Changes

Cohort / File(s) Summary of changes
CI Workflow (Prisma migrations)
.github/workflows/check-prisma-migrations.yaml
Adds a step "Remove auto-migration metadata" that drops the SchemaMigration table via Prisma CLI before running schema diff. Control flow now includes this pre-diff cleanup.
Backend Seed Script
apps/backend/prisma/seed.ts
Sets STACK_SEED_MODE='true' at seed start. Removes the top-level bootstrap that auto-invoked seed() and its error/cleanup handling.
Convex Example Function
examples/convex/convex/myFunctions.ts
Fixes getUserInfo return value by properly concatenating "The user's name is: " + user.displayName instead of an incorrect fragment.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant GH as GitHub Actions
  participant Job as Workflow Job
  participant DB as Target DB
  participant Prisma as Prisma CLI

  GH->>Job: Start check-prisma-migrations
  Job->>DB: Initialize database
  rect rgba(200,240,255,0.3)
    note right of Job: New step
    Job->>Prisma: Execute SQL to drop SchemaMigration
    Prisma->>DB: DROP TABLE SchemaMigration (if exists)
  end
  Job->>Prisma: prisma migrate diff (schema vs DB)
  Prisma-->>Job: Diff result
  Job-->>GH: Pass/Fail
Loading
sequenceDiagram
  autonumber
  participant App as App Runtime
  participant Seed as seed()
  note over App,Seed: Seed script behavior change

  rect rgba(230,230,230,0.3)
    note over App: Before
    App->>Seed: Module executes seed() at import/run
    Seed-->>App: Completes (handles errors & disconnects)
  end

  rect rgba(220,255,220,0.3)
    note over App: Now
    App->>Seed: Explicit call only (no auto-run)
    Seed->>Seed: Set STACK_SEED_MODE='true'
    Seed-->>App: Completes (caller manages lifecycle)
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I thump my paw at pipelines bright,
Dropping ghosts before the diff takes flight.
Seeds now wait for a proper cue,
Flags set true, like morning dew.
In Convex fields, names now sing—
Hop, hop, ship the tidy thing. 🥕🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title “fix dev failing tests” is overly generic and does not convey the primary changes in this PR, such as updating the Prisma migration workflow, removing the SchemaMigration table, setting the seed mode, or fixing the string concatenation bug in getUserInfo. Please update the title to clearly summarize the main change, for example “Remove SchemaMigration table from CI workflow and fix Prisma migration and string concatenation issues.”
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed The PR description includes the required CONTRIBUTING.md link comment and provides a high-level summary, detailed change breakdown, and review guidance, fully satisfying the repository’s template and giving clear context for reviewers.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-dev-tests

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5176ad1 and 5b664a0.

📒 Files selected for processing (3)
  • .github/workflows/check-prisma-migrations.yaml (1 hunks)
  • apps/backend/prisma/seed.ts (1 hunks)
  • examples/convex/convex/myFunctions.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Prefer ES6 Map over Record when representing key–value collections

Files:

  • examples/convex/convex/myFunctions.ts
  • apps/backend/prisma/seed.ts
🪛 Checkov (3.2.334)
.github/workflows/check-prisma-migrations.yaml

[medium] 65-66: Basic Auth Credentials

(CKV_SECRET_4)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: Security Check
  • GitHub Check: build (22.x)
  • GitHub Check: restart-dev-and-test
  • GitHub Check: build (22.x)
  • GitHub Check: setup-tests
  • GitHub Check: all-good
  • GitHub Check: lint_and_build (latest)
  • GitHub Check: docker
🔇 Additional comments (3)
apps/backend/prisma/seed.ts (1)

14-14: LGTM! Clear seed mode indicator.

Setting STACK_SEED_MODE at the start of the seed function appropriately signals seeding context to downstream logic.

examples/convex/convex/myFunctions.ts (1)

17-17: Critical bug fix: correct variable reference and concatenation.

The change fixes two issues:

  1. Replaces non-existent obj with the correct user variable
  2. Adds missing + concatenation operator

The previous code would have thrown a ReferenceError at runtime.

.github/workflows/check-prisma-migrations.yaml (1)

62-67: LGTM! Appropriately removes auto-migration metadata.

The new step correctly drops the SchemaMigration table before performing the schema diff, preventing auto-migration metadata from interfering with the comparison. The DROP TABLE IF EXISTS makes the operation idempotent.

Note on static analysis hint: Checkov flags the hardcoded password as a security concern. However, this password is:

  • Consistent with the existing workflow (line 70)
  • Used for local CI Docker Compose environment (not production)
  • Matches the test database setup referenced in line 40

This is likely a false positive in this context.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@recurseml recurseml bot left a comment

Choose a reason for hiding this comment

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

Review by RecurseML

🔍 Review performed on 6b08d8b..4ebc2a8

✨ No bugs found, your code is sparkling clean

✅ Files analyzed, no issues (2)

.github/workflows/check-prisma-migrations.yaml
apps/backend/src/auto-migrations/index.tsx

@BilalG1 BilalG1 marked this pull request as ready for review October 15, 2025 20:20
@claude
Copy link
Contributor

claude bot commented Oct 15, 2025

Claude finished @BilalG1's task —— View job


I'll analyze this and get back to you.

@BilalG1 BilalG1 merged commit 479d543 into dev Oct 15, 2025
19 of 21 checks passed
@BilalG1 BilalG1 deleted the fix-dev-tests branch October 15, 2025 20:57
@coderabbitai coderabbitai bot mentioned this pull request Oct 15, 2025
N2D4 pushed a commit that referenced this pull request Oct 16, 2025
<!--

Make sure you've read the CONTRIBUTING.md guidelines:
https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md

-->

<!-- RECURSEML_SUMMARY:START -->
## High-level PR Summary
This PR fixes database schema issues related to Prisma migrations by
setting the correct `search_path` before applying auto-migrations and
removing the `SchemaMigration` table from the CI workflow to ensure
proper schema comparison during migration checks.

⏱️ Estimated Review Time: 5-15 minutes

<details>
<summary>💡 Review Order Suggestion</summary>

| Order | File Path |
|-------|-----------|
| 1 | `apps/backend/src/auto-migrations/index.tsx` |
| 2 | `.github/workflows/check-prisma-migrations.yaml` |
</details>



[![Need help? Join our
Discord](https://img.shields.io/badge/Need%20help%3F%20Join%20our%20Discord-5865F2?style=plastic&logo=discord&logoColor=white)](https://discord.gg/n3SsVDAW6U)


[![Analyze latest
changes](https://img.shields.io/badge/Analyze%20latest%20changes-238636?style=plastic)](https://squash-322339097191.europe-west3.run.app/interactive/d1ed7a31dbea01bc38c87afa5ef5f493d67bca1a1f57d00ee521864bb9e14ca1/?repo_owner=stack-auth&repo_name=stack-auth&pr_number=955)
<!-- RECURSEML_SUMMARY:END -->
<!-- ELLIPSIS_HIDDEN -->


----

> [!IMPORTANT]
> Fixes Prisma migration schema issues and a string concatenation error
in `getUserInfo`.
> 
>   - **Database Schema**:
> - Removes `SchemaMigration` table in
`.github/workflows/check-prisma-migrations.yaml` to ensure correct
schema comparison.
> - Sets `STACK_SEED_MODE` to `'true'` in `seed()` in `seed.ts` for
consistent seeding behavior.
>   - **Bug Fix**:
> - Fixes string concatenation error in `getUserInfo` in
`myFunctions.ts` by using `+` instead of `obj.displayName`.
> 
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup>
for 5b664a0. You can
[customize](https://app.ellipsis.dev/stack-auth/settings/summaries) this
summary. It will automatically update as commits are pushed.</sup>


<!-- ELLIPSIS_HIDDEN -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Corrected user info message to properly display the user’s name in the
example app.

* **Chores**
* CI workflow now clears auto-generated migration metadata before
comparing schema changes to reduce false positives.
* Seeding now explicitly sets a seed-mode environment flag and no longer
auto-executes on direct invocation, enabling more controlled runs.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@coderabbitai coderabbitai bot mentioned this pull request Oct 17, 2025
@coderabbitai coderabbitai bot mentioned this pull request Dec 13, 2025
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