name: crowdsourcing-task-review-workflow description: Understand and modify the full Madoc TS crowdsourcing contribution and review pipeline. Use when changing claim creation rules, crowdsourcing-task and crowdsourcing-review lifecycle behavior, reviewer assignment policy, or project settings that control submission/review flow in services/madoc-ts.
Crowdsourcing Task & Review Workflow (Madoc TS)
Goal
Provide a reliable map of how contribution tasks and review tasks are created, transitioned, and gated by project/template/site settings.
Scope
- Claim preparation and task creation decisions
- Task hierarchy creation (project -> manifest/canvas -> user tasks)
- Contribution status transitions and review task creation
- Reviewer assignment, review actions, and merge flow
- Settings that materially affect task/review behavior
Non-scope
- Generic queue infrastructure details unrelated to crowdsourcing task types
- Capture model editor UI implementation details
- Non-crowdsourcing task types
Primary Entry Points
- Contribution task handler:
services/madoc-ts/src/gateway/tasks/crowdsourcing-task.ts - Review task handler:
services/madoc-ts/src/gateway/tasks/crowdsourcing-review.ts - Claim routes:
services/madoc-ts/src/routes/projects/create-resource-claim.ts - Claim status update:
services/madoc-ts/src/routes/projects/update-resource-claim.ts - Reviewer assignment policy:
services/madoc-ts/src/routes/projects/assign-review.ts - Revision-task update guard:
services/madoc-ts/src/routes/projects/update-revision-task.ts - Claim gating helper:
services/madoc-ts/src/utility/claim-utilities.ts - Review action APIs:
services/madoc-ts/src/extensions/capture-models/crowdsourcing-api.ts - Project config schema:
services/madoc-ts/src/types/schemas/project-configuration.ts
Read This Next
- Deep pipeline + setting map:
references/pipeline-and-settings.md
Fast Mental Model
- A user starts by preparing/creating a resource claim.
- The claim route ensures task structure exists for project/manifest/canvas, then decides whether user can claim.
- A
crowdsourcing-taskis created or reused and tied to a capture-model revision. - When the user submits (
status = 2), acrowdsourcing-reviewtask is created/reused. - Reviewer actions update revisions and push the user task to accepted/rejected/changes requested.
- Parent manifest/canvas tasks and review tasks are synchronized based on subtask completion.
Lifecycle Anchors
crowdsourcing-taskevents:madoc-ts.status.-1,.2,.3,.4, plus assignment notifications.crowdsourcing-reviewevents:madoc-ts.created,.assigned,.status.3.
Critical Decision Points
- Claim allowed vs denied:
canUserClaimResource(...)+ project settings + existing subtasks. - Manifest-vs-canvas contribution model:
claimGranularityandshadow.showCaptureModelOnManifest. - Review creation on submission: first submit creates review task, subsequent submits reuse existing active review.
- Reviewer selection: random reviewer, manual reviewer, or admin fallback.
- Flagged-cell guard:
assign-review.tschecks linked submission revisions for unresolved tabular markers (status = "flag") before assignment, andAutomaticReviewBot.tsalso skips submissions with unresolved flags as a safety net. Tabular markers withstatus = "note"are informational and do not block assignment/auto-review.
Settings With Real Runtime Effect
Treat these as first-class when debugging behavior:
claimGranularitymaxContributionsPerResourcerevisionApprovalsRequiredcontributionWarningTimerandomlyAssignReviewermanuallyAssignedRevieweradminsAreReviewersmodelPageOptions.preventContributionAfterRejectionmodelPageOptions.preventContributionAfterSubmissionmodelPageOptions.preventMultipleUserSubmissionsPerResourcemodelPageOptions.preventContributionAfterManifestUnassignallowSubmissionsWhenCanvasCompleteshadow.showCaptureModelOnManifestreviewOptions.allowMergingreviewOptions.enableAutoReview
See references/pipeline-and-settings.md for each setting’s code path.
Defined But Currently Not Wired
These appear in project-template types but are not currently enforced in the main runtime path:
ProjectTemplate.configuration.tasks.generateOnCreateProjectTemplate.configuration.tasks.generateOnNewContentProjectTemplate.hooks.onCreateReviewProjectTemplate.hooks.onAssignReview
Do not assume they affect runtime unless you add explicit call sites.
Suggested Debug Workflow
- Start with the project config and claim input (
projectId,manifestId,canvasId,revisionId,status). - Trace
prepareResourceClaimandcreateResourceClaimfor structure creation and gating. - Inspect the resulting
crowdsourcing-taskstate (revisionId,reviewTask,userManifestTask). - Follow task event handlers (
status.2,status.3,status.4,status.-1). - Trace review assignment (
assign-review.ts) and review actions (crowdsourcing-api.ts). - Validate frontend gating in
use-canvas-user-tasks.tsanduse-manifest-user-tasks.tsif behavior looks inconsistent with backend.
Pitfalls
- Confusing parent structural tasks (
crowdsourcing-manifest-task,crowdsourcing-canvas-task) with user contribution tasks (crowdsourcing-task). - Debugging claim failures without checking
canUserClaimResourceandmodelPageOptionsrestrictions. - Assuming each submission creates a new review task; the system reuses active review tasks.
- Ignoring manifest-mode behavior (
claimGranularity = manifest) when diagnosing canvas claim issues. - On project collection pages and manifest canvas grids,
site-collection.ts/site-manifest.tsmap task state to UI filter status:0available/no bar,1in progress,2submitted/review,3completed. The "show available" filter hides1,2,3.
Suggested Checks
- Claim same resource twice with different
revisionIdand verify policy behavior. - Submit a contribution (
status=2) and verify review task create/reuse behavior. - Approve/request-changes/reject and verify user task status and notifications.
- Verify reviewer assignment policy under random/manual/admin fallback settings.