7 KiB
Architecture and incremental migration
Boundary
Browser → central website session → same-origin /api/v1 on control panel → existing identity/permission/link services → narrow native-service adapters. MySQL remains authoritative for website accounts, verified links and website-owned records. Native services remain authoritative for balances, inventory, kit eligibility, game quest progress, charges and delivery. No new wallet, generic console proxy, account privilege, broad service token or alternate UUID-proof mechanism is introduced.
Initial code is additive in node/api-v1.mjs, mounted before legacy dispatch in control-panel/server.mjs, behind API_V1_ENABLED. Existing handlers and consumers are unchanged. This stage deliberately does not wrap side-effecting legacy rewards GET or unknown live-only handlers.
Permission design for subsequent stages
Obtain the deployed central resolver before extending scope. Use explicit action grants with domain Website, Community, Minecraft or Network, plus applicable department and server. Resolve these server-side on every operation; fail closed when scope, verified identity or resolver state is missing. A Website Support grant does not grant Community appeal approval, Minecraft ban management or Network administration. Do not translate rank level, staff:true, menu visibility, profile names, a submitted UUID or a stale frontend permission snapshot into authorization.
For each migrated endpoint record: action permission, domain, department/server context, verified-account ownership, native service permission and whether step-up/owner approval is required. Require review by the permission owner and affected maintainer. Scope-aware privileged endpoints are deferred, not provided by the legacy effective-node response. No role-boundary changes may be bundled into API rollout.
Order and acceptance gates
- Inventory and reconcile. Owner/website/Minecraft maintainers confirm deployed commit, uncommitted source and release differences in coordination issue #2. Capture server contracts and table ownership without exporting secrets or production player data. Preserve all existing branches and the inventory-sharing fork.
- Read-only foundation (this increment). Review OpenAPI, session-only authentication, self ownership, validation, errors, rate budget, correlation and restricted audit collection. Exercise the toggle and rollback in isolated staging. Confirm account, linking, permissions, honest status and native exchange catalogue end to end. Missing bridge configuration returns 503, never demo balances/catalogues.
- Scoped authorization and native read expansion. Integrate the deployed role resolver with explicit Website/Community/Minecraft/Network and department/server decisions. Add read adapters for bank, quests, kits and orders only after ownership and native snapshot contracts are known. Keep website entitlement catalogues separate from native game goods. Add independent OpenAPI schemas and contract tests.
- One mutation at a time. Prioritize a narrow established native operation. Preserve its transaction boundary and native immutable reference; do not implement balance edits in Node. Test in isolated services before enabling behind an operation-specific flag. Owner and service maintainer approve semantics and recovery.
- Consumer migration. Introduce one consumer adapter at a time, compare sanitized read results in staging, then canary with owner-coordinated traffic. Never double-submit a mutation to old and new routes. Keep old request/response shapes working until callers have explicitly migrated. Record usage and agreed deprecation windows before retirement.
Mutation contract required before enablement
- Bind idempotency to authenticated principal, verified UUID, operation, domain/scope and canonical payload hash. Same key/different payload must be 409; same operation/key must retrieve its durable native reference and state. A timeout is unknown outcome, not permission to create a new transaction.
- Have the authoritative native owner atomically persist idempotency/reference, conditional debit or reward eligibility, state transition and durable delivery/outbox entry. Use unique constraints and locking/CAS suitable for multi-process concurrency. A Node-only in-memory deduplication map is insufficient.
- Service authentication must be independently scoped by service/action/server, private transport, bounded timestamp/nonce or equivalent durable replay prevention, rotation and revocation. Do not pass browser Authorization through or disclose tokens in errors. Preserve the existing game channel until maintainers verify its replacement; do not call it complete replay protection for every future operation.
- Model states such as accepted → charged/earned → delivery-pending → delivered and retryable/terminal failures using the actual existing contract. Only native confirmation marks delivery. Preserve receipts through restart and requeue an acknowledgement using the same reference. Do not refund/recredit blindly after a timeout.
- Website perks grant only approved permission entitlements with their own approval/revocation audit; in-game purchases retain native redemption and item delivery. A website perk order must not directly credit funds or issue a game item.
- Privileged action audits must include principal, explicit permission/scope, target, correlation ID, immutable native reference and outcome, with durable integrity/retention controls. Exclude secret codes and tokens. Pair audit/outbox with mutations so failure cannot silently lose accountability.
Required isolated integration scenarios
Run with independent fixture MySQL/PostgreSQL and native service instances, plus Paper/Velocity staging where applicable. Include anonymous/expired/service-auth rejection; cross-account order/code access; caller UUID spoofing and relink races; department/server mismatch; support denied appeal approval/admin access; duplicate and changed-payload keys; concurrent debits/claims/stock buys; failure before commit, after commit before HTTP response, during native inventory delivery and before/after ack; restart and service outage recovery; rollback with pending deliveries preserved. Assert authoritative balances, stock, receipts and delivery counts, not only HTTP status. Existing Java ledger tests are reusable but do not validate the new website-to-game deployment.
Current gaps / dependencies
Deployed source and scoped permission backend are missing from accessible branches. Banking, current quests, kit market, perks, orders and redemption transaction contracts remain unverified. Maintainer response and isolated environment are pending. This initial stage has fixture integration coverage, not live MySQL/PostgreSQL/Paper/Velocity verification. Legacy routes are retained; no consumers, financial flows, rewards, role definitions, live data or deployments have been changed. Read-only catalogue pagination is bounded by the old bridge's 500 rows; improve that native read contract before claiming full catalogue enumeration.

Staff