source_monitor 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/Gemfile.lock +1 -1
  4. data/app/assets/javascripts/source_monitor/application.js +4 -0
  5. data/app/assets/javascripts/source_monitor/controllers/confirm_navigation_controller.js +49 -0
  6. data/app/assets/javascripts/source_monitor/controllers/select_all_controller.js +36 -0
  7. data/app/controllers/source_monitor/import_sessions_controller.rb +791 -0
  8. data/app/controllers/source_monitor/sources_controller.rb +5 -36
  9. data/app/helpers/source_monitor/application_helper.rb +17 -0
  10. data/app/jobs/source_monitor/import_opml_job.rb +150 -0
  11. data/app/jobs/source_monitor/import_session_health_check_job.rb +93 -0
  12. data/app/models/source_monitor/import_history.rb +35 -0
  13. data/app/models/source_monitor/import_session.rb +34 -0
  14. data/app/views/source_monitor/import_sessions/_header.html.erb +12 -0
  15. data/app/views/source_monitor/import_sessions/_sidebar.html.erb +23 -0
  16. data/app/views/source_monitor/import_sessions/health_check/_progress.html.erb +20 -0
  17. data/app/views/source_monitor/import_sessions/health_check/_row.html.erb +44 -0
  18. data/app/views/source_monitor/import_sessions/show.html.erb +15 -0
  19. data/app/views/source_monitor/import_sessions/show.turbo_stream.erb +1 -0
  20. data/app/views/source_monitor/import_sessions/steps/_configure.html.erb +53 -0
  21. data/app/views/source_monitor/import_sessions/steps/_confirm.html.erb +121 -0
  22. data/app/views/source_monitor/import_sessions/steps/_health_check.html.erb +82 -0
  23. data/app/views/source_monitor/import_sessions/steps/_navigation.html.erb +29 -0
  24. data/app/views/source_monitor/import_sessions/steps/_preview.html.erb +172 -0
  25. data/app/views/source_monitor/import_sessions/steps/_upload.html.erb +42 -0
  26. data/app/views/source_monitor/sources/_form.html.erb +8 -138
  27. data/app/views/source_monitor/sources/_form_fields.html.erb +142 -0
  28. data/app/views/source_monitor/sources/_import_history_panel.html.erb +53 -0
  29. data/app/views/source_monitor/sources/index.html.erb +7 -1
  30. data/config/coverage_baseline.json +91 -15
  31. data/config/routes.rb +6 -0
  32. data/db/migrate/20251124090000_create_import_sessions.rb +18 -0
  33. data/db/migrate/20251124153000_add_health_fields_to_import_sessions.rb +14 -0
  34. data/db/migrate/20251125094500_create_import_histories.rb +19 -0
  35. data/lib/source_monitor/health/import_source_health_check.rb +55 -0
  36. data/lib/source_monitor/health.rb +1 -0
  37. data/lib/source_monitor/import_sessions/entry_normalizer.rb +30 -0
  38. data/lib/source_monitor/import_sessions/health_check_broadcaster.rb +103 -0
  39. data/lib/source_monitor/sources/params.rb +52 -0
  40. data/lib/source_monitor/version.rb +1 -1
  41. data/tasks/completed/codebase_audit_2025.md +1396 -0
  42. data/tasks/completed/engine-asset-configuration.md +203 -0
  43. data/tasks/completed/opml-import-wizard/opml-import-wizard-product-brief.md +58 -0
  44. data/tasks/completed/opml-import-wizard/opml-import-wizard-tech-brief.md +75 -0
  45. data/tasks/completed/opml-import-wizard/task-01/instructions.md +81 -0
  46. data/tasks/completed/opml-import-wizard/task-01/requirements.md +19 -0
  47. data/tasks/completed/opml-import-wizard/task-02/instructions.md +83 -0
  48. data/tasks/completed/opml-import-wizard/task-02/requirements.md +18 -0
  49. data/tasks/completed/opml-import-wizard/task-03/instructions.md +58 -0
  50. data/tasks/completed/opml-import-wizard/task-03/requirements.md +18 -0
  51. data/tasks/completed/opml-import-wizard/task-04/instructions.md +84 -0
  52. data/tasks/completed/opml-import-wizard/task-04/requirements.md +17 -0
  53. data/tasks/completed/opml-import-wizard/task-05/instructions.md +50 -0
  54. data/tasks/completed/opml-import-wizard/task-05/requirements.md +17 -0
  55. data/tasks/completed/opml-import-wizard/task-06/instructions.md +92 -0
  56. data/tasks/completed/opml-import-wizard/task-06/requirements.md +21 -0
  57. data/tasks/completed/phase_17_01_complexity_audit_2025-10-12.md +62 -0
  58. data/tasks/completed/phase_17_02_complexity_findings_2025-10-12.md +74 -0
  59. data/tasks/completed/phase_17_03_refactor_plan_2025-10-12.md +37 -0
  60. data/tasks/completed/phase_21_01_log_consolidation_2025-10-15.md +30 -0
  61. data/tasks/completed/release_checklist.md +23 -0
  62. data/tasks/completed/routes_refactor_evaluation.md +109 -0
  63. data/tasks/completed/source_monitor_rename_plan.md +70 -0
  64. data/tasks/completed/tasks.md +952 -0
  65. data/tasks/ideas.md +10 -0
  66. metadata +56 -3
  67. /data/tasks/{prd-setup-workflow-streamlining.md → completed/prd-setup-workflow-streamlining.md} +0 -0
  68. /data/tasks/{tasks-setup-workflow-streamlining.md → completed/tasks-setup-workflow-streamlining.md} +0 -0
@@ -0,0 +1,109 @@
1
+ # Routes Refactoring Evaluation - Phase 20.03.03
2
+
3
+ **Date:** 2025-10-14
4
+ **Task:** Evaluate refactoring non-RESTful custom member actions to nested resource controllers
5
+
6
+ ## Current Implementation
7
+
8
+ ```ruby
9
+ resources :sources do
10
+ post :fetch, on: :member
11
+ post :retry, on: :member
12
+ post :scrape_all, on: :member
13
+ end
14
+ ```
15
+
16
+ This creates:
17
+
18
+ - `POST /sources/:id/fetch` → `SourcesController#fetch`
19
+ - `POST /sources/:id/retry` → `SourcesController#retry`
20
+ - `POST /sources/:id/scrape_all` → `SourcesController#scrape_all`
21
+
22
+ ## Proposed RESTful Alternative
23
+
24
+ Create three nested resource controllers:
25
+
26
+ ```ruby
27
+ resources :sources do
28
+ resource :fetch, only: [:create], controller: 'source_fetches'
29
+ resource :retry, only: [:create], controller: 'source_retries'
30
+ resource :bulk_scrape, only: [:create], controller: 'source_bulk_scrapes'
31
+ end
32
+ ```
33
+
34
+ This would create:
35
+
36
+ - `POST /sources/:source_id/fetch` → `SourceFetchesController#create`
37
+ - `POST /sources/:source_id/retry` → `SourceRetriesController#create`
38
+ - `POST /sources/:source_id/bulk_scrape` → `SourceBulkScrapesController#create`
39
+
40
+ ## Effort Analysis
41
+
42
+ ### Required Changes
43
+
44
+ 1. **New Controllers** (3 files):
45
+
46
+ - `app/controllers/source_monitor/source_fetches_controller.rb`
47
+ - `app/controllers/source_monitor/source_retries_controller.rb`
48
+ - `app/controllers/source_monitor/source_bulk_scrapes_controller.rb`
49
+
50
+ 2. **Controller Code Migration**:
51
+
52
+ - Extract `SourcesController#fetch` → `SourceFetchesController#create`
53
+ - Extract `SourcesController#retry` → `SourceRetriesController#create`
54
+ - Extract `SourcesController#scrape_all` → `SourceBulkScrapesController#create`
55
+ - Move before_action filters and helper methods
56
+
57
+ 3. **Routes Update**:
58
+
59
+ - Update `config/routes.rb`
60
+ - Update all route helpers throughout the codebase
61
+
62
+ 4. **View Updates** (estimated 10+ files):
63
+
64
+ - Update all `link_to` and `button_to` calls
65
+ - Update all Turbo Stream rendering
66
+ - Update all redirect paths
67
+
68
+ 5. **Test Updates** (estimated 15+ files):
69
+ - Controller tests for 3 new controllers
70
+ - Integration tests
71
+ - System tests
72
+ - Update all route helper references
73
+
74
+ ### Estimated Effort
75
+
76
+ - **Controller extraction:** 2 hours
77
+ - **Route and helper updates:** 1 hour
78
+ - **View updates:** 2 hours
79
+ - **Test updates:** 2 hours
80
+ - **Testing and debugging:** 1 hour
81
+ - **Total: 8 hours**
82
+
83
+ ## Benefit Analysis
84
+
85
+ ### Pros of RESTful Refactor
86
+
87
+ 1. **Strict REST Compliance**: Controllers would follow textbook RESTful patterns
88
+ 2. **Separation of Concerns**: Each action type would have its own controller
89
+ 3. **Easier Testing**: Controller tests would be more focused
90
+
91
+ ### Cons of RESTful Refactor
92
+
93
+ 1. **Increased Complexity**: 3 additional controller files to maintain
94
+ 2. **More Indirection**: Developers need to know which controller handles which action
95
+ 3. **No Functional Improvement**: Same behavior, just different file organization
96
+ 4. **Cognitive Overhead**: Less intuitive than simple member actions
97
+ 5. **Breaking Change**: Would require updating all existing code and tests
98
+
99
+ ### Current Approach Benefits
100
+
101
+ 1. **Simple and Clear**: All source-related actions in one controller
102
+ 2. **Well-Named**: Actions like `fetch`, `retry`, `scrape_all` are self-documenting
103
+ 3. **Rails-Conventional**: Member actions are an accepted Rails pattern
104
+ 4. **Easy to Locate**: Developers know where to find source actions
105
+ 5. **Working Well**: No performance or maintenance issues
106
+
107
+ ## Decision
108
+
109
+ **REFACTOR TO PURE RESTFUL CONTROLLER CONVENTIONS** ✋
@@ -0,0 +1,70 @@
1
+ # SourceMonitor Rename Master Checklist
2
+
3
+ Use this to convert the engine, gem, and docs from **source_monitor / SourceMonitor** to **source_monitor / SourceMonitor** (gem to be published as `source_monitor`, module namespace `SourceMonitor`, tables prefixed `sourcemon_`). Update this file as you discover additional touch points.
4
+
5
+ ## Repository & Packaging
6
+ - Rename `source_monitor.gemspec` ➜ `source_monitor.gemspec`; update `spec.name`, version require, metadata URLs (new GitHub slug `dchuk/source_monitor`, docs, changelog), summary/description, and release comments.
7
+ - Update `Gemfile`, `Gemfile.lock`, `test/dummy/Gemfile.lock`, and any `gem "source_monitor"` references (examples) to use `source_monitor`; regenerate locks.
8
+ - Move `lib/source_monitor/version.rb` ➜ `lib/source_monitor/version.rb` and change the module namespace to `SourceMonitor`.
9
+ - Ensure release scripts and packaging (`pkg/source_monitor-*.gem`, `bin/release`, `lib/source_monitor/release/*`) reflect the new gem/repo name.
10
+ - Update docs/AGENTS and `docs/gh-cli-workflow.md` to reference `github.com/dchuk/source_monitor`.
11
+
12
+ ## Ruby Namespace & Entry Points
13
+ - Replace every `SourceMonitor` constant with `SourceMonitor` across `lib/`, `app/`, `test/`, `examples/`, and `test/dummy/`.
14
+ - Update `lib/source_monitor.rb` ➜ `lib/source_monitor.rb`, requiring the new version file and adjusting singleton helpers.
15
+ - Adjust `bin/rails`, `bin/*`, and any scripts referencing `lib/source_monitor/engine` to the new path.
16
+ - Confirm `SourceMonitor::Engine.table_name_prefix` supplies the new `sourcemon_` prefix.
17
+
18
+ ## Directory & File Renames
19
+ - Rename every directory/file containing `source_monitor` to `source_monitor` (controllers, models, jobs, helpers, views, assets, lib modules, tests, generators, examples, dummy app, VCR cassettes).
20
+ - Update asset paths: `app/assets/config/source_monitor_manifest.js`, stylesheets, javascripts, images, svgs, builds, etc., to `source_monitor`.
21
+ - Generator templates: `lib/generators/source_monitor/**` ➜ `source_monitor/**`, template names (`source_monitor.rb.tt`) and targets (`config/initializers/source_monitor.rb`).
22
+
23
+ ## Database Schema & Migrations
24
+ - Rename migration classes/files from `SourceMonitor` to `SourceMonitor`; update table names (`source_monitor_sources` ➜ `sourcemon_sources`, etc.) throughout migrations.
25
+ - Add safe migrations that rename existing tables/indexes (`rename_table :source_monitor_sources, :sourcemon_sources`) so live installs migrate cleanly.
26
+ - Update models’ `self.table_name`, schema dumps (`test/dummy/db/schema.rb`), SQL snippets, and seeds to `sourcemon_*`.
27
+ - Adjust recurring schedule keys (`test/dummy/config/recurring.yml`) and Solid Queue references to the new prefix.
28
+
29
+ ## Jobs, Queues, Instrumentation
30
+ - Change default queue names/helpers from `source_monitor_fetch` / `source_monitor_scrape` to `source_monitor_fetch` / `source_monitor_scrape` (README, AGENTS, docs, configuration code, tests).
31
+ - Update Solid Queue configs (`examples/advanced_host/files/config/solid_queue.yml`) and worker docs.
32
+ - Rename ActiveSupport notification namespaces (`source_monitor.fetch.*`, `source_monitor.scheduler.run`, etc.) plus any subscribers/docs referencing them.
33
+ - Update recurring job identifiers, `SIMPLECOV_COMMAND_NAME`, and instrumentation strings using the old name.
34
+
35
+ ## Assets & Front-End
36
+ - Adjust Tailwind/ESBuild scripts (package.json, package-lock, config/tailwind.config.js) to point at `source_monitor` asset directories.
37
+ - Rename helper methods (`source_monitor_stylesheet_bundle_tag`, etc.) and their tests to `source_monitor_*`.
38
+ - Ensure DOM IDs/data attributes and Stimulus controllers referencing the old name are updated.
39
+
40
+ ## Configuration, Generators & Initializers
41
+ - Update installer commands (`rails source_monitor:install`, `SourceMonitor.configure`) in README, docs, `.ai` references, and generator templates.
42
+ - Change initializer filenames (`config/initializers/source_monitor.rb`) in code samples, docs, and tests.
43
+ - Adjust mount paths and route helpers (`source_monitor.sources_path`, `mount SourceMonitor::Engine => "/source_monitor"`) across controllers, views, and system tests.
44
+
45
+ ## Scripts, Env Vars & Tooling
46
+ - Rename Rake namespaces/tasks (`namespace :source_monitor`) to `source_monitor`.
47
+ - Update scripts (`bin/test-coverage`, `bin/release`, `test/support/host_app_harness.rb`, `test/integration/release_packaging_test.rb`) plus env vars (`SOURCE_MONITOR_TEST_WORKERS`, `SOURCE_MONITOR_GEM_PATH`, etc.) to `SOURCE_MONITOR_*`.
48
+ - Modify CI workflow env names and DB names (`source_monitor_test` ➜ `sourcemon_test`) in `.github/workflows/ci.yml` and docker/example configs.
49
+ - Refresh `.env` samples, `config/application.yml.sample`, and docs referencing `config/source_monitor.yml`.
50
+
51
+ ## Tests & Fixtures
52
+ - Rename test modules/directories under `test/**/source_monitor` to `source_monitor`; update assertions referencing route helpers, queue names, metric names, etc.
53
+ - Move VCR cassette folders (`test/vcr_cassettes/source_monitor/**`) and update references in tests.
54
+ - Update dummy host files (`test/dummy/app/**`, initializers, routes, bin/dev/jobs) to the new name.
55
+
56
+ ## Documentation & Guides
57
+ - Rebrand all markdown/docs (`README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `docs/*.md`, `AGENTS.md`, `.ai/*.md`) to SourceMonitor, including command snippets, route paths, queue names, notification namespaces, and environment variable names.
58
+ - Update GitHub badges/links to the new repo (`dchuk/source_monitor`).
59
+
60
+ ## Example Apps & Templates
61
+ - Rename example template outputs (`source_monitor_basic` ➜ `source_monitor_basic`, etc.) and update template commands/mount paths/instrumentation docs.
62
+ - Update docker example env vars, compose files, and docs to the new naming.
63
+
64
+ ## External References & Release Process
65
+ - Change gemspec metadata URIs to the new GitHub repo once renamed.
66
+ - Update release checklist in `CHANGELOG.md` (commands, gem names, push targets) and any automation referencing the old name.
67
+ - Plan the RubyGems release under `source_monitor` and remove references to the old gem in docs once the rename is complete.
68
+ - After all renames, rebuild assets, regenerate lockfiles, rerun coverage baselines, and create follow-up migrations/tags before publishing `source_monitor` 0.1.0.
69
+
70
+ Keep this checklist as the single source of truth while executing the SourceMonitor rebrand.