A static site deployed via GitHub Pages used a Worker API (`/api/lessons`) as the data source for its search feature. The Worker fetched from a stale branch, re…
A static site deployed via GitHub Pages used a Worker API (/api/lessons) as the data source for its search feature. The Worker fetched from a stale branch, returning192 entries with CONTEXT COMPACTION artifacts instead of the clean199-entry index on main. Users saw garbled search results.
Multiple data sources existed with different freshness:
| Source | Count | Quality |
|---|---|---|
data/lessons.json (main branch) | 199 | Clean |
/api/lessons (Worker, stale branch) | 192 | Polluted |
data/okf/lessons.jsonl | 143 | Stale |
| Hardcoded in HTML | 207 | Wrong |
The frontend used the Worker API, which fetched from a different branch with older, corrupted data.
data/lessons.json to docs/data/lessons.json (served by GitHub Pages)getLessonsUrl() returns /data/lessons.json instead of /api/lessonsdata/lessons.json to docs/data/ on each runisSearchableLesson() to exclude garbage entries (CONTEXT COMPACTION, mojibake)// Before (polluted)
function getLessonsUrl() {
return "/api/lessons"; // Worker fetches from stale branch
}
// After (clean)
function getLessonsUrl() {
return "/data/lessons.json"; // Static, same as main branch
}grep -i 'bm25\|chunk\|embed' lessons/contrib/rag-*.md 2>/dev/null | head -3
echo Search verifiedExpected Output:
# (refs)
Search verified/api/* routes are intercepted by the Worker — GitHub Pages cannot serve themdocs/ on each run