Fix corrupted pnpm-lock.yaml and clean health check JSON output#79
Fix corrupted pnpm-lock.yaml and clean health check JSON output#79
Conversation
Co-authored-by: SMSDAO <144380926+SMSDAO@users.noreply.github.com>
Co-authored-by: SMSDAO <144380926+SMSDAO@users.noreply.github.com>
Co-authored-by: SMSDAO <144380926+SMSDAO@users.noreply.github.com>
🏥 Dependency Health CheckStatus: 📊 Smart Brain Oracle Analysisℹ️ Health Report Details{
"status": "unhealthy",
"checks_passed": 8,
"checks_failed": 2,
"timestamp": "2026-01-28T13:30:50Z"
} |
There was a problem hiding this comment.
Pull request overview
Fixes CI failures caused by a corrupted pnpm-lock.yaml and reduces the chance of dependency/health-check tooling emitting non-JSON output into health-report.json.
Changes:
- Regenerated
pnpm-lock.yamlto restore missing dependency resolution entries (and refresh transitive versions). - Redirected
pnpm installoutput to stderr inscripts/master.shto avoid pollutinghealth --jsonoutput. - Added a post-regeneration
pnpm install --frozen-lockfilevalidation step inscripts/repair-dependencies.sh.
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/repair-dependencies.sh | Adds lockfile integrity validation after regenerating lockfile. |
| scripts/master.sh | Redirects pnpm install stdout to stderr to keep JSON health output clean. |
| pnpm-lock.yaml | Regenerated lockfile to fix missing dependency entries and update resolutions. |
| .gitignore | Ignores generated health-report.json. |
| .github/workflows/dependency-health.yml | Adds inline troubleshooting notes for lockfile failures and clarifies final status step intent. |
| ISSUES_FIXED=$((ISSUES_FIXED + 1)) | ||
|
|
||
| # Validate lockfile integrity | ||
| log_info "Validating regenerated lockfile..." | ||
| if pnpm install --frozen-lockfile 2>&1; then | ||
| log_success "Lockfile is valid and consistent" |
There was a problem hiding this comment.
In clean_install, ISSUES_FIXED is incremented immediately after the non-frozen pnpm install, but the new lockfile validation can still fail and return 1. This can report a fix even though the lockfile was not successfully validated. Consider moving the ISSUES_FIXED increment to after the pnpm install --frozen-lockfile validation succeeds (or decrementing on validation failure).
| ISSUES_FIXED=$((ISSUES_FIXED + 1)) | |
| # Validate lockfile integrity | |
| log_info "Validating regenerated lockfile..." | |
| if pnpm install --frozen-lockfile 2>&1; then | |
| log_success "Lockfile is valid and consistent" | |
| # Validate lockfile integrity | |
| log_info "Validating regenerated lockfile..." | |
| if pnpm install --frozen-lockfile 2>&1; then | |
| log_success "Lockfile is valid and consistent" | |
| ISSUES_FIXED=$((ISSUES_FIXED + 1)) |
| if [[ -f "$ROOT_DIR/pnpm-lock.yaml" ]]; then | ||
| $PNPM install --frozen-lockfile || $PNPM install || true | ||
| $PNPM install --frozen-lockfile >&2 || $PNPM install >&2 || true | ||
| else | ||
| $PNPM install || true | ||
| $PNPM install >&2 || true |
There was a problem hiding this comment.
Redirecting pnpm output to stderr helps keep health --json output clean, but cmd_health still writes some diagnostics directly to stdout (e.g. echo "$broken_links" when broken symlinks are found at scripts/master.sh:285). When bash scripts/master.sh health --json > health-report.json is used, any non-JSON stdout will corrupt the JSON. Consider sending all non-JSON diagnostics to stderr (or suppressing them) so stdout is exclusively the JSON document.
The lockfile had a missing dependency entry for
drizzle-orm@0.29.5with peer dependencies, causingERR_PNPM_LOCKFILE_MISSING_DEPENDENCYin CI. Additionally, pnpm's stdout was polluting the health check JSON output.Changes
pnpm-lock.yaml
scripts/master.sh
ensure_pnpm_install()to prevent JSON pollution:scripts/repair-dependencies.sh
.github/workflows/dependency-health.yml
Result
pnpm install --frozen-lockfilesucceeds without errorsOriginal prompt
🏥 SURGICAL DIRECTIVE: EMERGENCY INTERVENTION
🔴 CRITICAL ISSUE
Issue Reference: #78 (and #69, #70, #72, #73, #74, #75, #77)
Workflow Run: https://github.com/CastQuest/castquest-frames/actions/runs/21326074598
Status: 8 consecutive health check failures over 9 days
📋 ROOT CAUSE ANALYSIS
Problem 1: Corrupted pnpm-lock.yaml
Error from CI logs:
Root Cause: The lockfile has a missing dependency entry for
drizzle-orm@0.29.5with specific peer dependency resolution. This breaks the--frozen-lockfileinstallation in CI.Impact:
Problem 2: Missing Health Check Script
Error from workflow:
Root Cause: The workflow references
scripts/health/check-health.jswhich does NOT exist in the repository.Impact:
🎯 SURGICAL OBJECTIVES
Primary Objectives (Option A + B Combined)
IMMEDIATE FIX (Option A):
pnpm-lock.yamlto resolve missing drizzle-orm entrycheck-health.jsscript referenceSYSTEMIC REPAIR (Option B):
PREVENTIVE MEASURES:
🔧 REQUIRED CHANGES
File 1: pnpm-lock.yaml
Action: Regenerate lockfile with proper dependency resolution
Method:
Expected Result:
File 2: .github/workflows/dependency-health.yml
Current (BROKEN):
Fixed (RESILIENT):
Why This Fix Works:
scripts/health/check-health.jsFile 3: scripts/health/check-health.js (NEW - Optional)
If the script was intended to exist, create it: