Branch: ai/probe-consumers
Depends on: step-13 (TerminalProbe in candy-palette)
Blocks: β
Migrate sugar-glow and candy-wish to consume TerminalProbe from candy-palette (extracted in step-13). Today both libs do their own probing; both have known failure modes on Windows/SSH/old terminals.
Reference: Β§387.9 (terminal-probing reinvention), Β§13.5 (probing failures cited for these libs).
sugar-glow/composer.jsonΒ·candy-wish/composer.jsonβ addsugarcraft/candy-paletteif not already there (it might already be there for color profile); confirm viapath-repo-closure.sugar-glow/src/β replace any direct env-var/terminfo probing with\SugarCraft\Palette\Probe\TerminalProbe::run(). ReadCapabilityenum to decide rendering paths (e.g., Sixel vs HalfBlock).candy-wish/src/β same.- Both libs' existing probing-related tests can be removed (now tested centrally in candy-palette) β replace with consumer-side tests confirming the lib correctly maps Capabilities to its rendering choices.
- No env-var / terminfo parsing code left in sugar-glow or candy-wish.
- Both libs consume
TerminalProbe::run()for any capability check. - On simulated probe failure, both libs degrade gracefully (no panics).
- Existing tests pass (after porting probe-specific tests to consumer-side mapping tests).
- β₯95 % coverage maintained.
-
git statusclean on master.
- path-repo closure: candy-palette in both libs if not already there.
- sugar-glow: identify probing call sites (look for
getenv('TERM_PROGRAM'),getenv('COLORTERM'), terminfo lookups). Replace each with aCapabilitycheck via TerminalProbe. - candy-wish: same.
- Graceful failure: ensure that if TerminalProbe throws (it shouldn't after step-13, but defensively), both libs fall back to the lowest-common-denominator rendering.
- Run phpunit + check-path-repos.
- Mock TerminalProbe via DI (test seam) to return fixture ProbeReports; assert each lib picks the right rendering path.
- Simulated probe failure: TerminalProbe throws β lib still produces output (no panic).
- Coverage on each lib's rendering-decision branches.
- Each lib's README:
## Shared foundationsmentioning candy-palette's TerminalProbe. - CALIBER_LEARNINGS in each: "Don't getenv() or read terminfo directly β go through TerminalProbe."
- PR title:
sugar-glow + candy-wish: consume TerminalProbe - PR body:
## Summary - sugar-glow + candy-wish migrated to candy-palette's TerminalProbe (step-13). - Direct env-var/terminfo probing removed from both libs. - Graceful fallback on simulated probe failure verified. - Closes Β§387.9 (probing reinvention) and addresses Windows/SSH/old-terminal failure modes. ## Test plan - [x] vendor/bin/phpunit in sugar-glow + candy-wish (β₯95% each) - [x] Mocked-Probe consumer-side mapping tests - [x] php tools/check-path-repos.php Refs: docs/repo_map_step_29.md, docs/repo_map_update.md Β§387.9, Β§13.5 - Commit subject:
sugar-glow + candy-wish: consume TerminalProbe.