Skip to content

fix(mcp): get_architecture overview subset, aspects enum + validation (+ .cbmignore how-to)#806

Merged
DeusData merged 4 commits into
mainfrom
distill/560-architecture-overview
Jul 4, 2026
Merged

fix(mcp): get_architecture overview subset, aspects enum + validation (+ .cbmignore how-to)#806
DeusData merged 4 commits into
mainfrom
distill/560-architecture-overview

Conversation

@DeusData

@DeusData DeusData commented Jul 3, 2026

Copy link
Copy Markdown
Owner

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 fixesget_architecture(aspects=["overview"]) silently returned a near-empty result; unknown aspect tokens failed silently; the schema advertised no valid values.

  1. "overview" subset = every aspect except file_tree, via a single shared predicate cbm_store_arch_aspect_in_overview() used by both gates (store-side want_aspect, MCP-side aspect_wanted) so the two sites cannot drift.
  2. Schema enum — 13 valid tokens advertised on the aspects items schema.
  3. Server-side validation — unknown tokens return isError with the valid-values list (SSOT array), bounded snprintf, and the new path-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-ci green; 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 against discover.c/gitignore.c, with the planned #489/#802 negation policy in an explicitly not-yet-implemented section. Linked from README.

Refs #560.

DeusData and others added 4 commits July 3, 2026 19:08
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>
@DeusData DeusData enabled auto-merge July 3, 2026 22:38
@DeusData DeusData merged commit bb2510e into main Jul 4, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant