Skip to content

feat(apps): implement journaled lifecycle and generation-safe updates #453

Done

Description

@RentnerKev

Phase: 4 | Priority: P0

Install, activate and update apps independently while making interruptions and data compatibility explicit.

Scope

  • Persist install/update states and operate supervised process groups with bounded readiness/drain/shutdown.

  • Prepare candidates without productive jobs/external effects; use explicit app-scoped migration operations.

  • Fence old runtime writes, DB sessions and workers before promoting one active generation.

  • Implement compatible rollback, recovery-required states, dependency-aware removal and separate explicit data purge.

  • Use local verified packages, local grants and the durable lifecycle journal at startup/cutover/recovery. Marketplace accounts, ratings, statistics and reporting acknowledgements are outside that critical path.

Dependencies

These are implementation prerequisites; app-to-app delivery gates do not create runtime dependencies.

Acceptance criteria

  • A candidate can stage while the active app runs, but only one generation can write or execute productive jobs.
  • App readiness/protocol/data mismatch cannot promote a candidate or restart the entire platform.
  • Process failure and interruption before/after every state transition are recoverable from the durable operation journal.
  • Migration failures preserve a safe prior state or report recovery-required; arbitrary privileged install/uninstall scripts are not executed.
  • Rollback occurs automatically only when old code can safely read/write current data; incompatible or post-cutover writes are never silently discarded.
  • Removal respects certificate/pool/security dependencies; app failure still allows base platform administration and recovery.
  • Stopping Marketplace services during install/update completion, app startup, drain/activation or local recovery does not block or undo the local operation; installation reporting is a separate background concern.

Planning baseline: Beta 4.
This issue schedules future work; backlog creation does not implement or deploy it.
Use focused project checks and short integration/recovery tests. Endurance runs belong to release preparation. Normal PRs need no additional documentation files or screenshot commits unless requested.

Activity

  1. added this to the v1.0.0-beta.4 milestone on Nov 15, 2026
  2. added
    enhancement
    area: runtime
    area: database
    on Nov 15, 2026
  3. RentnerKev commented on Nov 26, 2026

    @RentnerKev
    MemberAuthor

    The acceptance criteria are covered by merged changes and tests. The remaining gaps are listed below the table.

    Where the tests run: ARR is the App Runtime Reference workflow, jobs "Native app runtime reference (amd64)" and "(arm64)". Rust is the CI job "Rust". Its step "Run privileged IPC fixtures with coverage" runs the root, PostgreSQL and published Greeting fixtures. Web Tests is the CI job "Web Tests".

    Criterion Covered by
    1. A candidate stages while the active app runs; only one generation writes or runs jobs #478, #541 and #558. Tests: staging_services_status_and_publishes_candidate_while_retirement_is_busy. The lifecycle authority in privileged_signed_lifecycle asserts at registration and at worker stop that no other generation is live (Rust, ARR). privileged_postgres_uid_fencing withdraws the old database login and kills its sessions. Also drain_retires_authority_while_a_writer_is_stopping_and_waits_for_workers, and "runtime authority persists and fences app generations, delegation, secrets and replay" (Web Tests). In privileged_published_greeting_distribution_gates step 7 (ARR), calls from the replaced generation get 412.
    2. Readiness, protocol or data mismatch cannot promote a candidate or restart the platform In privileged_signed_lifecycle (Rust, ARR), a candidate that fails readiness restarts the previous release. #587 adds two cases in check_interrupted_transitions. A candidate that reports protocol 9.9.9 times out, and the previous release restarts. A candidate declaring data the installation cannot open is refused before the fence, and a UI rollback to it fails with incompatibleData; the running app's PID stays the same. #574: "a stopped app manager leaves the proxy and administration running, another owned child does not" (Web Tests).
    3. Process failure and interruption around every transition are recoverable from the journal #478 and #541: interrupted_generation_and_uid_reservations_survive_single_owner_reopen, interrupted first install and claim, and a missing archive or data directory at boot in privileged_signed_lifecycle. The retirement tests cover shutdown and fencing. #587 boots from more interrupted journal states. An update interrupted after it reserved the next generation fences that generation and restarts the old release. Uncertain grants restart it with an empty grant set. An unconfirmed removal stays removing until start cancels it. A pending removal and a pending purge both finish at boot. In #586, a committed migration followed by a failed start ends in recoveryRequired, and recover finishes the migrated release without migrating again. Gaps are listed below.
    4. Migration failures keep a safe prior state or report recovery-required; no privileged install/uninstall scripts #568, privileged_app_data_migrations (Rust, and ARR step "Verify app database provisioning and data migrations"). A failing step rolls back atomically. The test also covers RESET ROLE escalation, symlinked steps, \! shell escapes, COMMIT injection, a timeout and a cancelled migration. Also steps_stay_plain_sql_inside_the_runner_transaction. #586, privileged_published_greeting_data_migrations (Rust, ARR): a failing 1.2.0 migration restarts 1.1.0 with the data version and rows unchanged. A committed 1.4.0 migration followed by a failed start reports recoveryRequired and keeps the data. There is no install or uninstall hook mechanism. The only package code that runs is bin/app and plain SQL steps, both under the app UID (privileged_generation_launches_restricted_child_and_revokes_listener).
    5. Automatic rollback only when old code can use current data; nothing discarded silently A candidate that fails readiness falls back to the previous release, which can still open the data (privileged_signed_lifecycle). A rollback keeps data written after the cutover (privileged_published_greeting_lifecycle, ARR). #586: rolling back from 1.3.0 to 1.1.0 is refused with incompatibleData, and the generation and data stay unchanged. After the committed 1.4.0 migration and the failed start, 1.3.0 is not restarted on version-3 data. #587 adds the refused data-incompatible candidate.
    6. Removal respects dependencies; app failure still allows administration and recovery App failure: #574 (see row 2). Recovery after app exit and a failing slot at boot are covered in privileged_signed_lifecycle. Removal: dependency_block_and_separate_purge_keep_the_uid_reserved, and "app removal returns uncommitted domains to platform and keeps committed ownership" (Web Tests). In #587, "removal and data purge wait while the app owns a proxy host" (Web Tests) and an interrupted removal stays recoverable. #585 reports these refusals as dependencyBlocked (dependency_refusals_are_reported_apart_from_conflicts). Certificate and pool checks are open (see below).
    7. Stopping Marketplace services does not block or undo local operations privileged_published_greeting_distribution_gates (#569, ARR) keeps the Marketplace and GitHub API hosts blocked through install, update and an offline restart, with zero connection attempts. With the catalog server stopped, privileged_signed_lifecycle boots, rolls back, recovers, falls back after a failed activation, uninstalls and purges. privileged_published_greeting_lifecycle rolls back and restarts offline, and #584 uninstalls and purges the published Greeting offline. offline_management_coalesces_retries_and_serializes_with_catalog_install (Rust). A launch only uses recorded packages through recover.

    Gaps and follow-ups

    • Criterion 3: a crash right after database_provisioned, before the migration starts, has no dedicated test. The flag is saved before runtime::provision runs, but recovery does not trust it: migration::recorded_version reads the real database and its version marker, so a missing database or a missing marker plans the activation like a first install. The interruption tests boot from journal states written while the manager was stopped, or use failed activations. No test kills the manager at each journal save.
    • Criterion 6: no app owns certificates, pools or security resources yet, so those removal checks arrive with the feat(apps): add provider registration and validated engine contributions #454 provider profiles. The sticky provider_dependencies_unknown marker also belongs to the remaining feat(apps): add provider registration and validated engine contributions #454 work. It blocks removal of every provider app until someone clears it by hand.
    • Criterion 7: no installation-reporting code exists yet, so there is nothing to keep apart from the local operation.

    Closing as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: databasearea: runtimeenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions