Skip to content

feat(data_drip): add self-documenting backfills + catalog - #21

Open
jmjurado23 wants to merge 6 commits into
mainfrom
feat/add_description
Open

feat(data_drip): add self-documenting backfills + catalog#21
jmjurado23 wants to merge 6 commits into
mainfrom
feat/add_description

Conversation

@jmjurado23

@jmjurado23 jmjurado23 commented Jun 5, 2026

Copy link
Copy Markdown

🚪 Why?

Problem

DataDrip's web UI only listed past backfill runs — there was no way to see which backfills (datadrips) exist, no place to document what each one does, and no guidance for operators on how to fill in a backfill's options before running it. On apps with many backfills, understanding any of them meant reading the source.

🔑 What?

Changes

  • Add an optional one-line description, shown in the catalog so anyone can tell what a datadrip does at a glance.
  • Add optional instructions written in Markdown, declared with the same DSL idiom as description (instructions <<~MARKDOWN ... MARKDOWN; a plain def self.instructions override also works): rendered as formatted rich text in the New Backfill Run form the moment a backfill is selected, so operators see what it does and how to fill in the options before running. Rendered by a tiny dependency-free Markdown renderer (headings, bold, inline code, bullet lists, fenced code blocks).
  • Add a Backfills Catalog at /data_drip/backfills listing every datadrip with its description and the configurable fields (options) it accepts.
  • Make the catalog searchable by name, description, or field name (e.g. find every backfill that accepts company_ids).
  • Paginate the catalog (10 per page); search filters across every page.
  • Derive the configurable-fields column from each backfill's declared options, so it renders even on host apps still running an older DataDrip.
  • Add Runs ↔ Catalog navigation and document the description/instructions DSLs, the :enum attribute type, and the catalog page in the README.
Screenshot 2026-08-03 at 14 58 48 Screenshot 2026-08-03 at 14 22 50

✅ Verification

Tests

  • Specs cover the description / custom_fields / instructions DSLs (spec/lib/data_drip/backfill_spec.rb), instructions returned by the options endpoint (spec/controllers/data_drip/backfill_runs_controller_spec.rb), the catalog controller (spec/controllers/data_drip/backfills_controller_spec.rb), and the helper's optional-description / legacy-class fallbacks (spec/helpers/data_drip/backfills_helper_spec.rb).
  • Existing tests pass: yes — full suite 128 examples, 0 failures; RuboCop clean on touched files.

Manual Verification

  • Catalog: confirmed the rendered HTML (sidebar, description column, configurable-field chips, the 20% / 60% / 20% layout, and the "Configurable fields" header) and exercised the client-side search + pagination (page navigation, search collapsing results to a single page, the empty state, and reset to page 1 on clear).

🏷️ Skill tags

skill:backend

🤖 Generated with Claude Code

@jmjurado23 jmjurado23 changed the title Add datadrip descriptions and a searchable, paginated backfills catalog feat(data_drip): add descriptions + backfills catalog Jun 5, 2026
@jmjurado23 jmjurado23 changed the title feat(data_drip): add descriptions + backfills catalog feat(data_drip): add self-documenting backfills + catalog Jun 11, 2026
@jmjurado23
jmjurado23 marked this pull request as ready for review June 11, 2026 15:10

@manfredmmm manfredmmm 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.

LGTM!

… UI)

Re-implements the feature from PR #21 on top of the restyled main, using the
current design system and conventions instead of the pre-restyle UI.

- Add `description` and `instructions` DSL to DataDrip::Backfill, mirroring
  DataDrip::Script.description. `description` is a one-line catalog summary;
  `instructions` is Markdown guidance shown in the New Backfill Run form.
- Add a searchable, paginated Backfills Catalog at /data_drip/backfills,
  reachable from a new "Catalog" pill in the shared header. Server-side search
  (autosubmit) and the shared pagination partial replace the PR's client-side JS.
- Render `instructions` server-side via a tiny, dependency-free Markdown
  renderer (headings, bold, inline code, bullet lists, fenced code blocks) with
  Tailwind classes, reusing the existing backfill-options fetch — dropping the
  PR's markdown.js and backfill_form_controller.js.
- Generalize Paginatable to page an in-memory array (the catalog list).
- Document the DSLs + catalog in the README, seed the example backfills, and add
  the description/instructions hints to the generator template.
- Recompile the shipped tailwind.css for the new classes.

Specs: full suite green (312 examples). Restyle of #21.

Co-Authored-By: Miguel Larrañaga <miguel.larranaga@factorial.co>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jmjurado23
jmjurado23 force-pushed the feat/add_description branch from 4f6c1f9 to fd6ce23 Compare August 3, 2026 08:47
jmjurado23 and others added 5 commits August 3, 2026 11:41
javascript_importmap_tags resolves every pinned module through asset_path when
it builds the import map, so a host on a strict Sprockets pipeline
(check_precompiled_asset) raised "asset ... was not declared to be precompiled"
for data_drip/controllers/*.js. The engine put its JS on config.assets.paths
but never declared it for precompilation.

Register data_drip/**/*.js (JS only — the compiled CSS is served outside the
pipeline by DataDrip::AssetsController) on config.assets.precompile, guarded to
a real Array so Propshaft hosts are unaffected. Add regression coverage.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sprockets-rails resolves config.assets.precompile through
Sprockets::Manifest#find, which calls start_with? on each entry — a Regexp
entry raises NoMethodError ("undefined method `start_with?' for an instance of
Regexp") on a strict Sprockets host. Enumerate the engine's JS files and
register their explicit logical-path strings instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The class-name column dominated under the default auto table layout because
the fully-qualified backfill class names are long. Switch to table-fixed with
explicit widths (class 1/4, description 1/2, fields 1/4) and wrap long class
names, so the description column is the widest. Recompile tailwind.css.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
In development, Zeitwerk reloading leaves stale class copies in
DataDrip::Backfill.descendants (DataDrip.all), so the catalog listed the same
backfill several times — and stale copies show "No description". Resolve each
name to its current constant and dedupe. The class picker already dedupes by
name, so only the catalog was affected. Production (eager load) is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ription

The previous dedup resolved each name to its current constant, but under
Zeitwerk reloading the live copy can lose its `description` while a stale copy
keeps it — so the catalog showed "No description" for backfills that have one.
Group the (possibly duplicated) copies by name and pick one that still carries
a description. Production (eager load, no reload) is unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

3 participants