Skip to content

CS-206 [Improvement] - Ability to be able to add Custom departments to be assigned for Policies, Evidence and People#3004

Merged
tofikwest merged 24 commits into
mainfrom
chas/add-custom-departments
Jun 4, 2026
Merged

CS-206 [Improvement] - Ability to be able to add Custom departments to be assigned for Policies, Evidence and People#3004
tofikwest merged 24 commits into
mainfrom
chas/add-custom-departments

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Jun 3, 2026

This is an automated pull request to merge chas/add-custom-departments into dev.
It was created by the [Auto Pull Request] action.


Summary by cubic

Enable custom department names across admin policies, policies, risks, tasks, and people by replacing enums with validated strings end to end. Adds a reusable DepartmentSelect with “Add custom…” and enforces a 64‑char limit. Addresses CS-206.

  • New Features

    • API: Departments are strings across create/update/filters/responses; trim/normalize, reject empty/whitespace, max 64 chars. Admin Policies, Policies, Risks (incl. query filters), People, and Tasks validate inputs; Tasks accept null to clear. OpenAPI updated (string types, nullable where relevant, maxLength, examples). Auth types and department visibility use strings; visibleToDepartments is string[].
    • UI: Added DepartmentSelect with “Add custom…” flow, collision-safe sentinel, and 64‑char input cap; used on People, Policy, Task, and Risk pages. Updated Zod validation for Policies, Risks, and Tasks to require trimmed strings and enforce the 64‑char limit.
    • Embedding/Links: Carry department as a string in the embedding index and link suggestions.
  • Migration

    • Run Prisma migrations in packages/db to convert department columns in Policy, Member, Risk, Task to TEXT and Policy.visibleToDepartments to TEXT[]. Preserve "none" defaults for Member and Task.

Written for commit 3de0f6a. Summary will update on new commits.

Review in cubic

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 3, 2026

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

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Jun 4, 2026 2:07pm
comp-framework-editor Ready Ready Preview, Comment Jun 4, 2026 2:07pm
portal Ready Ready Preview, Comment Jun 4, 2026 2:07pm

Request Review

@chasprowebdev chasprowebdev changed the title [dev] [chasprowebdev] chas/add-custom-departments CS-206 [Improvement] - Ability to be able to add Custom departments to be assigned for Policies, Evidence and People Jun 3, 2026
@linear
Copy link
Copy Markdown

linear Bot commented Jun 3, 2026

CS-206

@vercel vercel Bot temporarily deployed to Preview – portal June 3, 2026 02:32 Inactive
@chasprowebdev
Copy link
Copy Markdown
Contributor

custom-departments.mov

@chasprowebdev
Copy link
Copy Markdown
Contributor

@cubic-dev-ai Ultrareview

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented Jun 3, 2026

@cubic-dev-ai Ultrareview

@chasprowebdev Ultrareview monthly budget exhausted (12/12 used). Budget resets at the start of next month.

@chasprowebdev
Copy link
Copy Markdown
Contributor

@cubic-dev-ai please review it.

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented Jun 3, 2026

@cubic-dev-ai please review it.

@chasprowebdev I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 30 files

Confidence score: 3/5

  • There is some merge risk because apps/app/src/components/DepartmentSelect.tsx uses a reserved sentinel value (__add_custom__) that can collide with a real department name, which can block users from selecting that valid option.
  • apps/api/src/risks/dto/get-risks-query.dto.ts currently accepts whitespace-only department query values; those values remain truthy and can apply an unintended exact filter, leading to confusing empty results.
  • Given one medium-severity, high-confidence user-facing behavior issue and one lower-severity validation gap, this looks fixable but worth addressing before relying on this flow in production.
  • Pay close attention to apps/app/src/components/DepartmentSelect.tsx and apps/api/src/risks/dto/get-risks-query.dto.ts - sentinel collisions and whitespace query handling can both produce incorrect filtering behavior.

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/api/src/risks/dto/get-risks-query.dto.ts
Comment thread apps/app/src/components/DepartmentSelect.tsx Outdated
@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented Jun 3, 2026

@cubic-dev-ai please review it.

@chasprowebdev I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 30 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@chasprowebdev
Copy link
Copy Markdown
Contributor

@cubic-dev-ai please review it

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented Jun 3, 2026

@cubic-dev-ai please review it

@chasprowebdev I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 33 files

Confidence score: 3/5

  • There is a concrete regression risk in apps/app/src/actions/schema.ts: the policy update schema no longer enforces department content constraints, so empty/whitespace-only or oversized values could pass validation.
  • Given the issue’s medium severity (6/10) and high confidence (9/10), this introduces user-facing data quality risk and warrants caution before merging.
  • Pay close attention to apps/app/src/actions/schema.ts - restore/verify department field validation rules to prevent invalid policy updates.

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/app/src/actions/schema.ts Outdated
@chasprowebdev
Copy link
Copy Markdown
Contributor

@cubic-dev-ai please review it.

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented Jun 4, 2026

@cubic-dev-ai please review it.

@chasprowebdev I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 33 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@tofikwest tofikwest merged commit ec2c709 into main Jun 4, 2026
11 checks passed
@tofikwest tofikwest deleted the chas/add-custom-departments branch June 4, 2026 14:57
@tofikwest
Copy link
Copy Markdown
Contributor

approved

@claudfuen
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.70.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants