Menu ▾ ▴

#21 [Feature]: Add explicit offline execution and cache age limits

open
nobody
2026-09-12
2026-09-11
Anonymous
No

Originally created by: thomijasir
Originally owned by: thomijasir

Feature description

Let users intentionally run a command from the encrypted runtime cache and optionally reject cached data that is too old.

Current behavior

A successful runtime fetch updates an encrypted cache. The CLI falls back to that cache after an availability failure, but users cannot request offline execution or set a freshness limit.

Why we need this

Developers may know they are offline, and production jobs may need a clear maximum age for cached secrets. Explicit controls make the source and freshness policy visible.

Proposed CLI interface

  • dopbase run ENVIRONMENT --offline -- command
  • dopbase run ENVIRONMENT --cache-max-age 24h -- command

Expected behavior

  • --offline skips all server requests, including environment resolution, and loads the matching encrypted cache entry directly.
  • Offline lookup accepts the same environment ID and canonical project/environment aliases already stored in the cache.
  • --cache-max-age applies to both explicit offline loads and automatic fallback.
  • Omitting --cache-max-age preserves the current unlimited-age behavior.
  • Reject future timestamps and cache entries older than the configured duration.
  • Print the cache fetch time, age, and source to stderr before starting the child.
  • Keep automatic fallback limited to availability errors. Authentication and authorization errors must not fall back.

Security and compatibility

  • Do not decrypt unrelated cache entries while resolving an alias.
  • Bind cache data to the active server and credential as it is today.
  • Never print cached secret values or include them in errors.
  • Reject invalid cache envelopes instead of attempting partial recovery.

Out of scope

  • Changing cache encryption or key derivation.
  • Adding cache cleanup commands.
  • Contacting the server to validate an offline cache entry.

Acceptance criteria

  • [ ] Offline mode starts the child from a usable matching cache without network access.
  • [ ] Offline mode fails before starting the child when no matching cache exists.
  • [ ] Age limits accept fresh entries and reject stale or future-dated entries.
  • [ ] Automatic fallback obeys the same age limit.
  • [ ] Authentication failures never use fallback data.
  • [ ] The source and age message is sent to stderr.

Test scenarios

  • Extend runtime cache and child-process tests under app/tests/cli/.
  • Cover ID and canonical aliases, server and credential isolation, no network access, stale entries, future timestamps, corrupt data, availability fallback, and authorization failures.

Documentation

Document offline guarantees, cache matching, default age behavior, and how automatic fallback differs from explicit offline mode.

Dependencies

Uses the existing encrypted runtime cache. No server change is required.

Related

Tickets: #37

Discussion

  • Anonymous

    Anonymous - 2026-09-11
     

Log in to post a comment.