Commit 9630877
[sdk generation pipeline] Auto-trim oversized CHANGELOG.md during SDK generation (#47809)
* Auto-trim oversized CHANGELOG.md during SDK generation
CHANGELOG.md is embedded into the PyPI long_description, so it must not grow unbounded. Add trim_changelog_if_needed to sdk_changelog: when CHANGELOG.md exceeds 128 KB, keep the newest half of version entries and append a PyPI pointer note for older history. Called automatically after the changelog edit in main().
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Preserve trim note on the <4-entries no-op path
Apply the <4 version-entry early return before stripping the trim note so an existing PyPI-pointer note is not silently lost when modify_file writes content back on the no-op path.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Trim CHANGELOG down under the size limit instead of cutting a fixed half
The half-cut strategy could still leave the file over the limit (e.g. azure-mgmt-sql stayed at ~190 KB). Keep the newest version entries that fit under size_limit and remove all older entries completely, so the trimmed file is always under the limit. Add a regression test using the real azure-mgmt-sql 4.0.0 CHANGELOG fixture.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add expected trimmed azure-mgmt-sql changelog fixture
Check in the trimmed output of the azure-mgmt-sql 4.0.0 CHANGELOG so the result is easy to review, and assert the trim produces it exactly.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Raise CHANGELOG trim limit from 128 KB to 192 KB
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add azure-mgmt-network 31.0.0 changelog fixture and share trim assertions
Add a second real-world fixture (azure-mgmt-network 31.0.0) with its expected trimmed output, and refactor the fixture check into a shared helper. Assert the trimmed size on normalized (LF) bytes so it matches the pipeline regardless of local newline translation. Normalize fixtures to LF.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Trim CHANGELOG down to half the limit for headroom (high-water/low-water)
Keeping the file just under the limit meant it re-trimmed on almost every release (headroom was only ~1-3 KB). Trigger trimming at size_limit (192 KB) but cut down to trim_target (half, 96 KB) so there is headroom and trims are infrequent. Regenerate fixtures and update tests.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Keep at least 4 newest CHANGELOG entries when trimming
Balance usefulness against headroom: trimming aims for the 96 KB target but
always retains the 4 newest version entries unless they exceed the 192 KB hard
limit. Regenerated sql/network fixtures now keep 4 entries.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add azure-mgmt-datafactory CHANGELOG trim test fixture
210 KB changelog trims to 4 newest entries (10.0.0b1..9.1.0, ~90 KB).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Apply black formatting to test_sdk_changelog.py
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Trigger changelog trim on normalized LF byte length
Use the normalized (LF) UTF-8 byte length instead of stat().st_size so the
trim trigger is consistent across platforms and matches the Linux pipeline.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Lower CHANGELOG size limit to 128 KB
Trigger at 128 KB (target 64 KB). Regenerated fixtures: sql keeps 3 newest
entries (~127 KB, capped by the hard limit below the 4-entry floor), network
and datafactory keep 4.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add containerservice and cosmosdb CHANGELOG trim test fixtures
Both have many small entries, so the 64 KB target keeps well above the 4-entry
floor: containerservice keeps 15 newest (~60 KB), cosmosdb keeps 18 (~63 KB).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 6e44a95 commit 9630877
12 files changed
Lines changed: 16960 additions & 0 deletions
File tree
- eng/tools/azure-sdk-tools
- packaging_tools
- tests
- data
Lines changed: 117 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
42 | 156 | | |
43 | 157 | | |
44 | 158 | | |
| |||
202 | 316 | | |
203 | 317 | | |
204 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
205 | 322 | | |
206 | 323 | | |
207 | 324 | | |
| |||
0 commit comments