Repository navigation
feat(sidecar): serialise per-file metadata as JSON (D4-B part 1) - #16
Merged
Merged
Conversation
First half of D4-B. Adds the sidecar module with a pure builder: UTF-8 validation (JSON string values require it), escaping for quotes, backslashes and control characters, and two shapes - complete with end time and total bytes, or partial for a file that was never closed. The metadata struct is self-contained so an open file can hold a copy instead of pointing at a session that may be destroyed first. Wired into all three build files; the MinGW job now compiles src/*.c so new sources cannot be forgotten. Not wired to file_mgr yet: this commit adds no behaviour change.
Editing Makefile, Android.mk and CMakeLists.txt through Python's text mode on Windows rewrote them with CRLF, which broke check-verification-flow: its anchored grep patterns never match past a trailing CR.
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.
D4-B 的前半段:只做序列化器,不接 file_mgr,无行为变化。
内容
src/sidecar.h/.c:sidecar_build_json()纯函数,两种形态complete=true:带end_time_unix_ms+total_bytescomplete=false:进程被杀时留下的那一版sidecar_is_valid_utf8():手写校验,覆盖过长编码、孤立续字节、截断、代理区\"\\\b\f\n\r\t,其余 <0x20 走\u%04xdump_pcm_file_meta_t自包含(keys + 格式 + generation/split_index + 起始时间),供后续让file_info_t持副本,避免悬垂引用sidecar.c;MinGW job 改为编译src/*.c,以后新增源文件不会漏测试
sidecar utf8 validation:合法 ASCII/中文 + 四类非法序列sidecar json builder:完整/partial 两种输出、关键字段、引号与反斜杠转义、缓冲区不足、UNKNOWN 格式、非法 UTF-8 key 均返回 -1这一步没有任何调用点,
.pcm与现有行为完全不受影响。下一步接file_mgr_close钩子 + 开关。