Skip to content

feat(Phase-6): Admin, audit API, and reconciliation #168

Description

@chitrank2050

Overview

This is the tracking issue for Phase 6. The goal is to make Meterplex operable — admin dashboard APIs, queryable audit logs, dead letter replay, reconciliation jobs, and the credit/wallet system deferred from earlier phases.

Phases 1-5 build the billing engine. Phase 6 makes it manageable by humans.

Success Criteria

  • Admin can query audit logs with filters (actor, resource, tenant, date range)
  • Admin can view, retry, and discard dead letter events via API
  • Reconciliation job compares raw usage vs billed usage and flags mismatches
  • Reconciliation job compares subscription state vs payment state
  • AI credits / wallet system with prepaid balance, top-ups, and discounts
  • Daily limit support (DAILY reset period) for features
  • Usage summary endpoint with percentage breakdowns (daily, monthly, annual)
  • Timezone-aware billing period boundaries
  • Invoice PDF generation for tenant download
  • Export usage and invoice reports (CSV/JSON)
  • All admin actions audit-logged

Tracking / Sub-tasks

Resources

  • Architecture Log: docs/phases/phase-6.md (to be created)
  • Architecture Doc: docs/architecture/phase-6-admin-reconciliation.md (to be created)
  • Security Audit: docs/audits/security-audit-v2.md

Why this phase matters

A billing system without admin tooling is a black box. When a tenant disputes a charge, the support team needs to query audit logs, inspect usage, compare against invoices, and identify discrepancies. When usage events fail, someone needs to investigate and replay them. When a tenant wants prepaid credits instead of postpaid billing, the system needs to support both models.

This phase transforms Meterplex from "it works" to "it's operable."

Note: This issue represents the "Phase 6" milestone. Individual PRs should reference the specific sub-tasks above.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions