Skip to content

Commit 8e8dbfb

Browse files
committed
feat: add AGENTS.md
1 parent d6cc8f1 commit 8e8dbfb

2 files changed

Lines changed: 107 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# AGENTS.md
2+
3+
## Overview
4+
5+
- `sentry/sentry` is the core PHP SDK, not an application or framework bundle.
6+
- Public entry points include the autoloaded global helpers in
7+
`src/functions.php` and the public classes and interfaces under `src/`.
8+
- Use this file for repo-specific constraints that are easy to miss, and
9+
explore the codebase for current implementation details.
10+
11+
## Compatibility Rules
12+
13+
- The minimum supported PHP version for shipped code is `7.2`.
14+
`composer.json` requires `^7.2|^8.0`, so shipped code must remain valid on
15+
PHP `7.2` unless support policy is intentionally being changed.
16+
- This SDK has a broad public API surface. Treat changes to global helpers,
17+
`Options`, `ClientBuilder`, `ClientInterface`, `HubInterface`,
18+
`TransportInterface`, `IntegrationInterface`, tracing/logs/metrics types, and
19+
Monolog handlers as BC-sensitive.
20+
- Preserve the existing cross-version compatibility style. This repo supports
21+
multiple `psr/log`, `symfony/options-resolver`, `guzzlehttp/psr7`, and
22+
`monolog/monolog` major versions.
23+
- Do not assume optional packages or binaries are available. Monolog is only a
24+
suggested dependency, and FrankenPHP/RoadRunner worker coverage depends on
25+
optional binaries and dev dependencies.
26+
- `Spotlight` is treated as an active send path alongside DSN-based delivery.
27+
Do not gate runtime setup or transport behavior on DSN alone.
28+
29+
## Editing Guidance
30+
31+
- Keep `declare(strict_types=1);` in PHP files.
32+
- Follow the existing formatting rules from `.php-cs-fixer.dist.php`.
33+
- If you add or change an SDK option, update the resolver/defaults in
34+
`Options`, the relevant getters and setters, the `init()` option array-shape
35+
docs in `src/functions.php`, and the affected tests.
36+
- `src/functions.php` is autoloaded and part of the public API. Keep helper
37+
signatures, phpdoc, and runtime behavior synchronized with the underlying
38+
client, hub, and runtime-context implementation. Functions in
39+
`src/functions.php` should use camelCase naming.
40+
- `IntegrationRegistry` intentionally calls `setupOnce()` only once per
41+
integration class during the process lifetime. Preserve de-duplication and
42+
default-integration gating when changing integration setup behavior.
43+
- `ErrorHandler` has fragile register-once, previous-handler chaining, reserved
44+
memory, and out-of-memory behavior. Preserve that lifecycle carefully and add
45+
PHPT coverage when changing fatal or silenced error handling.
46+
- `SentrySdk::startContext()`, `endContext()`, and `withContext()` must keep
47+
runtime-context isolation and best-effort flushing intact for logs, metrics,
48+
and transport in long-running worker scenarios.
49+
- `HttpTransport` and `PayloadSerializer` are tightly coupled. Preserve the
50+
envelope item selection, Spotlight delivery path, dynamic sampling context,
51+
and the transaction/profile relationship when changing transport or
52+
serialization behavior.
53+
- Monolog support spans multiple Monolog major versions through the
54+
compatibility traits and handlers under `src/Monolog/`. Preserve that
55+
compatibility style when changing logging integrations.
56+
- `Client::SDK_VERSION` is updated by the release action via
57+
`scripts/bump-version.sh`. Do not modify it manually as part of normal
58+
development changes.
59+
60+
## Test Expectations
61+
62+
- Add tests with every behavior change. This is a library repo with broad
63+
compatibility and regression coverage.
64+
- New tests belong under `tests/`.
65+
- `phpunit.xml.dist` defines a `unit` suite that includes both PHPUnit tests
66+
and `tests/phpt`, plus a separate `oom` suite for `tests/phpt-oom`.
67+
- Prefer targeted PHPUnit runs while iterating.
68+
- After editing files, run the relevant formatting, lint, and test commands for
69+
the code you changed.
70+
- Before handing back substantive code changes, run `composer check` when
71+
feasible and call out anything you could not run.
72+
- If you change error handling, fatal error capture, or PHP-version-specific
73+
behavior, add or update PHPT coverage.
74+
- If you change runtime-context or worker-mode behavior, add or update focused
75+
coverage for the FrankenPHP or RoadRunner paths as appropriate.
76+
77+
## Tools And Commands
78+
79+
- `phpstan.neon` only analyzes `src`, uses `phpstan-baseline.neon`, and will
80+
not catch behavior regressions in `tests/` or PHPT coverage.
81+
- `phpunit.xml.dist` is strict about unexpected output, so noisy debug output
82+
will fail tests.
83+
- This repo is a library, so do not expect a runnable application entrypoint.
84+
85+
## Docs And Release Notes
86+
87+
- `README.md` and `CHANGELOG.md` are updated manually during releases, so do
88+
not modify them as part of normal development changes.
89+
- If a change may require updates in the separate documentation repo, ask the
90+
user whether to review `../sentry-docs` if that sibling checkout exists. If
91+
it does not exist, ask the user for the local docs path first. If they opt
92+
in, update that repo's `master` branch when safe, use git worktrees to
93+
inspect the relevant docs, and suggest any needed changes to avoid stale
94+
documentation.
95+
- If a change affects installation, configuration, error handling, tracing,
96+
profiling, metrics, logs, or worker-mode behavior, call out the likely
97+
README or release-note follow-up in your summary instead of editing those
98+
files automatically.
99+
100+
## CI Notes
101+
102+
- `.github/workflows/ci.yml` runs the PHPUnit compatibility matrix across
103+
Ubuntu and Windows, lowest and highest dependencies, and separate runtime
104+
jobs for FrankenPHP and RoadRunner.
105+
- `.github/workflows/static-analysis.yaml` runs PHP-CS-Fixer, PHPStan, and
106+
Psalm on single recent PHP versions rather than across the full test matrix.

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

0 commit comments

Comments
 (0)