Skip to content

Temporarily disable legacy checker flow + add Sentry observability#213

Merged
JuanVqz merged 7 commits intomainfrom
fix/disable-releases-api
May 6, 2026
Merged

Temporarily disable legacy checker flow + add Sentry observability#213
JuanVqz merged 7 commits intomainfrom
fix/disable-releases-api

Conversation

@JuanVqz
Copy link
Copy Markdown
Member

@JuanVqz JuanVqz commented May 4, 2026

Summary

Temporarily disable the legacy GH-Actions checker flow at the API edge so we can isolate whether the new lockfile flow is the source of the production memory leak. Adds Sentry tracking on every disabled endpoint and on the remaining legacy gem pages so we can identify any caller.

Background

PRs #199, #200, #203 and railsbump/checker#40 reduced the leak meaningfully but did not close it. Heroku metrics for the most recent weekend show AVG 873 MB / MAX 1335 MB on web.1 against a 1024 MB quota, with R14 errors firing repeatedly.

On Apr 30 we measured a clean +14 MB step on web.1 RSS for each POST /lockfiles upload that did not reclaim, while quiet windows of pure crawler traffic stayed flat. That points the next investigation at the new lockfile flow.

To make that investigation clean, this PR removes the legacy flow as a confound. The legacy chain runs through:

  • POST /api/releasesRailsReleases::Create.perform_async / Gemmies::Process.perform_async
  • POST /api/github_notificationsGithubNotification.create! + GithubNotifications::Process.perform_async
  • POST /api/results → tail of the GH Actions check pipeline
  • The Heroku Scheduler entry running bin/rails runner "Compats::CheckUnchecked.call" every 10 min (must be disabled separately in the Heroku UI; no CLI for that)

After this PR plus the scheduler removal, the only flow producing checker work is Lockfile#run_check! on POST /lockfiles.

Manual steps required after merge

# 1. Remove the Heroku Scheduler entry (no CLI for this addon)
heroku addons:open scheduler -a railsbump-production
# Delete the row "bin/rails runner Compats::CheckUnchecked.call"
# Leave the "bin/rails runner Maintenance::Hourly.call" row alone — it's
# orthogonal (sitemap regen, email notifications, cleanup). One nuisance:
# its check_pending_compats helper will start reporting "compats pending
# for a long time" since CheckUnchecked is off. If those alerts get noisy,
# comment that private method out in app/services/maintenance/hourly.rb.

# 2. Disable the GH Actions checker workflows in railsbump/checker
gh workflow disable check_bundler.yml -R railsbump/checker
gh workflow disable rails_release_sanity_check.yml -R railsbump/checker
# Belt-and-suspenders: prevents accidental dispatches even if the
# scheduler entry is restored or someone calls BundlerGithubCheck directly.
# Re-enable later with `gh workflow enable <file> -R railsbump/checker`.

What this PR is not

Not a fix. The leak measurement points at the lockfile flow; this PR only removes the legacy flow as a possible confound and gives us observability on what is still calling those endpoints. The leak hunt continues in a follow-up PR (planned: per-request memory delta middleware to attribute RSS retention to a specific path).

Test plan

  • Deploy to staging, hit each disabled endpoint, confirm 503 + Sentry event arrives.
  • Open Sentry → Performance, confirm transactions appear at ~5% sample.
  • Remove the Heroku Scheduler entry.
  • Watch Sentry inbox for temporarily_disabled messages over 24h to identify callers.
  • Watch web.1 RSS curve for slope change vs. last week.

Related

JuanVqz added 7 commits May 4, 2026 13:18
Returns 503 with a temporarily_disabled JSON body while we investigate
the web dyno memory leak. Captures every hit via Sentry.capture_message
with caller IP, user-agent, referer, and the small name/version params
so we can identify what is hitting this endpoint after the Heroku
Scheduler entry for Compats::CheckUnchecked is removed.

Wraps the existing controller spec with xdescribe and a comment so the
suite stays green; re-enable after restoring endpoint behavior.
Returns 503 with a temporarily_disabled JSON body. Sentry capture
extracts only action, conclusion, branch (small fields) plus IP,
user-agent, referer; intentionally does NOT capture the raw request
body to avoid the same logging-allocation pattern that contributed to
the lockfile-content RSS jumps measured on Apr 30.

Wraps the controller spec with xdescribe so the suite stays green.
Tail end of the legacy GH-Actions checker flow. Once the Heroku
Scheduler entry for Compats::CheckUnchecked is removed and no new
workflows are dispatched, this endpoint should see zero traffic.
Sentry capture lets us confirm that and identify any unexpected
caller. Returns 503.

Wraps the controller spec with xdescribe so the suite stays green.
Removes the 'Check a gem' nav link and homepage entry point when the
new lockfile-based flow is enabled, leaving only the lockfile
submission path visible. The backend routes still exist; they are
covered by the legacy-page Sentry tracking added separately.
Sentry.capture_message is called from the four remaining legacy entry
points so we can identify who is still hitting them after the UI is
hidden:

- POST /gems (gemmies#create)            full sample
- GET  /gems/compat_table                 full sample (low expected volume after homepage stops calling it)
- GET  /gems/:id (gemmies#show)           1% sample (heavy crawler traffic)
- GET  /gems/:gemmy_id/compatibility/:id  1% sample (heavy crawler traffic)

Sampled paths use rand < 0.01 to stay within Sentry free-tier event
quota; the captured payload includes IP, user-agent, referer and the
small path parameters.
traces_sample_rate=0.05 turns on per-transaction performance traces in
the Sentry UI; profiles_sample_rate=0.05 adds allocation flame graphs
on the same sampled requests. Together they give us per-endpoint
latency and allocation hot spots without manual instrumentation, while
staying well under the free-tier event quota at the app's current
traffic level.
The previous commit dropped before_action :authenticate_api_key! when
swapping the controller body for the temporarily_disabled response.
Restoring it so only authorized callers reach the Sentry capture path
and bots/scanners get a clean 401 without burning Sentry quota.
sanitize_result_params! is intentionally left out: we never read the
result body anymore, so there is nothing to sanitize.
config.release = Rails.configuration.revision
config.send_default_pii = true
config.traces_sample_rate = 0.05
config.profiles_sample_rate = 0.05
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

traces_sample_rate=0.05 turns on per-transaction performance traces in
the Sentry UI; profiles_sample_rate=0.05 adds allocation flame graphs
on the same sampled requests. Together they give us per-endpoint
latency and allocation hot spots without manual instrumentation, while
staying well under the free-tier event quota at the app's current
traffic level.

@JuanVqz JuanVqz requested a review from a team May 4, 2026 19:27
@JuanVqz JuanVqz marked this pull request as ready for review May 4, 2026 19:27
@JuanVqz JuanVqz merged commit 27872d2 into main May 6, 2026
2 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