Skip to content

fix: disambiguate color swatches and guild hashtags - #1630

Merged
nunomaduro merged 1 commit into
dev-null-sh:productionfrom
xHeaven:fix/guild-color-mentions
Nov 18, 2026
Merged

nunomaduro merged 1 commit into
dev-null-sh:productionfrom
xHeaven:fix/guild-color-mentions

Conversation

@xHeaven

@xHeaven xHeaven commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Summary

A bare #dead rendered as a swatch even when a guild used that handle. Now #dead can link to the guild, and color(#dead) renders the swatch and hex value with the wrapper hidden in the post.

Changes

  • Show a hint beneath the Composer when a hex-shaped hashtag could be intended as a swatch. Use as color wraps the last candidate, returns focus and the caret to the draft, and leaves posting up to the author.
  • Use the explicit color syntax in preview and published text. Exclude it from guild matching, including feeds and mutes. Keep automatic colors such as #000, numeric issue references such as #123, and literal examples in code or URLs working.
  • Reserve space for the hint so that showing it and applying the fix keep the Composer controls in place.

Validation

  • composer test:lint, composer test:types, and composer test:type-coverage passed. PHP type coverage was 100%.
  • bun run test:unit passed with 321 Node tests and 1,102 component tests. bun run build passed.
  • php -d memory_limit=1G vendor/bin/pest --ci --compact tests/Feature/Controllers/GuildControllerTest.php --filter='excludes explicit swatches' passed with 1 test and 11 assertions.
  • Chromium checks exercised the hint, autofix, caret, preview, guild board, character-limit handling, and code and URL exclusions. All six viewport and theme combinations had zero horizontal overflow and zero measured shift when the hint appeared or the autofix ran. The head log's Inertia navigation and polling had standard CLS of 0. Fresh-load CLS matched the baseline in both themes (0.006196 desktop, 0.009533 laptop, 0 mobile).

Visual evidence

Before and after use the same fictional posts and #dead guild in isolated environments. The draft contains #dead and #CAFE. The after preview shows the Dead guild link and the explicit #CAFE swatch. The color-only palette post is absent from the after guild board.

Desktop Composer · 1440 × 900 · light

Before After
Before, no color hint After, color hint and focused autofix

Screenshot matrix

Viewport Theme Composer Preview Modal Guild board
1440 × 900 Light Before · After Before · After Before · After Before · After
1440 × 900 Dark Before · After Before · After Before · After Before · After
1366 × 650 Light Before · After Before · After Before · After Before · After
1366 × 650 Dark Before · After Before · After Before · After Before · After
390 × 844 (emulated) Light Before · After Before · After Before · After Before · After
390 × 844 (emulated) Dark Before · After Before · After Before · After Before · After

Edge cases in dark mobile emulation. Autofix disabled at the character limit · Code and URLs keep literal colors

Recordings

Desktop · light · mouse autofix and preview

Desktop Composer autofix and preview

MP4

Desktop · dark · keyboard autofix in the modal

Keyboard autofix in the modal

MP4

Mobile viewport · dark · emulated touch. GIF · MP4

Device verification

Safari on an iPhone 18 Pro simulator running iOS 27.0. The software keyboard left Commit visible in both composers. Tapping Use as color restored draft focus. Preview showed the swatch and guild link. The guild link opened the board through Inertia, and a fresh Safari reload kept the color-only post out. Scrolling exposed the floating Composer control above the bottom navigation and Safari toolbar.

Keyboard and hint · Autofix and restored focus · Preview · Guild board · Modal with keyboard

Simulator GIF · Simulator MP4

Independent review

GPT-6.1 Sol, high reasoning, priority service, returned CODE: PASS and VISUAL: PASS for base c2eccd80d1682e38d3718ca9f3b1c6c70e0c7690 and head aff79cda0cb0f13e8d7b31cfe9ea294bf572216f. The reviewer reproduced the autofix and caret restoration in Chromium, ran focused parser and component checks, and inspected the before/after stills, sampled video frames, and native simulator evidence. All 63 media files matched manifest SHA-256 ef7b09e2583795dd58c3af9a80232ec36e4af79b7c275d2ad9b7d5ce38ad6878.

Limitations

The full PHP coverage suite and hosted checks are left to CI. Mobile verification used Chromium viewport emulation and an iOS simulator. Physical devices and Android were outside this validation pass. The short laptop viewport shows pre-existing sidebar overlap, and the floating Composer button can overlay the far right of a post on mobile in both revisions.

Summary by CodeRabbit

  • New Features
    • Added explicit color(#hex) markup for displaying color swatches, with support for 3-, 4-, 6-, and 8-digit hex values.
    • The draft composer can suggest formatting an ambiguous hex-like hashtag as a color swatch.
    • Color swatches render in text while remaining distinct from guild mentions and commits.
  • Bug Fixes
    • Improved hashtag handling around color markup, code, and URLs to reduce unintended links and suggestions.

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The changes add color(#hex) markup for color swatches, a draft action that formats ambiguous color hashtags, and updates to color rendering and guild hashtag matching. They also update documentation and tests for the syntax and related behavior.

Changes: Color Markup and Hashtag Handling

Layer / File(s) Summary
Color and hashtag detection
resources/js/lib/colors.ts, resources/js/lib/code.ts, resources/js/lib/hashtags.ts, tests/Unit/Colors.test.ts
Color detection now recognizes explicit color(#hex) markup and returns display labels with source positions. Hashtag helpers identify ambiguous color hashtags after masking code and URLs.
Draft color formatting and suggestion handling
resources/js/components/commit-composer.tsx, resources/js/components/mention-textarea.tsx, tests/Unit/ComposerDraft.test.tsx, tests/Unit/OrgMentionSuggestions.test.tsx
The composer can replace the last qualifying ambiguous color hashtag with color(#hex), subject to body-length limits. Issue and guild suggestions are suppressed while typing explicit color syntax.
Swatch rendering and guild hashtag matching
resources/js/components/linkified-text.tsx, app/Services/Hashtags.php, tests/Unit/LinkifiedText.test.tsx, tests/Feature/Controllers/GuildControllerTest.php, KNOWLEDGE_BASE.md
Rendered swatches use color labels, and guild hashtag matching removes qualifying explicit color expressions before matching. Tests and documentation cover the updated syntax.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CommitComposerBody
  participant ambiguousColorInDraft
  User->>CommitComposerBody: Enter draft text
  CommitComposerBody->>ambiguousColorInDraft: Check draft for an ambiguous color hashtag
  ambiguousColorInDraft-->>CommitComposerBody: Return the last matching hashtag or no match
  CommitComposerBody-->>User: Show the Use as color action when a match qualifies
  User->>CommitComposerBody: Select Use as color
  CommitComposerBody-->>User: Replace the hashtag with color(hex) and restore the caret
Loading

Suggested reviewers: paulinevos

Merge Risk: Minimal · up to aff79

This change separates explicit color swatches from guild hashtags, and no merge-blocking issue was found. Existing behavior for automatic colors, issue references, and code or URL examples appears preserved.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the two main changes: color swatch disambiguation and guild hashtag handling. The changeset supports both. Explicit color(...) markup now renders swatches, and bare hex-shaped hashtags…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two main changes: color swatch disambiguation and guild hashtag handling. The changeset supports both. Explicit color(...) markup now renders swatches, and bare hex-shaped hashtags such as #dead link to guilds. The title is specific and short. It omits the Composer hint and the explicit-color exclusion from guild matching, which is acceptable.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1e76143e-a7a5-421e-8039-74b28c43b81b
Commits

Reviewing files that changed from the base of the PR and between c2eccd8 and aff79cd.

Files selected for processing: 13

  • KNOWLEDGE_BASE.md
  • app/Services/Hashtags.php
  • resources/js/components/commit-composer.tsx
  • resources/js/components/linkified-text.tsx
  • resources/js/components/mention-textarea.tsx
  • resources/js/lib/code.ts
  • resources/js/lib/colors.ts
  • resources/js/lib/hashtags.ts
  • tests/Feature/Controllers/GuildControllerTest.php
  • tests/Unit/Colors.test.ts
  • tests/Unit/ComposerDraft.test.tsx
  • tests/Unit/LinkifiedText.test.tsx
  • tests/Unit/OrgMentionSuggestions.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@nunomaduro
nunomaduro merged commit a7089ad into dev-null-sh:production Nov 18, 2026
12 checks passed
jubianchi added a commit to jubianchi/dev-null.sh that referenced this pull request Nov 18, 2026
A hashtag had to start with a letter, so guilds like #3dprinting or
when a letter follows them.

Bare colors and issue references keep their meaning: numbers alone, as
in dev-null-sh#123, stay an issue reference, and a word that is a hex color
starting with a digit, as in #3d3d3d or #2fa, stays a color and cannot
name a guild. Letter-first hashtags such as #dead keep the behaviour
from dev-null-sh#1630.
jubianchi added a commit to jubianchi/dev-null.sh that referenced this pull request Nov 18, 2026
A hashtag had to start with a letter, so guilds like #3dprinting or
when a letter follows them.

Bare colors and issue references keep their meaning: numbers alone, as
in dev-null-sh#123, stay an issue reference, and a word that is a hex color
starting with a digit, as in #3d3d3d or #2fa, stays a color and cannot
name a guild. Letter-first hashtags such as #dead keep the behaviour
from dev-null-sh#1630.
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.

2 participants