feat(highlights): paint and clear valid non-palette API hex (YPE-4494) - #131
Conversation
Partner apps share a highlights DB with the main Bible app, which can use colors outside the five SDK swatches. RN Expo now paints valid non-palette hex from the API, shows an exact-hex remove swatch (ANY rule), keeps apply palette-only, and drops invalid hex from paint and the action tray. Co-authored-by: Cameron Pak <cameronandrewpak@gmail.com>
cameronapak
left a comment
There was a problem hiding this comment.
Spec
Mostly pass vs YPE-4494.
Locked rules look implemented:
- Apply stays palette-only (
startWriterejects non-palette apply) - Paint keeps valid non-palette via
isValidHighlightHexinderiveServerColors - Remove tray shows exact non-palette hex + checkmark (
buildVerseActionSwatches); invalid dropped - Remove write allows valid non-palette; invalid rejected
- ANY remove kept; stacked on
highlights/ #100 - Locked seam tests present (swatches, paint-projection, useHighlights clear/apply)
Partial: projectPaintColors is tested/exported but not used on the production paint path (deriveServerColors inlines the same filter). Ticket asked to prefer existing helpers / paint-projection seam — either wire it or drop the unused export.
Standards
Changes requested (docs).
- Hard:
AGENTS.mdstill says bothapplyandremovereject non-palette (Do not relax this…). Code +constants.tsprose already relax remove/paint. Update AGENTS (and ADR 0017’s “colors outside the five swatches are ignored”) in this PR so the written standard matches. - Hard/soft: Core Exports list in AGENTS should include
isValidHighlightHex(andprojectPaintColorsonly if it stays public). - Judgement: unused
projectPaintColors+ duplicated normalize/validate across cache/swatches. - Soft: no changeset here — OK if the #100 stack carries one at ship time; call that out before merge.
Code Reviewer bot, sent on behalf of Cam. Own-PR review → COMMENT (GitHub blocks self-approve).
cameronapak
left a comment
There was a problem hiding this comment.
Spec follow-up
One more Spec gap vs web parity (YPE-4494 “web matching helpers”):
showAllApplyColors on Expo uses activePaletteColors.size > 1, while web uses activeHighlights.size > 1 (includes non-palette).
Mixed fully-highlighted selection {1:'123456', 2:YELLOW} currently omits yellow from the apply row (locked by the new swatch test). Web would re-offer the full palette so the user can paint yellow onto the non-palette verse.
Please align Expo with web (activeHighlights / total distinct valid colors), and flip that test expectation.
Code Reviewer bot, sent on behalf of Cam.
…lors Update AGENTS.md and ADR 0017 to document palette-only apply, valid non-palette paint/remove, and invalid hex dropping. Remove the unused projectPaintColors helper; deriveServerColors already filters via isValidHighlightHex. Co-authored-by: Cameron Pak <cameronandrewpak@gmail.com>
Match web activeHighlights.size > 1: mixed palette + non-palette selections re-offer the full apply row so users can paint over custom hex. Add locked swatch seam test for the mixed case. Co-authored-by: Cameron Pak <cameronandrewpak@gmail.com>
…rs gate Co-authored-by: Cameron Pak <cameronandrewpak@gmail.com>
cameronapak
left a comment
There was a problem hiding this comment.
Re-review @ 9d8a1d6
Follow-ups address the prior Spec + Standards blockers.
Spec
Pass.
showAllApplyColorsnow usesactiveHighlights.size > 1(web parity)- Swatch test expects full apply row for
{123456, YELLOW} - Apply palette-only / paint+clear valid non-palette / invalid dropped / ANY remove still hold
- Unused
projectPaintColorsremoved;isValidHighlightHexremains on the paint path
Standards
Pass.
AGENTS.mdapply/remove/paint rules updated for YPE-4494- ADR 0017 no longer says non-palette colors are ignored
Soft (non-blocking): Core Exports bullet in AGENTS.md still lists HIGHLIGHT_COLORS / isHighlightColor only — consider adding isValidHighlightHex since it is public from core.
No remaining blocking findings from my side.
Code Reviewer bot, sent on behalf of Cam. Own-PR review → COMMENT (GitHub blocks self-approve).
Co-authored-by: Cameron Pak <cameronandrewpak@gmail.com>
bmanquen
left a comment
There was a problem hiding this comment.
Two-axis review of highlights...HEAD — Standards (repo docs + smell baseline) and Spec (YPE-4494). Findings are inline, labelled by axis; the two are reported separately and not reranked against each other.
Standards: 6. Spec: 5, two blocking.
Co-authored-by: Cameron Pak <cameronandrewpak@gmail.com>
Co-authored-by: Cameron Pak <cameronandrewpak@gmail.com>
Review feedback (Cam)
Addresses blocking review on #131:
AGENTS.mdand ADR 0017 now document YPE-4494 behavior: palette-only apply, valid non-palette hex paints and clears (ANY rule + exact hex remove circles), invalid hex dropped.projectPaintColors; production paint already filters viaisValidHighlightHexinsidederiveServerColors.Still open from review (not in this commit)
activePaletteColors.size > 1vs webactiveHighlights.size > 1when selection mixes palette + non-palette (threads onverse-action-swatches.ts).Visual context (YPE-4494)
Same contract as web #330, split across core paint + native tray:
Ownership:
Call shape for Clear on a near-black API color (
0a0000):Greptile’s flowchart below still describes the validation gate; this section adds ownership + the tray call path.
Greptile Summary
The PR enables valid six-digit non-palette API highlight colors to paint and be cleared while keeping apply actions palette-only.
Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD API[API highlight color] --> Validate{Valid six-digit hex?} Validate -- No --> Drop[Drop from paint and swatches] Validate -- Yes --> Paint[Normalize and paint] Paint --> Palette{Palette color?} Palette -- Yes --> RemovePalette[Show palette remove swatch] Palette -- No --> RemoveCustom[Show exact custom remove swatch] Apply[Apply action] --> ApplyPalette{Palette color?} ApplyPalette -- Yes --> Write[Paint and write] ApplyPalette -- No --> Reject[Reject as invalid]Reviews (4): Last reviewed commit: "fix(ui): pin platform-react-ui@2.6.2 for..." | Re-trigger Greptile