mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-08 22:02:54 +00:00
chore(ai): CI health fixes (flaky tests)
Fixed flaky test in tests/hashtag-preferences.test.mjs caused by mock timing issue where load() triggered concurrent fetches, breaking the assumption of sequential calls. Updated assertions to robustly handle multi-kind fetching. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
26e3d6032a
commit
881e31a661
2 files changed
+31
-7
No files matched your search
@@ -0,0 +1,24 @@
|
||||
# CI Health Agent Task Log
|
||||
|
||||
**Agent:** ci-health-agent
|
||||
**Cadence:** daily
|
||||
**Date:** 2026-02-24
|
||||
**Status:** Completed
|
||||
|
||||
## Summary
|
||||
|
||||
Identified and fixed a flaky test in `tests/hashtag-preferences.test.mjs` that was causing intermittent CI failures.
|
||||
|
||||
## Details
|
||||
|
||||
### 1. Flake Identification
|
||||
- **Test:** `load applies same-timestamp updates deterministically with overlap fetch` in `tests/hashtag-preferences.test.mjs`.
|
||||
- **Symptom:** Assertion error where `expected: ['oldpref']` but `actual: ['newpref']` on the first load.
|
||||
- **Root Cause:** The test mocked `nostrClient.fetchListIncrementally` using a `callCount` variable to determine when to return a newer event ("cipher-new"). The test author assumed `hashtagPreferences.load()` triggers a single fetch call. However, `load()` triggers concurrent fetches for multiple kinds (30015 and 30005), causing `callCount` to increment twice during the *first* load operation. This caused the mock to return the "future" event prematurely.
|
||||
|
||||
### 2. Resolution
|
||||
- **Fix:** Modified the mock implementation to condition the return of the new event on `params.since > 0` (which correctly distinguishes the incremental update fetch from the initial load) rather than `callCount`.
|
||||
- **Verification:** Updated test assertions to correctly verify that incremental fetching occurs, handling the multi-call nature of the implementation. Ran `node tests/hashtag-preferences.test.mjs` and confirmed it passes consistently.
|
||||
|
||||
## Artifacts
|
||||
- Created `artifacts/ci-flakes-20260224.md` with failure details.
|
||||
Reference in new issue
Block a user