Skip to content

Add Discord gig status updates#301

Merged
michaelmwu merged 1 commit into
mainfrom
michaelmwu/update-job-status
May 23, 2026
Merged

Add Discord gig status updates#301
michaelmwu merged 1 commit into
mainfrom
michaelmwu/update-job-status

Conversation

@michaelmwu
Copy link
Copy Markdown
Member

@michaelmwu michaelmwu commented May 23, 2026

Summary

  • add /update-gig-status for registered gig forum threads
  • allow status updates by Steering Committee+ or the original thread poster
  • update both dashboard engagement status and the Discord thread title marker
  • update stale recruiting reminder copy to mention the current RECRUITING status
  • make stale recruiting dashboard notifications open the gig detail page directly

Status input handling

Discord slash commands use fixed choices for the command input, which gives users an enum-like picker. The implementation still validates server-side and rejects unexpected statuses instead of accepting arbitrary values or adding enum fields from user input. That keeps dashboard reporting and thread title markers canonical while avoiding silent autocorrection to the wrong state.

Validation

  • uv run pytest tests/unit/test_jobs.py -q
  • uv run pytest tests/unit/test_discord_command_metadata.py -q
  • uv run pytest tests/integration/test_dashboard_playwright.py -q
  • ./scripts/lint.sh
  • bun run --cwd apps/admin_dashboard lint
  • bun run --cwd apps/admin_dashboard typecheck
  • bun run --cwd apps/admin_dashboard build
  • git diff --check

Summary by CodeRabbit

Release Notes

  • New Features

    • Discord bot now supports updating gig status with a new slash command that automatically updates the dashboard and reflects the status change in the thread title.
  • Improvements

    • Notification handling in the dashboard for stale recruiting gigs now intelligently navigates directly to the specific gig when available.
  • Tests

    • Added test coverage for gig status update permissions and thread title synchronization.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 23, 2026

Warning

Review limit reached

@michaelmwu, we couldn't start this review because you've used your available PR reviews for now.

Your plan currently allows 1 review/hour. Refill in 51 minutes and 35 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 40084635-73d4-4865-a96f-a76529aed257

📥 Commits

Reviewing files that changed from the base of the PR and between 91aff75 and 06468a1.

📒 Files selected for processing (7)
  • apps/admin_dashboard/src/main.tsx
  • apps/api/src/five08/backend/static/dashboard/.vite/manifest.json
  • apps/api/src/five08/backend/static/dashboard/assets/index-DAy1pv-J.js
  • apps/api/src/five08/backend/static/dashboard/index.html
  • apps/discord_bot/src/five08/discord_bot/cogs/jobs.py
  • tests/integration/test_dashboard_playwright.py
  • tests/unit/test_jobs.py
📝 Walkthrough

Walkthrough

This PR adds a Discord slash command to update gig engagement status with thread-title synchronization, enables dashboard notifications to route directly to specific gig detail views, and includes unit and integration tests validating both workflows. Build artifacts reflect the rebuilt dashboard bundle.

Changes

Discord Gig Status Update Command

Layer / File(s) Summary
Status update helpers and permissions
apps/discord_bot/src/five08/discord_bot/cogs/jobs.py, tests/unit/test_jobs.py
Adds _interaction_user_can_update_gig_thread to authorize updates by original poster or Steering Committee+ members, and _rename_gig_thread_for_status to rewrite Discord thread titles with status markers. Unit tests validate permission enforcement and title rewrites.
Slash command implementation
apps/discord_bot/src/five08/discord_bot/cogs/jobs.py
Implements /update-gig-status command: validates forum thread context, normalizes status input, authorizes the updater, upserts dashboard engagement, updates status, renames the thread with new marker, and audits/reports outcomes. Recruiting reminder text updated to reference dashboard "RECRUITING" status.

Dashboard Notification Routing

Layer / File(s) Summary
Notification handler and integration tests
apps/admin_dashboard/src/main.tsx, tests/integration/test_dashboard_playwright.py
Notification click handler extracts gigId from engagement_id or notification.id prefix and opens gig detail directly; fallback navigates to recruiting gigs list. Integration test mocks notifications API with a stale recruiting gig notification and validates the Notifications panel click flow through to gig detail page.

Build Asset Updates

Layer / File(s) Summary
Asset versioning
apps/api/src/five08/backend/static/dashboard/.vite/manifest.json, apps/api/src/five08/backend/static/dashboard/index.html
Vite manifest and HTML index updated to reference new versioned JavaScript bundle.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • 508-dev/508-workflows#252: Implementation adds Discord slash command and thread-renaming helpers to update engagement status and synchronize visible status tags back to Discord posts, matching the request for command-driven lifecycle updates and Discord post tag synchronization.

Possibly related PRs

  • 508-dev/508-workflows#288: Both PRs modify apps/admin_dashboard/src/main.tsx to route to gig detail pages; the retrieved PR establishes gig-detail routing infrastructure, while this PR updates the stale-recruiting notification handler to compute and navigate to specific gig IDs.
  • 508-dev/508-workflows#285: Both PRs modify stale recruiting notification navigation logic in apps/admin_dashboard/src/main.tsx to route users to the correct gig view or filter based on notification-derived engagement IDs.

Poem

🐰 A gig's status now flows swift through Discord threads,
From slash commands to dashboard breadcrumbs red,
With threads renamed in markers bold and true,
And notifications routing gigs anew.
Permissions guard, tests stand tall—a feature through!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a Discord slash command for updating gig status, which is the primary feature across modified files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch michaelmwu/update-job-status

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
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a Discord slash command to update a gig’s dashboard engagement status and synchronize the visible status marker in the corresponding Discord forum thread title, while also improving stale recruiting notifications in the admin dashboard.

Changes:

  • Add /update-gig-status to update a gig’s engagement status (with permission checks) and rename the Discord thread title marker.
  • Update stale recruiting reminder copy and improve stale recruiting notifications to deep-link directly to the gig detail view.
  • Extend unit/integration tests to cover the new permission logic, thread renaming behavior, and notification click-through.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/unit/test_jobs.py Adds unit coverage for gig status update permissions and thread title marker renaming.
tests/integration/test_dashboard_playwright.py Updates dashboard integration test to validate stale recruiting notification navigation to gig detail.
apps/discord_bot/src/five08/discord_bot/cogs/jobs.py Implements /update-gig-status, helper methods for authorization and thread renaming, and updates recruiting reminder text.
apps/api/src/five08/backend/static/dashboard/index.html Updates bundled dashboard asset reference.
apps/api/src/five08/backend/static/dashboard/.vite/manifest.json Updates Vite manifest entry to match new bundle output.
apps/admin_dashboard/src/main.tsx Changes stale recruiting notification click handling to open gig detail directly when possible.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/discord_bot/src/five08/discord_bot/cogs/jobs.py Outdated
Comment thread apps/discord_bot/src/five08/discord_bot/cogs/jobs.py
Copy link
Copy Markdown

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

🧹 Nitpick comments (1)
apps/discord_bot/src/five08/discord_bot/cogs/jobs.py (1)

3552-3554: 💤 Low value

Potential None dereference when checking poster permissions.

At line 3553, post.starter is accessed within the _interaction_user_can_update_gig_thread call, but post is only checked for None later at line 3573. If _read_thread_post returns None, this will raise an AttributeError.

The code does handle post being None in the ternary (post.starter if post else None), so poster_id will be None in that case. The permission check then proceeds, allowing Steering Committee+ to pass even with a None poster_id, which may be intentional. However, if post is None and the user is not Steering Committee+, they'll be rejected with a "forbidden" error before seeing the more specific "Could not read the original gig post" message at line 3585.

Consider reordering to check post availability before authorization so users get a clearer error message.

Suggested reorder
+        post = await self._read_thread_post(thread)
+        if post is None:
+            self._audit_command_safe(
+                interaction=interaction,
+                action="crm.update_gig_status",
+                result="error",
+                metadata={
+                    "stage": "starter_message_unavailable",
+                    "status": normalized_status.value,
+                    "guild_id": str(guild.id),
+                    "thread_id": str(thread.id),
+                },
+            )
+            await interaction.response.send_message(
+                "❌ Could not read the original gig post for this thread.",
+                ephemeral=True,
+            )
+            return
+
-        post = await self._read_thread_post(thread)
         poster_id = self._thread_poster_id(thread, post.starter if post else None)
+        poster_id = self._thread_poster_id(thread, post.starter)
         if not self._interaction_user_can_update_gig_thread(interaction, poster_id):
             ...
-
-        if post is None:
-            ...
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/discord_bot/src/five08/discord_bot/cogs/jobs.py` around lines 3552 -
3554, The code calls _read_thread_post and then immediately runs
_interaction_user_can_update_gig_thread using post.starter (via poster_id),
which can lead to a confusing forbidden error if post is None; reorder the logic
so you first await _read_thread_post and if the returned post is None
raise/return the "Could not read the original gig post" error before performing
permission checks; update the poster_id calculation to use
_thread_poster_id(thread, post.starter) only after confirming post is not None
and then call _interaction_user_can_update_gig_thread(interaction, poster_id) to
decide authorization.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/discord_bot/src/five08/discord_bot/cogs/jobs.py`:
- Around line 3552-3554: The code calls _read_thread_post and then immediately
runs _interaction_user_can_update_gig_thread using post.starter (via poster_id),
which can lead to a confusing forbidden error if post is None; reorder the logic
so you first await _read_thread_post and if the returned post is None
raise/return the "Could not read the original gig post" error before performing
permission checks; update the poster_id calculation to use
_thread_poster_id(thread, post.starter) only after confirming post is not None
and then call _interaction_user_can_update_gig_thread(interaction, poster_id) to
decide authorization.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 12785d58-9908-4b1d-b9c1-587f69c61e7d

📥 Commits

Reviewing files that changed from the base of the PR and between e7f288a and 91aff75.

📒 Files selected for processing (7)
  • apps/admin_dashboard/src/main.tsx
  • apps/api/src/five08/backend/static/dashboard/.vite/manifest.json
  • apps/api/src/five08/backend/static/dashboard/assets/index-DAy1pv-J.js
  • apps/api/src/five08/backend/static/dashboard/index.html
  • apps/discord_bot/src/five08/discord_bot/cogs/jobs.py
  • tests/integration/test_dashboard_playwright.py
  • tests/unit/test_jobs.py

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 91aff75bf2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/discord_bot/src/five08/discord_bot/cogs/jobs.py
@michaelmwu michaelmwu force-pushed the michaelmwu/update-job-status branch from ea35d47 to 06468a1 Compare May 23, 2026 12:59
@michaelmwu michaelmwu merged commit 0a10676 into main May 23, 2026
7 checks passed
@michaelmwu michaelmwu deleted the michaelmwu/update-job-status branch May 23, 2026 13:03
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 06468a1757

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +2365 to +2367
if thread.archived:
await thread.edit(archived=False, reason=reason)
await thread.edit(name=next_name, reason=reason)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve archive state when renaming gig threads

When /update-gig-status runs on an archived forum thread, _rename_gig_thread_for_status always unarchives it before renaming and never restores the previous archived state. This means a status-only edit permanently reopens old threads (and can also leave them reopened even if the later rename call fails), which changes channel behavior beyond the requested status update.

Useful? React with 👍 / 👎.

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