|
| 1 | +--- |
| 2 | +title: "Tag input swallows commas into one mega-tag — commas should split into separate tags" |
| 3 | +lede: "Typing 'Quantum-Computing, Quantum-Innovations, Computational-Biology' into a tag field saves it as ONE tag, 'Quantum-Computing-Quantum-Innovations-Computational-Biology', because toDashed treats commas exactly like spaces. Commas should be tag separators, spaces the word-joiners." |
| 4 | +date_created: 2026-08-02 |
| 5 | +date_modified: 2026-08-02 |
| 6 | +authors: |
| 7 | + - Michael Staton |
| 8 | +augmented_with: |
| 9 | + - Claude Code on Claude Opus 4.8 |
| 10 | +semantic_version: 0.0.0.1 |
| 11 | +tags: |
| 12 | + - Issue |
| 13 | + - Augment-It |
| 14 | + - Strategy-Curator |
| 15 | + - Tags |
| 16 | + - Bug |
| 17 | +status: Resolved |
| 18 | +--- |
| 19 | + |
| 20 | +# Tag input swallows commas into one mega-tag |
| 21 | + |
| 22 | +## Why Care? |
| 23 | + |
| 24 | +Surfaced live on 2026-08-02 while curating the "Quantum Innovation & |
| 25 | +Computational Biology" thesis: the source |
| 26 | +`biology-begins-to-tangle-with-quantum-computing` ended up with the tag |
| 27 | +`Quantum-Computing-Quantum-Innovations-Computational-Biology` — three |
| 28 | +intended tags fused into one — plus a stray `Quantum-Computing`. Edit mode |
| 29 | +then rendered the fused value as one oversized chip. The operator had |
| 30 | +typed commas; the input ignored them. |
| 31 | + |
| 32 | +## Root cause |
| 33 | + |
| 34 | +`toDashed` (`apps/strategy-curator/src/curation.svelte.ts`) is the culprit: |
| 35 | + |
| 36 | +```ts |
| 37 | +export function toDashed(s: string): string { |
| 38 | + return s.trim().split(/[^a-zA-Z0-9]+/).filter(Boolean).join('-'); |
| 39 | +} |
| 40 | +``` |
| 41 | + |
| 42 | +It splits on **any** non-alphanumeric run — spaces *and* commas alike — |
| 43 | +then hyphen-joins everything back. So a whole comma-separated entry becomes |
| 44 | +a single dashed token. |
| 45 | + |
| 46 | +Both tag entry points feed the *entire* raw input straight into it as one |
| 47 | +tag, with no comma-splitting: |
| 48 | + |
| 49 | +- **Source edit:** `TagBar.svelte` → `curation.applyTag(raw)` → `toDashed(raw)` → one `tag.apply`. |
| 50 | +- **Corpus create:** `StrategyPicker.svelte` `addTag(t)` → `toDashed(t)` → one `pendingTags` entry. |
| 51 | + |
| 52 | +(The Authors field, by contrast, *does* comma-split — the inconsistency the |
| 53 | +operator reasonably expected the tag field to share.) |
| 54 | + |
| 55 | +## Expected behavior |
| 56 | + |
| 57 | +Commas (and newlines) are **tag separators**; spaces within a segment stay |
| 58 | +**word-joiners** (dashed). So: |
| 59 | + |
| 60 | +> `Quantum Computing, Computational Biology` → `["Quantum-Computing", "Computational-Biology"]` |
| 61 | +
|
| 62 | +Pasting a comma-separated list into either tag field should create multiple |
| 63 | +distinct chips, deduped, each Train-Case-dashed. |
| 64 | + |
| 65 | +## Fix |
| 66 | + |
| 67 | +Add a `splitTags(raw): string[]` helper next to `toDashed` (split on |
| 68 | +`[,\n]+`, `toDashed` each segment, drop empties), and route both entry |
| 69 | +points through it: |
| 70 | + |
| 71 | +- `applyTag` loops over `splitTags(raw)`, firing one `tag.apply` per new tag. |
| 72 | +- `StrategyPicker.addTag` appends every `splitTags(t)` result to `pendingTags`. |
| 73 | + |
| 74 | +Suggestion-click paths pass a single token, which `splitTags` returns |
| 75 | +unchanged — no regression. |
| 76 | + |
| 77 | +## Resolution |
| 78 | + |
| 79 | +Fixed 2026-08-02. Note the runtime fix only reaches augment.didi.sh after a |
| 80 | +strategy-curator rebuild + redeploy; the already-mangled data on existing |
| 81 | +records is corrected separately (the Quantum source's tags were repaired |
| 82 | +directly in the canonical layer the same day). |
| 83 | + |
| 84 | +## See also |
| 85 | + |
| 86 | +- [[feedback_tags_train_case]] — the Train-Case convention this preserves. |
0 commit comments