The code graph read source files with read_to_string and silently dropped every file that was not UTF-8. Files Visual Studio saves as UTF-16 and files older .NET and PLC tools save as Windows-1252 were therefore missing from the graph, in every language; that is one reason C# graphs are small. A UTF-8 BOM was also kept as a leading U+FEFF (t84).
New decoder:compliance_graph::encoding::read_source. A BOM picks UTF-8 or UTF-16 LE/BE and is removed. Without one it tries UTF-8, then falls back to Windows-1252 (encoding_rs, already in the lock). These count as unreadable:
malformed content after a BOM;
bytes that are not UTF-8 and contain a NUL (binaries, UTF-16 without a BOM);
I/O errors.
Counted, not skipped: the graph build counts unreadable files and logs one warning per build, with paths at debug level only. It stores unreadable_file_count on the build run; serde(default) keeps older runs readable. PLC builds don't carry the count yet, because their files are read in the agent.
Card:/api/v1/graph/{id}/summary returns unreadable_files. When that is above 0, the target page's Codegraph card shows "N Dateien nicht lesbar" / "N files unreadable".
Same decoder elsewhere: it is also used where these files are read again, or within the same stage:
graph chunking and the explorer's file view;
PLC read_tree and native_projects: a 1252 .st file and a UTF-16 PLCopen XML file now give their POUs;
.NET read_text, replacing its own BOM handling;
finding snippets (source_text.rs), header version macros (SBOM) and triage context.
Side effect: a mobsfscan finding in a non-UTF-8 manifest or plist can now get a line, which shifts its line-based fingerprint. This is rare.
Not changed, follow-ups:
the GDPR/OAuth pattern scanner (would create new findings);
Backlog: VB, .aspx, .cshtml and .razor parsers, not in this PR.
Tests
Decoder: every encoding, malformed input, binary input, I/O errors.
Registry and engine: a temp tree in every encoding, with the unreadable files counted.
An old build record still reads; the summary shows the count.
PLC: 1252 and UTF-16 sources.
Dashboard: the singular and plural texts.
Locally: fmt, clippy with -D warnings (graph, core, agent, dashboard server and web, mcp, werkbank-exec, control-map), the lib and dashboard tests, and all agent integration tests against Mongo (94 passed).
The code graph read source files with `read_to_string` and silently dropped every file that was not UTF-8. Files Visual Studio saves as UTF-16 and files older .NET and PLC tools save as Windows-1252 were therefore missing from the graph, in every language; that is one reason C# graphs are small. A UTF-8 BOM was also kept as a leading U+FEFF (t84).
- **New decoder:** `compliance_graph::encoding::read_source`. A BOM picks UTF-8 or UTF-16 LE/BE and is removed. Without one it tries UTF-8, then falls back to Windows-1252 (`encoding_rs`, already in the lock). These count as unreadable:
- malformed content after a BOM;
- bytes that are not UTF-8 and contain a NUL (binaries, UTF-16 without a BOM);
- I/O errors.
- **Counted, not skipped:** the graph build counts unreadable files and logs one warning per build, with paths at debug level only. It stores `unreadable_file_count` on the build run; `serde(default)` keeps older runs readable. PLC builds don't carry the count yet, because their files are read in the agent.
- **Card:** `/api/v1/graph/{id}/summary` returns `unreadable_files`. When that is above 0, the target page's Codegraph card shows "N Dateien nicht lesbar" / "N files unreadable".
- **Same decoder elsewhere:** it is also used where these files are read again, or within the same stage:
- graph chunking and the explorer's file view;
- PLC `read_tree` and `native_projects`: a 1252 `.st` file and a UTF-16 PLCopen XML file now give their POUs;
- .NET `read_text`, replacing its own BOM handling;
- finding snippets (`source_text.rs`), header version macros (SBOM) and triage context.
- Side effect: a mobsfscan finding in a non-UTF-8 manifest or plist can now get a line, which shifts its line-based fingerprint. This is rare.
- **Not changed, follow-ups:**
- the GDPR/OAuth pattern scanner (would create new findings);
- content fingerprints (would change existing fingerprints);
- the control-check surface search;
- git diff lines;
- werkbank-exec's PLC reader (the decoder would first have to move to a shared crate).
- **Delegated tools:** semgrep, gitleaks, cppcheck, devskim, mobsfscan, syft, clamav and oelint read files themselves.
- **Backlog:** VB, .aspx, .cshtml and .razor parsers, not in this PR.
**Tests**
- Decoder: every encoding, malformed input, binary input, I/O errors.
- Registry and engine: a temp tree in every encoding, with the unreadable files counted.
- An old build record still reads; the summary shows the count.
- PLC: 1252 and UTF-16 sources.
- Dashboard: the singular and plural texts.
Locally: fmt, clippy with `-D warnings` (graph, core, agent, dashboard server and web, mcp, werkbank-exec, control-map), the lib and dashboard tests, and all agent integration tests against Mongo (94 passed).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
The graph registry read source files with read_to_string and skipped any
that were not UTF-8, so Visual Studio's UTF-16 files and older .NET/PLC
tools' Windows-1252 files never reached the graph, in every language. A
UTF-8 BOM was kept as a leading U+FEFF.
- compliance_graph::encoding::read_source: a BOM (UTF-8, UTF-16 LE/BE)
names the encoding and is dropped; otherwise UTF-8, else Windows-1252
(encoding_rs, already in the lock). Malformed UTF-16, a NUL in non-UTF-8
bytes (a binary) and I/O errors are errors.
- The registry counts the files it still can't read, warns once per build
(paths at debug only) and the tree build stores the count on the build
run (unreadable_file_count, serde default for older runs).
- GET /api/v1/graph/{id}/summary returns unreadable_files; the target
page's Codegraph card shows "N Dateien nicht lesbar" / "N files
unreadable" when it is above 0.
- The same decoder where a file is read again or in the same stage: graph
chunking, the graph's file view, PLC read_tree and native_projects,
.NET read_text (replaces its own BOM code), finding snippets
(source_text), embedded header versions, LLM and control triage context.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The code graph read source files with
read_to_stringand silently dropped every file that was not UTF-8. Files Visual Studio saves as UTF-16 and files older .NET and PLC tools save as Windows-1252 were therefore missing from the graph, in every language; that is one reason C# graphs are small. A UTF-8 BOM was also kept as a leading U+FEFF (t84).compliance_graph::encoding::read_source. A BOM picks UTF-8 or UTF-16 LE/BE and is removed. Without one it tries UTF-8, then falls back to Windows-1252 (encoding_rs, already in the lock). These count as unreadable:unreadable_file_counton the build run;serde(default)keeps older runs readable. PLC builds don't carry the count yet, because their files are read in the agent./api/v1/graph/{id}/summaryreturnsunreadable_files. When that is above 0, the target page's Codegraph card shows "N Dateien nicht lesbar" / "N files unreadable".read_treeandnative_projects: a 1252.stfile and a UTF-16 PLCopen XML file now give their POUs;read_text, replacing its own BOM handling;source_text.rs), header version macros (SBOM) and triage context.Tests
Locally: fmt, clippy with
-D warnings(graph, core, agent, dashboard server and web, mcp, werkbank-exec, control-map), the lib and dashboard tests, and all agent integration tests against Mongo (94 passed).🤖 Generated with Claude Code
The graph registry read source files with read_to_string and skipped any that were not UTF-8, so Visual Studio's UTF-16 files and older .NET/PLC tools' Windows-1252 files never reached the graph, in every language. A UTF-8 BOM was kept as a leading U+FEFF. - compliance_graph::encoding::read_source: a BOM (UTF-8, UTF-16 LE/BE) names the encoding and is dropped; otherwise UTF-8, else Windows-1252 (encoding_rs, already in the lock). Malformed UTF-16, a NUL in non-UTF-8 bytes (a binary) and I/O errors are errors. - The registry counts the files it still can't read, warns once per build (paths at debug only) and the tree build stores the count on the build run (unreadable_file_count, serde default for older runs). - GET /api/v1/graph/{id}/summary returns unreadable_files; the target page's Codegraph card shows "N Dateien nicht lesbar" / "N files unreadable" when it is above 0. - The same decoder where a file is read again or in the same stage: graph chunking, the graph's file view, PLC read_tree and native_projects, .NET read_text (replaces its own BOM code), finding snippets (source_text), embedded header versions, LLM and control triage context. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>23e9c28166to68f73afde6