Skip to content

Architecture: deepen platform lifecycle seams #37

Description

@ElbertePlinio

Pickforge Platform architecture master plan

Goal

Deepen the highest-risk shared platform behavior without changing product UI, publishing identity, migration history, or package layout by assumption.

Why

Recent checkout/deletion and hosted-router work spans durable state, package implementation, Deno adapters, and release tooling. The priority is to concentrate policy behind testable interfaces, preserve release compatibility, and reduce lockstep choreography.

Top priority

PR 1 — checkout lifecycle local-Postgres interface. Replace lifecycle policy duplicated in the billing test fake with characterization against the durable lifecycle. This is the prerequisite for safely changing checkout/deletion orchestration.

Architecture constraints

  • Credit ledger remains the balance source of truth.
  • Checkout/deletion durable state remains in Supabase; authentication identity is deleted last.
  • Preserve idempotency, refund recovery, tombstones, and existing public package consumers.
  • Use additive forward migrations only; never renumber/rewrite history.
  • Keep packages UI-free. Shared update presentation is out of scope.
  • Keep release artifacts, signatures, and latest.json mutually compatible.
  • Do not introduce a new published package or generic persistence layer without Pro stack as platform packages: billing, sync, flags, shared edge utilities #10 approval and two real adapters.

Scope / acceptance checklist

  • Lifecycle contract cases run through local Postgres and cover replay, deletion races, refunds, cleanup, and finalization.
  • Checkout/deletion orchestration has one accountable owner; Deno adapters retain only request/environment/response work.
  • Sync last-writer-wins decision is one durable operation with real concurrent push/push and push/delete proof.
  • Router work is durably claimed before provider invocation; retries/replays do not duplicate provider work or debits.
  • AppImage repair is success-or-no-change for artifact, signature, and updater feed.
  • Touched Deno adapters are checked with their import maps; published consumer compatibility is proven before removing exports.
  • Every SQL change is forward-only and covered by local database validation.

Dependency-ordered PR plan

PR 1 — Lifecycle persistence characterization

  • Depends on: none
  • Touches: billing tests; lifecycle database tests/fixtures
  • Prove: production billing behavior and durable lifecycle agree for races, replays, recovery, and cleanup.
  • Validation: focused billing test; PICKFORGE_ALLOW_LOCAL_DB_TESTS=1 bun run test:supabase; bun run typecheck.
  • Link: pending

PR 2 — Consolidate checkout/deletion orchestration

PR 3 — Durable sync last-writer-wins

  • Depends on: chore: reconcile hosted Supabase migration history #35 migration coordination
  • Touches: sync package, one forward migration, local database tests
  • Prove: one durable decision returns compatible written/stale results under concurrent writes and tombstones.
  • Validation: focused sync tests; local Supabase suite; database advisor check; typecheck.
  • Link: pending

PR 4 — Durable router attempt ownership

PR 5 — Transactional AppImage repair

  • Depends on: none
  • Touches: tauri-release implementation and tests
  • Prove: signer/feed/commit failures leave the complete prior release set unchanged.
  • Validation: focused release tests; typecheck; tauri-release build.
  • Link: pending

Existing issue coordination

Non-goals

  • No update UI work.
  • No remote flags or rollout platform.
  • No package explosion, shared fake package, generic repository layer, or migration-history rewrite.
  • No publishing-credential work.

No-feature-flag decision

No feature flag is planned. These slices are implementation integrity, characterization, durable-state, and release-compatibility work rather than incomplete user-facing capability. Each slice must be fully validated before its release; do not merge a partially enabled behavior behind a new flag.

Audit commit snapshot

358aa6b2bb2a2a2a34be44ec3f837f57f3ae59a9 on main.

Current status

Planned

Next action

Open this as the master tracking issue, link #10/#23/#35/#36, then start PR 1 with local-Postgres lifecycle characterization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions