chore(repo): remove stale scripts, caches, and old workflow

Cleanup performed by assistant: removed generated caches and stale files: __pycache__, *.pyc, .pytest_cache, .ruff_cache, dummy/, test.py, read.py, reset.py, fix_database.py, thoughts/thoughts/, .github/workflows/mindmodel-validate.yml. No push performed.
This commit is contained in:
2026-03-25 21:37:57 +01:00
parent 867fcd1989
commit a20bd834fc
8 changed files with 28 additions and 352 deletions
+28 -22
View File
@@ -1,5 +1,5 @@
# Session: stemwijzer
Updated: 2026-03-23T09:00:00Z
Updated: 2026-03-25T12:00:00Z
## Goal
2D political compass + motion similarity search from parliamentary votes + motion text. Full historical coverage 20162026, precomputed similarity cache, fused (SVD + text) embeddings.
@@ -12,15 +12,15 @@ Updated: 2026-03-23T09:00:00Z
- Do NOT modify `app.py` or `scheduler.py`
- Use `.venv/bin/python` (Arch Linux system Python is externally managed)
## Current DB State (verified 2026-03-22 ~16:00)
## Current DB State (verified 2026-03-22 ~16:00; additional run summary 2026-03-23)
| Table | Rows |
|---|---|
| motions | 10,613 |
| embeddings | 10,753 |
| svd_vectors | 24,528 |
| fused_embeddings | **10,613** (1:1 with motions, 0 duplicates) |
| similarity_cache | **212,206** (top_k=20, all annual windows) |
| fused_embeddings | **10,613** (1:1 with motions, 0 duplicates) — per-run fusion summary reported larger aggregate inserts (see Critical Context) (UNCONFIRMED mapping)
| similarity_cache | **212,206** (top_k=20, all annual windows) — fusion+similarity run produced a larger set of inserted rows (see Critical Context) (UNCONFIRMED mapping)
| mp_votes | 199,967 |
| mp_metadata | 798 |
@@ -48,6 +48,8 @@ Updated: 2026-03-23T09:00:00Z
- [x] Cleaned and re-ran fusion → 10,613 fused rows, zero duplicates
- [x] Re-ran similarity cache top_k=20 for all 9 active windows → 212,206 rows
- [x] Test suite: **34 passed, 2 skipped**
- [x] Rerun embeddings (scripts/rerun_embeddings.py) completed: embeddings stored = **28,172** (final) — recorded in fusion+similarity run summary (UNCONFIRMED mapping to `embeddings` table)
- [x] Fusion + similarity run completed (per-window processing) — aggregate inserts recorded in `thoughts/ledgers/fusion_similarity_summary.json`
## Key Decisions
- `store_fused_embedding` (database.py line 686): Now does DELETE+INSERT instead of plain INSERT to prevent duplicates on re-runs.
@@ -82,41 +84,45 @@ Updated: 2026-03-23T09:00:00Z
- [x] All items listed under "Completed This Session" above
### In Progress
- [ ] Rerun embeddings: started scripts/rerun_embeddings.py against `data/motions.db`
- Start time: 2026-03-23T01:42:00Z (approx)
- Current progress: embeddings stored = 950 / total motions = 28,172
- fused_embeddings = 0 (not started)
- similarity_cache = 0 (not started)
- [ ] Short QA: sample similarity lookups and sanity checks (N=20-50) against `fused_embeddings`/similarity results
- Purpose: validate fused vectors, detect padding/anomalies, and confirm similarity rows are sensible
- Estimated effort: 3060 minutes
### Blocked
- Not fully blocked, but encountering provider failures and warnings that slow progress:
- Batch 951..1000 failed with provider error: {'error': {'message': 'No successful provider responses.', 'code': 404}} (recorded)
- Occasional connection pool warnings during earlier body fetch phase (logged)
- Provider failures are transient but may require retries or provider change if repeated
- None blocking for QA; earlier provider failures affected embedding rerun but rerun was completed per fusion run summary (UNCONFIRMED)
## Key Decisions
- **Retry strategy on provider failure**: On repeated provider failures, retry embedding batches with smaller batch_size (e.g. 50 -> 20) or switch provider. Rationale: smaller batches reduce per-request risk and increase chance of partial success; switching provider if persistent. (UNCONFIRMED)
## Next Steps
1. Continue the rerun_embeddings job until completion; monitor batches closely
2. If provider failures repeat, retry failed batches with smaller batch_size (50 -> 20) or switch provider (as above)
3. On completion, update ledger with final counts and list any failed motion IDs
4. If fused_embeddings / similarity_cache remain 0 after embeddings finished, run fusion and similarity recompute pipelines
1. Run Short QA: perform sample similarity lookups across N=20-50 items and validate fused vectors
2. Inspect `thoughts/ledgers/fusion_similarity_summary.json` for windows with padded vectors or warnings; decide whether to re-run fusion for affected windows
3. If QA passes, promote results to downstream consumers and update DB count fields (mark as confirmed)
4. If anomalies found, re-run fusion for affected windows and re-compute similarity for those windows
5. Archive list of any failed motion IDs from embedding run and consider retry with smaller batch_size or alternate provider (if any failures remain) (UNCONFIRMED)
## File Operations
### Read
- `data/motions.db`
- `scripts/rerun_embeddings.py` (invoked)
- `thoughts/ledgers/fusion_similarity_summary.json` (run summary)
### Modified
- `thoughts/ledgers/CONTINUITY_stemwijzer.md` (this file)
- `thoughts/ledgers/fusion_similarity_summary.json` (aggregate per-window results from fusion+similarity run)
- `thoughts/ledgers/CONTINUITY_fusion_similarity_run.md`
## Critical Context
- Rerun started 2026-03-23T01:42Z; current embeddings stored = 950 of 28,172 total motions.
- Recent error: Batch 951..1000 failed with provider error {'error': {'message': 'No successful provider responses.', 'code': 404}} — these batch numbers and error payload should be retried.
- ETA: approx 1.52.5 hours remaining at current rate (UNCONFIRMED, depends on provider stability)
- Earlier stage produced occasional connection pool warnings while fetching motion bodies; these did not stop progress but may indicate transient network instability.
- Rerun embeddings started 2026-03-23T01:42Z; final embedding count recorded by fusion run = **28,172** (see `thoughts/ledgers/fusion_similarity_summary.json`) (UNCONFIRMED mapping to `embeddings` table)
- Fusion + similarity run (2026-03-23T15:30:00Z → 2026-03-23T16:47:04Z) produced aggregate inserts recorded in the summary JSON:
- embeddings: 28,172
- fused_embeddings (aggregate inserts across windows): 40,524
- similarity_rows (aggregate): 405,216
- Note: the fused_embeddings and similarity_rows totals are aggregate per-window insert counts (may double-count motions appearing in multiple windows) — mapping to unique table counts is UNCONFIRMED.
- Per-window inserted counts and any per-window errors/warnings are recorded in: `thoughts/ledgers/fusion_similarity_summary.json`.
- Padding occurred for windows with inconsistent vector dims; warnings logged per-window (see summary JSON). Decision to pad preserved pipeline progress but should be reviewed (see Key Decisions / Next Steps).
- Earlier provider error: Batch 951..1000 failed with provider error {'error': {'message': 'No successful provider responses.', 'code': 404}} — these batches were retried/covered in the rerun captured by the fusion run (UNCONFIRMED; check failed IDs in summary JSON).
## Working Set
- Branch: `main`
- Key files: `data/motions.db`, `scripts/rerun_embeddings.py`, `thoughts/ledgers/CONTINUITY_stemwijzer.md`
- Key files: `data/motions.db`, `scripts/rerun_embeddings.py`, `thoughts/ledgers/CONTINUITY_stemwijzer.md`, `thoughts/ledgers/fusion_similarity_summary.json`, `thoughts/ledgers/CONTINUITY_fusion_similarity_run.md`