Repository navigation
fix(exceptions): match project root on directory boundaries for in_app - #1277
Conversation
SDK performance: posthog-pythonBenchmarks completed. No changes flagged for review. Flags require at least a 5% change in the median and all six pairs agreeing on direction. This is a noise filter, not proof of a performance change or a CI gate. View all results
Values are medians of paired measurements. Not flagged does not mean unchanged. Unavailable means a measurement could not be provided, not zero. Estimated allocation measurements retain their instrumentation uncertainty. RSS measures the whole process, not just SDK allocations; observed peaks are sampled checkpoints. Paired ranges in the diagnostics describe variability, not confidence intervals. Each shard uses its own runner; compare Before PR against With PR within a row, not across shards. Compared 102 metric rows; 102 rows shown in all results. Omitted or shortened data remain in |
turnipdabeets
left a comment
There was a problem hiding this comment.
Thanks @MaiAditya !
💡 Motivation and Context
_is_in_project_rootused a barestartswith(project_root). The default root isos.getcwd()without a trailing separator, so with root/work/app, frames in/work/app-shared/lib.pyor/work/application/x.pywere markedin_app=True.A path now counts as inside the root only if it equals the root or starts with the root plus
os.sep. A root with a trailing separator still works.💚 How did you test it?
test_exception_utils.pyfor sibling-prefix dirs (not in app), real subpaths and a trailing-slash root (in app). Two cases fail onmain; all 40 tests in the file pass.Posthog(..., project_root="<tmp>/app", sync_mode=True)against a local HTTP server, raising from<tmp>/app-shared/shared_lib.py. The captured$exceptionframe hadin_app: trueonmainand noin_appwith this change./still matches every absolute path; frame paths come fromos.path.abspath, soos.sepis right on Windows.ruff format --checkclean.📝 Checklist
If releasing new changes
.sampo/changesets/in-app-project-root-boundary.md, written in thesampo addformat)🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Claude Code was used to find the case and draft the fix and tests. The author reviewed the change and ran the tests and the end-to-end check. Considered
os.path.commonpath, but kept a string check since frame paths are already normalized and this runs per frame.