Skip to content

test(overlay): add coverage for overlay rendering - #71

Merged
mabd-dev merged 2 commits into
mabd-dev:mainfrom
frittlechasm:test/overlay-coverage
Sep 6, 2026
Merged

test(overlay): add coverage for overlay rendering#71
mabd-dev merged 2 commits into
mabd-dev:mainfrom
frittlechasm:test/overlay-coverage

Conversation

@frittlechasm

@frittlechasm frittlechasm commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Pull Request

Description

Adds test coverage for the internal/render/tui/overlay package as part of #63.

The tests cover the package's current behavior without changing production code. Found some issues that I will raise another PR for 100% coverage.

Changes Made

  • Added tests for centered, left-aligned, right-aligned, and bottom-right overlays
  • Added tests for padding, coordinate clamping, shadows, and custom whitespace
  • Added tests for ANSI-styled text and Unicode display widths
  • Increased package test coverage from 0% to 98.5%

Testing

go test -cover ./internal/render/tui/overlay
  • Tested locally with example workflows
  • Added new tests (if applicable)
  • Tested with different filters, output, etc...

Checklist

  • I have starred the repository
  • My code follows the project's code style
  • I have updated the documentation (README, cli-flags, etc...)
  • My changes generate no new warnings
  • I have tested my changes in a real workflow
  • All tests pass locally

Greptile Summary

This PR adds coverage for overlay placement and rendering helpers. One non-blocking coverage gap remains: the shadow test does not verify the shadow's full horizontal geometry, so some visible rendering regressions would still pass.

Confidence Score: 4/5

Safe to merge from a product-safety perspective; the remaining concern affects regression protection rather than runtime behavior.

The only finding is a verified, non-blocking test-coverage gap.

Files Needing Attention: internal/render/tui/overlay/overlay_test.go

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex produced a proof for the posted P2 finding and linked it to the corresponding review comment.
  • T-Rex produced a second P2 finding proof for another review comment and prepared its artifacts for reviewer inspection.
  • T-Rex ran contract-validation tests for rendering baseline and several mutants; the baseline and two mutants passed, while one variant's result was explained by overlay clamping.

View all artifacts

T-Rex Ran code and verified through T-Rex

Comments Outside Diff (1)

  1. General comment

    P2 Shadow test accepts incorrect horizontal offset and width

    • Bug
      • TestPlaceOverlayWithShadow checks the exact first line but only requires that lines[1] contain at least one ; it does not check the shadow rune's column or count, and it does not assert the final line. Focused temporary-copy mutations shifting the shadow left and increasing its width both passed the current test despite visibly changing the rendered geometry.
    • Cause
      • The test uses strings.Contains(lines[1], "░") at lines 136-138 instead of asserting the complete expected shadow geometry or ANSI-stripped line contents across all relevant rows.
    • Fix
      • Assert the full expected geometry after stripping ANSI styling (for this input: first row X .., second row ░.., final row ....), or assert explicit shadow positions/counts and unchanged final row.

    T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "test(overlay): add coverage for overlay ..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

Comment on lines +136 to +138
if !strings.Contains(lines[1], "░") {
t.Errorf("second line does not contain shadow character: %q", lines[1])
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Protect Shadow Geometry

This non-blocking test only checks whether the second row contains a shadow rune, not its column or width, and it does not assert the final row. A shifted or wider shadow can therefore change the rendered overlay while this test still passes, reducing the value of the new regression coverage. Assert the ANSI-stripped complete output, or explicitly check each shadow row and rune position.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Artifacts

Evidence from the check

  • A non-destructive script copies the repository to a temporary directory, runs the baseline test, then runs vertical-extent, horizontal-offset, and width mutants; it shows which broken geometries the existing test accepts.

Command output from the check

  • Captured output from executing the focused mutation script shows baseline success and that left-offset and wider-shadow mutants still pass, confirming the coverage gap.

View artifacts

T-Rex Ran code and verified through T-Rex

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

tried to fix this in 186e6a3 with help from Codex & Claude

@mabd-dev
mabd-dev merged commit 6623fe6 into mabd-dev:main Sep 6, 2026
5 checks passed
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.

2 participants