fix: restore the profile when the prose read fails

_apply_writes promoted the bumped profile, then read its prose under the new pin. A NotCachedError, RateLimitError or UpstreamError from that read left the profile written with a pin the guard would refuse. The original bytes are now put back before the error goes on.
This commit is contained in:
Abdessamad Derraz committed 2026-11-05 19:30:04 +01:00
1 parent f8dce8f8c3
commit f9a786896e
2 files changed
+21 -2

No files matched your search

+8 -2
View File
@@ -4627,8 +4627,14 @@ def _apply_writes(
# The guard above read the prose under the pins the profile held.
# A bump that moves upstream_commit can leave prose the report
# judged in the fork under the new upstream pin (dolphin-mmjr2,
# hatari, xenios): read it again on what was written.
left = realign_prose(path, args.cache_dir, args.offline, dry_run=True)
# hatari, xenios): read it again on what was written. It reads
# the profile's own history, so it runs on the real path, and a
# read that fails (offline, rate limit) puts the profile back.
try:
left = realign_prose(path, args.cache_dir, args.offline, dry_run=True)
except BaseException:
path.write_bytes(original)
raise
if moved and left:
path.write_bytes(original)
print(