feat(iios): retention sweep dev endpoint + /metrics + smoke (P9)
POST /v1/dev/retention/sweep runs the sweep on demand; /metrics gains a global retention section (snapshot counts by status). smoke-retention.mjs (0-day windows) proves an aged interaction is redacted in place and surfaces as a REDACTED snapshot on /metrics. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import { AdapterRegistry } from '../adapters/adapter.registry';
|
||||
import { PrismaService } from '../prisma/prisma.service';
|
||||
import { ActorResolver, type MessagePrincipal } from '../identity/actor.resolver';
|
||||
import { SessionVerifier } from '../platform/session.verifier';
|
||||
import { RetentionService } from '../retention/retention.service';
|
||||
|
||||
/**
|
||||
* Dev-only helpers (gated by IIOS_DEV_TOKENS=1). Never enable in production.
|
||||
@@ -20,6 +21,7 @@ export class DevController {
|
||||
private readonly prisma: PrismaService,
|
||||
private readonly actors: ActorResolver,
|
||||
private readonly session: SessionVerifier,
|
||||
private readonly retention: RetentionService,
|
||||
) {}
|
||||
|
||||
@Post('token')
|
||||
@@ -96,6 +98,13 @@ export class DevController {
|
||||
return { eventId: id, scopeId: scope.id };
|
||||
}
|
||||
|
||||
/** Run the retention sweep on demand (drives the retention smoke). */
|
||||
@Post('retention/sweep')
|
||||
async retentionSweep() {
|
||||
this.assertDev();
|
||||
return this.retention.sweep();
|
||||
}
|
||||
|
||||
private principal(authorization?: string): MessagePrincipal {
|
||||
const token = (authorization ?? '').replace(/^Bearer\s+/i, '');
|
||||
if (!token) throw new BadRequestException('Authorization bearer token is required');
|
||||
|
||||
Reference in New Issue
Block a user