Skip to content

refactor: structure cleanup, sets, and Zeitwerk-first specs - #1149

Merged
gildesmarais merged 5 commits into
mainfrom
refactor/structure-ruby4-modernization
Sep 16, 2026
Merged

gildesmarais merged 5 commits into
mainfrom
refactor/structure-ruby4-modernization

Conversation

@gildesmarais

Copy link
Copy Markdown
Member

What changed

  • Drop orphaned ASYNC_FEED_REFRESH_ flag prefix/docs and unused StylesheetEntry; target RuboCop at Ruby 4.0 with Style/ItBlockParameter.
  • Load Html2rss::Web::VERSION in Boot.setup!, document collapsed Zeitwerk dirs, and make ConfigSnapshot.deep_dup the single deep-dup owner (LocalConfig delegates).
  • Expose public Auth.extract_token for Health; replace hand-rolled XOR with OpenSSL.secure_compare on feed-token and health-token paths; simplify DirectoryParams.match?.
  • Convert hot membership allowlists to frozen Sets; O(1) cold-seed rank index; skip Marshal.dump for empty static cache params.
  • Boot the app once from spec/spec_helper.rb and strip per-spec require_relative chains.

Why

Approved structure / cruft / Ruby 4 modernization pass for html2rss-web: remove broken env-prefix validation, unify duplicated auth and cloning seams, and lean on CRuby 4 Set plus Zeitwerk instead of manual requires.

Risk

  • Low for behavior: auth compare stays constant-time with length guard; DirectoryParams semantics covered by existing specs.
  • Deploy note: empty-param static cache keys change from hashed [] to digest empty (one-time miss).
  • SUPPORTED_STRATEGIES is frozen at SourceResolver load time (fine for today’s static gem registry).
  • Spec suite now always boots the full app via Zeitwerk (boot-time cost; suite already green).

Review map

  1. app/web/security/auth.rb + app/web/api/v1/health.rb + app/web/security/feed_token.rb — shared Bearer extraction and OpenSSL.secure_compare.
  2. app/web/boot.rb + app/web/config/config_snapshot.rb + app/web/config/local_config.rb — VERSION load, deep_dup ownership, Zeitwerk require cleanup.
  3. app/web/feeds/source_resolver.rb + app/web/catalog/starters.rb + telemetry/sanitizer Set swaps — perf micro-changes.
  4. spec/spec_helper.rb — central app boot; rest of spec/ is require deletion only.
  5. .rubocop.yml + app/web/config/flags.rb + docs/README.md — Ruby 4 target and async-refresh cruft removal.

Validation

  • Dev Container: make ready → exit 0 (357 examples, 0 failures).
  • Assure (review.gil findings + security/perf/tests): readiness Yes; no Critical/Important findings.

Remove the orphaned ASYNC_FEED_REFRESH env prefix and unused StylesheetEntry,
and enable TargetRubyVersion 4.0 plus Style/ItBlockParameter.
Require config/version during Boot.setup!, document collapsed dirs, make
ConfigSnapshot.deep_dup the single owner, and drop redundant require_relatives.
Expose Auth.extract_token for Health, replace hand-rolled XOR with
OpenSSL.secure_compare, and avoid array subtraction in DirectoryParams.
Convert allowlists and path keys to Set lookups, memoize supported strategies,
and index cold-seed ranks for O(1) starter ranking.
Require app in spec_helper so specs rely on Zeitwerk instead of per-file
require_relative chains.
@gildesmarais gildesmarais changed the title refactor: structure cleanup, Ruby 4 Sets, and Zeitwerk-first specs refactor: structure cleanup, sets, and Zeitwerk-first specs Sep 16, 2026
@gildesmarais
gildesmarais marked this pull request as ready for review September 16, 2026 21:20
@gildesmarais
gildesmarais merged commit 3b93f25 into main Sep 16, 2026
21 of 24 checks passed
@gildesmarais
gildesmarais deleted the refactor/structure-ruby4-modernization branch September 16, 2026 21:20
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