CI Failure Investigation and Fix Walkthrough
CI Failure Investigation and Fix Walkthrough
Section titled “CI Failure Investigation and Fix Walkthrough”We successfully resolved a series of CI failures to get the build green.
Changes
Section titled “Changes”1. Fix pnpm Version Mismatch
Section titled “1. Fix pnpm Version Mismatch”The initial error “packages field missing or empty” was caused by a mismatch between the local pnpm version (v10) and the CI version (v9). Attempting to use a v10 lockfile with v9 caused the failure.
Resolution: Updated .github/workflows/ci.yml to use pnpm v10.
2. Initialize System Tests
Section titled “2. Initialize System Tests”The system-test job failed because the app lacked the test/system directory.
Resolution:
- Created
test/application_system_test_case.rbconfigured for headless Chrome. - Created
test/system/sanity_test.rbwith a basic home page check.
3. Fix Lint Errors
Section titled “3. Fix Lint Errors”The lint job failed due to trailing whitespace in the new test file.
Resolution: Removed trailing whitespace from test/system/sanity_test.rb.
4. Fix IPv6 Database Connection Error
Section titled “4. Fix IPv6 Database Connection Error”System tests failed on CI with ActiveRecord::ConnectionNotEstablished trying to connect to ::1.
Resolution: Explicitly set PGHOST and DATABASE_URL to 127.0.0.1 in .github/workflows/ci.yml.
5. Fix Invalid Fixtures
Section titled “5. Fix Invalid Fixtures”System tests crashed due to database constraint violations in the auto-generated fixtures.
users.yml: Missingaccount_idandemail(NOT NULL constraints).admin_users.yml: Duplicate empty emails (Unique constraint).accounts.yml: Invalid Array syntax (MyTextinstead of[]).
Resolution: Updated all fixtures with valid, constraint-compliant data.
Verification Results
Section titled “Verification Results”CI Status
Section titled “CI Status”All jobs passed successfully in the final run:
test: ✅ Successlint: ✅ Successsystem-test: ✅ Successscan_ruby: ✅ Success