Skip to content

tern: crons block renders with native Tern UI - #334

Merged
yourconscience merged 1 commit into
mainfrom
feat/tern-native-crons
Nov 27, 2026
Merged

yourconscience merged 1 commit into
mainfrom
feat/tern-native-crons

Conversation

@yourconscience

@yourconscience yourconscience commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

The crons block was hand-rolled text: colored ● glyphs, manual " " spacing, uppercase section headings, and ui.badge pills repurposed as buttons. It now uses Tern's native components:

  • ui.stats tiles for the per-host health summary, tinted by the worst health
  • ui.section groups for "Needs attention" and each host
  • ui.table job rows: status-dot TextCell, schedule and last-run columns, and ButtonCell Run now / Pause / Resume
  • ui.button for Collect and Web instead of clickable badges
  • ui.progress while collecting (unchanged)

Behavior is unchanged: same tackroom cron collect and run/pause/resume verbs, same 60s poll.

Checked: plugin loads clean (tern plugin reload → ready), and the tackroom cron collect JSON 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:

  • Align idle-job health styling with the muted native UI tone.

Enhancements:

  • Modernize the crons block with native Tern stats, sections, tables, buttons, and status-aware controls while preserving existing cron actions and refresh behavior.

Documentation:

  • Update the crons block documentation to describe the native stats and table-based layout.

@sourcery-ai

sourcery-ai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Compute per-host health totals and render them as native stat tiles, while building job rows, columns, and sections from the same view data.

  • tern/plugins/tackroom-crons/host.luau L269-381

Render the header with native buttons and replace host summaries and job lists with stat tiles, sections, and tables.

  • tern/plugins/tackroom-crons/host.luau L388-395, L422-425, L435-438

Dispatch native button actions by action name and table-row item key to preserve collect, web, run, pause, and resume behavior.

  • tern/plugins/tackroom-crons/host.luau L520-528

Use the muted native tone for idle health and dock-view helper text.

  • tern/plugins/tackroom-crons/host.luau L16, L454, L466

Documentation

Update the feature overview to describe the host stat tiles, attention section, and per-host job tables.

  • tern/plugins/tackroom-crons/RECIPE.md L19-22

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Nov 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2d6feff9-c118-4d4e-822a-aa10ab7cfc65
Commits

Reviewing files that changed from the base of the PR and between 0d8f591 and 0e59c19.

Files selected for processing: 2

  • tern/plugins/tackroom-crons/RECIPE.md
  • tern/plugins/tackroom-crons/host.luau
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

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

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


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment on lines +278 to +279
if counts[k] ~= nil then
counts[k] = counts[k] + 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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`.

@yourconscience
yourconscience merged commit 3a56c7d into main Nov 27, 2026
11 checks passed
@yourconscience
yourconscience deleted the feat/tern-native-crons branch November 27, 2026 09:13
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