test(starlark): cover the review fixes #535 shipped without tests (#650)

Six Starlark fixes are on main via #535 and #537, but a follow-up commit
carrying tests for half of them was pushed to fix/starlark-pixlet-install
six minutes after #535 merged, so those tests never landed. This ports
them onto the api_v3 package split:

- a failed toggle write answers 500, and a loaded app is not flipped in
  memory when the manifest write fails
- each manifest writer gets its own temp file; concurrent writes leave
  readable JSON; no temp files are left behind
- a failed dynamic import of tronbyte_repository / pixlet_renderer does
  not stay cached in sys.modules
- a failed save_config() leaves config and timing untouched and does not
  re-render; a successful save still applies

It also logs when the timing update to the manifest is not persisted.
_update_manifest_safe answers False rather than raising, so the existing
except branch never saw that failure.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chuck
2026-09-28 10:40:32 -04:00
committed by GitHub
co-authored by Claude Opus 5.5
parent f6c0fe55d9
commit 65d82580bc
2 changed files with 196 additions and 1 deletions
+4 -1
View File
@@ -465,7 +465,10 @@ def update_starlark_app_config(app_id):
def update_fn(manifest):
manifest['apps'][app_id].update(timing_updates)
starlark_plugin._update_manifest_safe(update_fn)
# _update_manifest_safe answers False rather than
# raising, so the except below never sees this failure.
if starlark_plugin._update_manifest_safe(update_fn) is False:
logger.warning("Timing for %s was not persisted to the manifest", app_id)
except Exception as e:
logger.warning(f"Failed to persist timing to manifest for {app_id}: {e}")
starlark_plugin._render_app(app, force=True)