Skip to content

Harden script/default_appraisal_zeitwerk_check (WA-VERIFY-082)#1074

Open
kitcommerce wants to merge 1 commit intonextfrom
issue-1068-harden-zeitwerk-check
Open

Harden script/default_appraisal_zeitwerk_check (WA-VERIFY-082)#1074
kitcommerce wants to merge 1 commit intonextfrom
issue-1068-harden-zeitwerk-check

Conversation

@kitcommerce
Copy link
Contributor

Fixes #1068

Summary

Three hardening improvements to script/default_appraisal_zeitwerk_check:

  1. Subshell pattern for engine loops — replaced the previous single cd "$ROOT_DIR/core/test/dummy" (bare directory change in the parent shell) with an explicit loop over all three engines (core, admin, storefront), each run in its own subshell (cd "$engine/test/dummy" && RAILS_ENV=test bin/rails zeitwerk:check). This isolates directory changes and prevents set -e failures from leaving the shell in an unexpected directory.

  2. Redis readiness wait — added timeout 60 bash -c 'until redis-cli ping > /dev/null 2>&1; do sleep 2; done' before the checks run, so the script no longer fails with spurious connection errors when Redis is still starting up in CI.

  3. Explicit RAILS_ENV=test — both the rbenv exec and plain bin/rails code paths now set RAILS_ENV=test inline rather than relying on the ambient export, making intent unambiguous.

Coverage expanded: previously only core/test/dummy was checked. Now all three engine dummy apps are verified, with a graceful SKIP if a dummy directory is absent.

Client Impact

None — CI-only script. No application code, APIs, or public interfaces changed.

- Replace bare cd+cd pattern with subshell per engine so directory
  changes are isolated and set -e failures cannot corrupt the working dir
- Add Redis readiness wait (timeout 60) before running checks to avoid
  false negatives when Redis is still initialising in CI
- Set RAILS_ENV=test explicitly in all zeitwerk:check invocations
- Expand coverage from core-only to all three engines (core, admin, storefront)
  each via their own test/dummy app

Fixes #1068
@kitcommerce
Copy link
Contributor Author

🤖 Wave 1 Automated Review — PR #1074

Architecture — PASS

Good structural improvement. Looping over engines in subshells isolates directory changes and failures cleanly. The separation of concerns (Redis readiness → engine iteration → per-engine check) is well-organized.

Simplicity — PASS

The refactored script is actually simpler in intent despite being slightly longer — the engine loop replaces implicit single-engine assumption with explicit multi-engine support. The rbenv exec fallback is clean.

Security — PASS_WITH_NOTES

{
  "reviewer": "security",
  "verdict": "PASS_WITH_NOTES",
  "severity": null,
  "summary": "No security issues. Minor observation about the Redis wait loop.",
  "findings": [
    {
      "severity": "LOW",
      "file": "script/default_appraisal_zeitwerk_check",
      "line": 42,
      "issue": "The `timeout 60` + `redis-cli ping` loop is fine for CI but could hang for 60s in local dev if Redis is not running. Not a security issue per se.",
      "suggestion": "Consider a brief log message noting what it is waiting for (already done — \"Waiting for Redis to be ready...\"). No action needed."
    }
  ]
}

Test Quality — PASS_WITH_NOTES

This is a shell script, so unit testing is limited. The script relies on CI execution for validation. The subshell pattern with set -e propagation is correctly structured to fail fast.

Rails Conventions — PASS

N/A for shell scripts. The RAILS_ENV=test is correctly hardcoded for the zeitwerk check context.


Wave 1 Verdict: ✅ All clear — no blocking issues.

@kitcommerce
Copy link
Contributor Author

Wave 2 Review Results

rails-security: PASS — CI/local script hardening only.
database: PASS — no database changes.
test-quality: PASS — no test logic changes; script should reduce flakiness.

Wave 2 PASSED.

@kitcommerce kitcommerce added review:rails-security-done Rails security review complete review:database-done Database review complete review:wave2-complete gate:build-passed Build gate passed review:performance-pending Review in progress review:frontend-pending Frontend review in progress review:accessibility-pending Review in progress labels Mar 17, 2026
Copy link
Contributor Author

@kitcommerce kitcommerce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wave 3 reviews (performance / frontend / accessibility)

{"reviewer":"performance","verdict":"PASS","severity":null,"summary":"Build/CI script hardening only; no runtime performance impact.","findings":[]}
{"reviewer":"frontend","verdict":"PASS","severity":null,"summary":"No frontend changes.","findings":[]}
{"reviewer":"accessibility","verdict":"PASS","severity":null,"summary":"No accessibility changes.","findings":[]}

@kitcommerce kitcommerce added review:performance-passed Auto-review label review:frontend-passed Auto-review label review:accessibility-passed Auto-review label review:wave3-complete Wave 3 review complete review:documentation-pending and removed review:performance-pending Review in progress review:accessibility-pending Review in progress review:frontend-pending Frontend review in progress labels Mar 17, 2026
Copy link
Contributor Author

@kitcommerce kitcommerce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wave 4 (documentation) review

PASS — Script change is self-documenting via inline comments; no additional docs required.

@kitcommerce kitcommerce added review:wave4-complete Wave 4 (documentation) review complete merge:ready All conditions met, eligible for merge and removed review:documentation-pending labels Mar 17, 2026
@kitcommerce
Copy link
Contributor Author

⚠️ Merge Conflict

This PR is labeled merge:ready and the hold window has passed (60 min), but GitHub reports CONFLICTING — there are merge conflicts preventing auto-merge.

Please rebase onto next and push to resolve. Issue #1068 has been moved to status:blocked + blocked:merge-conflict.

@kitcommerce
Copy link
Contributor Author

⚠️ Merge conflict detected (mergeStateStatus: DIRTY). Cannot auto-merge. Blocking for resolution.

@kitcommerce
Copy link
Contributor Author

⚠️ Merge Conflict

Auto-merge blocked: mergeStateStatus: DIRTY — branch has conflicts with next. Rebasing required before merge can proceed.

Please rebase on next and push to resolve.

@kitcommerce kitcommerce added the blocked:merge-conflict PR has merge conflicts label Mar 17, 2026
@kitcommerce
Copy link
Contributor Author

⚠️ Merge conflict detected. This PR cannot be auto-merged until the conflict is resolved. Please rebase on next and push.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked:merge-conflict PR has merge conflicts gate:build-passed Build gate passed merge:ready All conditions met, eligible for merge review:accessibility-passed Auto-review label review:architecture-done Review complete review:database-done Database review complete review:frontend-passed Auto-review label review:performance-passed Auto-review label review:rails-conventions-done Rails conventions review complete review:rails-security-done Rails security review complete review:security-done Review complete review:simplicity-done Review complete review:test-quality-done Review complete review:wave1-complete review:wave2-complete review:wave3-complete Wave 3 review complete review:wave4-complete Wave 4 (documentation) review complete

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant