fix(code_indexer): honor ensure_ascii config instead of inverting it#139
Open
Osamaali313 wants to merge 1 commit into
Open
fix(code_indexer): honor ensure_ascii config instead of inverting it#139Osamaali313 wants to merge 1 commit into
Osamaali313 wants to merge 1 commit into
Conversation
Three JSON-writing paths computed
ensure_ascii = not output_config.get("ensure_ascii", False)
and passed it to json.dump. The stray `not` inverts the configured flag: the
sibling option on the line above (json_indent) is a direct pass-through, the
config field name equals the json.dump parameter, and the shipped default in
indexer_config.yaml is `ensure_ascii: false`. So with the default config the
code sent ensure_ascii=True, escaping every non-ASCII char (Chinese text,
accented identifiers) as \uXXXX in the index/statistics/summary JSON. Drop
the `not` so the flag is passed through as configured.
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
Three JSON-writing paths in
tools/code_indexer.pyinvert theensure_asciiconfig flag:(at lines 1131 / 1325 / 1341 —
build_all_indexes,generate_statistics_report,generate_summary_report).This is clearly meant to be a pass-through:
json_indent, is read verbatim with nonot;ensure_ascii— the same keyword it feeds tojson.dump;json.dumpis used withensure_ascii=Falsedirectly elsewhere in the file (line 445).The shipped default is
ensure_ascii: false(tools/indexer_config.yaml:100), i.e. keep literal UTF-8. Butnot False→True, so the code escapes every non-ASCII character (Chinese text, accented identifiers in LLM-generated file summaries/concepts) as\uXXXXin the index/statistics/summary JSON — the opposite of the configured behavior.Reproduction
Config
{"ensure_ascii": false}, data{"summary": "推荐 café"}:notinverts){"summary": "推荐 café"}❌{"summary": "推荐 café"}✅These functions are live:
workflows/codebase_index_workflow.pyinvokesbuild_all_indexes(),generate_summary_report(), andgenerate_statistics_report().Fix
Drop the
notat all three sites:No test suite currently covers
code_indexer.py.python -m py_compile tools/code_indexer.pypasses.