Skip to content

feat(registry): versioned structured host registry (registry v2)#85

Merged
pofallon merged 1 commit into
mainfrom
015-registry-v2
Jul 25, 2026
Merged

feat(registry): versioned structured host registry (registry v2)#85
pofallon merged 1 commit into
mainfrom
015-registry-v2

Conversation

@pofallon

Copy link
Copy Markdown
Contributor

Summary

Replaces the colon-delimited ~/.config/remo/known_hosts store with a versioned JSON registry.json (format v2 — named per-type fields, no positional overloading), behind a single accessor core/registry.py that owns parse / serialize / validate / advisory-lock / migrate for the CLI, providers, and web service.

What changed

  • New accessor src/remo_cli/core/registry.py — the one surface every consumer reads/writes through; atomic writes (os.replace), tolerant reads (per-entry warnings, never exceptions), and fcntl advisory locking with graceful degradation.
  • Seamless migration (US1) — lazy, lossless, idempotent known_hostsregistry.json, original renamed to known_hosts.v1.bak; a v2-invalid legacy entry is skipped + reported, never fatal.
  • No more corruption (US2) — IPv6/colon-containing values round-trip intact; remo add accepts bracketed and bare IPv6 literals.
  • One reader (US3) — web discovery/state/check collapse onto the shared read-only accessor (no side effects, read-only-mount safe).
  • No lost updates (US4) — every read-modify-write is lock-wrapped.
  • Version skew (US5) — setup API accepts payload v1 and v2, advertises payload_versions; the CLI aborts before any mutation if the service is behind; push delta-cache bumped to cache_version: 2.
  • Thin delegatescore/known_hosts.py public API unchanged, so ~30 existing call sites need no changes.
  • Docs (README, docs/web-session-interface.md, CLAUDE.md) updated.

Review fixes folded in (xhigh self-review)

  1. replace_registry now uses true wholesale-replace semantics — the service removes (not renames) a stale legacy mirror, and a malformed stale mirror can no longer 500 an otherwise-valid apply.
  2. put_registry apply catches RegistryError (not just OSError) → clean 500 instead of an uncaught traceback.
  3. Tolerant CLI migration (skip+report a v2-invalid entry instead of aborting every command).
  4. Both-present read no longer crashes on a concurrent-migration rename race.

Testing

  • Full suite: 1355 passed, 17 skipped, 0 failed.
  • ruff check src/remo_cli clean; mypy clean (60 files).
  • All quickstart.md scenarios manually verified end-to-end.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HAPB5GA4NVUgKFsVFVJDxN

Replace the colon-delimited `~/.config/remo/known_hosts` store with a
versioned JSON `registry.json` (format v2, named per-type fields, no
positional overloading) behind a single accessor `core/registry.py` that
owns parse/serialize/validate/advisory-lock/migrate for the CLI, providers,
and web service.

- Lazy, lossless, idempotent CLI migration (known_hosts -> registry.json,
  original renamed to known_hosts.v1.bak); tolerant per-entry migration
  skips+reports a v2-invalid legacy entry instead of aborting.
- `core/known_hosts.py` slimmed to thin delegates (public API unchanged).
- `remo add` accepts IPv6 literals (bracketed and bare multi-colon); the
  colon-safety field rejections are gone (JSON has no positional overloading).
- Web read paths (discovery/state/check) collapse onto the shared read-only
  accessor; advisory `fcntl` locking wraps every read-modify-write with
  graceful degradation.
- Setup API adoption mirror moves to payload v2 with a `payload_versions`
  capability handshake (still accepts v1); push delta-cache bumped to
  cache_version: 2. `replace_registry` uses true wholesale-replace semantics
  so the service removes (not renames) any stale legacy mirror and a
  malformed stale mirror can't 500 an otherwise-valid apply.
- Docs (README, web-session-interface, CLAUDE.md) updated to registry.json.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HAPB5GA4NVUgKFsVFVJDxN
@pofallon
pofallon merged commit 2a3d92e into main Jul 25, 2026
14 of 17 checks passed
@pofallon
pofallon deleted the 015-registry-v2 branch July 25, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant