Files
Charon/docs/plans/current_spec.md

50 lines
2.4 KiB
Markdown

# Investigation and Remediation Plan: CI Failures on feature/beta-release
## 1. Incident Summary
**Issue**: CI builds failing on `feature/beta-release`.
**Symptoms**:
- Frontend build fails due to missing module `../data/crowdsecPresets`.
- Backend coverage check fails (likely due to missing tests or artifacts).
- Docker build fails.
**Root Cause Identified**:
- The file `frontend/src/data/crowdsecPresets.ts` exists locally but was **ignored by git** due to an overly broad pattern in `.gitignore`.
- The pattern `data/` in `.gitignore` (intended for the root `data/` directory) accidentally matched `frontend/src/data/`.
## 2. Diagnosis Details
- **Local Environment**: The file `frontend/src/data/crowdsecPresets.ts` was present, so local `npm run build` and `npm run test:ci` passed.
- **CI Environment**: The file was missing because it was not committed.
- **Git Ignore Analysis**:
- `.gitignore` contained `data/` under "Caddy Runtime Data".
- This pattern matches any directory named `data` anywhere in the tree.
- It matched `frontend/src/data/`, causing `crowdsecPresets.ts` to be ignored.
## 3. Remediation Steps
1. **Fix `.gitignore`**:
- Change `data/` to `/data/` to anchor it to the project root.
- Change `frontend/frontend/` to `/frontend/frontend/` for safety.
2. **Add Missing File**:
- Force add or add `frontend/src/data/crowdsecPresets.ts` after fixing `.gitignore`.
3. **Verify**:
- Run `git check-ignore` to ensure the file is no longer ignored.
- Run local build/test to ensure no regressions.
## 4. Verification Results
- **Local Tests**:
- Backend Coverage: 85.4% (Pass)
- Frontend Tests: 70 files passed (Pass)
- Frontend Coverage: 85.97% (Pass)
- Build: Passed
- **Git Status**:
- `frontend/src/data/crowdsecPresets.ts` is now staged for commit.
- `.gitignore` is modified and staged.
## 5. Next Actions
- Commit the changes with message: `fix: resolve CI failures by unignoring frontend data files`.
- Push to `feature/beta-release`.
- Monitor the next CI run.
## 6. Future Prevention
- Use anchored paths (starting with `/`) in `.gitignore` for root-level directories.
- Check `git status` for unexpected ignored files when adding new directories.
- Add a pre-commit check or CI step to verify that all imported modules exist in the git tree (though `tsc` in CI does this, the issue was the discrepancy between local and CI).