Repository navigation
fix: preserve quoted content when stripping JSONC trailing commas - #118
Open
specetator wants to merge 1 commit into
Open
specetator wants to merge 1 commit into
specetator wants to merge 1 commit into
Conversation
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.
Problem
The trailing-comma replacement in
stripJsoncCommentsalso matches inside JSON strings. For example, a configured prompt containing,}or, ]loses that punctuation during loading.This affects both
supermemory.jsoncand plainsupermemory.json, sinceloadRawConfigsends both through the helper. It changes the actualCONFIG.filterPromptandCONFIG.recallDirectivevalues; the former is subsequently used in the memory client's settings update.Change
Consume string spans before matching structural trailing commas, preserving quoted content and escaped quotes/backslashes. Consume unterminated string spans as well, avoiding repeated attempts to match escaped quotes in malformed input;
JSON.parsestill rejects that input.This is a narrow correction to the trailing-comma handling introduced in #16. Earlier #14 was closed in favor of #16; no currently open competing fix was found. There are no dependency changes and this branch is independent of #115.
Regression coverage
CONFIGloading from both supported filenames in temporary isolated homes.On base
762137de375d3b1920ba91fbdc400a030df92513, all four new tests fail. On the final patch:bun run test: 37 passed, 0 failedbun run typecheck: passedbun run build: passedgit diff --check: passedEnvironment: Linux, Node 24.22.1, Bun 1.4.4, TypeScript 5.9.3;
bun install --frozen-lockfile. Tests use isolated HOME directories and make no hosted memory/model API calls. Windows/macOS and live provider behavior were not tested.Scope and AI disclosure
This does not turn the helper into a strict JSONC validator or change the existing fallback-to-default configuration behavior on parse errors. Other malformed-input permissiveness is outside scope.
OpenAI coding agents implemented and independently reviewed the change; no human line-by-line review is claimed. Independent checks also exercised valid-string round trips and malformed production-config fallback. The final published two file blobs were verified against the tested patch.