docs.dev

Manager Architecture

Developer view of the manager Gradle module — layers, the 13-package map, data and control flow, zone-discipline invariants, and known limits.

Developer view of the manager/ Gradle module: layers, package responsibilities, data flow and invariants. The user-facing behavior guide is the Manager guide; the plan and wire-format evidence live in docs/development/manager-plan.md and docs/development/manager-evidence.md in the repository. Source of truth: docs/development/manager-architecture.md in the n3Client repository.

Shape

Standalone Swing desktop app. Entry point dev.n3u.manager.ui.ManagerApp (Main-Class in the manager-all.jar shadow jar, manager/build.gradle.kts). Storage is entirely inside the fresh root: ~/.n3client/manager/ holds manager.db (SQLite, WAL mode) and vault.n3vault — the manager writes nothing outside it and never touches client storage (storage contract in docs/development/FOUNDATION.md, D09/D15).

Open tracker item: the storage contract in FOUNDATION.md lists the fresh-root children (runelite/, client/, logs/, repository/, cache/, jdk/) but omits manager/, which this module owns exclusively (Database.managerDataDirectory() returns ClientPaths.ROOT.resolve("manager") — manager/src/main/java/dev/n3u/manager/db/Database.java). The fix belongs to the FOUNDATION.md owner, not this guide.

Package map

manager/src/main/java/dev/n3u/manager/, 13 packages (file counts from a 2026-11-06 directory scan):

PackageFilesResponsibility
ui17Swing shell (Zone D). ManagerApp composes the window; ManagerContext wires panels to service interfaces; panels refresh on the EDT (ManagerApp class javadoc). Panels: AccountsPanel, CharactersPanel, DetailPanel, FilterPanel/FilterState/CharacterFilterMapper, HiscoresPanel, CollectionStatusPanel, ImportWizard, SettingsDialog, SecretRevealDialog, VaultPassphraseDialog, CsvExporter, plus format helpers (SessionLines, StatusFormats). Renders no secrets — reveal happens only through the audited VaultService.reveal in SecretRevealDialog.
service9Read/query façades used by the UI: JobService, QueryService (batched grid fetch — one filter query plus one batched read per joined dimension instead of per-character loops), StatsService, StatusService (override is the ONLY path to BANNED_CONFIRMED; automatic rules must never set it).
db34SQLite persistence: Database/SqliteDatabase/DatabaseException, Migrations/SchemaMigration, and one DAO + row pair per table (accounts, aliases, characters + CharacterFilter/CharacterQueryBuilder/range types, jobs, lookup results, proxies, settings, snapshots, status assessments, audit log, vault items).
net14Wire clients. DefaultHiscoresClient: Zone P, canonical host secure.runescape.com (never rely on the redirect), ISO-8859-1 decoding, never gates on Content-Type, carries no session data. DefaultDiscoveryClient (session refresh), DefaultTempleStatsClient (optional enrichment), LiteCsvParser for index_lite.ws, SessionRejectedException.
collect9Snapshot pipeline: SnapshotPipeline/DefaultSnapshotPipeline, ProxyPool/DefaultProxyPool, RateLimiter/DefaultRateLimiter (global token bucket, default ≤0.5 req/s plus per-acquire jitter — DefaultRateLimiter.java:10-11), ProxiedHiscoresClient, ProxyReportingHiscoresClient, SnapshotListener.
session3SessionService/DefaultSessionService (Zone S, direct egress — never proxied): ingest validates the session ID live against auth.jagex.com/game-session/v1/accounts before storage, then refresh merges (renames become aliases, missing characters get session_detached_at, 401/403 marks the account expired).
status5Evidence-gated rule engine: StatusEngine/DefaultStatusEngine implements the plan §5 truth table in precedence order (latest round transient failure → LOOKUP_FAILED first); enums CharacterStatus, Confidence, AssessmentMethod.
vault11VaultService/DefaultVaultService — the sole holder of plaintext secrets, AES-256-GCM per item; master key from the Windows Credential Manager via JNA (WindowsCredentialKeyProvider, CredApi) with Argon2KeyProvider passphrase fallback; reveal is the single audited chokepoint. Also VaultCrypto, VaultKeys, VaultException, InMemoryKeyProvider.
importd3ImportService/DefaultImportService/ImportPreview: read-only profiles.db import replicating the client's exact decrypt (Base64 of IV(16) ‖ AES/CBC/PKCS5Padding(json), key from SHA-256(deviceId)), staging into the vault behind a preview.
audit2Audit/DefaultAudit: appends to and queries audit_log; callers must pass details already redacted — this layer adds no redaction and never receives secret material.
retention1RetentionJob: full retention window from setting retention.full_days (default 90 — RetentionJob.java:37-38), weekly downsampling of older snapshots, one non-secret retention.run audit row per run; never touches the vault.
security1SecretScrubber: stateless pattern-based masking (scrub) and short-lived registered-secret masking (register/scrubRegistered); everything built from user- or wire-supplied text passes through it at the boundary.
observability1StatusReporter: process-local counters — round timings, failure classes, lookup outcomes, per-endpoint proxy health. Counters reset on restart; durable history lives in lookup_results, jobs, audit_log (the Manager guide).

Data and control flow

  1. Ingest — ImportWizard → SessionService.ingest: live validation, session ID into the vault, account + character rows into the DB (the Manager guide, §2). ImportService covers the read-only profiles.db path (preview → confirm → commit).
  2. Session refresh — scheduled, staggered, direct egress through DiscoveryClient; results merge as aliases/session_detached_at/expired.
  3. Collection — the scheduler queues characters by cadence, DefaultProxyPool picks a healthy endpoint, DefaultRateLimiter paces the fetch, DefaultHiscoresClient pulls the lite CSV, LiteCsvParser reads 25 skill + 92 activity lines, snapshot + skill rows are appended, and DefaultStatusEngine records an evidence-gated assessment (the Manager guide, §3-4).
  4. Read side — panels go through service/* interfaces only; QueryService batches the characters grid; CsvExporter emits the non-secret column set.
  5. Cross-cutting — every state change writes an Audit row; RetentionJob prunes snapshot history on demand/schedule; SecretScrubber guards all boundary text.

Invariants

  • Zone discipline: Zone P (public hiscores) never touches session IDs or vault content; Zone S (authenticated) always goes direct, never proxied; Zone D (UI) renders no plaintext (the Manager guide, §7, enforced by the net/session/vault package splits above).
  • Only VaultService decrypts; only StatusService.override can set BANNED_CONFIRMED; only audited reveal exposes plaintext prefixes.
  • Client reads/writes stay off the EDT; Swing mutation on the EDT (the Manager guide, "UI operation and validation").

Build, launch, tests

  • .\gradlew.bat :manager:shadowJar → manager/build/libs/manager-all.jar, launch via scripts/run-manager.bat / run-manager.sh (also fine to launch dev.n3u.manager.ui.ManagerApp from the IDE after .\gradlew.bat build).
  • Tests and the security scan wall: Development Testing.

Known limits

Behavioral limits are tracked in the Manager guide, §10 (quest points null, retired /latest JSON, no auto re-login, no ban inference from absence, process-local counters, unverified simultaneous-login concurrency).

Open tracker item: collection scheduling internals (DefaultSnapshotPipeline staggering, retry/backoff wiring) are documented at contract level only — the pipeline javadoc and the Manager guide, §3 own the behavior. Exit criterion: line-level trace of DefaultSnapshotPipeline (or tests asserting the stagger/backoff schedule) promoted into the guide.

On this page