Skip to content

feat: use relative frame filenames#214

Merged
hpouillot merged 6 commits into
mainfrom
hp/relative-frame-filenames
Jul 3, 2026
Merged

feat: use relative frame filenames#214
hpouillot merged 6 commits into
mainfrom
hp/relative-frame-filenames

Conversation

@hpouillot

@hpouillot hpouillot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Use project-relative stack frame filename values while keeping the raw path in abs_path. Cymbal uses filename as the source path for Ruby raw frames, so this keeps fingerprints stable across deploy directories without dropping the original absolute path.

Stacked on #213.
Fixes: #212

💚 How did you test it?

Not run successfully locally. bundle exec rspec spec/posthog/exception_capture_spec.rb spec/posthog/client_spec.rb spec/posthog/rails/exception_mechanism_spec.rb failed because the rspec executable is not installed in the local bundle.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm changeset to generate a changeset file

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Implemented with Pi. This follow-up PR keeps the path-stabilization changes separate from the exception-chain work and aligns Ruby raw frame payloads with Cymbal's filename/abs_path expectations.

@hpouillot hpouillot requested a review from a team as a code owner July 2, 2026 19:00
@hpouillot hpouillot self-assigned this Jul 2, 2026
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

posthog-ruby Compliance Report

Date: 2026-07-03 12:09:00 UTC
Duration: 98647ms

✅ All Tests Passed!

46/46 tests passed


Capture Tests

29/29 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields 110ms
Format Validation.Event Has Uuid 107ms
Format Validation.Event Has Lib Properties 110ms
Format Validation.Distinct Id Is String 106ms
Format Validation.Token Is Present 107ms
Format Validation.Custom Properties Preserved 107ms
Format Validation.Event Has Timestamp 107ms
Retry Behavior.Retries On 503 5407ms
Retry Behavior.Does Not Retry On 400 2110ms
Retry Behavior.Does Not Retry On 401 2110ms
Retry Behavior.Respects Retry After Header 8117ms
Retry Behavior.Implements Backoff 15716ms
Retry Behavior.Retries On 500 5212ms
Retry Behavior.Retries On 502 5212ms
Retry Behavior.Retries On 504 5212ms
Retry Behavior.Max Retries Respected 15621ms
Deduplication.Generates Unique Uuids 113ms
Deduplication.Preserves Uuid On Retry 5211ms
Deduplication.Preserves Uuid And Timestamp On Retry 10418ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 5215ms
Deduplication.No Duplicate Events In Batch 112ms
Deduplication.Different Events Have Different Uuids 108ms
Compression.Sends Gzip When Enabled 107ms
Batch Format.Uses Proper Batch Structure 107ms
Batch Format.Flush With No Events Sends Nothing 5ms
Batch Format.Multiple Events Batched Together 110ms
Error Handling.Does Not Retry On 403 2108ms
Error Handling.Does Not Retry On 413 2107ms
Error Handling.Retries On 408 5210ms

Feature_Flags Tests

17/17 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id 108ms
Request Payload.Flags Request Uses V2 Query Param 106ms
Request Payload.Flags Request Hits Flags Path Not Decide 107ms
Request Payload.Flags Request Omits Authorization Header 107ms
Request Payload.Token In Flags Body Matches Init 108ms
Request Payload.Groups Round Trip 107ms
Request Payload.Groups Default To Empty Object 108ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False 108ms
Request Payload.Disable Geoip Omitted Defaults To False 107ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key 107ms
Request Lifecycle.No Flags Request On Init Alone 3ms
Request Lifecycle.No Flags Request On Normal Capture 106ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests 110ms
Request Lifecycle.Mock Response Value Is Returned To Caller 106ms
Retry Behavior.Retries Flags On 502 210ms
Retry Behavior.Retries Flags On 504 210ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event 109ms

@greptile-apps

greptile-apps Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff (1)

  1. spec/posthog/exception_capture_spec.rb, line 10-20 (link)

    P2 First test relies on an implicit environmental assumption

    This test calls parse_backtrace_line without an explicit project_root:, so the method defaults to Dir.pwd. The assertion expect(frame['filename']).to eq('user.rb') holds only because Dir.pwd (the test runner's working directory) doesn't happen to equal /path/to/project. If tests were ever run from that exact directory, frame_filename would return 'app/models/user.rb' instead and the test would silently fail. Pass project_root: '/some/other/root' explicitly to make the assertion deterministic.

Reviews (1): Last reviewed commit: "feat: use relative frame filenames" | Re-trigger Greptile

Comment thread lib/posthog/exception_capture.rb
@hpouillot hpouillot force-pushed the hp/relative-frame-filenames branch from d78da7c to 3a109f6 Compare July 2, 2026 19:09
@hpouillot hpouillot requested review from a team, ablaszkiewicz and cat-ph July 2, 2026 19:24
Comment thread .changeset/eager-owls-chain.md Outdated
Base automatically changed from hp/exception-chain-capture to main July 3, 2026 12:01
@hpouillot hpouillot merged commit 14d85f7 into main Jul 3, 2026
19 checks passed
@hpouillot hpouillot deleted the hp/relative-frame-filenames branch July 3, 2026 12:09
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.

Error tracking: stack trace filename is reduced to File.basename, dropping the project-relative path

4 participants