Skip to content

feat(audit): flag unexpected resources (ok/unexpected + Reason); finish DynamoDB removal#83

Merged
stevethomas merged 2 commits into
mainfrom
claude/gifted-lumiere-166b26
Jun 3, 2026
Merged

feat(audit): flag unexpected resources (ok/unexpected + Reason); finish DynamoDB removal#83
stevethomas merged 2 commits into
mainfrom
claude/gifted-lumiere-166b26

Conversation

@stevethomas
Copy link
Copy Markdown
Member

@stevethomas stevethomas commented Jun 3, 2026

Hey, I made a thing! 🥳

What problems are you solving?

Three things, all downstream of #80 (dropping DynamoDB sessions for Valkey):

  1. yolo audit couldn't see the leftover DynamoDB table. After feat(sessions): drop DynamoDB, move sessions onto the Valkey cluster #80 deleted YOLO's DynamoDB support, the per-app sessions table still lives in AWS — and it's still tagged yolo:app=<live app>, so audit's ownership test read it as fine. Audit had no way to know YOLO had stopped provisioning that kind of resource.

    Audit now flags it. A resource carrying a YOLO ownership marker but of an AWS service YOLO no longer has a Resources/ class for is surfaced — driven by Audit::SERVICE_BY_RESOURCE_GROUP, whose keys mirror the src/Resources/* directories (enforced by ManagedServicesTest). So it's correct by construction: dropping a service directory auto-surfaces its leftovers, and a still-managed service is never false-flagged. yolo audit production now shows the DynamoDB sessions table as a teardown candidate.

  2. Audit's status vocabulary was confusing — collapsed to two statuses + a Reason column. The original ok/drift/orphan/rogue taxonomy overloaded "drift", which already means attribute-level config mismatch in yolo sync. Audit is an ownership/inventory check — tags, ARN service, and whether the owning app's cluster is live — and it never inspects a resource's configuration. So it really has two outcomes:

    Status Meaning
    ok Accounted for.
    unexpected In the env's tag namespace but not accounted for — see the Reason.

    The cause moves into a Reason column: no ownership tag (was rogue), service no longer provisioned (was orphan — the DynamoDB case), app cluster gone (was drift). A sentence beats a one-word label, and "drift" now means exactly one thing across YOLO. The --drift flag becomes --unexpected.

  3. Finish scrubbing DynamoDB from the codebase. feat(sessions): drop DynamoDB, move sessions onto the Valkey cluster #80 left tombstones + one stale default: dropped the session.driver: dynamodb special-case in the manifest validator (the generic allow-list already rejects it) and its dedicated test; removed the DynamoDB absence-assertions from the IAM/env-step tests; fixed the yolo.yml stub that still advertised dynamodb as the default session driver, and the manifest-reference deprecation note.

Is there anything the reviewer needs to know to deploy this?

  • No infrastructure change and no AWS mutations — this is audit classification logic plus docs/test cleanup. The check is pure (tags + ARN service + cluster liveness), unit-tested, and rides the existing Resource Groups Tagging API query.
  • The leftover DynamoDB table is not deleted by this PR, by design — it now appears as unexpected / service no longer provisioned in yolo audit production; teardown is a manual aws dynamodb delete-table once confirmed.
  • Detection covers whole-service removal (the DynamoDB case), not per-resource desired-state. Catching feature-toggle-off leftovers (e.g. an IVS channel after disabling IVS) would need every sync step — including the custom-orchestration ones (S3 bucket, queue alarms, certs) — to declare its resource; left as a follow-up to avoid false-flagging legit infra.
  • 518 tests pass · phpstan clean · pint clean · VitePress build clean.

🤖 Generated with Claude Code

stevethomas and others added 2 commits June 3, 2026 16:39
…namoDB removal

`yolo audit` now classifies a fourth status, `orphan`: a resource carrying a
YOLO ownership marker but of an AWS service YOLO no longer provisions (it has
no `Resources/` class, so a sync would never recreate it). Driven by
`Audit::SERVICE_BY_RESOURCE_GROUP`, whose keys mirror the `src/Resources/*`
directories — enforced by ManagedServicesTest — so dropping a service dir
auto-surfaces its leftovers and a still-managed service is never false-flagged.

This makes the DynamoDB sessions table left behind by #80 visible: it's still
tagged `yolo:app=<live app>` (so the ownership test alone read it as `ok`), but
YOLO has no DynamoDB resource any more, so it now shows as `orphan` — a clear
teardown candidate. Orphan takes precedence over ok/drift and is surfaced via a
warning + a red label, ordered cleanup-first within its scope.

Also finishes scrubbing DynamoDB from the codebase:
- drop the `session.driver: dynamodb` special-case in the manifest validator
  (the generic allow-list already rejects it) and its dedicated test
- remove the DynamoDB tombstone assertions/comments from the IAM and env-step
  tests
- fix the `yolo.yml` stub that still advertised `dynamodb` as the default
  session driver, and the manifest-reference deprecation note

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Following review: the four-way ok/drift/orphan/rogue taxonomy overloaded
"drift" — which already means attribute-level config mismatch in `yolo sync` —
and made the labels hard to keep straight. Audit is an ownership/inventory
check (tags + ARN service + cluster liveness), never a config check, so it
really has just two outcomes:

- `ok`         — accounted for
- `unexpected` — not accounted for, with a `reason`:
    - `no ownership tag`              (was rogue)
    - `service no longer provisioned` (was orphan — the DynamoDB table)
    - `app cluster gone`              (was drift)

The cause moves from a one-word status into a Reason column — a sentence beats
a label, and "drift" now means exactly one thing across YOLO. The `--drift`
flag becomes `--unexpected`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@stevethomas stevethomas changed the title feat(audit): flag orphaned resources of unmanaged services; finish DynamoDB removal feat(audit): flag unexpected resources (ok/unexpected + Reason); finish DynamoDB removal Jun 3, 2026
@stevethomas stevethomas merged commit b02d5a4 into main Jun 3, 2026
5 checks passed
@stevethomas stevethomas deleted the claude/gifted-lumiere-166b26 branch June 3, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant