Repository navigation
Phase 4: incremental hallu sync via latest_version on listing - #415
Merged
neuromechanist merged 2 commits intoMay 10, 2026
Conversation
…PI call Backend: `GET /datasets` listing now includes `latest_version` from the most-recent `dataset_versions` row per dataset (null when none). Adds one correlated subquery per row; for the typical 50-100-row listing the added cost is negligible. CLI: `Dataset` type gains `latest_version?: string | null`. Script: `discover_datasets()` emits `dataset_id<TAB>latest_version` pairs. The main loop uses the listing-provided version directly, falling back to the per-dataset `/manifest` call only when the listing didn't carry one (older backend / no minted version yet). For ~100 nm datasets this drops ~100 extra API calls per cron cycle to zero in the steady state. Logging: per-dataset lines now carry consistent tags `[FRESH]`, `[UPDATE]`, `[SKIP]`, `[ADOPT]`, `[CLEAN]`, `[ZIP]`, `[WAIT]`, `[FAIL]` so grep-based dashboards can differentiate steady-state skips from real fetches (acceptance criterion 4 in #409).
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR415Version: 🤖 Updated on each push. |
…test scripts/hallu-sync.sh: - discover_datasets() now captures jq exit code and stderr; a parse failure (malformed API JSON, schema regression) returns 1 and log_errors with the captured message instead of silently truncating the page set. The /datasets length sanity check also validates the shape before continuing. - main() propagates discover_datasets failure as a sync abort. - Added a closing alarm: when the listing carried no latest_version for any dataset (manifest_fallbacks == total > 0), log_error explicitly flags 'the listing optimisation may have regressed' so cron monitoring fires. backend/src/routes/datasets.ts: - SQL comments at both managed SELECTs document that latest_version is the hallu-sync contract; future maintainers shouldn't change the ordering without updating the script. test/api.test.ts: - New value-correctness test: cross-checks listing's latest_version against /versions (same DESC-by-created_at order as the SQL subquery). Tolerates dev DBs that have no minted version via early return. Intentionally not addressed: - Renamed log-string tags break grep-based runbooks. The new tags ([SKIP]/[UPDATE]/[FRESH]/[FAIL]) are the AC #4 improvement; the rename is called out in the PR description and the operator runbook in MEMORY (infra_hallu_sync.md) will be updated separately.
Contributor
Author
Review summaryThree parallel reviewers ran (code-reviewer, silent-failure-hunter, pr-test-analyzer). Critical — addressed
High — addressed
Important — addressed
Intentionally not addressed
Verification
|
neuromechanist
merged commit May 10, 2026
d1e24da
into
feature/issue-406-epic-rate-limit-hardening
1 check passed
This was referenced May 11, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Eliminate the ~100 per-dataset `/datasets//manifest` API calls the hallu cron makes every hour by surfacing `latest_version` on the listing endpoint and consuming it in the script.
Closes #409
Part of epic #406
Changes
Acceptance checklist (from #409)
Out of scope (with reason)
Test plan