Skip to content

[#648] Add Career Discord settings in Blade - #664

Closed
StevScripts wants to merge 2 commits into
KnightHacks:mainfrom
StevScripts:stevin/career-discord-config-648
Closed

StevScripts wants to merge 2 commits into
KnightHacks:mainfrom
StevScripts:stevin/career-discord-config-648

Conversation

@StevScripts

@StevScripts StevScripts commented Nov 3, 2026 •

Copy link
Copy Markdown

Why

Officers need to update Career channels and reminder roles when Discord is reorganized. This adds those settings to Blade's existing Discord config page.

What

Closes: #648

Adds five settings:

  • Internship and new-grad posting channels. Digests use the same channels.
  • Internship and new-grad reminder roles.
  • An optional channel for job source failure alerts.

The posting channels and reminder roles are seeded with the supplied production IDs. The failure channel starts empty and shows "Not configured". An officer must set career_source_health_channel before failure alerts can be enabled. All other settings still require a production ID.

The existing officer permissions, audit trail and cache behavior stay in place. Required ID reads still throw when no ID is configured. A separate optional reader lets future failure-alert code handle an unset channel.

The migrations preserve officer edits. The final migration only shortens the original descriptions, leaving custom wording untouched.

This prepares the settings for #651, #653 and #654. All five remain marked "Unused" until those tickets add consumers. Job delivery and subscriptions are outside this PR.

The five settings follow parent #633 and the agreed internship/new-grad split. They differ from #648's automated three-key suggestion, so confirm the names with downstream owners before merge.

Test Plan

Final checks passed after the description update and comment cleanup:

  • pnpm verify:precommit: React analysis, formatting, lint and typechecking.
  • All 20 PostgreSQL migration/lineage tests.

An earlier full workspace run passed 3,147 tests in 421 files, and the full workspace build passed. Those runs predate the description-only migration; the final checks above include it. Migration generation found no schema drift.

Database and API tests cover fresh installs, upgrades, preserved officer edits, required IDs, optional set/clear, audit records and cache refresh.

Chromium checks verified saving, reloading and clearing the setting against SQL, plus desktop and 320px mobile layouts. Browser checks used a test officer; API integration tests separately verified audit writes.

Screenshots

Updated screenshots show the shorter descriptions and the unconfigured failure channel.

Career posting channels

career-channels-desktop

Digest roles

career-roles-desktop

Empty failure channel

failure-channel-desktop

Officer editor

failure-channel-dialog-desktop

Setup and rollout

  • An officer must choose the failure channel before alerts are enabled. When it is unset, future delivery code must skip that notification and keep normal work and error logging running.
  • Development IDs are empty, so they fall back to production. Configure safe development destinations or agree to that fallback before enabling development delivery.
  • Confirm rollout with the maintainer: deploy compatible code, drain old Blade instances, then apply migrations 0064–0066. Old code cannot safely display the new keys or empty production value. The optional CI migration job does not wait for deployment or draining. Keep compatible code deployed while the new rows exist; use a forward fix if needed.

Checklist

  • Database: pnpm db:generate ran. SQL migrations, snapshots and journal are committed and tested locally.
  • Environment Variables: no persistent environment variables or environment files changed.

Closes KnightHacks#648

Co-authored-by: Codex <codex@openai.com>
@StevScripts StevScripts added Feature New Feature or Request Major Big change - 2+ reviewers required Blade Change modifies code in Blade app Database Change modifies code in the DB package API Change modifies code in the global API/tRPC package labels Nov 3, 2026
@StevScripts StevScripts self-assigned this Nov 3, 2026
Co-authored-by: Codex <codex@openai.com>
@StevScripts
StevScripts marked this pull request as ready for review November 3, 2026 17:43
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Walkthrough

Adds five Career Discord settings to the configuration registry and database. Only the source-health alert channel can have an unset production destination. Optional reads return null for that unset value, while strict reads continue to throw. Blade now allows officers to configure or clear the optional destination and distinguishes an unset value from a development ID that reuses production. The changes add migration, API, utility, and UI tests. Delivery consumers remain out of scope.

Pre-merge checks: Passed 7 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 41.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 7 passed
Check name Status Explanation
Title check Passed The title starts with the required issue number, clearly describes the Career Discord settings change, and is 43 characters long.
Linked Issues check Passed [#648] Scope: add Career Discord config entries to the existing registry, seed them, and make them viewable and editable in Blade. Evidence: DISCORD.CONFIG_KEYS gains the Career keys (packages/const…
Out of Scope Changes check Passed Changes map to the Career config objective. Core: new keys and registry (packages/consts), nullable production_id with a check constraint, migrations 0064–0066, schema and resolveDiscordConfigId n…
No Hardcoded Secrets Passed No hardcoded API keys, passwords, tokens, or secrets were found in the pull-request additions. The long numeric literals are Discord channel/role IDs and test fixtures. Credential-related matches in g…
Validated Env Access Passed No pull-request-added source line uses process.env or equivalent raw environment access. The existing accesses in packages/api/src/tests/integration/platform-config.test.ts, `packages/db/scripts/s…
No Typescript Escape Hatches Passed No new TypeScript escape hatches were introduced. Added lines contain no any type, @ts-ignore, @ts-expect-error, or non-null assertion. The existing creator?: any in `packages/db/scripts/seed_…
Description check Passed Description states the PR adds five Career Discord settings to Blade's Discord config page, names the setting types, and explains the seeding, optional failure channel, permissions and audit behavior,…
Full details: Linked Issues check

Explanation

[#648] Scope: add Career Discord config entries to the existing registry, seed them, and make them viewable and editable in Blade. Evidence: DISCORD.CONFIG_KEYS gains the Career keys (packages/consts/src/discord.ts). Migrations 0064–0066 seed career_internship_channel, career_new_grad_channel, career_internship_digest_role, career_new_grad_digest_role with production IDs, and career_source_health_channel unset. Officers edit them through the existing DiscordConfigDialog and discord-config-section.tsx. Tests cover the 20-row list and the edit flow. [#648] Done when, read path: getDiscordConfigId and the new getOptionalDiscordConfigId in packages/utils/src/discord-config.ts are generic over the key. The module header states that apps/cron and other processes share this read path, so cron and the API can read the new keys. Tests in packages/utils/src/tests/discord-config.test.ts cover reads. Caveat: no cron or API consumer of these keys is wired in this PR. The PR states that consumers belong to #651, #653 and #654, and #648 lists those as blocked work. The read capability is present, so this is not treated as a failure. The five-key split differs from #648's three-key suggestion. The PR states this follows parent #633 and the issue's own scope allows "any other Discord routing Career needs".

Full details: Out of Scope Changes check

Explanation

Changes map to the Career config objective. Core: new keys and registry (packages/consts), nullable production_id with a check constraint, migrations 0064–0066, schema and resolveDiscordConfigId nullability, optional reader getOptionalDiscordConfigId, validator rule for required production IDs, and the officer dialog and section UI. Supporting: tests, docs/DATABASE-USAGE.md, and .forge/features/career-discord-config/* documentation. The packages/db/scripts/seed_devdb.ts change makes the guild dev-seed guard also require productionId. It is not named in the PR description. It is tied to this PR's nullable production_id work, and the 0064 check already requires a production ID for guild. It is a small guard and does not add unrelated behavior, so it is not treated as out of scope. No unrelated change was found in the reviewed evidence.

Full details: No Hardcoded Secrets

Explanation

No hardcoded API keys, passwords, tokens, or secrets were found in the pull-request additions. The long numeric literals are Discord channel/role IDs and test fixtures. Credential-related matches in generated snapshots are schema names and constraints, not secret values.

Full details: Validated Env Access

Explanation

No pull-request-added source line uses process.env or equivalent raw environment access. The existing accesses in packages/api/src/tests/integration/platform-config.test.ts, packages/db/scripts/seed_devdb.ts, and packages/utils/src/discord-config.ts are unchanged from the base revision.

Full details: No Typescript Escape Hatches

Explanation

No new TypeScript escape hatches were introduced. Added lines contain no any type, @ts-ignore, @ts-expect-error, or non-null assertion. The existing creator?: any in packages/db/scripts/seed_devdb.ts is unchanged.

Full details: Description check

Explanation

Description states the PR adds five Career Discord settings to Blade's Discord config page, names the setting types, and explains the seeding, optional failure channel, permissions and audit behavior, rollout order, and test evidence. It is directly related to the changeset.

Full details: Docstring Coverage

Explanation

Docstring coverage is 41.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 12 functions across 17 files. (9 skipped: 9 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate unit tests (beta)
  • 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.

apps/blade/src/app/_components/admin/roles/discord-config-dialog.tsx

ESLint execution timed out; analysis is incomplete

apps/blade/src/app/_components/admin/roles/discord-config-section.tsx

ESLint skipped: the matched ESLint configuration already failed (timeout).

apps/blade/src/tests/admin/admin-config-console.test.tsx

ESLint skipped: the matched ESLint configuration already failed (timeout).

Review coverage is incomplete: 3 files could not be fully reviewed. Findings from completed review steps are included; see review info for details.

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between b88d4de and c49d8ea.

Files selected for processing: 29
  • .forge/features/career-discord-config/spec.md
  • .forge/features/career-discord-config/srd.md
  • .forge/features/career-discord-config/status.md
  • .forge/features/career-discord-config/test-cases.md
  • apps/blade/src/app/_components/admin/roles/discord-config-dialog.tsx
  • apps/blade/src/app/_components/admin/roles/discord-config-section.tsx
  • apps/blade/src/tests/admin/admin-config-console.test.tsx
  • docs/DATABASE-USAGE.md
  • packages/api/src/tests/config/discord-config-validation.test.ts
  • packages/api/src/tests/config/discord-config.test.ts
  • packages/api/src/tests/integration/platform-config.test.ts
  • packages/consts/src/discord.ts
  • packages/db/drizzle/0064_career_discord_optional_channel.sql
  • packages/db/drizzle/0065_career_discord_config_seed.sql
  • packages/db/drizzle/0066_career_discord_config_copy.sql
  • packages/db/drizzle/meta/0064_snapshot.json
  • packages/db/drizzle/meta/0065_snapshot.json
  • packages/db/drizzle/meta/0066_snapshot.json
  • packages/db/drizzle/meta/_journal.json
  • packages/db/scripts/seed_devdb.ts
  • packages/db/src/schemas/discord-config.ts
  • packages/db/src/tests/career-discord-config-migration.test.ts
  • packages/db/src/tests/discord-config-migration.test.ts
  • packages/db/src/tests/migration-lineage.test.ts
  • packages/db/src/tests/support/career-discord-config.ts
  • packages/utils/src/discord-config.ts
  • packages/utils/src/tests/discord-config-consumers.test.ts
  • packages/utils/src/tests/discord-config.test.ts
  • packages/validators/src/platform-config.ts
Files not fully reviewed because their changes were unavailable: 3
  • packages/db/drizzle/meta/0064_snapshot.json
  • packages/db/drizzle/meta/0065_snapshot.json
  • packages/db/drizzle/meta/0066_snapshot.json

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

@StevScripts StevScripts closed this Nov 3, 2026
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 Blade Change modifies code in Blade app Database Change modifies code in the DB package Feature New Feature or Request Major Big change - 2+ reviewers required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SPRINT-04] Career: add Discord config keys for posting channels and digest roles

1 participant