---
phase: 10-refresh-auto-archive-wiring
plan: 04
subsystem: archive
tags: [archive, persistence, noop-client, dashboard-runtime, rust]

# Dependency graph
requires:
  - phase: 10-refresh-auto-archive-wiring
    provides: ArchiveStore::load_or_create, archive_store.json path wiring, compute_archive_state manual-state preservation

provides:
  - DashboardRuntime::with_archive_store(store) constructor for explicit archive injection
  - main.rs uses with_archive_store instead of default() + field assign for cleaner construction
  - NoopClient returns Err("offline: noop client") for refresh_recipient and refresh_all
  - Refresh error paths (amber indicator, failure toast, "Refresh failed - retry") observable during development

affects:
  - Phase 10 UAT re-verification

# Tech tracking
tech-stack:
  added: []
  patterns:
    - "DashboardRuntime::with_archive_store(store) constructor mirrors with_cards pattern for explicit dependency injection"
    - "NoopClient returns Err for ALL mutation+refresh operations for consistent offline behavior"

key-files:
  created: []
  modified:
    - crates/app/src/dashboard/mod.rs
    - crates/app/src/main.rs

key-decisions:
  - "DashboardRuntime::with_archive_store added as explicit constructor; Default::default() kept using ArchiveStore::new() (in-memory) for test compatibility"
  - "NoopClient refresh overrides return Err('offline: noop client') matching existing save_note/remove_item/add_item pattern"

patterns-established:
  - "DashboardRuntime construction: use with_archive_store(load_or_create(path)) in production; default() for tests"

requirements-completed: [DATA-05, DATA-06]

# Metrics
duration: 3min
completed: 2026-03-21
---

# Phase 10 Plan 04: Archive Init Wiring and NoopClient Refresh Errors Summary

**DashboardRuntime gains with_archive_store constructor for clean archive injection; NoopClient now returns Err for refresh calls making error UI paths observable during development**

## Performance

- **Duration:** ~3 min
- **Started:** 2026-03-21T01:28:01Z
- **Completed:** 2026-03-21T01:31:00Z
- **Tasks:** 2
- **Files modified:** 2

## Accomplishments

- Added `DashboardRuntime::with_archive_store(store: ArchiveStore) -> Self` constructor, replacing the two-step `default()` + field assignment in main.rs with a single clean call.
- Updated main.rs to use `DashboardRuntime::with_archive_store(archive_store)` — archive state is loaded from disk before the init loop (preserved from 10-03 wiring).
- Added `refresh_recipient` and `refresh_all` overrides to `NoopClient` returning `Err("offline: noop client")`, making amber indicator, "Refresh failed - retry" text, and failure toast all reachable during seed-data development testing.
- All 115 tests pass.

## Task Commits

Each task was committed atomically:

1. **Task 1: DashboardRuntime::with_archive_store and main.rs wiring** - `13b6814` (feat)
2. **Task 2: NoopClient refresh error overrides** - `d5296d0` (feat)

## Files Created/Modified

- `crates/app/src/dashboard/mod.rs` - Added `with_archive_store(store: ArchiveStore) -> Self` constructor to `DashboardRuntime`
- `crates/app/src/main.rs` - Replaced default() + field assign with `with_archive_store(archive_store)`; added `refresh_recipient`/`refresh_all` Err overrides to `NoopClient`

## Decisions Made

- Kept `Default` impl using `ArchiveStore::new()` (in-memory, no disk I/O) — the 115 tests all use `DashboardRuntime::default()` and must not touch the filesystem
- `with_archive_store` constructor added alongside `Default`, not replacing it — both are needed

## Deviations from Plan

None - plan executed exactly as written. The important_context note in the prompt indicated Task 1 was partially done by 10-03; the `with_archive_store` constructor was the remaining piece, added cleanly.

## Issues Encountered

`cargo build` failed at link stage with "Access is denied" because the app.exe was locked by the OS. Used `cargo check` to verify compilation — library compiled cleanly with only a pre-existing `dead_code` warning.

## Next Phase Readiness

- All Phase 10 plans complete
- Archive persistence, refresh-revert fix, and NoopClient error signaling are all wired
- Ready for Phase 10 UAT re-verification: archive state should survive restarts; clicking refresh should show amber error state and failure toast with seed data

---
*Phase: 10-refresh-auto-archive-wiring*
*Completed: 2026-03-21*
