Skip to content

Commit c2c9bd5

Browse files
docs: carry generated-file ownership guidance to next (#4196)
Carry the reviewed generated-file ownership guidance from merged #4193 into `next`, so contributors follow the simplified generation model before its next regeneration. All four documents exactly match main commit `1b37b9a85e857a7ada4db661bf867bf680290ccf`. They replace the retired budget instructions with the rule to change generator inputs/compiler, regenerate owned files, and keep handwritten behavior in separate extensions. Ordinary review enforces ownership; no replacement checker is introduced. This is the handwritten-documentation prerequisite only. Generated tools, inventory, generation metadata, runtime, dependencies, workflows, and release behavior are unchanged; canonical next regeneration will remove the retired generated tools separately. Validation: basic review, exact byte comparison of all four documents against the merged main commit, four-file scope assertion, and `git diff --check` pass. No runtime tests were rerun for this documentation-only change. SDK CODEOWNER review and normal next CI are required.
1 parent 834b779 commit c2c9bd5

4 files changed

Lines changed: 46 additions & 47 deletions

File tree

‎AGENTS.md‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,21 @@ changing generated files. Handwritten policy, automation, tests, and examples
77
should remain small and should not alter exported SDK APIs unless the change
88
explicitly requires it.
99

10-
## Custom-code budget
11-
12-
Follow [the custom-code guidance](scripts/castiron/CUSTOM_CODE.md). Budget changes
13-
belong in a separate PR containing only `.castiron-ratchet.json`, with an explicit justification
14-
in the PR description. Increases require a **human approving review** before merging.
15-
Agents may investigate and draft proposals, but must not approve budget increases
16-
(including through a human's credentials) or bypass the gate. Do not weaken
17-
counting, broaden exclusions, or alter generation metadata to make a change pass.
18-
The checker and effective budget come from main, not the PR. Keep default CODEOWNERS.
10+
## Generated-file ownership
11+
12+
Never hand-edit generated SDK files, including generated tests, documentation,
13+
workflows, or the generated-file inventory. Change the authoritative API schema,
14+
configuration, or compiler, then regenerate. Put SDK-specific behavior in
15+
separately owned handwritten helpers and extension points.
16+
17+
Regeneration replaces generator-owned files and deletes retired generated paths.
18+
Handwritten edits to generated files are overwritten; they are never replayed or
19+
merged into new output. Preserve separately owned handwritten files and resolve
20+
ownership collisions explicitly. Follow this AGENTS.md rule and review generated output and inventory changes
21+
together. Generated-file ownership currently relies on contributor guidance and
22+
code review; there is no dedicated generated-file edit check or required gate.
23+
Fix violations in the inputs/compiler and regenerate; never update inventory
24+
hashes to accept a handwritten patch.
1925

2026
## Security requirements for coding agents
2127

‎CONTRIBUTING.md‎

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -96,26 +96,25 @@ and [Dependabot's cooldown policy](https://docs.github.com/en/code-security/refe
9696

9797
## Modifying/Adding code
9898

99-
Most of the SDK is generated code. Modifications to code will be persisted between generations, but may
100-
result in merge conflicts between manual patches and changes from the generator. The generator will never
99+
Most of the SDK is generated code. Never edit generated files by hand; change
100+
the authoritative generation inputs or compiler and regenerate instead. The generator will never
101101
modify the contents of the `src/openai/lib/` and `examples/` directories.
102102

103-
## Custom-code budget
104-
105-
The custom-code budget counts additions plus deletions in the remaining patch
106-
against verified generated output. `.castiron-ratchet.json` defines this repository's
107-
ceiling. CI uses the checker and budget on main, not the PR's proposed versions.
108-
109-
Budget changes must be in a separate PR modifying **only `.castiron-ratchet.json`**.
110-
Justify the current usage, proposed ceiling, and why fixing generation is not
111-
appropriate in the PR description. Increases require a **human approving review**
112-
and must merge before an SDK change relies on them. Agents may draft proposals,
113-
but must not approve increases or bypass the gate. Keep default CODEOWNERS.
114-
Lower the ceiling after cleanup while retaining headroom; decreases must still
115-
fit the measured usage.
116-
117-
See [custom-code technical details](scripts/castiron/CUSTOM_CODE.md) for accounting,
118-
local checks, trusted CI, and activation instructions.
103+
## Generated-file ownership
104+
105+
Do not edit generated SDK files by hand. Fix the API schema, generation
106+
configuration, or compiler and regenerate instead. Put SDK-specific behavior in
107+
separately owned handwritten helpers and extension points.
108+
109+
Regeneration replaces generated files and removes retired generated paths.
110+
Handwritten edits to generated output are overwritten, not carried forward.
111+
Separately owned handwritten files are preserved. Resolve ownership conflicts
112+
explicitly before regeneration. Follow the ownership rules in `AGENTS.md`
113+
and review generated output and inventory changes together. Generated-file
114+
ownership currently relies on contributor guidance and code review, without a
115+
dedicated generated-file edit check or required gate. Fix violations in the
116+
generation inputs/compiler and regenerate; do not edit inventory hashes to
117+
accept a handwritten patch.
119118

120119
## Security requirements for contributions
121120

0 commit comments

Comments
 (0)