Repository navigation
tern: crons block renders with native Tern UI - #334
Conversation
Reviewer's GuideImplementationCompute per-host health totals and render them as native stat tiles, while building job rows, columns, and sections from the same view data.
Render the header with native buttons and replace host summaries and job lists with stat tiles, sections, and tables.
Dispatch native button actions by action name and table-row item key to preserve collect, web, run, pause, and resume behavior.
Use the muted native tone for idle health and dock-view helper text.
DocumentationUpdate the feature overview to describe the host stat tiles, attention section, and per-host job tables.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 48 minutes. View limit details
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. |
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tern/plugins/tackroom-crons/host.luau" line_range="278-279" />
<code_context>
+ for _, j in data.jobs do
+ if j.host == h then
+ local k = j.health or "ok"
+ if counts[k] ~= nil then
+ counts[k] = counts[k] + 1
end
end
</code_context>
<issue_to_address>
**Host totals omit unknown health states**
When a job has a health value not listed in `ORDER`, `health_counts` ignores that job, and `host_stats` sums only the recognized counts, so the host tile undercounts jobs and can show zero for a host that has jobs.
Count jobs with unrecognized health values in the host total.
Also at `tern/plugins/tackroom-crons/host.luau:311`.
</issue_to_address>
### Comment 2
<location path="tern/plugins/tackroom-crons/host.luau" line_range="528" />
<code_context>
+ elseif name == "run" or name == "pause" or name == "resume" then
+ local job = job_by_key(state, ev.item)
+ if job then
+ act(state, job, name)
end
end
</code_context>
<issue_to_address>
**Completed actions leave stale rows**
When an in-flight collect has captured its snapshot before a Run, Pause, or Resume action finishes, the action callback's `collect` call returns because `state.loading` is already true; the earlier scan then installs its pre-action snapshot, leaving the UI stale until the next poll.
Queue a refresh when an action finishes during collection, and run it as soon as the active collect completes.
Also at `tern/plugins/tackroom-crons/host.luau:352-355`.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 2 findings to address first, and the table now routes Run, Pause, and Resume through the row item ID instead of the job key embedded in the action. If that ID is mismatched, a click could run or pause the wrong launchd job; reverting would restore the old routing but would not undo any effects of a job that already ran.
Blocking findings: tern/plugins/tackroom-crons/host.luau:279, tern/plugins/tackroom-crons/host.luau:528
| if counts[k] ~= nil then | ||
| counts[k] = counts[k] + 1 |
There was a problem hiding this comment.
🟡 Medium · Host totals omit unknown health states
When a job has a health value not listed in ORDER, health_counts ignores that job, and host_stats sums only the recognized counts, so the host tile undercounts jobs and can show zero for a host that has jobs.
Count jobs with unrecognized health values in the host total.
Also at tern/plugins/tackroom-crons/host.luau:311.
Prompt for AI agents
In `tern/plugins/tackroom-crons/host.luau` at lines 278-279:
**Host totals omit unknown health states**
When a job has a health value not listed in `ORDER`, `health_counts` ignores that job, and `host_stats` sums only the recognized counts, so the host tile undercounts jobs and can show zero for a host that has jobs.
Count jobs with unrecognized health values in the host total.
Also at `tern/plugins/tackroom-crons/host.luau:311`.| elseif name == "run" or name == "pause" or name == "resume" then | ||
| local job = job_by_key(state, ev.item) | ||
| if job then | ||
| act(state, job, name) |
There was a problem hiding this comment.
🟡 Medium · Completed actions leave stale rows
When an in-flight collect has captured its snapshot before a Run, Pause, or Resume action finishes, the action callback's collect call returns because state.loading is already true; the earlier scan then installs its pre-action snapshot, leaving the UI stale until the next poll.
Queue a refresh when an action finishes during collection, and run it as soon as the active collect completes.
Also at tern/plugins/tackroom-crons/host.luau:352-355.
Prompt for AI agents
In `tern/plugins/tackroom-crons/host.luau` at line 528:
**Completed actions leave stale rows**
When an in-flight collect has captured its snapshot before a Run, Pause, or Resume action finishes, the action callback's `collect` call returns because `state.loading` is already true; the earlier scan then installs its pre-action snapshot, leaving the UI stale until the next poll.
Queue a refresh when an action finishes during collection, and run it as soon as the active collect completes.
Also at `tern/plugins/tackroom-crons/host.luau:352-355`.
The crons block was hand-rolled text: colored
●glyphs, manual" "spacing, uppercase section headings, andui.badgepills repurposed as buttons. It now uses Tern's native components:ui.statstiles for the per-host health summary, tinted by the worst healthui.sectiongroups for "Needs attention" and each hostui.tablejob rows: status-dotTextCell, schedule and last-run columns, andButtonCellRun now / Pause / Resumeui.buttonfor Collect and Web instead of clickable badgesui.progresswhile collecting (unchanged)Behavior is unchanged: same
tackroom cron collectand run/pause/resume verbs, same 60s poll.Checked: plugin loads clean (
tern plugin reload→ ready), and thetackroom cron collectJSON matches the fields the view reads. Rendered pixels not visually verified — worth a look in Tern on this Mac before merge.Summary by Sourcery
Render the crons block using Tern’s native UI components while preserving its existing behavior.
Bug Fixes:
Enhancements:
Documentation: