Skip to content

[#651] Add member alert settings to the Career job router - #677

Open
Kevinli7673 wants to merge 2 commits into
mainfrom
api/career-alert-settings
Open

Kevinli7673 wants to merge 2 commits into
mainfrom
api/career-alert-settings

Conversation

@Kevinli7673

Copy link
Copy Markdown
Contributor

Why

Blade needs a way for members to choose which job alerts they receive. This finishes the settings left out of #670 and uses the services from #673.

Closes #651

What

  • Members can list, add, edit, and remove their own company and location alert rules.
  • Members can read both digest settings and change either track independently. If Discord role sync fails, Blade gets the saved choice and roleSynced: false.
  • All six procedures use the member profile from the signed-in session.

Test plan

  • 42 targeted API tests passed, including disposable PostgreSQL tests for access, ownership, and digest settings. The API surface snapshot gained six procedures.
  • Root lint passed with warnings. Root typecheck passed.
  • Root format passed across all 24 packages.

Checklist

  • Database schema and migrations are unchanged.
  • Environment variables are unchanged.

Kevinli7673 and others added 2 commits December 2, 2026 14:38
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Explain Change →

Walkthrough

The job-board router adds protected procedures for alert preferences and digest subscriptions. Integration tests cover access checks, owner-scoped preference changes, independent digest tracks, role-sync failure, and member isolation. Feature documentation updates the scope, procedure details, status, and test coverage.

Merge Risk: Low · up to 25356 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 6 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive [#651] The PR implements one #651 scope item: ping preferences and digest opt-ins. In packages/api/src/routers/job-board.ts, six protected procedures list, add, update, and remove alert preferences,… Confirm that the remaining #651 scope items exist at the reviewed head, with tests for member access and private-application and note privacy. Cite the files and tests that provide them. If they do not exist, add them or split #651 so this …
Passed Passed checks: 6 passed

Check name Status Explanation
Title check Passed Title starts with the issue number in brackets, [#651], and describes the main change (member alert settings in the Career job router). It is 57 characters, under the 72-character limit.
Description check Passed Description explains the purpose (members choose job alerts, finishing settings from #670 using #673), lists the behavior added (rule CRUD, independent digest tracks, roleSynced handling, session-base…
Out of Scope Changes check Passed All changed code relates to the alert and digest objective. job-board.ts adds the six procedures and delegates to the alert and digest utilities. job-board.test.ts adds access, ownership, and dige…
No Hardcoded Secrets Passed No hardcoded secrets in the PR diff. I read every added line across the 8 changed files and scanned them for key, password, token, and secret patterns (api_key, secret, password, token, sk-, ghp_, xox…
Validated Env Access Passed The PR diff adds no process.env usage. A search of added lines in the PR range found no matches. The six changed source and test files contain one process.env reference, `packages/api/src/tests/in…
No Typescript Escape Hatches Passed No added line in the changed TypeScript files uses any, @ts-ignore, @ts-expect-error, or a non-null assertion (!.). I checked the added lines in packages/api/src/routers/job-board.ts, `packa…
Full details: Description check

Explanation

Description explains the purpose (members choose job alerts, finishing settings from #670 using #673), lists the behavior added (rule CRUD, independent digest tracks, roleSynced handling, session-based member profile), and gives test and checklist results. It is directly related to the changeset.

Full details: Out of Scope Changes check

Explanation

All changed code relates to the alert and digest objective. job-board.ts adds the six procedures and delegates to the alert and digest utilities. job-board.test.ts adds access, ownership, and digest tests, and changes callerFor to support unauthenticated callers. router-contract.test.ts expects the six new procedures. The .forge/features/career-job-router spec, SRD, status, and test-case files document the same scope. These support the implementation and do not add unrelated behavior. The excluded api-surface.test.ts.snap file cannot be inspected under its exclusion rule, so its contents are not assessed.

Full details: No Hardcoded Secrets

Explanation

No hardcoded secrets in the PR diff. I read every added line across the 8 changed files and scanned them for key, password, token, and secret patterns (api_key, secret, password, token, sk-, ghp_, xox, AKIA, bearer, private key). The scan found no matches. The new code in packages/api/src/routers/job-board.ts only delegates to helpers and reads the member ID from the session. The test changes use fixture identifiers such as NO_PROFILE_USER and ALEX.memberId, which are not credentials. The .forge markdown changes are documentation and contain no credential values.

Full details: Validated Env Access

Explanation

The PR diff adds no process.env usage. A search of added lines in the PR range found no matches. The six changed source and test files contain one process.env reference, packages/api/src/tests/integration/job-board.test.ts line 113 (process.env.DATABASE_URL = disposable.url;). The same statement exists at line 111 of the base revision. The PR only shifts its line number by adding lines above it. It is pre-existing, not introduced by this PR. The line also carries an eslint-disable-next-line no-restricted-properties comment. The PR does not activate, expose, or worsen it.

Resolution

None required for this PR. Optional follow-up: replace the pre-existing process.env.DATABASE_URL assignment in the job-board integration test with the validated env path, in a separate change.

Full details: No Typescript Escape Hatches

Explanation

No added line in the changed TypeScript files uses any, @ts-ignore, @ts-expect-error, or a non-null assertion (!.). I checked the added lines in packages/api/src/routers/job-board.ts, packages/api/src/tests/integration/job-board.test.ts, and packages/api/src/tests/job-board/router-contract.test.ts, plus a whole-diff pattern search over *.ts and *.tsx. The only type assertion added is as Session in the test helper callerFor, and as const in test fixtures. The check does not list type assertions, so they do not trigger a failure.

Full details: Linked Issues check

Explanation

[#651] The PR implements one #651 scope item: ping preferences and digest opt-ins. In packages/api/src/routers/job-board.ts, six protected procedures list, add, update, and remove alert preferences, and list and set digest subscriptions. The digest mutation returns the saved choice with roleSynced: false when Discord role sync fails. Tests cover UNAUTHORIZED and FORBIDDEN access, caller-scoped ownership, independent digest tracks, and subscription isolation. The other #651 scope items are not shown in this PR: job search and sort, job and company views, saving applications and stages, people in process, officer Discord settings, and privacy checks for private applications and notes. The PR description says it does not claim the full router scope. The summary does not show whether these items already exist at head from #670 or #673. The linked issue also cites packages/api/src/routers/career.ts, but the changes are in job-board.ts. Also, the API surface snapshot is excluded under !**/*.snap, so its content cannot be checked.

Resolution

Confirm that the remaining #651 scope items exist at the reviewed head, with tests for member access and private-application and note privacy. Cite the files and tests that provide them. If they do not exist, add them or split #651 so this PR does not close it. Confirm the router file path that the issue requirements apply to.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/api/src/routers/job-board.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

packages/api/src/tests/integration/job-board.test.ts

ESLint skipped: the matched ESLint configuration already failed (missing-dependency).

packages/api/src/tests/job-board/router-contract.test.ts

ESLint skipped: the matched ESLint configuration already failed (missing-dependency).

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

@Kevinli7673

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

Actionable comments

Minor 1
  1. Audit alert-preference deletion.
    packages/api/src/routers/job-board.ts, lines 292 · 🗄️ Data Integrity & Integration · ⚡ Quick win
    removeAlertPreference deletes data without calling createAdminAuditEvent. Pass the session actor to the workflow and write the audit event in the same transaction as the deletion.
    As per coding guidelines, “any protectedProcedure mutation that deletes data or moves money, writes an event via createAdminAuditEvent.”
    Source: Coding guidelines

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 2493690 and 2535666.

Files ignored due to path filters: 1

  • packages/api/src/tests/root/__snapshots__/api-surface.test.ts.snap is excluded by !**/*.snap
Files selected for processing: 7

  • .forge/features/career-job-router/spec.md
  • .forge/features/career-job-router/srd.md
  • .forge/features/career-job-router/status.md
  • .forge/features/career-job-router/test-cases.md
  • packages/api/src/routers/job-board.ts
  • packages/api/src/tests/integration/job-board.test.ts
  • packages/api/src/tests/job-board/router-contract.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

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.

[SPRINT-04] Career: add the member and officer tRPC router

1 participant