Skip to content

refactor(tags): ♻️ 🏷️ prefix user tags with tag- to disambiguate from system classifiedAs#841

Merged
phoebus-84 merged 1 commit intomainfrom
fix_tag_system
Apr 21, 2026
Merged

refactor(tags): ♻️ 🏷️ prefix user tags with tag- to disambiguate from system classifiedAs#841
phoebus-84 merged 1 commit intomainfrom
fix_tag_system

Conversation

@phoebus-84
Copy link
Copy Markdown
Collaborator

classifiedAs stores both user free-form tags and system-derived metadata (machine-, material-, category-, powercompat-, env-*, etc.), forcing display code to maintain drifting per-component blocklists to hide system tags from users.

Introduce a dedicated TAG_PREFIX.USER = "tag" prefix applied symmetrically on save and read:

  • lib/tagging.ts: add userTag, isUserTag, stripUserTagPrefix, isSystemTag, extractUserTagValues, normalizeUserTagsForSave helpers plus SYSTEM_TAG_PREFIXES and LEGACY_SYSTEM_TAG_PATTERNS constants.
  • Save sites (useProjectCRUD handleProjectCreation + handleMachineCreation, resource claim) normalize user-entered tags to tag-.
  • URL filter producers (ProductsFilters, ProjectsFilters) prefix on apply and strip on load so chips show "laser cut" instead of "tag-laser-cut".
  • Display sites (ProjectCardNew, ProjectDetailNew, GeneralCard, ProjectsTableRow, ProductsActiveFiltersBar) route through extractUserTagValues, removing bespoke blocklists (including stale mat:, c:, pc:, env:, pwr:, rep:, m: entries).
  • Legacy un-prefixed tags remain visible via backwards-compat fallback in extractUserTagValues; no data migration required.

Closes interfacer-gui-i46.

… system classifiedAs

classifiedAs stores both user free-form tags and system-derived metadata (machine-*, material-*, category-*, powercompat-*, env-*, etc.), forcing display code to maintain drifting per-component blocklists to hide system tags from users.

Introduce a dedicated TAG_PREFIX.USER = "tag" prefix applied symmetrically on save and read:

- lib/tagging.ts: add userTag, isUserTag, stripUserTagPrefix, isSystemTag, extractUserTagValues, normalizeUserTagsForSave helpers plus SYSTEM_TAG_PREFIXES and LEGACY_SYSTEM_TAG_PATTERNS constants.
- Save sites (useProjectCRUD handleProjectCreation + handleMachineCreation, resource claim) normalize user-entered tags to tag-<slug>.
- URL filter producers (ProductsFilters, ProjectsFilters) prefix on apply and strip on load so chips show "laser cut" instead of "tag-laser-cut".
- Display sites (ProjectCardNew, ProjectDetailNew, GeneralCard, ProjectsTableRow, ProductsActiveFiltersBar) route through extractUserTagValues, removing bespoke blocklists (including stale mat:, c:, pc:, env:, pwr:, rep:, m: entries).
- Legacy un-prefixed tags remain visible via backwards-compat fallback in extractUserTagValues; no data migration required.

Closes interfacer-gui-i46.
@phoebus-84 phoebus-84 merged commit f8cd61c into main Apr 21, 2026
1 check passed
@phoebus-84 phoebus-84 deleted the fix_tag_system branch April 21, 2026 15:44
This was referenced Apr 21, 2026
phoebus-84 added a commit that referenced this pull request Apr 21, 2026
- **style: 🎨  lighter markdown editor (#763)**
- **feat: ✨ links to projects now lead to new products page (#813)**
- **feat: ✨ improve UX for unauthenticated users (#814)**
- **fix: πŸ› project images editing (#817)**
- **fix: πŸ› qr code disappear for projects that have it and new tabs
mapping for url params (#818)**
- **feat: ✨ add recyclability and repairability filters (#821)**
- **feat: interfacer gui big rework phase 1 (#825)**
- **fix: πŸ› migrate to mominatim for location autocomplete and lookup
(#834)**
- **feat(dpp): ✨ dedicated DPP detail page with prototype-matching UI
(#835)**
- **feat(layout): ✨ show top bar and sidebar for unauthenticated users
(#836)**
- **fix(nav): πŸ› Designs links to /designs, fix active state catch-all
(#837)**
- **feat: ✨ wire sorting orderBy and distinctPrimaryAccountableCount
from backend (#838)**
- **feat(dpp): ✨ redesign DPP tab to match Figma prototype (#839)**
- **refactor(ui): remove redundant owner banners and fix search filters
(#840)**
- **refactor(tags): ♻️ 🏷️ prefix user tags with tag- to disambiguate
from system classifiedAs (#841)**

---------

Co-authored-by: Puria Nafisi Azizi <puria@dyne.org>
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.

1 participant