Skip to content

Redact ANSI formatting codes from observability snapshot test #108

Description

@coderabbitai

Summary

The run_observability_logs_match_snapshot test in src/bin_tests/main_tests.rs was updated in #107 to accept ANSI escape/colour codes embedded directly in the insta::assert_snapshot! expected output. This makes the snapshot brittle: any incidental change to terminal colour configuration, tracing subscriber settings, or escape-code formatting will break the test without indicating a real behavioural regression. It also obscures the actual behavioural expectations behind raw escape sequences.

Resolution

  • Strip ANSI escape sequences from log output before snapshotting (e.g., configure the tracing subscriber with colour disabled in test environments, or apply a redaction filter), so that snapshots contain only human-readable structured text.
  • Add separate semantic assertions about log structure and field presence (e.g., that operation, repository, branch, and outcome fields are present) to make the behavioural intent explicit and robust.

References

/cc @leynos

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions