Skip to content

Add showCitationNumbers theme flag to toggle inline citation badges - #209

Merged
josej-ea merged 3 commits into
adobe:devfrom
josej-ea:feature/theme-citation-numbers-toggle
Nov 11, 2026
Merged

josej-ea merged 3 commits into
adobe:devfrom
josej-ea:feature/theme-citation-numbers-toggle

Conversation

@josej-ea

@josej-ea josej-ea commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a new theme behavior flag, behavior.citations.showCitationNumbers (default true), that controls whether inline citation number badges render in concierge message text. The "Sources" footer below the message is unaffected.

Android counterpart to the iOS PR: adobe/aepsdk-concierge-ios#201

Motivation

Brands want the sources list for transparency without the inline ①② badges interrupting message readability. Previously the badges always rendered when sources were present; the only existing citations flag (showLinkIcon) controls the sources list link icon, not the inline badges.

Changes

  • ConciergeThemeTokens.kt — new showCitationNumbers: Boolean = true on ConciergeCitationsBehavior; default keeps existing themes unaffected (backward compatible).
  • ThemeParser.kt — parses the key with optBoolean(..., true) so a missing key preserves current behavior.
  • ConciergeResponse.kt — when the flag is false, citation annotation is skipped (sources passed as empty to CitationAnnotator) so no inline badges render; the Sources footer is still driven separately by ChatFooter.
  • ThemeParserTest.kt — coverage for explicit false and the missing-key default.
  • style-guide.md — documents the key in the behavior table, JSON examples, and implementation-status table.

Testing

  • ThemeParserTest: 112/112 passing, including the 2 new citations tests.
  • Verified end-to-end in the Android sample app: with "showCitationNumbers": false in behavior.citations, concierge messages render without inline badges while the Sources footer still appears.

Theme usage

"behavior": {
  "citations": {
    "showLinkIcon": true,
    "showCitationNumbers": false
  }
}

Adds behavior.citations.showCitationNumbers (default true) so themes can
hide the inline citation number badges in concierge message text while
keeping the Sources footer below the message visible.

- ConciergeCitationsBehavior: new flag, defaults to true so existing
  themes are unaffected
- ThemeParser: parse the key with optBoolean default true
- ConciergeResponse: skip citation annotation when flag is false
- ThemeParserTest: coverage for explicit false and missing-key default
- Document the key in style-guide.md

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@codecov

codecov Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...cierge/ui/components/messages/ConciergeResponse.kt 75.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@josej-ea
josej-ea requested a review from rymorale November 10, 2026 18:49

@rymorale rymorale left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the changes look good to me overall with just a couple of minor things to address. feel free to merge after updating.

// When behavior.citations.showCitationNumbers is false, skip annotation so no inline
// citation number badges render; the Sources footer is driven separately by ChatFooter.
val annotatedText = remember(text, sources, citationsBehavior.showCitationNumbers) {
val effectiveSources = if (citationsBehavior.showCitationNumbers) sources else emptyList()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new tests only cover parsing, so reverting this line wouldn't fail anything. Could we add a small Compose UI test (e.g. alongside the existing ChatMessageItemTest) that sets showCitationNumbers = false with non-empty sources and asserts no citation badges render while the Sources footer is still shown?

val linkIconStyle: ConciergeLinkIconStyle? = null
val linkIconStyle: ConciergeLinkIconStyle? = null,
/** Whether inline citation number badges are rendered in the message text. The "Sources" footer is unaffected. */
val showCitationNumbers: Boolean = true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: ConciergeCitationsBehavior is a public data class, so adding a constructor param changes the constructor/copy signatures. This is source compatible for Kotlin callers but not binary compatible for anything compiled against the previous version. It follows the same pattern as linkIconStyle, so not blocking, just worth noting in the release notes.

Address review feedback for showCitationNumbers:

- Add Compose UI tests verifying disabled citation numbers hide inline
  badges while the Sources footer remains visible and expandable
- Cover explicit enabled and default behavior to confirm badges render
- Document the constructor and generated copy signature changes in
  ConciergeCitationsBehavior and the need to recompile binary consumers
- Link release notes from the documentation index

Validation:
- All 3 new Compose UI tests pass on the Android emulator
- Temporarily bypassing the rendering guard causes the disabled-state
  test to fail; restoring it returns all tests to passing
- Android 17 validation required a temporary newer AndroidX test-tooling
  override; no repository dependency changes included
Comment thread Documentation/release-notes.md Outdated
@@ -0,0 +1,13 @@
# Release notes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we typically add the release notes in the tag created when making a release. did you mean to commit this file?

| `behavior.citations.linkIconStyle.size` | number | `16` | Inline link icon size, in dp. |
| `behavior.citations.linkIconStyle.spacing` | number | `2` | Gap between link text and its icon, in dp. |
| `behavior.citations.linkIconStyle.color` | string | `--message-concierge-link-color`, else `--color-text` | Inline link icon tint color (hex). |
| `behavior.citations.showCitationNumbers` | boolean | `true` | When `false`, hides the inline citation number badges in AI message text. The "Sources" footer below the message still appears. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The testapp themes (code/testapp/src/main/assets/themeDefault.json and themeDemo.json) don't include showCitationNumbers under behavior.citations. The iOS PR added it to theme-all-properties.json. could we add it here too for discoverability?

Add explicit showCitationNumbers defaults to both bundled test-app themes. Remove the standalone release notes and index link, retaining the SDK binary-compatibility warning in the style guide.
@josej-ea
josej-ea requested a review from rymorale November 11, 2026 03:47
@josej-ea
josej-ea merged commit 0f086bc into adobe:dev Nov 11, 2026
11 checks passed
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