Skip to content

Resupply & Repair action packages from the base detail sheet (v1.4.0) #28

Description

@Zillatron27

Contextual resupply / repair action packages for a specific base — the v1.4.0 "Resupply & Repair" theme. Spec: project-context/apxm/specs/v1.4-resupply-repair.md.

Goal. From a base's BURN or REPAIR detail sheet, get the needed materials bought and onto a ship with minimal taps. Every commit is the user's own (HARD RULE). Ship sending stays the existing SendShipView feature and is not part of a package.

Entry point. Header action button on the base detail sheet (BURN → RESUPPLY, REPAIR → REPAIR), modelled on ContractTerminateButton. The runner opens through detailView; no new tab or navigation mechanism.

Package shapes.

  • RESUPPLY(site, days, exchange, ship?) — bill per ticker = ceil(max(0, days × dailyBurn − (store + warehouse + remainingAllocation))); buy = bill − CX-warehouse stock at exchange (one CXPO_BUY step per ticker with qty > 0); then MTRA CX-warehouse → ship if a ship is chosen.
  • REPAIR(site, exchange, ship?, horizon = now | 24h | 48h) — bill = Σ Platform.repairMaterials[horizon] over PRODUCTION/RESOURCES buildings − (store + warehouse); buy/move as above.

Rules.

  • No ship docked at the exchange must not break the flow: buy-only is a valid outcome. Rerunning later with a ship present buys nothing (netted) and just transfers.
  • Netting subtracts base STORE + base WAREHOUSE, then CX-warehouse stock. This is a purchasing rule; the burn-days rule still counts STORE only. Deviates from rPrun/fork (which do not net the repair bill) — documented with credit.
  • Repair quantities come from the server-authoritative repairMaterials fields on SITE_SITES (the BRA figure), not the fork's age/180 proration. FIO-only sites are gated off (FIO cannot distinguish building types).
  • Staleness: preview shows the data-source badge; EXECUTE is disabled past the staleness threshold with the reason.
  • Execution dial: manual per commit (default) — each step waits for the user's ACT tap and any APEX confirmation overlay is revealed for the user to confirm. settings.autoConfirm gets a Settings toggle only after the manual path is device-proven. Timed / all-at-once modes are out of scope for this release.

PR plan.

  1. Foundations — ACT/buffer-refresh: no shared #container lock — refresh engine and step machine bypass action-lock #95 shared #container lock across buffer-refresh and the step machine; single disabled-button detection shared by lib/act/apex-button.ts and contract-actions.ts.
  2. RESUPPLY from the BURN sheet — first live exercise of the confirm-overlay mode (CXPO_BUY pops one); device session required.
  3. REPAIR from the REPAIR sheet.
  4. autoConfirm Settings toggle.

Deferred. Ship-move step in packages (OPEN_SFC stub stays), timed/all-at-once modes, #31 extraction.

Engine ported from refined-prun (MIT, Dan Pavlides) via jackinabox86's fork (https://github.com/jackinabox86/APXM); the transient-package model mirrors refined-prun PR #204 by @jackinabox86. The preview's storage-fit line follows refined-prun PR #206 by @erendrake; the CX Buy isTrusted guard follows refined-prun PR #199 by @raylu. Credit all in the PRs and CHANGELOG.

Activity

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

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions