-
Notifications
You must be signed in to change notification settings - Fork 0
docs(#243): add API pattern replication guidance to AGENTS.md #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,10 @@ All git forge operations (GitHub API calls, PR comments, issue creation, workflo | |
|
|
||
| **When reviewing PRs:** Flag any direct `exec.Command("gh", ...)`, raw GitHub API calls, or other forge-specific operations outside `internal/forge/github/` as a medium-severity or higher finding. This is an architectural violation, not a style preference. | ||
|
|
||
| ## API pattern replication | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [low] correctness The claim that several methods share the Git Trees API pattern is inaccurate. Only commitFilesTo (line 647) implements the full refs-commit-tree pattern. CommitFiles and CommitFilesToBranch are thin wrappers. The truncation check already covers all callers by design. Suggested fix: Reword to reflect the current architecture, e.g.: the Git Trees API pattern currently centralized in commitFilesTo — new methods using the same endpoint should replicate its truncation handling. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [low] style-consistency The new section lacks bold structural markers (e.g., When writing code:, When reviewing PRs:) that the adjacent Forge abstraction section uses for guidance categories. Suggested fix: Optional — consider adding a bold lead-in like When implementing a new method: for consistency with adjacent sections. |
||
|
|
||
| **When implementing a new method** that calls the same API endpoint or uses the same multi-step API pattern as an existing method in the file, read the existing implementation first. Replicate its error handling (e.g., truncation checks, 404-to-ErrNotFound mapping), retry logic (e.g., `retryOnTransient`), and response validation. The `internal/forge/github/github.go` file has the Git Trees API pattern (refs → commit → tree) currently centralized in `commitFilesTo` — new methods using the same endpoint should replicate its truncation handling. | ||
|
|
||
| ## Architecture Decision Records (ADRs) | ||
|
|
||
| These rules apply whenever you touch `docs/ADRs/` or review a PR that does. Full authoring guidance is in [`skills/writing-adrs/SKILL.md`](skills/writing-adrs/SKILL.md); invoke that skill when writing a new ADR. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[medium] correctness
retryOnRepoRace does not exist anywhere in the repository. Only retryOnTransient exists (internal/forge/github/github.go:561). Referencing a fabricated identifier in agent-facing guidance will cause confusion.
Suggested fix: Remove retryOnRepoRace from the example list. The parenthetical should read: retry logic (e.g., retryOnTransient).