{
  "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": "3ec41d1b-c6a4-4952-bbe9-7e76f0467449",
      "key": "ALEASE",
      "title": "Coordinate scheduled maintenance with fenced leases",
      "field": "Distributed systems",
      "summary": "Elect one active scheduler while preventing expired owners from mutating shared state.",
      "context": "A fictional document service runs periodic retention planning on multiple application instances. Paused instances resume after lease expiry and can overlap newer schedulers.",
      "stack": [
        "TypeScript",
        "PostgreSQL"
      ],
      "prerequisites": [
        "Create a synthetic maintenance queue and two independent scheduler clients.",
        "Use fake time where possible and no destructive real retention actions."
      ],
      "developerValue": "Practice lease assumptions, fencing and stale-owner rejection.",
      "companyValue": "Review safe coordination that remains explainable under pauses 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": "authority",
          "title": "Define scheduler authority",
          "goal": "Model lease identity, expiry and protected actions."
        },
        {
          "id": "coordination",
          "title": "Guard competing owners",
          "goal": "Acquire, renew and execute with fencing."
        },
        {
          "id": "failure",
          "title": "Exercise time and connection failures",
          "goal": "Reconcile ownership and recover interrupted runs."
        }
      ],
      "tickets": [
        {
          "id": "137c560f-3b37-4f30-8426-546e3aa40870",
          "key": "ALEASE-101",
          "title": "Specify scheduler lease state with a separate authority epoch",
          "type": "TASK",
          "priority": "MEDIUM",
          "difficulty": "FOUNDATIONAL",
          "estimateMinutes": 90,
          "phaseId": "authority",
          "dependsOn": [],
          "scenario": "The scheduler table stores only owner name and expiry, so an old owner can appear identical to a later process with the same name.",
          "acceptanceCriteria": [
            "Include lease identity, holder instance, expiry and monotonic epoch.",
            "Define active and expired semantics at the exact boundary.",
            "Keep display names outside authority checks."
          ],
          "implementationNotes": [
            "Use opaque process-instance identities."
          ],
          "verification": [
            "Represent two successive owners with distinct epochs.",
            "Reuse a display name and verify it cannot impersonate the previous instance."
          ],
          "deliverables": [
            "Lease schema and authority contract"
          ],
          "rollout": "Review the schema before scheduler writes; leave coordination disabled until epoch checks exist.",
          "skills": [
            "Lease modeling",
            "Identity"
          ],
          "fieldMix": [
            {
              "field": "Distributed systems",
              "percentage": 100
            }
          ],
          "patterns": []
        },
        {
          "id": "0c584b13-0bed-4295-8275-3a3727ee254b",
          "key": "ALEASE-102",
          "title": "Use one authoritative clock boundary for lease decisions",
          "type": "TASK",
          "priority": "MEDIUM",
          "difficulty": "INTERMEDIATE",
          "estimateMinutes": 150,
          "phaseId": "authority",
          "dependsOn": [
            "ALEASE-101"
          ],
          "scenario": "Two instances disagree about lease expiry because their local clocks differ by several seconds.",
          "acceptanceCriteria": [
            "Define the clock used for acquisition and expiry checks.",
            "Keep client clock readings out of authority decisions.",
            "Document pause and network-delay assumptions."
          ],
          "implementationNotes": [
            "Prefer database time within the transaction for this local PostgreSQL exercise."
          ],
          "verification": [
            "Skew client clocks and obtain the same database lease decision.",
            "Reach exact expiry and verify the documented eligibility boundary."
          ],
          "deliverables": [
            "Clock-bound lease queries and skew test"
          ],
          "rollout": "Canary lease reads under controlled skew; stop acquisition if authoritative time is unavailable.",
          "skills": [
            "Clock semantics",
            "Distributed assumptions"
          ],
          "fieldMix": [
            {
              "field": "Distributed systems",
              "percentage": 100
            }
          ],
          "patterns": []
        },
        {
          "id": "4ad58e6e-5ca0-4354-b547-5799b106f722",
          "key": "ALEASE-103",
          "title": "Classify maintenance actions that require fencing before side effects",
          "type": "TASK",
          "priority": "MEDIUM",
          "difficulty": "FOUNDATIONAL",
          "estimateMinutes": 90,
          "phaseId": "authority",
          "dependsOn": [
            "ALEASE-101",
            "ALEASE-102"
          ],
          "scenario": "The design adds a lease but assumes every downstream operation automatically knows whether its caller is still leader.",
          "acceptanceCriteria": [
            "List each protected mutation and its fencing check location.",
            "Separate read-only planning from state-changing execution.",
            "Mark unfenceable external effects as unresolved."
          ],
          "implementationNotes": [
            "Use synthetic retention plans; delete no real objects."
          ],
          "verification": [
            "Trace a plan-state update to its epoch guard.",
            "Identify an external adapter without epoch support and block its destructive action."
          ],
          "deliverables": [
            "Fencing coverage matrix"
          ],
          "rollout": "Require coverage before enabling actions; keep unresolved provider operations read-only.",
          "skills": [
            "Boundary analysis",
            "Fencing"
          ],
          "fieldMix": [
            {
              "field": "Distributed systems",
              "percentage": 60
            },
            {
              "field": "System design",
              "percentage": 40
            }
          ],
          "patterns": []
        },
        {
          "id": "1979cc45-8d18-4b81-a5b1-e35cf93ee238",
          "key": "ALEASE-104",
          "title": "Acquire a scheduler lease atomically under competing instances",
          "type": "STORY",
          "priority": "HIGH",
          "difficulty": "ADVANCED",
          "estimateMinutes": 210,
          "phaseId": "coordination",
          "dependsOn": [
            "ALEASE-102",
            "ALEASE-103"
          ],
          "scenario": "Two instances see an expired lease and both believe they became the active scheduler.",
          "acceptanceCriteria": [
            "Acquire through one guarded database transaction.",
            "Increment the epoch only for the winning acquisition.",
            "Return current safe ownership metadata to the loser."
          ],
          "implementationNotes": [
            "Use two independent database connections and a barrier."
          ],
          "verification": [
            "Race two acquisitions and assert one winning epoch.",
            "Hold a valid lease and verify another instance cannot replace it early."
          ],
          "deliverables": [
            "Atomic acquisition command and race test"
          ],
          "rollout": "Canary with two local clients; stop scheduling if ownership results conflict.",
          "skills": [
            "Transactions",
            "Leader coordination"
          ],
          "fieldMix": [
            {
              "field": "Distributed systems",
              "percentage": 60
            },
            {
              "field": "Database engineering",
              "percentage": 40
            }
          ],
          "patterns": []
        },
        {
          "id": "40de2d15-5509-4231-b50e-871b4d3f67be",
          "key": "ALEASE-105",
          "title": "Renew a scheduler lease only for the current holder and epoch",
          "type": "BUG",
          "priority": "MEDIUM",
          "difficulty": "INTERMEDIATE",
          "estimateMinutes": 150,
          "phaseId": "coordination",
          "dependsOn": [
            "ALEASE-104"
          ],
          "scenario": "A delayed renewal from an earlier process extends the newest owner's lease row while reporting success to the stale process.",
          "acceptanceCriteria": [
            "Match holder instance and epoch in the renewal update.",
            "Bound extension duration from the authoritative clock.",
            "Return lost authority when no matching active lease exists."
          ],
          "implementationNotes": [
            "Never renew solely by a shared scheduler name."
          ],
          "verification": [
            "Renew the current owner successfully.",
            "Acquire a newer epoch, then submit the old renewal and reject it."
          ],
          "deliverables": [
            "Guarded renewal and stale-message test"
          ],
          "rollout": "Enable guarded renewal before automated scheduling; make authority loss stop further work claims.",
          "skills": [
            "Guarded updates",
            "Lease renewal"
          ],
          "fieldMix": [
            {
              "field": "Distributed systems",
              "percentage": 70
            },
            {
              "field": "Database engineering",
              "percentage": 30
            }
          ],
          "patterns": []
        },
        {
          "id": "58209b0c-92e2-4cee-b9bb-9cfb19f4e7a6",
          "key": "ALEASE-106",
          "title": "Fence maintenance writes after a paused scheduler resumes",
          "type": "TASK",
          "priority": "HIGH",
          "difficulty": "EXPERT",
          "estimateMinutes": 300,
          "phaseId": "coordination",
          "dependsOn": [
            "ALEASE-103",
            "ALEASE-104",
            "ALEASE-105"
          ],
          "scenario": "A scheduler pauses past expiry, then resumes a previously prepared plan after another instance has taken over.",
          "acceptanceCriteria": [
            "Every protected write checks current authority epoch.",
            "A stale owner cannot complete or activate a plan.",
            "Record rejected stale activity without overwriting current progress."
          ],
          "implementationNotes": [
            "Carry epoch through the command and recheck at commit."
          ],
          "verification": [
            "Pause owner A, let B acquire, then finish B's plan.",
            "Resume A and verify its write is rejected even if it began earlier."
          ],
          "deliverables": [
            "Commit-time fencing and pause reproduction"
          ],
          "rollout": "Canary synthetic plan activation; disable unfenced writes until every path passes the stale-owner probe.",
          "skills": [
            "Fencing",
            "Concurrency"
          ],
          "fieldMix": [
            {
              "field": "Distributed systems",
              "percentage": 70
            },
            {
              "field": "Database engineering",
              "percentage": 30
            }
          ],
          "patterns": []
        },
        {
          "id": "42696a4d-e7ab-4989-96d5-836fc981be39",
          "key": "ALEASE-107",
          "title": "Make scheduled maintenance occurrences idempotent across leadership changes",
          "type": "STORY",
          "priority": "MEDIUM",
          "difficulty": "ADVANCED",
          "estimateMinutes": 240,
          "phaseId": "coordination",
          "dependsOn": [
            "ALEASE-104",
            "ALEASE-106"
          ],
          "scenario": "A new leader repeats the current maintenance period and creates a second plan for the same logical occurrence.",
          "acceptanceCriteria": [
            "Derive occurrence identity from schedule and intended UTC instant.",
            "Enforce one durable logical run per occurrence.",
            "Allow a new owner to resume existing nonterminal work safely."
          ],
          "implementationNotes": [
            "Do not derive identity from acquisition time or process name."
          ],
          "verification": [
            "Change leader midway through an occurrence and retain one run.",
            "Retry a terminal occurrence and return its recorded result."
          ],
          "deliverables": [
            "Occurrence identity contract and leader-change test"
          ],
          "rollout": "Enable idempotent creation before multi-instance operation; reconcile existing duplicates through read-only reports.",
          "skills": [
            "Idempotency",
            "Scheduling"
          ],
          "fieldMix": [
            {
              "field": "Distributed systems",
              "percentage": 60
            },
            {
              "field": "Database engineering",
              "percentage": 40
            }
          ],
          "patterns": []
        },
        {
          "id": "3db026fe-17be-43ce-b013-09293946383b",
          "key": "ALEASE-108",
          "title": "Expose lease health without implying the holder is making progress",
          "type": "STORY",
          "priority": "MEDIUM",
          "difficulty": "FOUNDATIONAL",
          "estimateMinutes": 90,
          "phaseId": "failure",
          "dependsOn": [
            "ALEASE-105",
            "ALEASE-106",
            "ALEASE-107"
          ],
          "scenario": "A scheduler renews its lease while stuck on one task, so the status page incorrectly reports healthy processing.",
          "acceptanceCriteria": [
            "Report lease authority and work-progress timestamps separately.",
            "Distinguish no leader, active leader and stalled work.",
            "Keep unknown progress explicit after observation gaps."
          ],
          "implementationNotes": [
            "Use safe instance tokens rather than host secrets."
          ],
          "verification": [
            "Show an active progressing scheduler.",
            "Freeze progress while renewing the lease and show stalled work."
          ],
          "deliverables": [
            "Scheduler status projection"
          ],
          "rollout": "Add status before alert thresholds; disable noisy alerts while retaining raw safe state.",
          "skills": [
            "Observability",
            "Health semantics"
          ],
          "fieldMix": [
            {
              "field": "Distributed systems",
              "percentage": 50
            },
            {
              "field": "Site reliability",
              "percentage": 50
            }
          ],
          "patterns": []
        },
        {
          "id": "25e5fff8-6453-4db5-8197-414afa1d2b75",
          "key": "ALEASE-109",
          "title": "Recover coordination after a database connection partition",
          "type": "TASK",
          "priority": "MEDIUM",
          "difficulty": "EXPERT",
          "estimateMinutes": 300,
          "phaseId": "failure",
          "dependsOn": [
            "ALEASE-102",
            "ALEASE-106",
            "ALEASE-108"
          ],
          "scenario": "An instance loses database connectivity but can still contact the fake work provider, raising the risk of acting on expired authority.",
          "acceptanceCriteria": [
            "Stop new protected actions when authority cannot be verified.",
            "Reconcile lease and run state after reconnection.",
            "Resume only under a current valid epoch."
          ],
          "implementationNotes": [
            "Use controlled local adapter disconnection, not real network disruption."
          ],
          "verification": [
            "Disconnect one owner, acquire with another, and continue valid work.",
            "Reconnect the old owner and reject its cached authority before any action."
          ],
          "deliverables": [
            "Partition drill and authority recovery trace"
          ],
          "rollout": "Run before multi-instance scheduling; fail closed on unresolved ownership.",
          "skills": [
            "Network partitions",
            "Recovery"
          ],
          "fieldMix": [
            {
              "field": "Distributed systems",
              "percentage": 60
            },
            {
              "field": "Networking",
              "percentage": 20
            },
            {
              "field": "Site reliability",
              "percentage": 20
            }
          ],
          "patterns": []
        },
        {
          "id": "80c76564-4352-4b87-b27e-9820f241ff7e",
          "key": "ALEASE-110",
          "title": "Document lease guarantees and the provider conditions they depend on",
          "type": "CHORE",
          "priority": "MEDIUM",
          "difficulty": "INTERMEDIATE",
          "estimateMinutes": 150,
          "phaseId": "failure",
          "dependsOn": [
            "ALEASE-103",
            "ALEASE-107",
            "ALEASE-109"
          ],
          "scenario": "A release note says exactly one scheduler runs, even though stale processes may execute until downstream fences reject their writes.",
          "acceptanceCriteria": [
            "Describe mutual authority separately from process execution.",
            "List clock, transaction and provider fencing assumptions.",
            "Link each guarantee to a race or partition probe."
          ],
          "implementationNotes": [
            "Avoid claiming leases alone guarantee exactly-once effects."
          ],
          "verification": [
            "Trace a protected-write guarantee to its fencing test.",
            "Identify an unfenced provider and state the unsupported guarantee."
          ],
          "deliverables": [
            "Coordination operating contract"
          ],
          "rollout": "Review before enabling external actions; revise the contract when provider semantics change.",
          "skills": [
            "Distributed reasoning",
            "Technical communication"
          ],
          "fieldMix": [
            {
              "field": "Distributed systems",
              "percentage": 60
            },
            {
              "field": "System design",
              "percentage": 40
            }
          ],
          "patterns": []
        }
      ]
    }
  ]
}
