fix(mcp): log the numeric auto_index_limit in autoindex.skip (#1466) - #1779
fix(mcp): log the numeric auto_index_limit in autoindex.skip (#1466)#1779rarepops wants to merge 2 commits into
Conversation
The too_many_files warning passed the CBM_CONFIG_AUTO_INDEX_LIMIT key constant as the value of the `limit` field, so the warning read `limit=auto_index_limit` instead of the configured number. Format the effective file_limit into a buffer the same way the neighbouring `files` count already is. Fixes DeusData#1466 Signed-off-by: Rares Popa <2606875+rarepops@users.noreply.github.com>
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
|
Thank you for keeping the sibling daemon warning out of this focused fix. I checked current main and your distinction is correct: the MCP warning emits the configuration key name where the value should be, while daemon.autoindex.skipped omits the limit field entirely. Please open a separate focused issue for the daemon-log parity gap and link it here. This PR should remain limited to #1466. The current fix and binding log-sink test are grounded and have been labeled for review. Our queue is full, so detailed review may take a little time. Thank you for calling out the adjacent defect without bundling it. |
|
Opened #1818 as requested and kept it scoped to the daemon-log parity gap. The focused |
Fixes #1466
Problem
When auto-indexing skips a repository because its tracked-file count exceeds
auto_index_limit, the warning reports the name of the config key instead of the configured value:CBM_CONFIG_AUTO_INDEX_LIMITis#defined as the string"auto_index_limit"in src/cli/cli.h, and it was being passed straight through as the value of thelimitfield:The effective numeric limit was already in scope as
file_limit, read a few lines earlier viacbm_config_get_int().As the reporter noted, the malformed
filesfield from v0.9.0 is already fixed onmain; only thelimitfield remained.Fix
Format
file_limitinto a buffer, mirroring exactly how the neighbouringfilescount is already handled:Output now matches the issue's expectation:
Test
autoindex_skip_reports_numeric_limit_issue1466intests/test_mcp.cdrives the real public entry point (initialize->maybe_auto_index) against a fresh project holding more files thanauto_index_limit, and captures the emitted warning through a log sink.Reproduce-first, verified in both directions on the same tree:
autoindex_skip_reports_numeric_limit_issue1466FAIL tests/test_mcp.c:10637: strstr(warning, "limit=1") is NULLPASSmcpsuiteThe failure is not vacuous: the
msg=autoindex.skip,reason=too_many_filesandfiles=2assertions all pass in the RED run, so the skip path is genuinely exercised and the log line is genuinely captured. Only thelimit=1assertion flips. The test also asserts the absence oflimit=auto_index_limit, so a future regression that drops the value back to the key name fails loudly.Verification
Run in a container mirroring the CI toolchain (Ubuntu 24.04 + gcc, ASan/UBSan build):
mcpsuite: 204 passed, 0 failedlog,daemon,daemon_runtime,daemon_application(the suites covering the logging layer and the sibling auto-index admission path): 120 passed, 0 failedlint-formatwith clang-format-20: cleanlint-cppcheckwith cppcheck 2.20.0: cleanlint-no-suppressandlint-mem-ciare structurally unaffected: the diff adds noNOLINT, the onlyLINT_SRCSfile touched issrc/mcp/mcp.c(two stack buffers, no allocation), and no entry inscripts/lint-mem-whitelist.txtis pinned tomaybe_auto_index, so no sha256 pin is invalidated.Out of scope (possible follow-up)
While tracing this I noticed the daemon has a sibling warning at
src/daemon/application.cthat emitsreasonandfilesfor the same condition but carries nolimitkey at all:That is a different defect from #1466 (a missing field rather than a wrong one) and it is not what the issue reports, so I left it alone to keep this PR to one issue. Happy to open a separate issue or PR for it if you would like the two skip warnings to carry the same fields.