Skip to content

fix(reindex): --missing-metadata skips rows attempted in the last 24h - #579

Merged
neuromechanist merged 3 commits into
devfrom
fix/reindex-missing-metadata-recency-v2
May 22, 2026
Merged

neuromechanist merged 3 commits into
devfrom
fix/reindex-missing-metadata-recency-v2

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Replaces #552 (auto-closed during a botched rebase). This PR is a clean linear cherry-pick of the same change on top of current dev.

Summary

User observation: `nm000133` was getting reindexed on every `--missing-metadata` sweep with no progress. The filter only checked column nullness, so datasets whose upstream genuinely lacks a column we require (e.g. no `participants.tsv` -> `subject_count` stays NULL) re-matched every sweep, ran the full enrichment pipeline, and converged back to NULL. No useful work; just billing.

Adds a 24h recency guard to the `missing-metadata` filter: rows whose `metadata_updated_at` is within the last 24h are skipped. After 24h they're eligible again, giving upstream time to ship a fix (e.g. add `participants.tsv` to the BIDS root). Operators who need to force an immediate retry use `--all`.

Companion to PR #553 (`feat(enrich): auto-generate participants.tsv when missing at root`).

Test

`test/dataset-reindex.test.ts` covers the new behavior. Local: 21 pass, 0 fail.

Original PR

#552 was a merge commit on top of an older base. During the rebase to current dev the GitHub state machine auto-closed it. This re-issue is a clean linear commit (no merge weirdness) ready for normal review + merge.

@github-actions

github-actions Bot commented May 22, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR579

Version: 0.8.27-PR579.0087fc7
Commit: 0087fc7


🤖 Updated on each push.

@neuromechanist

Copy link
Copy Markdown
Contributor Author

Review (pr-review-toolkit:code-reviewer)

Critical: none.

Important — fixed in ffe96e8:

  • `--older-than` CLI help text said "Threshold for --stale (default: 30)". Now that the same flag also controls the `--missing-metadata` recency guard, the description was misleading. Updated to "Threshold in days for --stale (default 30) or --missing-metadata recency guard (default 1 / 24h)".

Strengths confirmed:

  • SQL semantics correct (`IS NULL OR < datetime('now', ?)` passes first-time rows and rows >24h old)
  • `metadata_updated_at` is nullable per migration 0020; no schema change needed
  • Validation matches the existing `stale` filter's defensive parity
  • `older_than_days` already flows from CLI through `buildReindexFilterQuery` — no new plumbing needed
  • 21 tests pass locally

Companion to PR #553 — both solve the `nm000133` reindex-loop bug from different angles. Land together.

@neuromechanist
neuromechanist merged commit 20aedfc into dev May 22, 2026
9 checks passed
@neuromechanist
neuromechanist deleted the fix/reindex-missing-metadata-recency-v2 branch May 22, 2026 19:03
neuromechanist added a commit that referenced this pull request May 22, 2026
When a dataset's BIDS root doesn't include participants.tsv, derive a minimal one from the sub-XXX/ directory listing and commit it via the GH App. Closes the lifecycle gap that #579 mitigated with a recency guard: now the data actually appears instead of staying NULL forever. Pure module + 3 real-integration tests, no mocks. Case-sensitive on purpose (BIDS spec mandates lowercase); see code comment in participants-tsv.ts.
neuromechanist added a commit that referenced this pull request May 22, 2026
Cross-phase review on dev→main #580 found Commander's '30' default always overrode the server-side ?? 1 default for --missing-metadata, hiding the 24h recency guard from #579. Fix moves default into the action handler per filter. Admin-merge: publish workflow fails with the npm 409 race that #581 (just merged) fixes for next time.
@neuromechanist neuromechanist mentioned this pull request Nov 27, 2026
5 tasks done

This branch was previously deployed

1 inactive deployment
npm — 0087fc70 Deployed May 22, 2026 by neuromechanist via publish #1058
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant