Repository navigation
Closed
Description
Problem
Currently, when a user requests publication (POST /datasets/:id/publish/request), the endpoint just inserts a DB row and emails admins. No validation happens. Admins then discover issues (failing BIDS validation, missing enrichment) only when they try to approve.
This wastes time and leaves datasets stuck in a "requested" state with no feedback to the user.
Proposed Behavior
When a user requests publication, the backend should:
1. Deploy CI if missing
- Check if BIDS validation workflow exists on the dataset repo
- If missing, deploy it (equivalent to
nemar admin ci add) - Trigger a validation run
2. Check BIDS validation status
- Query the latest CI run for the BIDS validation workflow
- If failing: set request status to
blockedwith reasonbids_validation_failed - If no runs yet: set status to
pending_ciand check again later (or instruct user to push)
3. Trigger LLM metadata enrichment
- Check if
.nemar/metadata.jsonexists and itspipeline_stage - If enrichment hasn't run, trigger the LLM enrichment workflow
4. Block or proceed
- If BIDS validation passes and enrichment is complete (or in progress): create the request normally, email admins
- If BIDS validation fails: create the request with
status: 'blocked', do NOT email admins yet. Return a clear message to the user:{ "status": "blocked", "reason": "bids_validation_failed", "message": "BIDS validation is failing on your dataset. Please check the repository CI and fix validation errors before requesting publication.", "ci_url": "https://github.com/nemarDatasets/<id>/actions" }
5. Status endpoint reflects block reason
GET /datasets/:id/publish/status should show:
{
"status": "blocked",
"block_reason": "bids_validation_failed",
"message": "BIDS validation is failing. Please fix validation errors and re-request.",
"ci_url": "https://github.com/nemarDatasets/<id>/actions"
}6. Unblocking
- When user fixes issues and re-requests (
POST /datasets/:id/publish/request), re-run the checks - If CI now passes, transition from
blockedtorequestedand email admins - Alternatively: a webhook on CI success could auto-unblock
Schema Changes
Add to publication_requests table:
block_reason TEXT- why the request is blocked (e.g.,bids_validation_failed,enrichment_incomplete)
Add new status value: blocked (alongside existing requested, approving, published, denied)
Email Policy
- Do NOT email admins when request is blocked (user needs to fix first)
- Do NOT spam users with repeated CI failure emails
- Email user ONCE when request is blocked with clear instructions
- Email admins only when request transitions to
requested(all checks pass)
CLI Changes
nemar dataset publish request should display the block reason:
Publication request blocked: BIDS validation is failing.
Please check CI results: https://github.com/nemarDatasets/nm000112/actions
Fix validation errors and run `nemar dataset publish request` again.
nemar dataset publish status should show block status:
Status: Blocked
Reason: BIDS validation failing
CI: https://github.com/nemarDatasets/nm000112/actions
Implementation Notes
- Reuse existing
checkCIStatus()logic from theci_checkstep in the approve pipeline - The annex pointer issue (BIDS validation CI fails on git-annex pointer files #267) should also be fixed so CI results are meaningful
- Front-loading these checks means admin approve pipeline can skip steps 1-2 if already verified
- Consider: should we also check if dataset has at least one version/tag? Or any other basic readiness?
Related Issues
- BIDS validation CI fails on git-annex pointer files #267 - BIDS validation CI fails on git-annex pointer files (must fix for CI results to be reliable)
- Disable Zenodo integration #268 - Disable Zenodo integration
Metadata
Metadata
Assignees
Labels
No labels
Activity
Block publication requests when BIDS CI is failing
Block publication requests when BIDS CI is failing
Block publication requests when BIDS CI is failing (#274)