Skip to content

fix: standardize structured log event names to kebab-case - #52

Open
rcbevans wants to merge 2 commits into
mainfrom
fix/log-event-naming
Open

fix: standardize structured log event names to kebab-case#52
rcbevans wants to merge 2 commits into
mainfrom
fix/log-event-naming

Conversation

@rcbevans

Copy link
Copy Markdown
Contributor

Summary

The codebase used 4+ different naming conventions for structured log event names. The dominant convention (~40+ events) is kebab-case (conn-close-error, pool-draining, notify-payload-parse-failed). This PR standardizes the 15 non-conforming events to kebab-case.

Breaking change

This is a breaking change for log pipelines that filter on event names. Any dashboards, alerts, or log routing rules that match on the old event names will need to be updated.

Renamed events

Old name New name File
"prune completed" "prune-completed" _leader_sweeps.py
"prune failed" "prune-failed" _leader_sweeps.py
"archive expiry completed" "archive-expiry-completed" _leader_sweeps.py
"applied migrations before startup" "migrations-applied-before-startup" migrate.py
"no pending migrations" "no-pending-migrations" migrate.py
"workgroup.child_exit" "workgroup-child-exit" workgroup.py
"workgroup.shutdown_signal" "workgroup-shutdown-signal" workgroup.py
"workgroup.health_kill" "workgroup-health-kill" workgroup.py
"workgroup.background_task_failed" "workgroup-background-task-failed" workgroup.py
"workgroup.shutdown_begin" "workgroup-shutdown-begin" workgroup.py
"workgroup.shutdown_complete" "workgroup-shutdown-complete" workgroup.py
"workgroup.burst_limit_exceeded" "workgroup-burst-limit-exceeded" workgroup.py
"job_failed" "job-failed" _handlers.py
"watch_reclaims-visibility-risk-probe-failed" "watch-reclaims-visibility-risk-probe-failed" _taskq.py
"watch_reclaims-listen-connection-lost" "watch-reclaims-listen-connection-lost" _taskq.py

What was changed

  • Source files (5): Event name string literals in logger.info(), logger.warning(), logger.error(), and logger.critical() calls. Also updated inline comments and docstrings that referenced the old event names.
  • Test files (3): Assertions and test docstrings that check for the renamed event names.
  • No variable names, function names, or code logic was modified.

What was NOT changed

  • typer.echo("no pending migrations") in cli.py — this is a CLI output string, not a structured log event name.
  • watch_reclaims-visibility-delay-at-risk and watch_reclaims-listen-reconnected — these events already use the watch_reclaims snake_case prefix but were not in scope for this audit. They can be addressed in a follow-up if desired.

Verification

  • uv run ruff check . — all checks passed
  • uv run ruff format --check . — 475 files already formatted
  • uv run pyright (on changed source files) — 0 errors, 0 warnings
  • uv run pytest tests/test_notify.py tests/test_leader.py tests/test_leader_prune.py tests/test_shutdown_orchestrator.py tests/test_migrate_coverage.py tests/test_migrate_runner.py tests/test_workgroup.py tests/test_consumer.py tests/test_watch_reclaims.py -v --tb=short -m "not integration"267 passed, 35 deselected
  • Final grep for all 15 old event names across src/, tests/, docs/ — zero hits (only the intentionally-preserved typer.echo CLI output remains)

@rcbevans

Copy link
Copy Markdown
Contributor Author

CI failure is the pre-existing flaky test test_pg_drop_during_phase2 (asserts cancelled but gets abandoned under timing pressure). Same flake noted in PR #39. Retriggered.

@rcbevans
rcbevans requested review from XBeg9, clinzy and kjw-azx July 29, 2026 05:43
@rcbevans rcbevans self-assigned this Jul 29, 2026
Rename 15 log events that used inconsistent naming conventions
(spaces, dot-prefix, snake_case) to the kebab-case convention used
by the majority of the codebase. This is a breaking change for log
pipelines that filter on event names.

Renamed events:
- "prune completed" -> "prune-completed"
- "prune failed" -> "prune-failed"
- "archive expiry completed" -> "archive-expiry-completed"
- "applied migrations before startup" -> "migrations-applied-before-startup"
- "no pending migrations" -> "no-pending-migrations"
- "workgroup.child_exit" -> "workgroup-child-exit"
- "workgroup.shutdown_signal" -> "workgroup-shutdown-signal"
- "workgroup.health_kill" -> "workgroup-health-kill"
- "workgroup.background_task_failed" -> "workgroup-background-task-failed"
- "workgroup.shutdown_begin" -> "workgroup-shutdown-begin"
- "workgroup.shutdown_complete" -> "workgroup-shutdown-complete"
- "workgroup.burst_limit_exceeded" -> "workgroup-burst-limit-exceeded"
- "job_failed" -> "job-failed"
- "watch_reclaims-visibility-risk-probe-failed" -> "watch-reclaims-visibility-risk-probe-failed"
- "watch_reclaims-listen-connection-lost" -> "watch-reclaims-listen-connection-lost"
@rcbevans
rcbevans force-pushed the fix/log-event-naming branch from 5bb55cd to 80dbf30 Compare July 30, 2026 04:54
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