Repository navigation
Conversation
✅ Integration test reportCommit: af6a99b
Top 3 slowest tests (at least 2 minutes):
|
|
/review |
61fd417 to
f9e24c5
Compare
f9e24c5 to
c8050e5
Compare
c8050e5 to
d7b1888
Compare
|
/review |
093b1be to
a89f4ef
Compare
|
/review |
There was a problem hiding this comment.
Automated review at a89f4ef. Each finding was verified against the code.
No blocking issues found. 5 non-blocking comment(s) and 1 question(s) below.
This PR adds a cmdio.Renderer layer (Color, LightDark, Hyperlink, Writer/Render) so callers stop depending on lipgloss v1 APIs that v2 removes, and it raises MSYS2 pty pipes from Ascii to basic ANSI. I traced the call sites and found nothing that changes output on v1 apart from the MSYS2 raise and the selftest tui profile diagnostic. That diagnostic now prints the same background for both streams and NoTTY where it used to print Ascii. The other items are smaller: the MSYS2 branch reads CLICOLOR from the process environment instead of ctx, one security test lost its OSC 8 check, and a few doc comments are imprecise.
Questions
- The MSYS2 Ascii→ANSI raise (
libs/cmdio/lipgloss.go:54, plus the two conpty tests) changes what Git Bash/mintty users see. It ships inside a PR that otherwise only reroutes callers and keeps v1 output unchanged, and it can only be checked by hand on Windows. Should it land in its own PR so it can be reviewed and reverted on its own, or does it need to stay with the seam? (non-blocking)
| lg.SetColorProfile(termenv.Ascii) | ||
| return &Renderer{lg: lg, profile: colorprofile.NoTTY}, false | ||
| } | ||
| if isMSYSPipe(w) && lg.ColorProfile() == termenv.Ascii && !termenv.EnvNoColor() { |
There was a problem hiding this comment.
[nice to have] termenv.EnvNoColor() reads CLICOLOR (and NO_COLOR) with os.Getenv. Everything else in cmdio reads these from ctx via env.Get (colorFromEnv in capabilities.go). So env.Set(ctx, "CLICOLOR", "0"), as acceptance tests do, doesn't stop an MSYS2 pipe from being raised to ANSI. That is also why the new conpty tests need t.Setenv. Could this be env.Get(ctx, "CLICOLOR") == "0", plus a CLICOLOR_FORCE check if you want termenv's full rule, so the decision comes from the same place as SupportsColor?
pardis-beikzadeh-db
left a comment
There was a problem hiding this comment.
Review limited to cmd/air.
| // emits no SGR codes; combined with the link fallback below this gives clean, | ||
| // un-escaped output under --no-color / NO_COLOR / piped stdout. | ||
| renderer, colorOn := cmdio.NewRenderer(ctx, out) | ||
| out = renderer.Writer(out) |
There was a problem hiding this comment.
problem: every styled cmd/air output now needs out = renderer.Writer(out) next to NewRenderer and newPalette, at four sites (here, run.go:398, run.go:413, logs.go:260). Today a missing one changes nothing, but after the v2 swap a new caller that forgets it prints color codes under --no-color or into pipes.
suggested fix: one helper that returns all three, e.g. newPalette(ctx, out) (palette, io.Writer, bool), used at the four sites. Fine as a follow-up.
a89f4ef to
75adb25
Compare
75adb25 to
273b6a3
Compare
273b6a3 to
7d1ad34
Compare
Adds the seam the charm.land v2 swap needs without changing output on v1. cmdio.Renderer carries the color profile for one writer: NewStyle, Profile, Writer, Render. Color, LightDark and Hyperlink stand in for the lipgloss helpers whose shape changes in v2. NewRenderer keeps #7700's rules: termenv's profile, Ascii when color is off, and the MSYS2 pty raise to ANSI unless CLICOLOR=0. Callers move to it: cmd/air writes through Renderer.Writer, and the selftest profile and huh probes read the profile and dark background through cmdio. Ruleguard bans lipgloss.AdaptiveColor and termenv.Hyperlink in new code so the v2 swap does not reintroduce them. No output changes: LogString still writes to stderr unstripped, and no pin golden moves. Co-authored-by: Isaac <no-reply@databricks.com>
7d1ad34 to
af6a99b
Compare
Changes
Adds the renderer seam the charm.land v2 swap needs. On v1 it changes output in one place: Git Bash and other MSYS2 terminals (see below).
libs/cmdio/lipgloss.go:Renderer(NewStyle,Profile,Writer,Render),Color,LightDark,Hyperlink.NewRendereruses termenv's profile and Ascii when color is off, as before. New: on an MSYS2 pty pipe, which cmdio treats as a terminal since cmdio: make NO_COLOR only affect color #7700 but termenv cannot recognise, it raises the profile from Ascii to basic ANSI unlessCLICOLOR=0. Lipgloss styles (spinner, pager, tables,databricks air) were uncolored there; they now show basic colors. v2 needs the same rule, so it lands here where it can be checked on v1.cmd/airwrites throughRenderer.Writer.cmd/selftest/tuiprofile and huh probes read the profile and dark background throughcmdio.libs/gorules/rule_lipgloss.gobanslipgloss.AdaptiveColorandtermenv.Hyperlinkin new code.Why
v2 removes
AdaptiveColor,termenv.Hyperlinkand the*Renderermethods the callers used, so every caller needs a version-agnostic seam first. Landing it on v1 first keeps the swap a mechanical change.LogStringis not in this PR, so stderr output is unchanged; that is the next PR.Tests
go build ./...;go veton touched packages; golangci-lint (0 issues); gofmt clean.TERM=xterm-256color go test -race -count=3 ./libs/cmdio/...passes.go testforlibs/tableview,libs/apps/...,cmd/air,cmd/apps,cmd/fs,cmd/aitools,cmd/selftest/...,internal/buildpasses.go test ./acceptance/...) passes.-update. No golden changes.Stack: based on
pietern/charm-v2/01-termtest-emulator. The branch after this one ispietern/charm-v2/02b-logstring-strip, which changes stderr output.Manual check for real terminals: in Git Bash (mintty),
databricks selftest tui colors --lipglossshows colored swatches with this PR and uncolored ones with #7736 below it; withCLICOLOR=0both are uncolored.This pull request and its description were written by Isaac.