Skip to content

[pull] master from GaijinEntertainment:master#976

Merged
pull[bot] merged 6 commits into
forksnd:masterfrom
GaijinEntertainment:master
May 10, 2026
Merged

[pull] master from GaijinEntertainment:master#976
pull[bot] merged 6 commits into
forksnd:masterfrom
GaijinEntertainment:master

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented May 10, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

borisbat and others added 6 commits May 9, 2026 14:31
…egressions

Closes a silent stale-state bug in the MCP server: every tool that compiles
.das via compile_file (compile_check / aot / lint / describe_type / find_symbol
/ list_functions / list_module_api / list_types) was retaining the C++-side
[function_macro] / [call_macro] registrations from its FIRST compile call,
so module edits to macro-heavy code (decs / sql / dasImgui boost) were
invisible to subsequent MCP calls until the server was restarted.

The fix: each of those 8 tools is now a thin do_<tool>() wrapper that
shells out via run_mcp_subtool() (utils/mcp/tools/common.das) to a fresh
daslang.exe running utils/mcp/subtools/<tool>.das. Macro state is process-
local, so a fresh subprocess starts with a clean slate every time. The
dispatch contract (do_<tool>(...args)) is unchanged, so protocol.das needs
no edit and the 270 existing tests in test_tools.das exercise the wiring
end-to-end.

Wins:
- Stale-macro bug fixed for all 8 tools.
- 4 new tests for the run_mcp_subtool helper itself: passthrough, missing
  subtool, timeout, panic-with-stdout-capture.
- 3 fixture subtools (_test_passthrough / _test_panic / _test_sleep) drive
  the helper tests.

cpp_dirs narrowing
------------------
Added a cpp_dirs parameter to do_find_symbol and do_goto_definition: an
optional comma-separated list of repo-relative paths that scopes the
with_cpp_source redirect lookup. Empty -> use the cached global C++ index
over CPP_SEARCH_DIRS (today's behavior). Non-empty -> fresh scoped scan
via the new cpp_lookup_by_name_scoped() helper in cpp_common.das, no
global cache touched.

The slow tests (test_find_symbol_with_cpp_source, test_goto_definition_with
_cpp_source, test_cpp_find_symbol) now pass cpp_dirs="src/builtin" or
directory="src/ast" so the scan walks ~33 files instead of the full ~947.
test_tools.das suite drops from 132s to 89s (33% faster) at 279/279 green.

daslib/json_boost.das STYLE018 fix
----------------------------------
Generic JV(struct) instantiation on a bool field generated `if (field ==
default<typedecl(field)>)` which lowers to `field == false` and trips the
new STYLE018 lint. Split the workhorse path with a static_if on
typeinfo stripped_typename(field) == "bool" so bool uses `if (!field)`
and numeric workhorses keep the generic-zero compare.

macro_call regressions
----------------------
- test_call_macro_cross_expr_emit.das: gap #3 from the dasImgui plan
  (cross-expression visibility of an auto-emitted module global).
- test_widget_dispatch.das + _widget_dispatch_helper.das: end-to-end
  smoke for the dasImgui-style [widget] call_macro pattern (dotted-flag
  parsing, named-tuple argument workaround, ExprField chain walking,
  cross-module Type.tStructure construction).

Lint sweep
----------
All 27 changed/new .das files pass mcp__daslang__lint cleanly (53 -> 0
warnings). Pre-existing PERF/STYLE warnings in touched files (cpp_common,
goto_definition, json_boost) cleared too, per the imminent PR lint gate.

Verification
------------
- 8001/8001 dastest tests pass.
- 7395/7395 AOT tests pass (after cmake reconfigure to refresh the new
  macro_call AOT glob).
- 279/279 mcp tests pass (270 existing + 4 new run_mcp_subtool + 5 new
  subtests inside those 4).
- 246/246 json round-trip tests pass (sanity for the json_boost edit).

mouse-data
----------
Cached the @capture(& var) lambda capture-by-reference syntax landmines
(parens, move-into-storage, unsafe wrapping) discovered while building
the [widget] runtime closures.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ess-tools

mcp: per-tool subprocess refactor + cpp_dirs narrowing + macro_call regressions
Three issues in utils/mouse/:
- No automatic re-indexing — `git pull` of new docs left the SQLite
  index stale until manual `mouse rebuild`.
- "Too similar" was a near-universal false positive — `dupe_check`
  blocked any FTS5 hit, and the OR-joined query matched nearly any
  natural-language question.
- Tool output rendered BM25 ranks raw (small negative floats, often
  scientific notation) with vague headers.

Fixes
- Auto-reindex: persisted staleness signature in a new `index_meta`
  table (migration v3). The signature compute lives in a new shared
  module `utils/common/git_signature.das` (per-search-dir
  `git rev-parse HEAD:<dir>` tree hash + filtered `git status
  --porcelain` + per-changed-file mtimes, hashed; sorted recursive
  filesystem walk on no-git fallback). Both utils/mouse and
  utils/mcp/tools/cpp_common use the shared module — ~150 LOC of
  duplicated git plumbing collapsed into one place.
- Per-tree HEAD: a `git pull` (or branch switch) that doesn't change
  the indexed subtree no longer invalidates the cache. Drops a
  whole class of spurious rebuilds on monorepo workflows.
- Sorted fs fallback: `_findfirst`/`readdir` ordering varies across
  platforms; collected paths are now sorted before hashing so the
  signature is deterministic.
- Jaccard scoring: dupe_check now sorts by Jaccard title similarity
  (with stop-words filtered); add_doc hard-blocks only at >= 0.7,
  surfaces the ranked list otherwise. Caller decides below threshold.
- Direct response messaging with fixed-decimal floats ({x:.3f}); ask
  shows "Top N best matches" with both BM25 and sim columns; add
  responses are mode-aware (block / created+similar / created-clean).
- New --raw-query / rawQuery flag bypasses sanitizer for FTS5
  power-user syntax.

daslib promotions
- daslib/strings_boost: new `jaccard(table, table)` and
  `jaccard(array, array)` next to `levenshtein_distance`.
- daslib/fio: `run_and_capture` promoted from utils/mcp/tools/common.das
  (one canonical home; common.das now relies on the daslib re-export).

Tests: utils/common/tests/test_git_signature (17), utils/mouse/tests
(34), utils/mcp/test_tools (275), tests/strings/strings_jaccard (11);
all PASS in interpreter mode. Sphinx clean; das2rst regenerated with
new groups.

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

mouse: git-aware auto-reindex + Jaccard dupe gate + --raw-query
…_signature helper

Commit 5839228 (mouse: git-aware auto-reindex) added two calls to
`compute_index_signature(root)` in main.das — `cmd_rebuild` and the
`tool_rebuild` MCP entrypoint. The actual helper exported from
`utils/common/git_signature.das` is `compute_signature(root, predicate,
search_dirs_abs)` (3 args). Both call sites failed to compile, breaking
`mouse rebuild` from the CLI and `mouse__rebuild` over MCP. The mouse
test suite didn't cover those entry points, so the regression slipped
through to master.

Rather than re-spell the 3-arg call at every signature-stamp site,
factor the canonical lambda + dirs into `compute_docs_signature(root)`
in index.das (same shape that `ensure_index_fresh` already computes for
the read side). Use it in:

- main.das `cmd_rebuild` (was broken)
- main.das `tool_rebuild` (was broken)
- index.das `ensure_index_fresh` (was inline)
- index.das `add` flow at line 533 (was inline)

Single source of truth for "what's the staleness signature shape" — keeps
the read in `ensure_index_fresh` and every write in lockstep.

Verification:
- `mouse rebuild` from CLI: 21/21 docs reindexed clean
- `utils/mouse/tests`: 61/61 pass
- lint clean on touched files (the two PERF warnings come from inside
  daslib/linq.das + sqlite_linq.das macro-expansion contexts, not the
  mouse files; latent on master)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@pull pull Bot locked and limited conversation to collaborators May 10, 2026
@pull pull Bot added the ⤵️ pull label May 10, 2026
@pull pull Bot merged commit 5114e2f into forksnd:master May 10, 2026
1 of 5 checks passed
@pull pull Bot had a problem deploying to github-pages May 10, 2026 02:58 Error
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant