refactor: single owners for frame markup, toast responses, durations, and state derivation - #3
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Behavior-preserving code-quality pass over the whole engine, from a deep maintainability review:
fd_refresh_framehelper owns the refresh<turbo-frame>markup that was hand-written in every index view, and a single sharedrefresh.turbo_stream.erbrenders 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::ActionsControllernow goes through theToastsconcern instead of its own parallelsuccess/failure/respond_withmachinery, so the toast shape and level→flash mapping exist in exactly one place.Flightdeck::Duration.humanizereplaces the three subtly-different ms/s/m/h case ladders infd_duration,Overview, and the completion chart's axis; overview tiles now carry display-ready values, removing thetile.value.is_a?(Numeric)type-switch from the view.JobRow.state_forowns thefinished_at→ annotation →:unknownrule previously duplicated inJobsQueryandJobDetail;PAYLOAD_COLUMNSunifies the two spellings of "every column except the payloads" inJobsQuery.verbsubclass 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 failuresbundle exec rake test:system(headless Chrome): 9 runs, 0 failuresbundle exec rubocop: 86 files, no offensesbundle exec rake assets:build && rake assets:check: rebuilt, byte-identical digests🤖 Generated with Claude Code