Skip to content

[Issues] Add priority to issues#422

Merged
DGoel1602 merged 2 commits intomainfrom
issue/priority
Mar 13, 2026
Merged

[Issues] Add priority to issues#422
DGoel1602 merged 2 commits intomainfrom
issue/priority

Conversation

@DGoel1602
Copy link
Contributor

@DGoel1602 DGoel1602 commented Mar 13, 2026

Why

Issues didn't have a priority

What

Issues now have a priority

Checklist

  • Database: No schema changes, OR I have contacted the Development Lead to run db:push before merging
  • Environment Variables: No environment variables changed, OR I have contacted the Development Lead to modify them on Coolify BEFORE merging.

Summary by CodeRabbit

  • New Features
    • Issues now support priority levels: Lowest, Low, Medium, High, and Highest.
    • Backend persisted issue priority with a dedicated column and index so priorities are stored and queried efficiently.

@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: f9a44f42-e6b4-43de-ab12-b711d750039c

📥 Commits

Reviewing files that changed from the base of the PR and between 1a13119 and 1408de7.

📒 Files selected for processing (2)
  • packages/consts/src/issue.ts
  • packages/db/src/schemas/knight-hacks.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/db/src/schemas/knight-hacks.ts
  • packages/consts/src/issue.ts

📝 Walkthrough

Walkthrough

Adds a PRIORITY constant with five ordinal levels and integrates it as a PostgreSQL enum and a non-null priority column on the Issue table in the DB schema.

Changes

Cohort / File(s) Summary
Priority Constant
packages/consts/src/issue.ts
Added exported PRIORITY constant: ["LOWEST", "LOW", "MEDIUM", "HIGH", "HIGHEST"] as const.
Database Schema
packages/db/src/schemas/knight-hacks.ts
Added issuePriority = pgEnum("issue_priority", ISSUE.PRIORITY) and a non-null priority: issuePriority().notNull() column to the Issue table; added priorityIdx index.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

Constants, Database, Feature, Major

🚥 Pre-merge checks | ✅ 4 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title uses a generic prefix '[Issues]' instead of the required issue number format '[#123]', failing to meet the specified requirement. Update the title to '[#422] Add priority to issues' to follow the required format with the issue number in brackets.
Validated Env Access ❓ Inconclusive Verification scripts check for direct process.env usage in modified files and across the codebase to ensure compliance with validated environment variable patterns. Execute the provided shell scripts to obtain actual verification results and confirm no direct process.env usage was introduced in the PR changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
No Hardcoded Secrets ✅ Passed Pull request contains no hardcoded secrets; changes include priority constant and database schema updates with legitimate configuration data only.
No Typescript Escape Hatches ✅ Passed PR changes introduce PRIORITY constant and issuePriority enum using type-safe patterns ('as const', pgEnum) with proper database schema definitions. No TypeScript escape hatches (any, @ts-ignore, @ts-expect-error, non-null assertions) detected in the added code.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue/priority
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

You can customize the high-level summary generated by CodeRabbit.

Configure the reviews.high_level_summary_instructions setting to provide custom instructions for generating the high-level summary.

@DGoel1602 DGoel1602 added the API Change modifies code in the global API/tRPC package label Mar 13, 2026
@DGoel1602 DGoel1602 marked this pull request as ready for review March 13, 2026 17:45
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
packages/db/src/schemas/knight-hacks.ts (1)

577-588: Consider adding an index on priority for query performance.

The table already has indexes on status, date, team, etc. If you expect to filter or sort issues by priority (a common use case), adding an index now would be beneficial.

📈 Suggested index addition
     statusIdx: index("issue_status_idx").on(table.status),
     dateIdx: index("issue_date_idx").on(table.date),
     parentIdx: index("issue_parent_idx").on(table.parent),
+    priorityIdx: index("issue_priority_idx").on(table.priority),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/db/src/schemas/knight-hacks.ts` around lines 577 - 588, Add an index
on the priority column in the same table index block to improve query
performance when filtering or sorting by priority; specifically, update the
index list (where parentReference, teamIdx, creatorIdx, statusIdx, dateIdx,
parentIdx are defined) to include index("issue_priority_idx").on(table.priority)
so the schema defines a dedicated priority index alongside the existing indexes.
packages/consts/src/issue.ts (1)

8-8: Consider using SCREAMING_SNAKE_CASE for priority values to match existing conventions.

ISSUE_STATUS values use SCREAMING_SNAKE_CASE (e.g., "IN_PROGRESS"), while PRIORITY uses Title Case (e.g., "Medium"). This inconsistency can cause confusion when writing queries or filters.

♻️ Suggested change for consistency
-export const PRIORITY = ["Lowest", "Low", "Medium", "High", "Highest"] as const;
+export const PRIORITY = ["LOWEST", "LOW", "MEDIUM", "HIGH", "HIGHEST"] as const;

As per coding guidelines: packages/consts/** – "Values are intentional and well-documented" and changes here affect the entire monorepo.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/consts/src/issue.ts` at line 8, The PRIORITY constant currently uses
Title Case strings; change its entries to SCREAMING_SNAKE_CASE (e.g., "LOWEST",
"LOW", "MEDIUM", "HIGH", "HIGHEST") to match ISSUE_STATUS and repo conventions;
update the export of PRIORITY (the array and its as const typing) so consumers
keep literal types, and run a quick search for usages of PRIORITY to adjust any
code expecting Title Case values (or add a migration/helper if needed).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/db/src/schemas/knight-hacks.ts`:
- Line 566: The new Issue schema adds priority: issuePriority().notNull()
without a default, which will break existing rows; either set a sensible default
on the column (e.g., change priority:
issuePriority().notNull().default("Medium")) or add a migration that backfills
existing Issue rows (update Issue set priority = 'Medium' where priority IS
NULL) before enforcing NOT NULL and then alter the column; reference the
priority column, issuePriority() call, and the Issue table when implementing the
change.

---

Nitpick comments:
In `@packages/consts/src/issue.ts`:
- Line 8: The PRIORITY constant currently uses Title Case strings; change its
entries to SCREAMING_SNAKE_CASE (e.g., "LOWEST", "LOW", "MEDIUM", "HIGH",
"HIGHEST") to match ISSUE_STATUS and repo conventions; update the export of
PRIORITY (the array and its as const typing) so consumers keep literal types,
and run a quick search for usages of PRIORITY to adjust any code expecting Title
Case values (or add a migration/helper if needed).

In `@packages/db/src/schemas/knight-hacks.ts`:
- Around line 577-588: Add an index on the priority column in the same table
index block to improve query performance when filtering or sorting by priority;
specifically, update the index list (where parentReference, teamIdx, creatorIdx,
statusIdx, dateIdx, parentIdx are defined) to include
index("issue_priority_idx").on(table.priority) so the schema defines a dedicated
priority index alongside the existing indexes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: ac99e68a-5c01-49c1-bb55-37509a730390

📥 Commits

Reviewing files that changed from the base of the PR and between 0194403 and 1a13119.

📒 Files selected for processing (2)
  • packages/consts/src/issue.ts
  • packages/db/src/schemas/knight-hacks.ts

Copy link
Contributor

@DVidal1205 DVidal1205 left a comment

Choose a reason for hiding this comment

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

very complex, can i get a tldr? (lgtm)

@DGoel1602 DGoel1602 added this pull request to the merge queue Mar 13, 2026
Merged via the queue into main with commit a445d98 Mar 13, 2026
7 checks passed
@DGoel1602 DGoel1602 deleted the issue/priority branch March 13, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API Change modifies code in the global API/tRPC package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants