{
  "policy": {
    "version": 5,
    "patterns": {
      "version": 1,
      "method": "CURATED_PRACTICE_TOPIC",
      "notice": "Pattern topics identify design choices to practice. Read the ticket's acceptance criteria and justify the simplest suitable approach. Tags are not capability or ownership evidence; an untagged ticket has no curated pattern topic assigned."
    },
    "fieldMix": {
      "version": 1,
      "method": "CURATED_ESTIMATE",
      "notice": "Field percentages are editorial estimates of the ticket's engineering focus. They total 100%; they are not measured time, proficiency scores, or ownership evidence."
    },
    "contentStatus": "PRACTICE_BRIEF",
    "assessmentStatus": "NOT_QUALIFIED",
    "evidenceUse": "NONE",
    "aiPolicy": "AI tools are welcome during implementation. Record assumptions, review the result, and verify its behavior.",
    "notice": "Fictional engineering practice briefs. Starter repositories, fixtures, automated grading, and verified ownership are not included.",
    "outcomeEvidence": "Tests, patches, and runbooks are requested deliverables. They become Outcome Evidence only through a qualified Mission and immutable Evidence IDs.",
    "ownershipEvidence": "Independent adaptation must be observed under a declared verification policy and cite immutable Evidence IDs. Completing a planning ticket establishes no Ownership Evidence."
  },
  "patternTopics": [
    {
      "id": "factory-method",
      "label": "Factory Method",
      "group": "Creational"
    },
    {
      "id": "abstract-factory",
      "label": "Abstract Factory",
      "group": "Creational"
    },
    {
      "id": "builder",
      "label": "Builder",
      "group": "Creational"
    },
    {
      "id": "prototype",
      "label": "Prototype",
      "group": "Creational"
    },
    {
      "id": "singleton",
      "label": "Singleton",
      "group": "Creational"
    },
    {
      "id": "adapter",
      "label": "Adapter",
      "group": "Structural"
    },
    {
      "id": "bridge",
      "label": "Bridge",
      "group": "Structural"
    },
    {
      "id": "composite",
      "label": "Composite",
      "group": "Structural"
    },
    {
      "id": "decorator",
      "label": "Decorator",
      "group": "Structural"
    },
    {
      "id": "facade",
      "label": "Facade",
      "group": "Structural"
    },
    {
      "id": "flyweight",
      "label": "Flyweight",
      "group": "Structural"
    },
    {
      "id": "proxy",
      "label": "Proxy",
      "group": "Structural"
    },
    {
      "id": "chain-of-responsibility",
      "label": "Chain of Responsibility",
      "group": "Behavioral"
    },
    {
      "id": "command",
      "label": "Command",
      "group": "Behavioral"
    },
    {
      "id": "interpreter",
      "label": "Interpreter",
      "group": "Behavioral"
    },
    {
      "id": "iterator",
      "label": "Iterator",
      "group": "Behavioral"
    },
    {
      "id": "mediator",
      "label": "Mediator",
      "group": "Behavioral"
    },
    {
      "id": "memento",
      "label": "Memento",
      "group": "Behavioral"
    },
    {
      "id": "observer",
      "label": "Observer",
      "group": "Behavioral"
    },
    {
      "id": "state",
      "label": "State",
      "group": "Behavioral"
    },
    {
      "id": "strategy",
      "label": "Strategy",
      "group": "Behavioral"
    },
    {
      "id": "template-method",
      "label": "Template Method",
      "group": "Behavioral"
    },
    {
      "id": "visitor",
      "label": "Visitor",
      "group": "Behavioral"
    },
    {
      "id": "ports-and-adapters",
      "label": "Ports and Adapters",
      "group": "Architectural"
    },
    {
      "id": "cqrs",
      "label": "CQRS",
      "group": "Architectural"
    },
    {
      "id": "strangler-fig",
      "label": "Strangler Fig",
      "group": "Architectural"
    },
    {
      "id": "saga",
      "label": "Saga",
      "group": "Distributed and reliability"
    },
    {
      "id": "transactional-outbox",
      "label": "Transactional Outbox",
      "group": "Distributed and reliability"
    },
    {
      "id": "circuit-breaker",
      "label": "Circuit Breaker",
      "group": "Distributed and reliability"
    },
    {
      "id": "bulkhead",
      "label": "Bulkhead",
      "group": "Distributed and reliability"
    }
  ],
  "projects": [
    {
      "id": "e8d4d766-7d14-42f3-a64d-e082f72919f3",
      "key": "ACLAIM",
      "title": "Make a database-backed work assignment queue correct",
      "field": "Database engineering",
      "summary": "Claim, renew and finish work without duplicate authority or stranded assignments.",
      "context": "A fictional inspection service assigns review jobs to staff. Polling clients sometimes claim the same job and a disconnected client can finish work after reassignment.",
      "stack": [
        "PostgreSQL",
        "TypeScript"
      ],
      "prerequisites": [
        "Create synthetic jobs and two independent database clients.",
        "Use explicit state methods and an injected clock."
      ],
      "developerValue": "Practice database concurrency, leases and transactional invariants.",
      "companyValue": "Review whether assignment authority remains reliable during contention and recovery.",
      "delivery": "Ten scoped tickets across three phases. Build a synthetic local service or select a ticket after recreating its prerequisites; estimates exclude setup.",
      "phases": [
        {
          "id": "model",
          "title": "Define assignment invariants",
          "goal": "Represent queue order, ownership and deadlines."
        },
        {
          "id": "claim",
          "title": "Protect concurrent transitions",
          "goal": "Claim, renew and finish with durable authority."
        },
        {
          "id": "recover",
          "title": "Recover stale work",
          "goal": "Inspect contention and repair expired assignments."
        }
      ],
      "tickets": [
        {
          "id": "3fdfabc0-ac34-411a-8ead-76434d07a940",
          "key": "ACLAIM-101",
          "title": "Define assignment states and their required database fields",
          "type": "TASK",
          "priority": "MEDIUM",
          "difficulty": "FOUNDATIONAL",
          "estimateMinutes": 90,
          "phaseId": "model",
          "dependsOn": [],
          "scenario": "Rows marked assigned sometimes have no assignee or lease deadline, making recovery ambiguous.",
          "acceptanceCriteria": [
            "Specify pending, assigned and terminal field invariants.",
            "Add checks that reject contradictory state combinations.",
            "Keep completion metadata distinct from lease metadata."
          ],
          "implementationNotes": [
            "Use migration-backed constraints where practical."
          ],
          "verification": [
            "Insert each valid synthetic state.",
            "Attempt assigned without an assignee or deadline and verify rejection."
          ],
          "deliverables": [
            "Assignment schema and constraint matrix"
          ],
          "rollout": "Apply constraints after inspecting synthetic legacy rows; quarantine invalid states before enabling writes.",
          "skills": [
            "Data modeling",
            "Check constraints"
          ],
          "fieldMix": [
            {
              "field": "Database engineering",
              "percentage": 80
            },
            {
              "field": "Backend",
              "percentage": 20
            }
          ],
          "patterns": []
        },
        {
          "id": "704313f1-6190-4f2a-bad7-d310e9a36f98",
          "key": "ACLAIM-102",
          "title": "Order eligible jobs with a stable tie break",
          "type": "TASK",
          "priority": "MEDIUM",
          "difficulty": "FOUNDATIONAL",
          "estimateMinutes": 75,
          "phaseId": "model",
          "dependsOn": [
            "ACLAIM-101"
          ],
          "scenario": "Jobs created at the same instant appear in a different order on each poll, making starvation difficult to reproduce.",
          "acceptanceCriteria": [
            "Order by declared priority, ready time and opaque job ID.",
            "Exclude future and terminal jobs explicitly.",
            "Bound claim candidate count."
          ],
          "implementationNotes": [
            "Document whether priority changes preserve or reset waiting time."
          ],
          "verification": [
            "Create equal-time jobs and observe stable order.",
            "Include future and completed jobs and verify they are ineligible."
          ],
          "deliverables": [
            "Eligibility query and ordering fixtures"
          ],
          "rollout": "Introduce the query in read-only inspection first; restore previous routing on semantic mismatch.",
          "skills": [
            "SQL ordering",
            "Queue semantics"
          ],
          "fieldMix": [
            {
              "field": "Database engineering",
              "percentage": 80
            },
            {
              "field": "Backend",
              "percentage": 20
            }
          ],
          "patterns": []
        },
        {
          "id": "77ecfee2-4d60-445e-a219-96537d7e030c",
          "key": "ACLAIM-103",
          "title": "Scope work assignment queries to the operator's organization",
          "type": "BUG",
          "priority": "HIGH",
          "difficulty": "INTERMEDIATE",
          "estimateMinutes": 150,
          "phaseId": "model",
          "dependsOn": [
            "ACLAIM-101",
            "ACLAIM-102"
          ],
          "scenario": "The job list is scoped in the controller, but the claim repository accepts a globally valid job ID.",
          "acceptanceCriteria": [
            "Require organization scope at repository entry.",
            "Claim and detail queries enforce that scope.",
            "Return no other-organization job metadata on denial."
          ],
          "implementationNotes": [
            "Test direct repository calls as well as API routes."
          ],
          "verification": [
            "Claim a permitted synthetic job.",
            "Claim another organization's ID and verify unchanged row state."
          ],
          "deliverables": [
            "Tenant-scoped assignment repository"
          ],
          "rollout": "Deploy repository guards before broader polling; inspect safe denial counters.",
          "skills": [
            "Tenant isolation",
            "Repository design"
          ],
          "fieldMix": [
            {
              "field": "Security",
              "percentage": 50
            },
            {
              "field": "Database engineering",
              "percentage": 30
            },
            {
              "field": "Backend",
              "percentage": 20
            }
          ],
          "patterns": []
        },
        {
          "id": "3bb8c64d-f79d-4857-b0c8-4bb2d8afbcf6",
          "key": "ACLAIM-104",
          "title": "Claim one pending job atomically under competing pollers",
          "type": "STORY",
          "priority": "HIGH",
          "difficulty": "ADVANCED",
          "estimateMinutes": 240,
          "phaseId": "claim",
          "dependsOn": [
            "ACLAIM-102",
            "ACLAIM-103"
          ],
          "scenario": "Two polling clients select the same pending job before either writes its assignment.",
          "acceptanceCriteria": [
            "Select and transition a job within one transaction.",
            "Use a database locking strategy with documented contention behavior.",
            "Return distinct jobs or no work under concurrent pollers."
          ],
          "implementationNotes": [
            "Evaluate SKIP LOCKED against the declared ordering and fairness policy."
          ],
          "verification": [
            "Start two clients at a barrier and assert unique claimed identities.",
            "Hold one candidate lock and verify the documented skip or wait behavior."
          ],
          "deliverables": [
            "Atomic claim query and concurrency test"
          ],
          "rollout": "Canary with two synthetic pollers; reduce concurrency if lock behavior violates the contract.",
          "skills": [
            "Row locking",
            "Transactions"
          ],
          "fieldMix": [
            {
              "field": "Database engineering",
              "percentage": 100
            }
          ],
          "patterns": []
        },
        {
          "id": "e33cbcfb-a0b1-47c3-a559-cfbd23e17a4b",
          "key": "ACLAIM-105",
          "title": "Issue a monotonically increasing assignment generation on every reclaim",
          "type": "TASK",
          "priority": "MEDIUM",
          "difficulty": "ADVANCED",
          "estimateMinutes": 210,
          "phaseId": "claim",
          "dependsOn": [
            "ACLAIM-104"
          ],
          "scenario": "A disconnected reviewer reconnects after its job was reassigned and still holds a token that appears current.",
          "acceptanceCriteria": [
            "Every new assignment increments a durable generation.",
            "Mutation commands require job, assignee and generation.",
            "A stale generation cannot renew or finish work."
          ],
          "implementationNotes": [
            "Treat the generation as authority, not a UI-only counter."
          ],
          "verification": [
            "Reclaim a job and complete using the new generation.",
            "Try completion from the previous generation and reject it."
          ],
          "deliverables": [
            "Assignment-generation guard"
          ],
          "rollout": "Enable guarded writes before automated reclaim; retain old assignment history.",
          "skills": [
            "Fencing",
            "Optimistic concurrency"
          ],
          "fieldMix": [
            {
              "field": "Database engineering",
              "percentage": 60
            },
            {
              "field": "Distributed systems",
              "percentage": 40
            }
          ],
          "patterns": []
        },
        {
          "id": "f0d3bed7-ee11-45b6-95b6-450478e4848d",
          "key": "ACLAIM-106",
          "title": "Renew assignment leases without extending a completed job",
          "type": "BUG",
          "priority": "MEDIUM",
          "difficulty": "INTERMEDIATE",
          "estimateMinutes": 150,
          "phaseId": "claim",
          "dependsOn": [
            "ACLAIM-104",
            "ACLAIM-105"
          ],
          "scenario": "A late heartbeat runs after completion and changes the row back into an apparently active assignment.",
          "acceptanceCriteria": [
            "Renew only the current assigned generation.",
            "Never modify terminal completion fields.",
            "Bound extension duration using the server's clock."
          ],
          "implementationNotes": [
            "Use one guarded update rather than read-then-write status changes."
          ],
          "verification": [
            "Renew a valid active assignment.",
            "Complete first, then send a delayed renewal and preserve terminal state."
          ],
          "deliverables": [
            "Lease renewal command and stale-heartbeat test"
          ],
          "rollout": "Canary renewal with short synthetic leases; pause renewal on unexpected transition conflicts.",
          "skills": [
            "Guarded updates",
            "Lease semantics"
          ],
          "fieldMix": [
            {
              "field": "Database engineering",
              "percentage": 60
            },
            {
              "field": "Distributed systems",
              "percentage": 40
            }
          ],
          "patterns": []
        },
        {
          "id": "c7918dc1-bca9-4a84-9c19-c3df31ba0a27",
          "key": "ACLAIM-107",
          "title": "Finish a job and publish its result reference in one transaction",
          "type": "STORY",
          "priority": "MEDIUM",
          "difficulty": "EXPERT",
          "estimateMinutes": 300,
          "phaseId": "claim",
          "dependsOn": [
            "ACLAIM-105",
            "ACLAIM-106"
          ],
          "scenario": "A result is visible while its job remains assigned because completion and result linking commit separately.",
          "acceptanceCriteria": [
            "Check assignment authority and lease at commit.",
            "Commit terminal state and result reference atomically.",
            "Duplicate identical completion returns the original outcome."
          ],
          "implementationNotes": [
            "Keep result bytes outside the database transaction; link only verified immutable identity."
          ],
          "verification": [
            "Complete a valid assignment with one result reference.",
            "Force transaction failure and verify neither completion nor result publication persists."
          ],
          "deliverables": [
            "Completion transaction and rollback tests"
          ],
          "rollout": "Enable completion on synthetic jobs; suspend writes if authority or result verification is unavailable.",
          "skills": [
            "Transactions",
            "Result integrity"
          ],
          "fieldMix": [
            {
              "field": "Database engineering",
              "percentage": 80
            },
            {
              "field": "Backend",
              "percentage": 20
            }
          ],
          "patterns": []
        },
        {
          "id": "c83603c3-ca94-44c8-8148-b83ebb148a1f",
          "key": "ACLAIM-108",
          "title": "Reclaim expired assignments using current row authority",
          "type": "TASK",
          "priority": "MEDIUM",
          "difficulty": "ADVANCED",
          "estimateMinutes": 210,
          "phaseId": "recover",
          "dependsOn": [
            "ACLAIM-105",
            "ACLAIM-106",
            "ACLAIM-107"
          ],
          "scenario": "A sweep selects expired jobs, then reclaims one that was renewed before its update executes.",
          "acceptanceCriteria": [
            "Recheck generation, assigned state and expiry in the reclaim update.",
            "Record previous ownership as immutable history.",
            "Bound each sweep and expose skipped renewals."
          ],
          "implementationNotes": [
            "Use a controlled clock and barrier for the renewal race."
          ],
          "verification": [
            "Reclaim a truly expired assignment.",
            "Renew between scan and update and verify reclaim skips it."
          ],
          "deliverables": [
            "Expiry reclaimer and race regression"
          ],
          "rollout": "Dry-run selected rows first; pause sweeps when clock or ownership checks disagree.",
          "skills": [
            "Concurrency",
            "Recovery"
          ],
          "fieldMix": [
            {
              "field": "Database engineering",
              "percentage": 70
            },
            {
              "field": "Distributed systems",
              "percentage": 30
            }
          ],
          "patterns": []
        },
        {
          "id": "b876e3a6-6868-445d-a485-7abebd6a5e0d",
          "key": "ACLAIM-109",
          "title": "Measure assignment lock behavior without claiming a throughput guarantee",
          "type": "CHORE",
          "priority": "MEDIUM",
          "difficulty": "INTERMEDIATE",
          "estimateMinutes": 180,
          "phaseId": "recover",
          "dependsOn": [
            "ACLAIM-104",
            "ACLAIM-108"
          ],
          "scenario": "Operators need to choose a polling interval and concurrency limit based on observed contention in the local prototype.",
          "acceptanceCriteria": [
            "Record database/runtime versions and synthetic job count.",
            "Measure lock waits and claim outcomes at fixed concurrency levels.",
            "Keep correctness assertions enabled during every run."
          ],
          "implementationNotes": [
            "Repeat each local condition three times; results describe only that environment."
          ],
          "verification": [
            "Run identical workloads at one and four pollers and record observations.",
            "Hold a long transaction and verify timeouts remain bounded without duplicate claims."
          ],
          "deliverables": [
            "Contention probe and observation report"
          ],
          "rollout": "Use observations to propose conservative local limits; restore lower concurrency if claim failures rise.",
          "skills": [
            "Database observability",
            "Concurrency testing"
          ],
          "fieldMix": [
            {
              "field": "Database engineering",
              "percentage": 50
            },
            {
              "field": "Performance engineering",
              "percentage": 30
            },
            {
              "field": "Quality engineering",
              "percentage": 20
            }
          ],
          "patterns": []
        },
        {
          "id": "8dbbb2d8-bdfa-4774-ab18-443677a49385",
          "key": "ACLAIM-110",
          "title": "Rehearse recovery of a queue with mixed expired and terminal jobs",
          "type": "TASK",
          "priority": "MEDIUM",
          "difficulty": "EXPERT",
          "estimateMinutes": 300,
          "phaseId": "recover",
          "dependsOn": [
            "ACLAIM-107",
            "ACLAIM-108",
            "ACLAIM-109"
          ],
          "scenario": "After an outage, operators need to resume assignments without redoing completed work or accepting stale reviewer results.",
          "acceptanceCriteria": [
            "Classify terminal, live and expired assignments from durable fields.",
            "Reclaim only expired authority and preserve terminal results.",
            "Report inconsistent rows instead of silently normalizing them."
          ],
          "implementationNotes": [
            "Use a fabricated outage dataset with one contradictory row."
          ],
          "verification": [
            "Recover valid mixed states and finish one reclaimed job.",
            "Submit a stale completion and inspect the contradictory row report."
          ],
          "deliverables": [
            "Queue recovery runbook and executable drill"
          ],
          "rollout": "Run the drill before increasing concurrency; keep uncertain jobs quarantined for review.",
          "skills": [
            "Recovery",
            "Data integrity"
          ],
          "fieldMix": [
            {
              "field": "Database engineering",
              "percentage": 60
            },
            {
              "field": "Site reliability",
              "percentage": 40
            }
          ],
          "patterns": []
        }
      ]
    }
  ]
}
