fix(mcp): get_architecture overview subset, aspects enum + validation (+ .cbmignore how-to)#806
Merged
Merged
Conversation
Distills the design from PR #560 onto current main: - "overview" now expands to every aspect except file_tree (the per-file listing that alone can push the payload past the MCP output cap). Previously the token matched nothing and silently degraded to just {total_nodes,total_edges}. Both aspect gates (want_aspect in store.c, aspect_wanted in mcp.c) share one predicate, cbm_store_arch_aspect_in_overview, declared in store.h so the two sites cannot drift. - The aspects items schema gains an enum of the 13 valid tokens (advisory, client-side), mirroring VALID_ASPECTS. - Server-side validation (authoritative): unknown aspect tokens now return an isError result listing the valid values instead of a silent near-empty response. Bounded snprintf; respects the existing 16-token aspects cap. Reproduce-first tests: overview-subset and unknown-aspect tests fail on the unfixed code; a parsed tools/list guard pins the schema enum. Co-authored-by: Kirchlive <roberto.livebox@gmail.com> Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Documents the current behavior as implemented in src/discover/discover.c and src/discover/gitignore.c: where .cbmignore is read from, the glob features the parser supports, the layered precedence against built-in skip lists / .gitignore hierarchy / git global excludes, and what negation can and cannot override today. Planned negation unification (un-skipping built-in dirs, non-negatable safety core, shared predicate for auxiliary walkers) is listed in an explicitly not-yet-implemented subsection. Linked from the README "Ignoring Files" section. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
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.
Distills the design from #560 onto current main, with the regression tests the original review asked for. Credit: co-authored by @Kirchlive, who found the bug and shaped all three layers.
What it fixes —
get_architecture(aspects=["overview"])silently returned a near-empty result; unknown aspect tokens failed silently; the schema advertised no valid values.file_tree, via a single shared predicatecbm_store_arch_aspect_in_overview()used by both gates (store-sidewant_aspect, MCP-sideaspect_wanted) so the two sites cannot drift.aspectsitems schema.isErrorwith the valid-values list (SSOT array), bounded snprintf, and the newpath-param free path handled.Tests (red-first, verified): with src/ stashed → 129 passed / 3 failed (schema enum NULL; overview missing entry_points; no isError on bogus aspect); with the fix → 132 passed / 0 failed.
lint-cigreen; test diff purely additive.Also included:
docs/cbmignore.md— a how-to for.cbmignore(syntax table, 5-layer precedence, last-match-wins negation, current cross-layer limitations), every claim verified againstdiscover.c/gitignore.c, with the planned #489/#802 negation policy in an explicitly not-yet-implemented section. Linked from README.Refs #560.