Unescape plain-text fields before persisting to SQLite#1370
Merged
SorraTheOrc merged 2 commits intomainfrom Apr 3, 2026
Merged
Unescape plain-text fields before persisting to SQLite#1370SorraTheOrc merged 2 commits intomainfrom
SorraTheOrc merged 2 commits intomainfrom
Conversation
Add unescapeText() to the persistence layer and apply it to plain-text fields (title, description, deleteReason, comment body, and audit.text) in saveWorkItem() and saveComment(). This converts backslash escape artifacts (e.g. literal \n from CLI argument passing) to their intended characters before storage. JSON/structured fields (tags, refs, full audit JSON) are intentionally excluded. Add 16 new tests: 11 unit tests for unescapeText and 5 DB round-trip integration tests verifying the unescaping behaviour. Agent-Logs-Url: https://github.com/TheWizardsCode/ContextHub/sessions/da790f96-11d5-483d-bc0d-40dcdfea3ed7 Co-authored-by: SorraTheOrc <250240+SorraTheOrc@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Unescape strings before inserting into DB
Unescape plain-text fields before persisting to SQLite
Apr 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backslash escape artifacts (e.g. literal
\nfrom CLI argument passing) were being stored verbatim in the DB instead of as their intended characters, reducing readability and requiring downstream post-processing.Changes
unescapeText(s)— new exported function inpersistent-store.ts; single-pass regex lookup converts\n,\t,\r,\\to actual characters; all other sequences (unrecognised escapes, quotes, backticks) pass through unchangedsaveWorkItem()— appliesunescapeTexttotitle,description,deleteReason, andaudit.text(inside the audit object, beforeJSON.stringify); structured fields (tagsJSON, full audit envelope) are intentionally untouchedsaveComment()— appliesunescapeTexttocomment.commentTests
unescapeTextcovering each sequence, multi-sequence strings, double-decode safety, and preservation of quotes/backticks/unknown escapesaudit.text(verifying JSON structure intact), and tags (verifying JSON field is not mutated)Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/graphql/usr/bin/gh gh issue create --repo TheWizardsCode/ContextHub --title Sample --body-file -(http block)/usr/bin/gh gh issue create --repo TheWizardsCode/ContextHub --title Sample --body-file - /tmp/wl-wt-subse/home/REDACTED/work/ContextHub/ContextHub/tests/cli/mock-bin/git k/ContextHub/Con-C bash text�� commit epo/.worklog/tmpsync 2 rgo/bin/bash init g/data sh bash(http block)If you need me to access, download, or install something from one of these locations, you can either: