Skip to content

docs: agree on public API changes before implementing them - #273

Open
turnipdabeets wants to merge 1 commit into
mainfrom
docs/public-api-changes
Open

docs: agree on public API changes before implementing them#273
turnipdabeets wants to merge 1 commit into
mainfrom
docs/public-api-changes

Conversation

@turnipdabeets

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Port of PostHog/posthog-js#4906 to posthog-ruby.

On contributor PRs we sometimes only settle the public API after several rounds of implementation review. By then the contributor, or their agent, has built each suggestion along the way, and a late change of direction wastes their work. This asks contributors to agree on the API shape on the issue first, and tells their agents to stop and ask.

  • CONTRIBUTING.md: new "Public API changes" section, same as posthog-js. Placed before "Rails package". The last paragraph refers back to the snapshot steps already in "CI-aligned checks" rather than repeating them.
  • AGENTS.md: new file, since this repo didn't have one. Same shape as the posthog-js one: it points agents to CONTRIBUTING.md, RELEASING.md, and the new section, and asks to keep shared guidance out of AGENTS.md.

💚 How did you test it?

Docs only. Checked that the commands and file paths it mentions exist in this repo.

📝 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)

  • Written with Claude Code, porting the posthog-js section and adapting the API-snapshot paragraph and beforeSend-style hook name to this SDK.

🤖 Generated with Claude Code

https://claude.ai/code/session_016syAmdpp8imNvs7PWkpwvb

@turnipdabeets turnipdabeets self-assigned this Sep 11, 2026
@github-actions

Copy link
Copy Markdown

posthog-ruby Compliance Report

Date: 2026-09-11 15:27:24 UTC
Duration: 98587ms

✅ All Tests Passed!

46/46 tests passed


Capture Tests

29/29 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields 109ms
Format Validation.Event Has Uuid 106ms
Format Validation.Event Has Lib Properties 109ms
Format Validation.Distinct Id Is String 106ms
Format Validation.Token Is Present 106ms
Format Validation.Custom Properties Preserved 107ms
Format Validation.Event Has Timestamp 107ms
Retry Behavior.Retries On 503 5413ms
Retry Behavior.Does Not Retry On 400 2108ms
Retry Behavior.Does Not Retry On 401 2109ms
Retry Behavior.Respects Retry After Header 8115ms
Retry Behavior.Implements Backoff 15622ms
Retry Behavior.Retries On 500 5212ms
Retry Behavior.Retries On 502 5211ms
Retry Behavior.Retries On 504 5213ms
Retry Behavior.Max Retries Respected 15722ms
Deduplication.Generates Unique Uuids 110ms
Deduplication.Preserves Uuid On Retry 5210ms
Deduplication.Preserves Uuid And Timestamp On Retry 10417ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 5214ms
Deduplication.No Duplicate Events In Batch 111ms
Deduplication.Different Events Have Different Uuids 108ms
Compression.Sends Gzip When Enabled 107ms
Batch Format.Uses Proper Batch Structure 105ms
Batch Format.Flush With No Events Sends Nothing 3ms
Batch Format.Multiple Events Batched Together 109ms
Error Handling.Does Not Retry On 403 2108ms
Error Handling.Does Not Retry On 413 2110ms
Error Handling.Retries On 408 5212ms

Feature_Flags Tests

17/17 tests passed

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

@turnipdabeets
turnipdabeets marked this pull request as ready for review September 11, 2026 17:17
@turnipdabeets
turnipdabeets requested a review from a team as a code owner September 11, 2026 17:17
@greptile-apps

greptile-apps Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
### Issue 1
CONTRIBUTING.md:52
**Public constants are omitted**

The approval requirement lists public options, methods, and types but omits public constants, even though the API snapshot explicitly tracks them. Contributors changing constants may therefore assume that prior agreement is unnecessary. Include public constants in this list.

```suggestion
- If you need something the SDK doesn't support and it would add or change a public option, method, type, or constant, open an issue describing your use case first. At this stage, context is more useful to us than code.
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "docs: agree on public API changes before..." | Re-trigger Greptile

Comment thread CONTRIBUTING.md

Public API is hard to change once it ships, so agree on it before writing the implementation. Our [SDK guidelines](https://posthog.com/handbook/engineering/sdks/guidelines) explain how we design it.

- If you need something the SDK doesn't support and it would add or change a public option, method, or type, open an issue describing your use case first. At this stage, context is more useful to us than code.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Public constants are omitted

The approval requirement lists public options, methods, and types but omits public constants, even though the API snapshot explicitly tracks them. Contributors changing constants may therefore assume that prior agreement is unnecessary. Include public constants in this list.

Suggested change
- If you need something the SDK doesn't support and it would add or change a public option, method, or type, open an issue describing your use case first. At this stage, context is more useful to us than code.
- If you need something the SDK doesn't support and it would add or change a public option, method, type, or constant, open an issue describing your use case first. At this stage, context is more useful to us than code.
Prompt To Fix With AI
This is a comment left during a code review.
Path: CONTRIBUTING.md
Line: 52

Comment:
**Public constants are omitted**

The approval requirement lists public options, methods, and types but omits public constants, even though the API snapshot explicitly tracks them. Contributors changing constants may therefore assume that prior agreement is unnecessary. Include public constants in this list.

```suggestion
- If you need something the SDK doesn't support and it would add or change a public option, method, type, or constant, open an issue describing your use case first. At this stage, context is more useful to us than code.
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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