fix: guard startup against mixed API module updates#168
Open
x86txt wants to merge 3 commits intoPegaProx:mainfrom
Open
fix: guard startup
against mixed API module updates#168x86txt wants to merge 3 commits intoPegaProx:mainfrom
x86txt wants to merge 3 commits intoPegaProx:mainfrom
Conversation
added 3 commits
March 16, 2026 13:16
Add a blueprint integrity check that detects missing required API modules and exits with an actionable remediation message instead of a traceback. Harden fallback updater behavior to avoid partial file updates that can cause mixed-version imports. Made-with: Cursor
Add a --check-startup command that validates required API modules and exits with actionable remediation instructions without launching services, with unit coverage for pass/fail paths. Made-with: Cursor
Detect missing runtime deps such as certifi/charset_normalizer in --check-startup and during app bootstrap, and provide actionable remediation commands instead of raw tracebacks. Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
update.shfallback file downloader (used when no release archive is available) has two issues that can leave an installation in a mixed-version state, causing import tracebacks on next startup:|| true, so the update continues and completes "successfully" even when critical files are missing or stale.rsyncused to copy extracted archive contents into the install directory does not use--delete, so files removed in a newer release persist from the previous version and can cause mixed-version imports.Once in this state, PegaProx crashes on startup with an unhelpful Python traceback (e.g.
ModuleNotFoundError) with no guidance on how to recover.There is also no way to validate installation integrity without fully launching the server.
Fix
1. Harden
update.shagainst partial updates--deleteto thersynccommand so removed upstream files do not linger as stale leftovers.2. Add startup blueprint integrity check
validate_blueprint_modules()verifies every required API module is importable viaimportlib.util.find_spec.RuntimeErrorwith an actionable message naming the missing modules and suggesting./update.sh --force.app.pycatches this specific error and prints a clean one-liner instead of a full traceback, then exits with code 1 for systemd/journal visibility.3. Add
--check-startupCLI preflight mode--check-startupflag runs the integrity check and exits without launching services.Impact
update.shnow aborts and rolls back when any file download fails in fallback mode.rsync --deleteensures the install directory mirrors upstream exactly (user config, SSL, logs, and backups are still excluded).--check-startuplets operators verify installation integrity without starting the server.Files Changed
pegaprox/api/__init__.pyvalidate_blueprint_modules()and call it before blueprint registrationpegaprox/app.pyRuntimeError, print clean error, exit 1pegaprox_multi_cluster.pycheck_startup_integrity()and--check-startupCLI flagupdate.shrsync --deletetests/test_startup_check.pyvalidate_blueprint_modules()tests/test_cli_startup_check.py--check-startupCLI mode