Skip to content

New Expensify displays the raw \: escape sequence in dependent-tag names containing a colon. #101426

Closed

Description

@m-natarajan

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.4.81-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from BrowserStack:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @Tmjarnesk1
Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

  1. Upload multilevel dependent tags with a tag name containing a colon.
  2. Navigate to Workspace → Tags.
  3. Open the dependent-tag list containing the project tags.
  4. Locate a tag containing a colon and observe.

Expected Result:

The tag should display as Oakland, SanFransisco, consistent with Expensify Classic and the expense tag picker.

Actual Result:

The dependent-tag list displays the raw stored value as Oak\:land, San\:Fransisco. The backslash appears only on this page; it is not shown in Classic or when the tag is applied to an expense.

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Multilevel Tag file uploaded :
Dependent+with+GL+codes+format (1).csv

Image

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @amyevans

Activity

  1. added
    Daily
    Bug
    on Sep 17, 2026
  2. MelvinBot commented on Sep 17, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The dependent-tag list renders the raw tag name instead of the unescaped one.

    A literal colon inside a tag name is stored escaped as \:, because : is the multi-level tag delimiter. Every other surface unescapes it for display via getCleanedTagName. This one screen skips it when the policy has dependent tags:

    src/pages/workspace/tags/DynamicWorkspaceViewTagsPage.tsx:155

    name: hasDependentTags ? tag.name : getCleanedTagName(tag.name),

    name is display-only. The raw name is already preserved separately in value (:154) and keyForList (:153), which are what the lookups, selection and bulk actions use.

    This is why the escape leaks only here: the tag's own settings page (DynamicTagSettingsPage.tsx:166), the expense tag picker (TagsOptionsListUtils.ts:65), the parent tags page (WorkspaceTagsPage.tsx:379) and Classic all clean the name.

    The conditional was introduced by Fix: Unable to import multi tags on Android and iOS & fix editing tags settings, in the same hunk as a genuinely needed keyForList change. Before that commit the page always cleaned the name, and neither the PR body nor the review discussion mentions the display change — it looks unintended.

    What changes do you think we should make in order to solve the problem?

    Always clean the display name on DynamicWorkspaceViewTagsPage.tsx:155 — drop the hasDependentTags ternary so name becomes getCleanedTagName(tag.name).

    Leave keyForList (:153) and value (:154) raw. They are real identities feeding tagListKeyedByName, currentPolicyTag.tags[...], updateWorkspaceTagEnabled, deletePolicyTags and clearPolicyTagErrors. Cleaning either would break bulk enable/disable/delete for any tag with an escaped colon.

    Add a test to tests/ui/WorkspaceViewTagsTableTest.tsx covering a dependent tag whose name contains \:, since no existing test exercises escaped colons.

    What alternative solutions did you explore? (Optional)

    Cleaning the name inside the table row component instead of at the call site — rejected, because the row also receives already-cleaned names from WorkspaceTagsPage.tsx and would double-process.

    Investigation details, side effects, and a related bug found nearby

    Why cleaning name is safe. name has exactly four consumers, all display-side:

    Selection is keyed purely on keyForList (selection.ts:82-91) and is disabled outright for dependent tags (:386). Row press uses the closed-over PolicyTag object, not the row (:162).

    Expected side effects, both intended:

    • Sort position can shift for affected rows, since the sort now compares what the user actually sees.
    • getCleanedTagName also HTML-decodes, so a dependent tag stored as R&D starts rendering as R&D here — matching every other screen.

    Ruled out: a dependent tag's name is only the leaf label, not a colon-joined path — the parent chain lives in rules.parentTagsFilter as a regex (PolicyTag.ts:20-33). So the \: here is unambiguously an escaped literal colon, not structural. parentTagsFilter itself is never rendered and must not be cleaned.

    Where the escaping comes from: for this flow, the backend. importMultiLevelTags uploads the raw spreadsheet with no client-side escaping (Tag.ts:862-905); the server stores the escaped name. The App can't stop the escaping, so it must render it cleaned.

    Separate bug found nearby, not fixed by the above. The tag list name is also rendered raw in ~10 places, because getTagListName returns the raw Onyx key. Most visibly, the header of this very screen (DynamicWorkspaceViewTagsPage.tsx:363) shows the raw value while line 339 cleans the identical value in the body. Others include DynamicIOURequestStepTag.tsx:208 and SearchEditMultiplePage.tsx:258. Note that currentTagListName doubles as the Onyx lookup key (:79), so the cleaned value must be a separate variable. This only shows up when a list name contains a colon, which the attached CSV doesn't exercise — worth a follow-up issue rather than scope creep here.

    Verification: this is a deterministic rendering bug traced end to end in code; I did not run a live repro, since the reporter's screenshot already shows the raw value and the inconsistency is visible between two screens in the same file.

    Related issue check: no duplicate found. Filtering Expenses by Tag Not Working touches tag matching but is about search filters returning no results, not name display.


    💡 Suggested AI code review rule

    This looks like a recurring, mechanically detectable pattern — the same class of raw-name leak exists in ~10 other places. Proposed for Expensify/App:

    • Rule: CONSISTENCY-18 — Render tag names through getCleanedTagName
    • Condition: Flag when a value originating from PolicyTag.name, getTagListName(...), or a policy-tag Onyx key is passed to a display prop (text, title, name, label, description, headerTitle, defaultValue) without getCleanedTagName. Do not flag identity uses — Onyx lookup keys, keyForList, value, route params, or parentTagsFilter.
    • Why: : is the multi-level tag delimiter, so a literal colon is stored as \:. Skipping the unescape leaks the raw escape sequence to users and makes screens disagree with each other, which is exactly this issue.
    • Search pattern: grep -nE '(text|title|name|label|description|headerTitle|defaultValue)=?\{?[^}]*(tag\.name|TagListName|tagListName)' src/
    • Offending code (❌): DynamicWorkspaceViewTagsPage.tsx:155
    • Correct pattern (✅): TagsOptionsListUtils.ts:63-72 — cleaned for display, raw for key and search

    The full rule file, with the ❌/✅ code inline in App's coding-standards format, would go in App/.claude/skills/app-coding-standards/. If it's worth adding, a maintainer can open it there as a draft PR.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/101426) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run

  3. added
    External
    on Sep 17, 2026
  4. melvin-bot commented on Sep 17, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @Ollyws (External)

  5. melvin-bot commented on Sep 17, 2026

    @melvin-bot

    Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

  6. melvin-bot commented on Sep 22, 2026

    @melvin-bot

    @Ollyws Eep! 4 days overdue now. Issues have feelings too...

  7. melvin-bot commented on Sep 24, 2026

    @melvin-bot

    @Ollyws 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

  8. Ollyws commented on Sep 25, 2026

    @Ollyws
    Contributor

    Will review asap.

  9. ashusatyarthi-wq commented on Sep 27, 2026

    @ashusatyarthi-wq

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When viewing multi-level dependent tags in Workspace > Tags, tag names containing a colon display the raw stored escape sequence (e.g., Oak\:land, San\:Fransisco) instead of the unescaped name (Oak:land, San:Fransisco).


    What is the root cause of that problem?

    In src/pages/workspace/tags/DynamicWorkspaceViewTagsPage.tsx (line 158), the table row data mapping conditionally suppresses cleaning tag names when dependent tags are enabled:

    // src/pages/workspace/tags/DynamicWorkspaceViewTagsPage.tsx:155–165
    acc.push({
        keyForList: hasDependentTags ? `${tag.name}-${tag.rules?.parentTagsFilter ?? ''}` : tag.name,
        value: tag.name,
        name: hasDependentTags ? tag.name : getCleanedTagName(tag.name), // ← Passes raw tag.name when hasDependentTags is true!
        enabled: tag.enabled,
        disabled: isDisabled,
        errors: tag.errors ?? undefined,
        pendingAction: tag.pendingAction,
        isLocked: !canWriteTags || isDisablingLastEnabledTag,
        showEnabledSwitch: !hasDependentTags,
        action: () => navigateToTagSettings(tag),
    });

    Because : serves as the multi-level tag path delimiter, literal colons inside tag names are stored with an escape backslash (\:).

    On regular (non-dependent) tags, line 158 runs getCleanedTagName(tag.name), which unescapes \: to : for display. However, the ternary hasDependentTags ? tag.name : getCleanedTagName(tag.name) deliberately passes the raw stored tag.name whenever hasDependentTags is true.

    Consequently:

    • In dependent tag lists, name is passed as Oak\:land to the table row (WorkspaceTagsTableRow.tsx:98).
    • Internal tag identification (keyForList and value) correctly uses the raw string, but name (which is strictly used for user-facing text, accessibility labels, and sorting) incorrectly displays the unescaped backslash.

    What changes do you think we should make in order to solve the problem?

    In src/pages/workspace/tags/DynamicWorkspaceViewTagsPage.tsx, always wrap tag.name with getCleanedTagName for the display property name:

    diff --git a/src/pages/workspace/tags/DynamicWorkspaceViewTagsPage.tsx b/src/pages/workspace/tags/DynamicWorkspaceViewTagsPage.tsx
    --- a/src/pages/workspace/tags/DynamicWorkspaceViewTagsPage.tsx
    +++ b/src/pages/workspace/tags/DynamicWorkspaceViewTagsPage.tsx
    @@ -155,7 +155,7 @@ function DynamicWorkspaceViewTagsPage({
                 acc.push({
                     keyForList: hasDependentTags ? `${tag.name}-${tag.rules?.parentTagsFilter ?? ''}` : tag.name,
                     value: tag.name,
    -                name: hasDependentTags ? tag.name : getCleanedTagName(tag.name),
    +                name: getCleanedTagName(tag.name),
                     enabled: tag.enabled,
                     disabled: isDisabled,
                     errors: tag.errors ?? undefined,

    Why this is safe:

    • name is used solely for visual display and accessibility in WorkspaceTagsTableRow.tsx.
    • keyForList and value remain unchanged and raw, ensuring list keys, selection state, and tag actions (enable, disable, delete, navigate) continue to receive the exact stored identifier.
    • Tag list search in WorkspaceViewTagsTable/index.tsx tokenizes both name and value, so search matching continues to work for both cleaned and raw representations.

    What alternative solutions did you explore? (Optional)

    • Cleaning inside WorkspaceTagsTableRow.tsx: Rejected because other callers (such as WorkspaceTagsPage.tsx) already pass cleaned names, which would lead to redundant processing. Cleaning at the property derivation site in DynamicWorkspaceViewTagsPage.tsx maintains consistency with the rest of the codebase.
  10. added a commit that references this issue on Sep 27, 2026
    2a9d4b9
  11. Ollyws commented on Sep 28, 2026

    @Ollyws
    Contributor

    I couldn't reproduce this with the attached .csv, it renders the colons without the backslash:

    Image

    @m-natarajan could you re-test? Thanks.

  12. m-natarajan commented on Sep 28, 2026

    @m-natarajan
    Author

    @Ollyws Unable to reproduce this in latest staging v9.4.94-0

    Image
  13. Ollyws commented on Sep 29, 2026

    @Ollyws
    Contributor

    Ok I think we're good to close this then.

    🎀👀🎀 C+ reviewed

  14. melvin-bot commented on Sep 29, 2026

    @melvin-bot

    Triggered auto assignment to @amyevans, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

  15. amyevans commented on Sep 29, 2026

    @amyevans
    Contributor

    Thanks for looking into it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions