fix: validate version bump + real /health + tests for version/health/rollback#32
Merged
Conversation
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.
Fixes all quality-audit findings, each verified failing on origin/main first.
CRITICAL — scripts/bump-version.js
/^\d+\.\d+\.\d+$/AND each componentNumber.isInteger(>= 0) BEFORE writing.process.exit(1)— never writes1.2.NaN/NaN.undefined.NaN, never exits 0 on corrupt input.parseVersion/bumpso tests drive the real code.1.2.3-beta→ wrote1.2.NaN, exit 0.1.2→ silently wrote1.3.0.MAJOR — app/server.js
/healthnow backed by a list of async readiness checks: all pass →200 {"status":"ok"}; any falsy/throw →503 {"status":"unavailable"}. It can now express failure (real readiness signal: listener must be bound; users wire real dependency probes viacreateApp({ readinessChecks })).404instead of 200-for-everything.TESTS (node:test, run via
npm test)tests/bump-version.test.js— table-driven patch/minor/major increments, file-rewrite on success, and loud failure (exit 1, stderr, file untouched, no NaN) on malformed VERSION. Spawns the real CLI.tests/server.test.js— starts the real server:/health→ 200,/→ 200, unknown → 404, and/health→ 503 when an injected readiness check fails/throws.tests/rollback-integration.sh— scenario 3 now assertsdocker-compose.failed.ymlexists,docker-compose.ymlis gone, and nothing is left running. New scenario 4 (both images unhealthy) asserts the system is fully quiesced.scripts/deploy-with-rollback.sh— both terminal-failure branches nowdocker compose downBEFORE moving the compose aside, so a failed deploy no longer leaks an unhealthy container (the new shell assertions require this).node-testsjob into ci.yml so the JS suite gates merges.Verification
npm test: 17/17 pass.bash -n+shellcheckclean on both shell scripts;docker compose configvalidates. The rollback integration test runs in CI (no local Docker daemon).