Skip to content

docs(maintenance): correct slog logging behavior after #218#222

Merged
veverkap merged 1 commit into
mainfrom
docs/fix-maintenance-slog-default-behavior-c3682ddc65252291
May 10, 2026
Merged

docs(maintenance): correct slog logging behavior after #218#222
veverkap merged 1 commit into
mainfrom
docs/fix-maintenance-slog-default-behavior-c3682ddc65252291

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 7, 2026

What

Commit 77541e8 (PR #218) changed maintenance.StartCleanup to call slog.Default() inline at each log site rather than capturing the default logger once at the top of runCleaners. This eliminates a race where goroutine scheduling could cause the snapshot to precede a concurrent slog.SetDefault call.

Both docs/maintenance.md and README.md still described the old behaviour:

Log output uses the slog.Logger that was the process-wide default at the time StartCleanup was called, not at the time each cleaner runs.

That statement is now incorrect — the logger is resolved at each log-write, not at startup.

Changes

  • docs/maintenance.md — update the logging bullet to match the actual slog.Default() call-site behaviour.
  • README.md — apply the same correction to the maintenance package section.

New wording

Log output uses slog.Default() resolved at the time each log entry is written. Any call to slog.SetDefault made after StartCleanup returns is immediately reflected in subsequent cleanup log entries.

Testing

Documentation-only change; no code was modified. Verified against maintenance/maintenance.go lines 54–62.

Warning

⚠️ Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • proxy.golang.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "proxy.golang.org"

See Network Configuration for more information.

Generated by Update Docs · ● 1.3M ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/update-docs.md@96b9d4c39aa22359c0b38265927eadb31dcf4e2a

Greptile Summary

This PR corrects two documentation files that described the old (pre-#218) logging behaviour, where the slog.Logger was captured once at startup. The source code now calls slog.Default() inline at each log site, and the docs are updated to match.

  • docs/maintenance.md and README.md: the logging bullet is reworded to state that slog.Default() is resolved at each log-write, so any subsequent slog.SetDefault call is immediately reflected in cleanup log entries.
  • No Go source code was modified; the change is documentation-only and the new wording matches maintenance.go lines 54 and 62 exactly.

Confidence Score: 5/5

Documentation-only change with no Go source modifications; safe to merge.

Both updated sentences match the actual slog.Default() call-site pattern in maintenance.go lines 54 and 62. The old wording was factually wrong and is now corrected in both locations. No code paths are touched.

No files require special attention.

Important Files Changed

Filename Overview
docs/maintenance.md Documentation-only update: corrects the logging behaviour bullet to reflect that slog.Default() is resolved at each log-write site rather than captured once at startup. Wording matches lines 54 and 62 of maintenance.go exactly.
README.md Same one-line correction applied to the maintenance package section; new wording is consistent with docs/maintenance.md and the source implementation.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant StartCleanup
    participant Goroutine
    participant slog

    Caller->>StartCleanup: StartCleanup(ctx, interval, cleaners...)
    StartCleanup->>Goroutine: launch background goroutine
    StartCleanup-->>Caller: return stop()

    Note over Caller: slog.SetDefault(newLogger) — reflected immediately

    Goroutine->>slog: slog.Default().ErrorContext(ctx, ...) [on error]
    slog-->>Goroutine: current default logger (newLogger)

    Goroutine->>slog: slog.Default().ErrorContext(ctx, ...) [on panic]
    slog-->>Goroutine: current default logger (newLogger)

    Caller->>StartCleanup: stop()
    StartCleanup-->>Caller: goroutine exited
Loading

Reviews (1): Last reviewed commit: "docs(maintenance): correct slog logging ..." | Re-trigger Greptile

After commit 77541e8, StartCleanup resolves slog.Default() inline at
each log site rather than capturing it once at startup. Update both
docs/maintenance.md and README.md to reflect that the process-wide
default logger is resolved at the time each log entry is written, so
any slog.SetDefault call made after StartCleanup returns is immediately
reflected in subsequent cleanup log entries.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added automation documentation Improvements or additions to documentation labels May 7, 2026
@veverkap veverkap marked this pull request as ready for review May 10, 2026 17:35
@veverkap veverkap requested review from a team and Copilot May 10, 2026 17:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates maintenance documentation to match the current maintenance.StartCleanup logging behavior after the change in #218, where the logger is resolved via slog.Default() at each log write (so late slog.SetDefault calls affect subsequent cleanup logs).

Changes:

  • Correct the maintenance.StartCleanup logging bullet in README.md.
  • Apply the same correction in docs/maintenance.md.
Show a summary per file
File Description
README.md Updates the maintenance package section to describe per-log-entry slog.Default() resolution.
docs/maintenance.md Updates the maintenance behavior documentation to match current slog.Default() call-site behavior.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@veverkap veverkap merged commit 0894e58 into main May 10, 2026
10 checks passed
@veverkap veverkap deleted the docs/fix-maintenance-slog-default-behavior-c3682ddc65252291 branch May 10, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants