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-task is created or reused and tied to a capture-model revision.
- When the user submits (
status = 2), a crowdsourcing-review task 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-task events: madoc-ts.status.-1, .2, .3, .4, plus assignment notifications.
crowdsourcing-review events: madoc-ts.created, .assigned, .status.3.
Critical Decision Points
- Claim allowed vs denied:
canUserClaimResource(...) + project settings + existing subtasks.
- Manifest-vs-canvas contribution model:
claimGranularity and shadow.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.ts checks linked submission revisions for unresolved tabular markers (status = "flag") before assignment, and AutomaticReviewBot.ts also skips submissions with unresolved flags as a safety net. Tabular markers with status = "note" are informational and do not block assignment/auto-review.
Settings With Real Runtime Effect
Treat these as first-class when debugging behavior:
claimGranularity
maxContributionsPerResource
revisionApprovalsRequired
contributionWarningTime
randomlyAssignReviewer
manuallyAssignedReviewer
adminsAreReviewers
modelPageOptions.preventContributionAfterRejection
modelPageOptions.preventContributionAfterSubmission
modelPageOptions.preventMultipleUserSubmissionsPerResource
modelPageOptions.preventContributionAfterManifestUnassign
allowSubmissionsWhenCanvasComplete
shadow.showCaptureModelOnManifest
reviewOptions.allowMerging
reviewOptions.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.generateOnCreate
ProjectTemplate.configuration.tasks.generateOnNewContent
ProjectTemplate.hooks.onCreateReview
ProjectTemplate.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
prepareResourceClaim and createResourceClaim for structure creation and gating.
- Inspect the resulting
crowdsourcing-task state (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.ts and use-manifest-user-tasks.ts if 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
canUserClaimResource and modelPageOptions restrictions.
- 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.ts map task state to UI filter status: 0 available/no bar, 1 in progress, 2 submitted/review, 3 completed. The "show available" filter hides 1,2,3.
Suggested Checks
- Claim same resource twice with different
revisionId and 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.
Source: digirati-co-uk/madoc-platform — distributed by TomeVault.
1---2name: crowdsourcing-task-review-workflow3description: 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. Use when this capability is needed.4---56# Crowdsourcing Task & Review Workflow (Madoc TS)78## Goal9Provide a reliable map of how contribution tasks and review tasks are created, transitioned, and gated by project/template/site settings.1011## Scope12- Claim preparation and task creation decisions13- Task hierarchy creation (project -> manifest/canvas -> user tasks)14- Contribution status transitions and review task creation15- Reviewer assignment, review actions, and merge flow16- Settings that materially affect task/review behavior1718## Non-scope19- Generic queue infrastructure details unrelated to crowdsourcing task types20- Capture model editor UI implementation details21- Non-crowdsourcing task types2223## Primary Entry Points24- Contribution task handler: `services/madoc-ts/src/gateway/tasks/crowdsourcing-task.ts`25- Review task handler: `services/madoc-ts/src/gateway/tasks/crowdsourcing-review.ts`26- Claim routes: `services/madoc-ts/src/routes/projects/create-resource-claim.ts`27- Claim status update: `services/madoc-ts/src/routes/projects/update-resource-claim.ts`28- Reviewer assignment policy: `services/madoc-ts/src/routes/projects/assign-review.ts`29- Revision-task update guard: `services/madoc-ts/src/routes/projects/update-revision-task.ts`30- Claim gating helper: `services/madoc-ts/src/utility/claim-utilities.ts`31- Review action APIs: `services/madoc-ts/src/extensions/capture-models/crowdsourcing-api.ts`32- Project config schema: `services/madoc-ts/src/types/schemas/project-configuration.ts`3334## Read This Next35- Deep pipeline + setting map: `references/pipeline-and-settings.md`3637## Fast Mental Model381. A user starts by preparing/creating a resource claim.392. The claim route ensures task structure exists for project/manifest/canvas, then decides whether user can claim.403. A `crowdsourcing-task` is created or reused and tied to a capture-model revision.414. When the user submits (`status = 2`), a `crowdsourcing-review` task is created/reused.425. Reviewer actions update revisions and push the user task to accepted/rejected/changes requested.436. Parent manifest/canvas tasks and review tasks are synchronized based on subtask completion.4445## Lifecycle Anchors46- `crowdsourcing-task` events: `madoc-ts.status.-1`, `.2`, `.3`, `.4`, plus assignment notifications.47- `crowdsourcing-review` events: `madoc-ts.created`, `.assigned`, `.status.3`.4849## Critical Decision Points50- Claim allowed vs denied: `canUserClaimResource(...)` + project settings + existing subtasks.51- Manifest-vs-canvas contribution model: `claimGranularity` and `shadow.showCaptureModelOnManifest`.52- Review creation on submission: first submit creates review task, subsequent submits reuse existing active review.53- Reviewer selection: random reviewer, manual reviewer, or admin fallback.54- Flagged-cell guard: `assign-review.ts` checks linked submission revisions for unresolved tabular markers (`status = "flag"`) before assignment, and `AutomaticReviewBot.ts` also skips submissions with unresolved flags as a safety net. Tabular markers with `status = "note"` are informational and do not block assignment/auto-review.5556## Settings With Real Runtime Effect57Treat these as first-class when debugging behavior:58- `claimGranularity`59- `maxContributionsPerResource`60- `revisionApprovalsRequired`61- `contributionWarningTime`62- `randomlyAssignReviewer`63- `manuallyAssignedReviewer`64- `adminsAreReviewers`65- `modelPageOptions.preventContributionAfterRejection`66- `modelPageOptions.preventContributionAfterSubmission`67- `modelPageOptions.preventMultipleUserSubmissionsPerResource`68- `modelPageOptions.preventContributionAfterManifestUnassign`69- `allowSubmissionsWhenCanvasComplete`70- `shadow.showCaptureModelOnManifest`71- `reviewOptions.allowMerging`72- `reviewOptions.enableAutoReview`7374See `references/pipeline-and-settings.md` for each setting’s code path.7576## Defined But Currently Not Wired77These appear in project-template types but are not currently enforced in the main runtime path:78- `ProjectTemplate.configuration.tasks.generateOnCreate`79- `ProjectTemplate.configuration.tasks.generateOnNewContent`80- `ProjectTemplate.hooks.onCreateReview`81- `ProjectTemplate.hooks.onAssignReview`8283Do not assume they affect runtime unless you add explicit call sites.8485## Suggested Debug Workflow861. Start with the project config and claim input (`projectId`, `manifestId`, `canvasId`, `revisionId`, `status`).872. Trace `prepareResourceClaim` and `createResourceClaim` for structure creation and gating.883. Inspect the resulting `crowdsourcing-task` state (`revisionId`, `reviewTask`, `userManifestTask`).894. Follow task event handlers (`status.2`, `status.3`, `status.4`, `status.-1`).905. Trace review assignment (`assign-review.ts`) and review actions (`crowdsourcing-api.ts`).916. Validate frontend gating in `use-canvas-user-tasks.ts` and `use-manifest-user-tasks.ts` if behavior looks inconsistent with backend.9293## Pitfalls94- Confusing parent structural tasks (`crowdsourcing-manifest-task`, `crowdsourcing-canvas-task`) with user contribution tasks (`crowdsourcing-task`).95- Debugging claim failures without checking `canUserClaimResource` and `modelPageOptions` restrictions.96- Assuming each submission creates a new review task; the system reuses active review tasks.97- Ignoring manifest-mode behavior (`claimGranularity = manifest`) when diagnosing canvas claim issues.98- On project collection pages and manifest canvas grids, `site-collection.ts` / `site-manifest.ts` map task state to UI filter status: `0` available/no bar, `1` in progress, `2` submitted/review, `3` completed. The "show available" filter hides `1,2,3`.99100## Suggested Checks101- Claim same resource twice with different `revisionId` and verify policy behavior.102- Submit a contribution (`status=2`) and verify review task create/reuse behavior.103- Approve/request-changes/reject and verify user task status and notifications.104- Verify reviewer assignment policy under random/manual/admin fallback settings.105106---107> Source: [digirati-co-uk/madoc-platform](https://github.com/digirati-co-uk/madoc-platform) — distributed by [TomeVault](https://tomevault.io).108<!-- tomevault:4.0:skill_md:2026-06-19 -->