mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-04 10:48:20 +00:00
One request pins the change (merge base .. HEAD), builds the graph and the runnable test registry of exactly the HEAD snapshot, seeds the graph from the change, walks what depends on it and answers which tests to run (cbm.test_impact). Missing or doubtful evidence never narrows: it becomes a run-all answer that names why. Snapshot (classified ledger -> frozen graph -> registry): - one shared language classifier for discovery and pinned blobs (raw bytes on every platform); the classified ledger feeds the frozen build, which indexes exactly the listed files and records partial parses as per-file PARSE_GAP instead of refusing the graph; - the pinned tree skips symlinks and submodule links (counted), as discovery never indexes them; - the test model scopes uncertainty to the suites of its file (they run whole), reads line splices where they occur, treats a mid-file `#ifndef X` + `#define X` as an ordinary condition, and no longer reads a plain identifier named like a macro as an invocation. On this repository the registry is now narrowable and matches a text census exactly (8,365 cases, 141 runner suites). Seeding and reach (port of the measured replay, rule B): - hunk -> overlapping definitions, comment-only hunks dropped, pure deletions -> enclosing definition, no-definition hunks -> whole file, deleted names found by text, header changes propagated through the include closure and the headers' macros (pastes included), file-level escalation for unclassifiable header lines; - inbound fixpoint walk over CALLS, ASYNC_CALLS, USAGE, CALL_REFERENCE, READS (+ routes); cases, suites and the runner's entry points are sinks; a reached runner main runs everything (RUNNER_REACHED); - a parse gap whose text names a reached definition reaches the definition around it (or its file); - macro-registered tests run their suites whole; cases and suites map to graph nodes by their start line. The line patterns reproduce the reference regexes exactly on 1,383,850 lines of this repository and 37,167,926 kernel lines; on 24 replayed changes the engine selects at least what the reference selected (13 identical, the rest only conservative supersets on the same graph). Also: - configured test declarations that cannot be mapped degrade their file (no configured roles, a test_declarations diagnostic) instead of aborting the whole index; - the selector keeps other runners' suites out of the selection, and the result codec judges the model by narrowability like the selector; - a change to .codebase-memory.json runs everything (built-in rule); - .codebase-memory.json with the c-cbm preset and this repository's rules. Gate fixes (suites, lint-ci, Windows cross-compile): - the request runs on its own thread with a default-size stack (daemon tool calls run on 256 KiB threads, where the in-process build died); - a request-supplied config_path is no longer followed by an unlink of an uninitialized path buffer; - the inventory's frame-local reader no longer stays reachable from the caller's source after the filter call; - FILE_ID_INFO needs _WIN32_WINNT >= 0x0602; the pinned-tree header pins it before any system header (toolchains defaulting lower failed); - memory-core ratchet: the win_utf8 converters gain core-backed `_in(cls, ...)` forms over one implementation (the legacy names keep the C library for unmigrated callers), the Git facts module uses them, and the Windows spawn path releases everything through one failure exit; pipeline, extraction and config allocations that this work touched moved to the core in matched pairs; baselines tightened; - the branch's C files formatted with the project's clang-format. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
33 lines
1.7 KiB
C
33 lines
1.7 KiB
C
#ifndef TEST_TEST_IMPACT_INVENTORY_INTERNAL_H
|
|
#define TEST_TEST_IMPACT_INVENTORY_INTERNAL_H
|
|
#include "test_inventory_filter_native_internal.h"
|
|
#include "mcp/test_impact_inventory.h"
|
|
|
|
#define NI_CHECK(condition) \
|
|
do { \
|
|
if (!(condition)) { \
|
|
fprintf(stderr, "native adapter assertion %s:%d: %s\n", __FILE__, __LINE__, \
|
|
#condition); \
|
|
goto done; \
|
|
} \
|
|
} while (0)
|
|
|
|
bool ni_write(if_native *n, const char *path, const void *bytes, size_t size);
|
|
bool ni_ambient_change(if_native *n);
|
|
bool ni_replace_snapshot(if_native *n, bool empty_controls);
|
|
bool ni_reset_input(if_native *n);
|
|
bool ni_commit_input(if_native *n);
|
|
bool ni_tree(if_native *n, cbm_git_revision_t revision);
|
|
bool ni_dependency(if_native *n, cbm_git_revision_t revision);
|
|
bool ni_start(if_native *n);
|
|
bool ni_prepare(if_native *n, cbm_test_impact_inventory_t **owner);
|
|
bool ni_error(if_native *n, cbm_inventory_status_t expected, size_t index, bool cleanup,
|
|
bool allow_unknown_index);
|
|
bool ni_default_view(const if_native *n, const cbm_test_impact_inventory_t *owner);
|
|
bool ni_limits_equal(const cbm_inventory_limits_t *a, const cbm_inventory_limits_t *b);
|
|
int ni_finish(if_native *n, cbm_test_impact_inventory_t *owner, int result);
|
|
int ni_case_faults(void);
|
|
int ni_case_entry(void);
|
|
int ni_case_limits(void);
|
|
#endif
|