Skip to content

features: viewing/cancelling jobs from the projectdetail page, improving "view" on the popup toasts - #201

Merged
giannatan merged 4 commits into
mainfrom
gianna/ui-fixes
Aug 12, 2026
Merged

features: viewing/cancelling jobs from the projectdetail page, improving "view" on the popup toasts#201
giannatan merged 4 commits into
mainfrom
gianna/ui-fixes

Conversation

@giannatan

@giannatan giannatan commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

refs: #195, #196

  • leaving the processing page during a run and going to the project detail page resulted in the "begin" button being greyed out with text that a processing run was in progress, but with no way to view the progress or cancel the job
  • pressing view on the job succeeded/error toasts brought the user back to the projectdetail page, which wasn't very informative in the latter case; hopefully added a fix that will open the respective/corresponding tabs or logs depending on the toast content

Summary by CodeRabbit

  • New Features
    • Added active-job status tracking and polling for projects.
    • Added project active-job details, including job type and status.
    • Enabled resuming active, failed, or cancelled jobs from project views.
    • Added navigation to relevant result tabs after successful processing.
    • Added deep links to project tabs and sub-tabs.
    • Added job cancellation, progress navigation, and reconnectable processing logs.
  • Bug Fixes
    • Prevented duplicate active-job entries.
    • Highlighted processing errors in the log panel for easier identification.

…m the projectdetail page, in the event the user leaves the page -> this also persists upon page reload
ex. "view" predict_job succeeded -> opens generated files tab on projectdetail page
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@giannatan, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 31 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

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

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ab649ff1-03d6-4b98-9e8a-20b9fb8b3a03

📥 Commits

Reviewing files that changed from the base of the PR and between 7ffe3a4 and 14a26c6.

📒 Files selected for processing (6)
  • landing-page/scripts/job_store.py
  • landing-page/scripts/projects_api.py
  • landing-page/src/App.tsx
  • landing-page/src/components/AppRouter.tsx
  • landing-page/src/components/project/ProjectDetail.tsx
  • landing-page/src/hooks/useProjectActiveJob.ts
📝 Walkthrough

Walkthrough

Changes

Active job flow

Layer / File(s) Summary
Active-job API contract
landing-page/scripts/job_store.py, landing-page/scripts/projects_api.py
The job store now returns job status. The authenticated active-job endpoint returns the job ID, kind, and status, or null.
Client active-job state
landing-page/src/types.ts, landing-page/src/hooks/useProjectActiveJob.ts, landing-page/src/lib/activeJobs.ts
The frontend adds active-job polling, initial-tab types, and duplicate-registration protection.
Job resumption and result routing
landing-page/src/App.tsx, landing-page/src/components/AppRouter.tsx, landing-page/src/components/workflow/ProcessingPage.tsx
The app routes completed jobs to result tabs and reconnects resumed jobs to processing streams. Processing logs can open initially and show errors in red.
Project active-job controls
landing-page/src/components/project/ProjectDetail.tsx
Project details consume initial navigation state, display job-specific status, support progress navigation, and cancel active jobs.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant App
  participant AppRouter
  participant ProjectDetail
  participant ProcessingPage
  App->>AppRouter: pass resumeJob and pendingProjectTab
  ProjectDetail->>AppRouter: request active-job view
  AppRouter->>ProcessingPage: reconnect with job ID and kind
  ProcessingPage-->>AppRouter: report completion or back navigation
  AppRouter->>App: clear resumed-job state
Loading

Possibly related issues

  • DDMAL/mothra#195 — The change adds viewing and cancellation of in-progress jobs from the project page.

Suggested reviewers: yueqiao12zhang, kyrieb-ekat

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes viewing and cancelling jobs from the project detail page and improving toast notification navigation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gianna/ui-fixes

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.

@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 posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
landing-page/scripts/job_store.py (1)

121-149: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Align the active-job documentation with the returned shapes.

get_active_job_for_project returns status, but its docstring omits it. claim_project_job returns active without status, so its “same shape” claim is incorrect. The current 409 handlers read only job_id and kind. Update both docstrings to state the actual shapes.

🤖 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 `@landing-page/scripts/job_store.py` around lines 121 - 149, Update the
docstrings for get_active_job_for_project and claim_project_job to document
their actual return shapes: get_active_job_for_project returns job_id, kind, and
status, while claim_project_job returns active without status. Remove or revise
any claim that both results have the same shape, without changing the 409
handlers or runtime behavior.
🧹 Nitpick comments (2)
landing-page/scripts/projects_api.py (1)

238-239: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Rename the unused con binding to satisfy Ruff.

Ruff reports RUF059 for line 238. Only cur is used.

♻️ Proposed fix
-    with db_cursor() as (con, cur):
+    with db_cursor() as (_con, cur):
         require_project_owner(cur, project_id, user["id"])
🤖 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 `@landing-page/scripts/projects_api.py` around lines 238 - 239, Rename the
unused con binding in the db_cursor() context manager unpacking to the
convention for intentionally ignored values, while retaining cur for
require_project_owner().

Source: Linters/SAST tools

landing-page/src/hooks/useProjectActiveJob.ts (1)

47-51: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Polling stops when a new job starts in this tab while job is null.

The effect at line 47 only starts an interval when job is already set. The comment documents the cross-tab tradeoff. There is a same-tab case too: ProjectDetail stays mounted, the user starts a job from another route, returns to the project page without a remount, and this hook keeps job === null. The in-memory registry covers that path, so the impact is limited to the missing status label.

Consider exposing refetchActiveJob calls on registry changes, or accept the gap and record it in the comment.

🤖 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 `@landing-page/src/hooks/useProjectActiveJob.ts` around lines 47 - 51, The
polling effect in useProjectActiveJob currently stops when job is null, so
same-tab registry updates do not refresh the status label. Update the hook to
trigger refetchActiveJob when the in-memory active-job registry changes,
including the null-job state, while preserving the existing polling behavior and
cleanup.
🤖 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.

Inline comments:
In `@landing-page/src/App.tsx`:
- Around line 134-148: The project step update currently runs concurrently with
the refetch and can be overwritten by a stale GET response. In the project
refresh flow around apiFetch and updateProjectSteps, chain the update after the
refetch applies, and enforce the minimum using normalized.stepsUnlocked so the
server value is preserved.

In `@landing-page/src/components/AppRouter.tsx`:
- Around line 490-501: Update the onResult handler in AppRouter to branch on the
effective job kind, using resumeJob?.kind when resuming and the existing
kickoff-derived kind otherwise, rather than directly checking batchRunIds.
Ensure resumed text_batch jobs use batch-result handling and resumed predict
jobs use annotation handling, regardless of stale or missing batchRunIds.
- Around line 359-362: Update the ProcessingPage element rendered by AppRouter
to use a React key derived from resumeJob.jobId, ensuring a changed resumed job
forces a remount and restarts its stream. Apply this to the shared
processing-view render path so both onViewActiveJob and the App.tsx toast
handler are covered.

In `@landing-page/src/components/project/ProjectDetail.tsx`:
- Around line 993-999: Update the status text in the ProjectDetail component to
select the article dynamically based on jobKindLabel(activeJobForProject.kind),
using “a” for consonant-starting labels and “an” for vowel-starting labels.
Preserve the existing queued/running status wording and job label rendering.
- Around line 192-205: Update handleCancelActiveJob to validate the apiFetch
cancellation response before calling markJobSettled, preserving the local job
and prompt when the server returns a non-success status. Add cancelError state
handling for failed responses and network rejections, clear it on a new attempt,
and render cancelError next to the status text while retaining the existing
cancellingJob cleanup.

In `@landing-page/src/hooks/useProjectActiveJob.ts`:
- Around line 24-27: The active-job response uses snake_case while
ProjectActiveJob consumers expect camelCase. In
landing-page/src/hooks/useProjectActiveJob.ts lines 24-27, explicitly map job_id
to jobId while preserving kind and status; then verify no direct changes are
needed in ProjectDetail.tsx lines 175-188, 192-205, and 1001-1009, since the
mapping should restore job matching, produce a valid cancel URL, and provide
kind for the progress flow.

---

Outside diff comments:
In `@landing-page/scripts/job_store.py`:
- Around line 121-149: Update the docstrings for get_active_job_for_project and
claim_project_job to document their actual return shapes:
get_active_job_for_project returns job_id, kind, and status, while
claim_project_job returns active without status. Remove or revise any claim that
both results have the same shape, without changing the 409 handlers or runtime
behavior.

---

Nitpick comments:
In `@landing-page/scripts/projects_api.py`:
- Around line 238-239: Rename the unused con binding in the db_cursor() context
manager unpacking to the convention for intentionally ignored values, while
retaining cur for require_project_owner().

In `@landing-page/src/hooks/useProjectActiveJob.ts`:
- Around line 47-51: The polling effect in useProjectActiveJob currently stops
when job is null, so same-tab registry updates do not refresh the status label.
Update the hook to trigger refetchActiveJob when the in-memory active-job
registry changes, including the null-job state, while preserving the existing
polling behavior and cleanup.
🪄 Autofix

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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 410f6e18-c38e-4895-84c7-c043a0922c3c

📥 Commits

Reviewing files that changed from the base of the PR and between 45f24b1 and 7ffe3a4.

📒 Files selected for processing (9)
  • landing-page/scripts/job_store.py
  • landing-page/scripts/projects_api.py
  • landing-page/src/App.tsx
  • landing-page/src/components/AppRouter.tsx
  • landing-page/src/components/project/ProjectDetail.tsx
  • landing-page/src/components/workflow/ProcessingPage.tsx
  • landing-page/src/hooks/useProjectActiveJob.ts
  • landing-page/src/lib/activeJobs.ts
  • landing-page/src/types.ts

Comment thread landing-page/src/App.tsx Outdated
Comment thread landing-page/src/components/AppRouter.tsx
Comment thread landing-page/src/components/AppRouter.tsx
Comment thread landing-page/src/components/project/ProjectDetail.tsx
Comment thread landing-page/src/components/project/ProjectDetail.tsx
Comment thread landing-page/src/hooks/useProjectActiveJob.ts Outdated
@giannatan
giannatan merged commit 52919eb into main Aug 12, 2026
3 checks passed
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.

1 participant