Skip to content

fix: kb_view_query parse error, formula module discovery, state-server→daemon naming - #61

Merged
cuttlefisch merged 2 commits into
mainfrom
fix/kb-view-query-and-daemon-naming
Jun 14, 2026
Merged

fix: kb_view_query parse error, formula module discovery, state-server→daemon naming#61
cuttlefisch merged 2 commits into
mainfrom
fix/kb-view-query-and-daemon-naming

Conversation

@cuttlefisch

Copy link
Copy Markdown
Owner

Three fixes surfaced by running the MCP self_test_suite on the macOS (Homebrew) install.

1. kb_view_query parse error (🔴 real bug)

Every stored view (agenda/kanban/backlog/sprint/timeline/orphans) failed with CozoDB: unexpected input … at 0..0.

Root cause: CozoKbStore::raw_query Debug-formats every cell, so the query column reads back quoted + escaped (e.g. "?[...] kind = \"task\""). execute_kb_view_query ran that verbatim — the leading " is the "unexpected input at 0..0". (The store-level test only passed because it unescapes via dv_str; the tool path was never covered.)

Fix: recover the clean string (new unquote_dv) before executing, and return a clear error instead of a raw parser error on an empty query. + unit test.

2. Module discovery on Homebrew installs (🟡)

The formula mae installs modules at …/share/mae/modules (FHS: bin/mae../share/mae/modules), but discovery only checked exe_dir/modules, so the formula binary couldn't find its bundled modules (only MAE.app and source builds could). Added the ../share/mae/modules path.

3. state-servermae-daemon naming (🟡)

mae-state-server merged into mae-daemon in v0.13.2, but the old name lingered: the audit_configuration JSON field (state_server_binary_founddaemon_binary_found), the self-test collab note, and several option/tool/manual descriptions. Renamed throughout. (The binary check already used mae-daemon.)

Verified: cargo check --workspace clean, fmt + clippy clean, unquote_dv + view_queries_are_executable tests pass.

🤖 Generated with Claude Code

heimdall and others added 2 commits June 14, 2026 16:27
…daemon naming

Three fixes surfaced by running the MCP self-test suite on the macOS install:

1. kb_view_query — all stored views (agenda/kanban/backlog/sprint/timeline/
   orphans) failed with "CozoDB: unexpected input at 0..0". Root cause:
   `raw_query` Debug-formats cells, so the `query` column comes back quoted +
   escaped (e.g. `"?[...] kind = \"task\""`), and `execute_kb_view_query` ran it
   verbatim — the leading quote is unexpected input at position 0. Recover the
   clean string (new `unquote_dv`, mirroring the test helper) before executing,
   and return a clear error instead of a raw parser error on an empty query.
   +unit test.

2. module discovery — the Homebrew/FHS `bin/mae` layout keeps modules at
   `../share/mae/modules` (e.g. /opt/homebrew/opt/mae/share/mae/modules), which
   the bare `exe_dir/modules` check missed, so the formula `mae` couldn't find
   its bundled modules (only MAE.app via MAE_FONT_DIR-style env, or source builds
   via CARGO_MANIFEST_DIR, worked). Add the `../share/mae/modules` discovery path.

3. naming — `mae-state-server` was merged into `mae-daemon` (v0.13.2), but
   "state server" lingered in the audit_configuration JSON field
   (`state_server_binary_found` → `daemon_binary_found`), the self-test collab
   note, and several option/tool/manual descriptions. Renamed to mae-daemon.
   (The binary check already used `mae-daemon` correctly.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…lures loud

Surfaced while debugging why `SPC C` (collab) was missing from which-key on a
Homebrew macOS install: the keymap-doom module silently never loaded, yet ~90%
of the leader tree still worked (from kernel keymaps.rs transitional defaults),
so nothing looked broken. Root causes in module discovery/observability:

1. Divergent discovery paths. `bootstrap::load_modules` had an inline search
   list; `pkg/cli.rs` had its OWN `module_search_dirs()` that checked only
   `./modules` + the user *packages* dir. So `mae list` reported "No modules
   found" even when the editor loaded them fine — useless as a diagnostic.
   Extracted one canonical `builtin_module_dirs()` (bootstrap) used by both.

2. macOS data dir not searched. The data-dir candidate used XDG
   `~/.local/share` even on macOS. Added the platform-native dir via
   `dirs::data_dir()` (`~/Library/Application Support/mae/modules`) so
   `make install`/user installs work regardless of convention. (The
   Homebrew/FHS `../share/mae/modules` path added earlier covers brew.)

3. Silent failure. Zero-discovery was a `debug!`; a missing keymap-doom had no
   branch at all. Both now `warn!` with the searched paths and an explicit note
   that module-only bindings (collab, KB sharing) will be missing — the log
   that would have diagnosed this immediately.

+ unit tests for builtin_module_dirs (env override precedence, no duplicates).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cuttlefisch
cuttlefisch merged commit 51fb489 into main Jun 14, 2026
14 checks passed
@cuttlefisch
cuttlefisch deleted the fix/kb-view-query-and-daemon-naming branch June 14, 2026 15:35
cuttlefisch added a commit that referenced this pull request Aug 5, 2026
Takes dependabot's rust-dependencies group bump directly rather than
landing it as a separate PR that would immediately conflict with this
branch's lockfiles. clap 4.6.4 -> 4.6.5 and clap_builder 4.6.2 -> 4.6.5,
applied to BOTH workspaces (the daemon keeps its own Cargo.lock per
ADR-014, and dependabot only ever touches the root one).

Also carries the 0.14.89 -> 0.14.92 workspace-internal version sync that
appears in every one of these PRs — issue #61: the version-bump workflow
does not update Cargo.lock, so the locks drift behind the released
version and every branch rediscovers it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
cuttlefisch added a commit that referenced this pull request Aug 5, 2026
Both lockfiles still claimed 0.14.92 while both `Cargo.toml`s said 0.14.93 —
`version-bump.yml` bumps the manifests but never regenerates the locks, so
every release leaves a tree where the committed lock disagrees with the
version it is tagged as (#61). Any build regenerates it and dirties the tree.

Mechanical: version strings only, no dependency changes. Committed here rather
than left dirty because deploy provenance should not inherit a lock that
doesn't match its tag — but this does NOT fix #61 itself, which is the
workflow.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
cuttlefisch added a commit that referenced this pull request Aug 5, 2026
fix(release): checksums (#648) + lockfile sync (#61) + Ansible deployment role
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