Skip to content

sgr: route table/list/calendar SGR wrap-helpers through Ansi (§3.3)#879

Merged
detain merged 2 commits into
masterfrom
ai/sgr-wrap-helpers-batch-a
May 25, 2026
Merged

sgr: route table/list/calendar SGR wrap-helpers through Ansi (§3.3)#879
detain merged 2 commits into
masterfrom
ai/sgr-wrap-helpers-batch-a

Conversation

@detain
Copy link
Copy Markdown
Owner

@detain detain commented May 25, 2026

Summary

Routes seven private "wrap text in SGR codes" helpers through the canonical
SugarCraft\Core\Util\Ansi, replacing hand-built
"\x1b[{$codes}m{$content}\x1b[0m" with
Ansi::CSI . $codes . 'm' . $content . Ansi::reset().

  • Byte-identicalAnsi::CSI === "\x1b[" and Ansi::reset() === "\x1b[0m"; codes are never parsed, surrounding empty-codes guards preserved verbatim.
  • Sites: sugar-table (StyledCell/Column/Table), sugar-stickers (Table/FlexBox), sugar-calendar (DatePicker), candy-lister (Model).
  • All four libs already require sugarcraft/candy-core — no new deps. Per §3.3 of improvements.md (note appended).
  • Sibling scan of all four src/ trees: no other trivial SGR wrap/reset literals found.

Test plan

  • sugar-table — 129 tests, 271 assertions — OK
  • sugar-calendar — 70 tests, 141 assertions — OK
  • candy-lister — 39 tests, 83 assertions — OK
  • sugar-stickers — Table+Flex tests 28/28 OK. Full suite has 27 pre-existing errors (Class "SugarCraft\Bits\Viewport\Viewport" not found — a missing autoload dep in src/Viewport.php, unrelated to this change; confirmed identical count with these edits stashed).
  • Post-edit grep confirms no SGR …m literals remain in any touched method.

Replace seven private "wrap text in SGR codes" helpers that hand-built
"\x1b[{$codes}m{$content}\x1b[0m" with Ansi::CSI . $codes . 'm' . $content
. Ansi::reset(). Byte-identical (Ansi::CSI === "\x1b[", Ansi::reset() ===
"\x1b[0m"); the canonical SGR home is SugarCraft\Core\Util\Ansi. Surrounding
empty-codes guards preserved verbatim. All four libs already require
sugarcraft/candy-core.

Sites: sugar-table StyledCell/Column/Table, sugar-stickers Table/FlexBox,
sugar-calendar DatePicker, candy-lister Model.

## Test plan
- sugar-table:    129 tests, 271 assertions — OK
- sugar-calendar:  70 tests, 141 assertions — OK
- candy-lister:    39 tests,  83 assertions — OK
- sugar-stickers:  Table+Flex tests 28/28 OK (full suite has 27 pre-existing
  errors: missing SugarCraft\Bits\Viewport\Viewport autoload, unrelated to
  this change — confirmed identical with changes stashed).
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 25, 2026

Not up to standards ⛔

🔴 Issues 1 minor

Alerts:
⚠ 1 issue (≤ 0 issues of at least minor severity)

Results:
1 new issue

Category Results
CodeStyle 1 minor

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@detain detain merged commit 407ea8b into master May 25, 2026
3 of 4 checks passed
@detain detain deleted the ai/sgr-wrap-helpers-batch-a branch May 25, 2026 16:04
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.

1 participant