One user-space repair task per eligible HWE debug-diag / compile-deploy base ID: 320 admitted (C 218, C++ 97, build scripts 5), 1 skipped by the content filter. Each ships a public spec with a check-to-basis table, at least two defects with single-fix fixtures, a symptom-masking fixture and an alternative correct implementation. Claude re-checked all 320: structure, the HWE quality items and trace6 Docker calibration receipts against current digests (320/320 USABLE). Difficulty is unmeasured. Known follow-up: 212 tasks use 120 ad-hoc family names; the next batch maps them to the canonical list. The batch's 1,256-line progress log stays in its factory report and the 36-local branch batch15-hwe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
17 lines
8.9 KiB
JSON
17 lines
8.9 KiB
JSON
{
|
||
"support": {
|
||
"Makefile": "CC = gcc\nCFLAGS = -std=c11 -O2 -Wall -Wextra -Werror\nSOURCES = main.c observer.c config_table.c config_parse.c config_load.c\nconfig-sequence: $(SOURCES) config.h observer.h\n\t$(CC) $(CFLAGS) $(SOURCES) -Wl,--wrap=fopen -Wl,--wrap=fclose -o $@\n.PHONY: clean\nclean:\n\trm -f config-sequence\n",
|
||
"README.md": "# 配置序列工具\n构建:`make`。默认演示:`./config-sequence demo/sequence.txt`。\n可选故障恢复演示:`./config-sequence demo/optional-invalid-sequence.txt 2`。\n完整接口、数据格式、业务语义与观察协议见 `docs/contract.md`。\nMakefile、main.c、observer.c、observer.h 是固定公开支撑,正式验收按同一 GCC argv 重建。\n只有 config.h、config_table.c、config_parse.c、config_load.c 属于提交文件。\n",
|
||
"demo/base.cfg": "# base configuration\n[service]\nname = camera\nrate = 12\n[transport]\nmode = local\n",
|
||
"demo/optional-invalid-sequence.txt": "demo/base.cfg\ndemo/optional-invalid.cfg\ndemo/site.cfg\n",
|
||
"demo/optional-invalid.cfg": "[service]\nrate = 999\nthis is not an assignment\n",
|
||
"demo/sequence.txt": "demo/base.cfg\ndemo/site.cfg\n",
|
||
"demo/site.cfg": "[service]\nrate = 24\nlabel = north camera\n",
|
||
"docs/contract.md": "# 配置序列合同\n1. 本工具按 manifest 内路径顺序加载项目配置,路径逐行,空行忽略,无路径内换行,最多2048条、每条最多400字节。命令为 `./config-sequence MANIFEST [REPEAT]`;REPEAT十进制1至4,默认1。每轮保留前轮表,累计统计。文件来自工程或验收临时目录,不读系统配置,不用网络。\n2. 固定支撑 main.c/observer.c/observer.h/Makefile 不提交;正式构建 `gcc -std=c11 -O2 -Wall -Wextra -Werror main.c observer.c config_table.c config_parse.c config_load.c -Wl,--wrap=fopen -Wl,--wrap=fclose -o config-sequence`。候选中的全部四文件实际参与构建。config.h 的公开签名和字段供支撑调用,可增加内部实现。\n3. 每轮按给定顺序尝试每个路径,失败继续。attempted为尝试路径数;opened为fopen成功数;open_failed为打开失败数。opened=parsed+rejected,attempted=opened+open_failed。parsed只计完整合法的打开文件(空文件合法),rejected只计打开后无效的文件。status有任一打开失败或拒绝时为-1,否则0;CLI观察完以0退出。\n4. 每个文件读到EOF,bytes累计所有成功打开文件实际内容字节数,包括拒绝文件与换行;无效行后仍读完整文件。配置最多255字节每行(不含LF),允许无末尾LF;LF分行,行首尾只修剪ASCII空格、TAB、CR。文件只允许ASCII可打印字节、TAB、CR、LF;NUL、其他控制字符、非ASCII或超长行使整个文件无效。空行和修剪后以#开头的整行注释忽略。不存在行内注释。\n5. 名字是ASCII小写字母开头、后接小写字母/数字/下划线,总长1至31。每文件初始section为global,`[ section ]`更换当前section;结束]之后仅允许可修剪空白。赋值为`key = value`,只按第一个=切分,key/value首尾修剪;value允许0至127个ASCII可打印字节(内部空格允许,内部TAB/CR不允许)。`! key`删除当前section内key,不存在时仍是合法操作。section、key同名不混用。\n6. 业务表以(section,key)为身份,后加载合法赋值覆盖旧值,删除移除该身份。最多64个不同身份;覆盖或删除不增加容量,超容量使整个文件无效。每个文件事务提交:任一行非法或超容量,整个文件对表及revision、assignments、deletions均无影响;先前合法文件保留,随后文件继续。每个合法赋值和删除操作使revision加1;assignments/deletions只累计已提交文件中的相应操作数。\n7. 每个成功打开的配置FILE必须在下一个路径打开之前关闭,返回调用方时全部关闭,同时至多持有一个配置流;不能拖延至批末统一关闭。观察器包装真实fopen/fclose,记录配置期的opens/closes/live/peak/boundary:boundary在每次尝试fopen之前仍有旧流存活时加1。零次成功打开时peak=0,否则peak=1;live=0、boundary=0,opens=opened、closes=opened。固定支撑在观察区外读取并关闭manifest。\n8. 每轮stdout输出一个JSON对象,字段恰为round、status、stats、revision、entries、live、peak、opens、closes、boundary。stats字段恰为attempted、opened、open_failed、parsed、rejected、bytes、assignments、deletions。计数为JSON非负整数(不含boolean),status为0或-1;entries为按section再key的ASCII升序数组,每项[section,key,value]。只比较count内有效条目,不要求未使用存储为零。JSON对象间及首尾允许任意JSON空白,必须完整消费stdout;任意stderr诊断字节允许。\n9. table_init产生空表和revision=0;table_copy完整复制逻辑表;table_equal比较逻辑表和revision;find返回有序插入点和found;get在不存在时NULL;set/delete失败不改变表。table_check检查逻辑有效区。stats_init清零;stats_check验证第3条两条恒等式。cfg_parse读取流并更新传入工作表,输出其操作数、实际bytes及首个错误行(合法时0),返回0/-1;事务归属load层。table_print/stats_print遵循第8条JSON子结构。\n",
|
||
"main.c": "#include \"config.h\"\n#include \"observer.h\"\n#include <stdlib.h>\n#include <string.h>\nint main(int argc, char **argv)\n{\n FILE *manifest;\n char line[512];\n char *paths[2048];\n size_t count = 0;\n size_t i;\n unsigned long repeat = 1;\n cfg_table table;\n cfg_stats stats;\n if (argc < 2 || argc > 3) { return 64; }\n if (argc == 3) {\n char *end;\n repeat = strtoul(argv[2], &end, 10);\n if (*end || repeat < 1 || repeat > 4) { return 64; }\n }\n manifest = fopen(argv[1], \"rb\");\n if (manifest == NULL) { return 65; }\n while (fgets(line, sizeof(line), manifest)) {\n size_t length = strlen(line);\n if (length && line[length - 1] == '\\n') { line[--length] = 0; }\n if (length == 0) { continue; }\n if (count == 2048 || length > 400) { return 66; }\n paths[count] = malloc(length + 1);\n if (!paths[count]) { return 67; }\n memcpy(paths[count++], line, length + 1);\n }\n fclose(manifest);\n cfg_table_init(&table);\n cfg_stats_init(&stats);\n for (i = 0; i < repeat; ++i) {\n int status;\n observer_begin();\n status = cfg_load((const char *const *)paths, count, &table, &stats);\n observer_end();\n printf(\"{\\\"round\\\":%zu,\\\"status\\\":%d,\\\"stats\\\":\", i + 1, status);\n cfg_stats_print(&stats, stdout);\n printf(\",\\\"revision\\\":%lu,\\\"entries\\\":\", table.revision);\n cfg_table_print(&table, stdout);\n printf(\",\\\"live\\\":%zu,\\\"peak\\\":%zu,\\\"opens\\\":%lu,\\\"closes\\\":%lu,\\\"boundary\\\":%lu}\\n\",\n observer_live(), observer_peak(), observer_opens(), observer_closes(), observer_boundary());\n }\n for (i = 0; i < count; ++i) { free(paths[i]); }\n return 0;\n}\n",
|
||
"observer.c": "#include \"observer.h\"\n#include <stdio.h>\nstatic FILE *streams[4096];\nstatic size_t live_count;\nstatic size_t peak_count;\nstatic unsigned long open_count;\nstatic unsigned long close_count;\nstatic unsigned long boundary_count;\nstatic int enabled;\nFILE *__real_fopen(const char *, const char *);\nint __real_fclose(FILE *);\nvoid observer_begin(void) { enabled = 1; }\nvoid observer_end(void) { enabled = 0; }\nsize_t observer_live(void) { return live_count; }\nsize_t observer_peak(void) { return peak_count; }\nunsigned long observer_opens(void) { return open_count; }\nunsigned long observer_closes(void) { return close_count; }\nunsigned long observer_boundary(void) { return boundary_count; }\nFILE *__wrap_fopen(const char *path, const char *mode)\n{\n FILE *result;\n size_t i;\n if (enabled && live_count != 0) { ++boundary_count; }\n result = __real_fopen(path, mode);\n if (enabled && result != NULL) {\n ++open_count;\n for (i = 0; i < 4096; ++i) {\n if (streams[i] == NULL) { streams[i] = result; break; }\n }\n ++live_count;\n if (live_count > peak_count) { peak_count = live_count; }\n }\n return result;\n}\nint __wrap_fclose(FILE *stream)\n{\n size_t i;\n for (i = 0; i < 4096; ++i) {\n if (streams[i] == stream) {\n streams[i] = NULL;\n --live_count;\n ++close_count;\n break;\n }\n }\n return __real_fclose(stream);\n}\n",
|
||
"observer.h": "#ifndef CONFIG_OBSERVER_H\n#define CONFIG_OBSERVER_H\n#include <stddef.h>\nvoid observer_begin(void);\nvoid observer_end(void);\nsize_t observer_live(void);\nsize_t observer_peak(void);\nunsigned long observer_opens(void);\nunsigned long observer_closes(void);\nunsigned long observer_boundary(void);\n#endif\n"
|
||
},
|
||
"seed": 620151
|
||
}
|