refactor(folders): derive roleOf and isServerSpecial from one attribute table #117

Merged
JMR-dev merged 2 commits from refactor-folder-role-table into main 2026-07-02 08:39:35 +00:00
2 Commits
Author SHA1 Message Date
Jason Ross 9c73654723 Merge branch 'main' into refactor-folder-role-table 2026-07-02 03:29:37 -05:00
JMR-devandClaude Fable 5 10203d8ee9 refactor(folders): derive roleOf and isServerSpecial from one attribute table
Replaces the two hand-maintained RFC 6154 tables in FolderRole's companion
-- roleOf's attribute when-ladder and the separate SPECIAL_USE_ATTRIBUTES set,
which had already drifted (\All and \Flagged were special-use but had no role
branch) -- with a single ordered ATTRIBUTE_ROLES map from a lowercase
SPECIAL-USE attribute to the FolderRole it implies (null = server-special but
role-less). roleOf returns the first role-bearing entry the folder advertises
(insertion order preserves the old ladder's precedence); isServerSpecial treats
every key as special-use. One source of truth, so the two can no longer diverge.

Also adds \Important (RFC 8457) as a role-less special-use key, so Gmail's
[Gmail]/Important is recognized as server-provisioned and the drawer de-dup
renders "Important - Gmail" instead of leaking the raw "Important ([Gmail])"
namespace form (#62). Purely additive: no role/specialUse mapping changed for
any existing attribute, and specialUse stays a plain Boolean column re-derived
on the next folder refresh -- no Room migration needed.

Tests: extends the #64 fidelity fixtures (FolderRoleTest, FolderMapperTest) with
the \Important case, and adds table-order precedence and role-less-fallback
guards pinning the refactor behavior-for-behavior.

Closes #65
Closes #62

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 02:49:16 -05:00