Skip to content

Faultline Error Tracking#479

Merged
cycomachead merged 7 commits into
mainfrom
cycomachead/166-faultline-compatibility-check/1
Jul 4, 2026
Merged

Faultline Error Tracking#479
cycomachead merged 7 commits into
mainfrom
cycomachead/166-faultline-compatibility-check/1

Conversation

@cycomachead

Copy link
Copy Markdown
Contributor

General Info

Changes

Installs Faultline for self-hosted error tracking. This PR also includes the Rails 8.1 upgrade (merged from cycomachead/137-rails-8-upgrade-start/2), which conveniently satisfies Faultline's rails >= 8.0 gemspec constraint — eliminating the need for vendoring or a fork.

Faultline setup

  • Added gem 'faultline' pointing at the upstream git repo (no vendoring needed on 8.1)
  • Mounted the dashboard at /admin/errors
  • Gated access to admins only via config.authenticate_with — resolves the current user from session[:user_id] (matching ApplicationController#current_user) and requires admin?
  • Configured user_method: :current_user so request errors are automatically associated with the logged-in user
  • MCP and APM features left disabled by default

Migration overrides

Three of Faultline's generated migrations required patches to work cleanly with strong_migrations and PostgreSQL:

Migration Issue Fix
create_faultline_error_groups strong_migrations can't inspect raw execute for the tsvector generated column Wrapped in safety_assured
add_spans_to_faultline_request_traces strong_migrations flags :json column (prefers jsonb) Wrapped in safety_assured, keeping Faultline's schema
change_sanitized_message_to_text On a fresh install, sanitized_message is already :text and used by a generated column — Postgres refuses to alter it Guarded to no-op when column is already the target type

Rails 8.1 changes (from merged branch)

  • config.load_defaults bumped to 8.1
  • params.require(...).permit(...)params.expect(...) in several controllers
  • ApplicationMailer base class extracted; EmailService updated to use TemplatedMailer
  • public/400.html added (Rails 8.1 default)
  • Spec updates: have_http_status(:unprocessable_entity)have_http_status(:unprocessable_content), error message string updated for params.expect

New transitive gems

Testing

  • All 7 Faultline migrations apply cleanly against PostgreSQL with no strong_migrations errors
  • GET /admin/errors (unauthenticated or non-admin) returns 401 Unauthorized
  • Faultline.track(exception) creates error groups and occurrences visible on the dashboard
  • User identity is correctly captured per request via current_user
  • Existing specs updated to reflect Rails 8.1 behavior changes

Documentation

No external documentation required. The generated initializer at config/initializers/faultline.rb is extensively commented with configuration options for notifications, GitHub integration, APM, and callbacks.

Checklist

  • Name of branch corresponds to story

Superconductor Ticket Implementation | App Preview | Guided Review

cycomachead and others added 4 commits July 2, 2026 09:12
Mount faultline at /admin/errors, gated to admins via
User.find_by(canvas_uid: session[:user_id])&.admin?. Migrations carry
overrides for strong_migrations (safety_assured on the raw tsvector
execute and the json column) and guard the redundant
change_sanitized_message_to_text migration, which is a no-op on fresh
PostgreSQL installs and otherwise fails against the generated column.

Depends on Rails >= 8.0 (faultline gemspec constraint).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…start/2' into cycomachead/166-faultline-compatibility-check/1
Resolve faultline directly from git (upstream gemspec's rails >= 8.0 is
now satisfied by Rails 8.1) and regenerate schema.rb in the 8.1 format.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Vendor faultline gem to override Rails 8.0 gemspec constraint
- Mount dashboard at `/admin/errors` with admin-only access gate
- Configure automatic user identification via `current_user`
- Add and patch migrations to satisfy `strong_migrations` and PostgreSQL
- Disable MCP and APM features by default

This allows adopting self-hosted error tracking without requiring an
immediate upgrade to Rails 8.0.

Co-authored-by: Claude Code <noreply@anthropic.com>
@cycomachead cycomachead mentioned this pull request Jul 2, 2026
20 tasks
@cycomachead cycomachead changed the title Investigate Faultline installation compatibility without upgrading to 8.0 Faultline Error Tracking + Rails 8.1 Jul 2, 2026
cycomachead and others added 3 commits July 4, 2026 08:25
…line-compatibility-check/1

# Conflicts:
#	db/schema.rb
Enables `config.register_error_subscriber` to automatically capture
exceptions reported via the Rails 7.2+ error reporting API, including
background jobs and handled errors.

Co-authored-by: Claude Code <noreply@anthropic.com>
- Add Rails.error.report to rescue blocks across controllers and models to instrument Tier 1 audit results without vendor lock-in.
- Guard current_user in lograge initializer to prevent NoMethodError when accessing mounted engine controllers like Faultline.

Co-authored-by: Claude Code <noreply@anthropic.com>
@cycomachead cycomachead changed the title Faultline Error Tracking + Rails 8.1 Faultline Error Tracking Jul 4, 2026
@cycomachead

Copy link
Copy Markdown
Contributor Author

This is working on staging.

@cycomachead
cycomachead merged commit 7b17663 into main Jul 4, 2026
13 checks passed
@cycomachead
cycomachead deleted the cycomachead/166-faultline-compatibility-check/1 branch July 4, 2026 09:40
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