beads/internal/ui
Huka 602f4bfa8f
fix(uimd): render bd show DESCRIPTION with terminal's actual background (#5776)
* fix(uimd): render bd show DESCRIPTION with terminal's actual background

glamour.WithEnvironmentConfig() defaults to styles.DarkStyle whenever
GLAMOUR_STYLE is unset, with no light/dark auto-detection. That left
the DESCRIPTION section's markdown body always dark-themed regardless
of the terminal's real background, even though internal/ui already
detects it (lipgloss.HasDarkBackground) for the header and every other
adaptive color in bd's output. Result: unreadable low-contrast body
text on light-background terminals.

Export internal/ui's detected background as IsDarkBackground and have
internal/uimd pick glamour's "light" or "dark" style from it, still
honoring an explicit GLAMOUR_STYLE override first.

Fixes #5775

* test(uimd): pin glamourStylePath, add CHANGELOG entry, harden IsDarkBackground

Address PR review requests on #5776:
- Add a table test for glamourStylePath() covering the GLAMOUR_STYLE
  override and the dark/light background branches.
- Add a CHANGELOG entry under Unreleased, scoped to every markdown body
  bd prints (DESCRIPTION, DESIGN, NOTES, ACCEPTANCE CRITERIA, comments,
  direct and proxied), not just bd show's DESCRIPTION field.
- Turn ui.IsDarkBackground from an exported mutable variable into an
  accessor over an unexported one, with a SetDarkBackgroundForTest seam
  for the new table test.
- Document why glamourStylePath's read of the background can never see
  an unprobed zero value: it only runs under the same ui.ShouldUseColor()
  gate that guards the probe.

* docs(recovery): refresh init-safety.md freshness marker

CI doc-flags-freshness check flagged Last reviewed as stale
(2026-06-09, 110 days). Content unchanged, marker bumped.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* chore(bazel): sync internal/uimd BUILD.bazel for the new test imports

markdown_test.go gains `charm.land/glamour/v2/styles` and
`internal/ui`, but `go_test(name = "uimd_test")` carried no `deps`
attribute, so `make bazel-sync` (gazelle) rewrites the file. The
advisory Bazel lane's "BUILD files in sync" step runs that exact
command and `exit 1`s on any porcelain drift, and it arms
unconditionally for fork PRs.

Generated with `make bazel-sync`, the remedy the gate itself prescribes.
No hand-written lines.

* fix(uimd,changelog): pin the style wiring at RenderMarkdown, move the entry to Unreleased

Both review lanes filed the CHANGELOG placement and codex filed the test gap;
this takes both. Neither needed a production change.

CHANGELOG: the 16-line entry was added inside `## [1.3.0] - 2026-09-15`, a
shipped and tagged release, so it rewrote published history for a fix that was
not in 1.3.0 and the next release cut would not have picked it up. Moved under
`## [Unreleased]`, at the END of its first `### Fixed` list rather than the top:
main is appending new entries at the top of that list constantly, and an
insertion there makes the adopted head conflict with main for no benefit
(measured -- top placement gave `git merge-tree` a CHANGELOG conflict, the tail
placement merges clean). The bullet text is byte-identical to the contributor's.

Test: TestGlamourStylePath pinned the helper but nothing pinned
markdown.go's `glamour.WithStylePath(glamourStylePath())`, so the whole
user-visible fix could be reverted with a green suite. Codex confirmed that
empirically and so did this change: reverting that one line to
`glamour.WithEnvironmentConfig()` leaves every pre-existing test in the package
PASSING -- including all four TestGlamourStylePath subtests -- and reds only the
new TestRenderMarkdownUsesTheDetectedBackgroundStyle. The new test renders one
sample under each background and requires the output to differ, so it detects
exactly that regression and nothing else.

The nit (SetDarkBackgroundForTest not re-running initColors) is left alone: the
synthesis marks it "none for merge" and today's only caller reads the flag.

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
2026-10-01 00:55:37 -07:00
..
BUILD.bazel build(bazel): side-by-side Bazel scaffold + policy tests (#6798) 2026-09-27 03:41:02 -07:00
pager.go feat: add FreeBSD release builds (#832) 2026-01-01 10:51:51 -08:00
pager_test.go style: run gofmt across entire codebase (bd-nmk12) 2026-02-07 19:35:20 -08:00
sanitize.go fix: address PR review feedback 2026-03-30 09:15:55 -07:00
sanitize_test.go Sanitize external tracker content for terminal display and add response size limits 2026-03-30 09:12:26 -07:00
styles.go fix(uimd): render bd show DESCRIPTION with terminal's actual background (#5776) 2026-10-01 00:55:37 -07:00
styles_test.go fix(ui): stop using blocked ● for priority in CLI output (#5511) 2026-08-10 06:19:51 -07:00
terminal.go fix(cli): render markdown with terminal capability gates (#3881) 2026-06-25 13:55:28 -07:00
terminal_test.go fix(cli): render markdown with terminal capability gates (#3881) 2026-06-25 13:55:28 -07:00