Skip to content

refactor: single owners for frame markup, toast responses, durations, and state derivation - #3

Merged
cmer merged 4 commits into
mainfrom
chore/code-quality-review
Jul 28, 2026
Merged

refactor: single owners for frame markup, toast responses, durations, and state derivation#3
cmer merged 4 commits into
mainfrom
chore/code-quality-review

Conversation

@cmer

@cmer cmer commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Summary

Behavior-preserving code-quality pass over the whole engine, from a deep maintainability review:

  • One owner for polling frames and toast responses. New fd_refresh_frame helper owns the refresh <turbo-frame> markup that was hand-written in every index view, and a single shared refresh.turbo_stream.erb renders every mutating action's toast + frame replacement from a { id:, url:, partial:, locals: } descriptor — deleting the four near-identical per-controller stream templates (which had already drifted) and all ten inlined poll-interval expressions. Jobs::ActionsController now goes through the Toasts concern instead of its own parallel success/failure/respond_with machinery, so the toast shape and level→flash mapping exist in exactly one place.
  • One duration formatter. Flightdeck::Duration.humanize replaces the three subtly-different ms/s/m/h case ladders in fd_duration, Overview, and the completion chart's axis; overview tiles now carry display-ready values, removing the tile.value.is_a?(Numeric) type-switch from the view.
  • One home for core derivations. JobRow.state_for owns the finished_at → annotation → :unknown rule previously duplicated in JobsQuery and JobDetail; PAYLOAD_COLUMNS unifies the two spellings of "every column except the payloads" in JobsQuery.
  • Dead code removed: the unused verb subclass contract, fd_jobs_url, Assets.reload!, ProcessRegistry.all/#flattened, QueueStats.all, RecurringCatalog.all.

Net −119 lines of app code. No user-visible changes, so no CHANGELOG entry.

Testing

  • bin/test (asset freshness + fast suite in both host modes): 262 runs × 2, 0 failures
  • bundle exec rake test:system (headless Chrome): 9 runs, 0 failures
  • bundle exec rubocop: 86 files, no offenses
  • bundle exec rake assets:build && rake assets:check: rebuilt, byte-identical digests

🤖 Generated with Claude Code

cmer and others added 4 commits July 28, 2026 10:21
JobRow.state_for is now the single owner of the finished_at ->
annotation -> :unknown rule that JobsQuery and JobDetail each spelled
out themselves, and PAYLOAD_COLUMNS replaces the two spellings of
"every column except the multi-kilobyte payloads" in JobsQuery.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
fd_duration, Overview's tiles and the completion chart's axis each had
their own ms/s/m/h case ladder with subtly different rounding.
Flightdeck::Duration.humanize is now the one way a number of seconds is
written; overview tiles carry display-ready values, so the view no
longer switches on the value's type.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The refresh <turbo-frame> markup was hand-written in every index view
and again in four near-identical turbo_stream templates, and the
per-frame poll-interval expression was inlined ten times; the copies
had already drifted. fd_refresh_frame now owns the frame markup, and
one shared refresh.turbo_stream.erb template renders every mutating
action's response from a { id:, url:, partial:, locals: } descriptor,
replacing the four per-controller templates.

Jobs::ActionsController now speaks through the Toasts concern instead
of its own parallel success/failure/respond_with machinery, so the
toast shape and the level -> flash mapping exist in exactly one place.
The unused verb contract method goes with it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Deletes methods nothing calls: fd_jobs_url, Assets.reload!,
ProcessRegistry.all / #flattened, QueueStats.all and
RecurringCatalog.all (tests now build the catalog directly).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@cmer
cmer merged commit 5fb7681 into main Jul 28, 2026
9 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