Files
amethyst/commons
Claude 5b103385bc refactor(commons): move PowJobStore, OkHttpWebSocket, TorRelayState and the NIP-29 predicates
Four small, verified moves. Each was shared-layer code whose only tie to the app
module was where the file happened to sit.

- PowJobStore -> commons/service/pow. Its interface (PoWJobPersistence) and DTO
  (PersistedPoWJob) were already in commons; only the File-backed implementation
  was stranded. Zero android imports. PowJobRestorer stays: it takes an Account.
- OkHttpWebSocket -> commons/service/http, beside the other OkHttp adapters.
  Zero android imports; quartz socket interfaces plus okhttp. Its close-handshake
  test travels with it.
- TorRelayState -> commons/tor, beside the TorRelaySettings/TorType it reasons
  over. Only androidx.compose.runtime.Stable, which commons allows; jvmAndroid
  because of okhttp. AccountsTorStateConnector does NOT travel with it, contrary
  to the survey that proposed this batch — it imports Account and
  AccountCacheState.
- The two pure NIP-29 predicates out of RelaySupportsNip -> commons/relays/nip11,
  next to the retriever moved in f5fc432e. looksLikeNonNip29Relay and the 2-arg
  isRelaySignedRelayGroup take a resolved Nip11RelayInformation and are therefore
  shareable; the three convenience forms that read Amethyst.instance.nip11Cache
  stay behind. Callers split by which overload they use.

No new tests here: these are relocations of code whose behaviour is unchanged,
and the one suite that existed (the websocket close handshake) moved with its
class. The NIP-29 predicates are now reachable for testing from commons, which
they were not before, but writing those tests is separable from the move.

The same-package trap bit three more times and is worth naming, because grepping
for imports cannot find it: a file in the moved class's own package has no import
line to rewrite. It caught AccountsTorStateConnector and PowJobRestorer in main
sources, PowAndUsageFileFormatTest in test sources — via PowJobsFile, a second
public type declared inside PowJobStore.kt that a search for the class name does
not match — and a [PowJobStore] KDoc link in PowMiningForegroundService. The
check that actually works is to enumerate every top-level declaration in each
moved file and grep for bare usages of all of them.

Verified: :commons:jvmTest (2552, 0 failures), :amethyst:testPlayDebugUnitTest,
:cli:compileKotlin, :commons:verifyKmpPurity,
:commons:compileCommonMainKotlinMetadata, :amethyst:compilePlayDebugKotlin.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AXvKXakvup4inNFfAhhr4L
2026-09-25 21:54:20 +00:00
..