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):
| Package | Files | Responsibility |
|---|---|---|
ui | 17 | Swing 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. |
service | 9 | Read/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). |
db | 34 | SQLite 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). |
net | 14 | Wire 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. |
collect | 9 | Snapshot 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. |
session | 3 | SessionService/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). |
status | 5 | Evidence-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. |
vault | 11 | VaultService/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. |
importd | 3 | ImportService/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. |
audit | 2 | Audit/DefaultAudit: appends to and queries audit_log; callers must pass details already redacted — this layer adds no redaction and never receives secret material. |
retention | 1 | RetentionJob: 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. |
security | 1 | SecretScrubber: 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. |
observability | 1 | StatusReporter: 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
- Ingest —
ImportWizard→SessionService.ingest: live validation, session ID into the vault, account + character rows into the DB (the Manager guide, §2).ImportServicecovers the read-onlyprofiles.dbpath (preview → confirm → commit). - Session refresh — scheduled, staggered, direct egress through
DiscoveryClient; results merge as aliases/session_detached_at/expired. - Collection — the scheduler queues characters by cadence,
DefaultProxyPoolpicks a healthy endpoint,DefaultRateLimiterpaces the fetch,DefaultHiscoresClientpulls the lite CSV,LiteCsvParserreads 25 skill + 92 activity lines, snapshot + skill rows are appended, andDefaultStatusEnginerecords an evidence-gated assessment (the Manager guide, §3-4). - Read side — panels go through
service/*interfaces only;QueryServicebatches the characters grid;CsvExporteremits the non-secret column set. - Cross-cutting — every state change writes an
Auditrow;RetentionJobprunes snapshot history on demand/schedule;SecretScrubberguards 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
VaultServicedecrypts; onlyStatusService.overridecan setBANNED_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 viascripts/run-manager.bat/run-manager.sh(also fine to launchdev.n3u.manager.ui.ManagerAppfrom 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.
Manager
The n3Client Manager — a standalone desktop app for account portfolios, session import, hiscores collection, evidence-gated statuses, security practices, and proxy-compliance checks.
Development Overview
The n3Client development tracker — document ownership map, current handoff state, working protocol, agent navigation, and source authority rules.