Skip to content

mouse-data/docs: 21 new + 1 updated card from linq_fold + dasImgui PR #38#2692

Merged
borisbat merged 4 commits into
masterfrom
bbatkin/mouse-cards-linq-fold-session
May 17, 2026
Merged

mouse-data/docs: 21 new + 1 updated card from linq_fold + dasImgui PR #38#2692
borisbat merged 4 commits into
masterfrom
bbatkin/mouse-cards-linq-fold-session

Conversation

@borisbat
Copy link
Copy Markdown
Collaborator

@borisbat borisbat commented May 16, 2026

Summary

Cards added/refined across two parallel work streams that wrapped today:

  1. linq_fold splice rewrite (PR linq_fold: extract _fold + add _old_fold baseline; 24-benchmark 4-way suite #2687 foundation, PR linq_fold: Phase 2A loop planner (where|select array + counter lanes) #2689 Phase 2A, PR macro_boost: add has_sideeffects + counter-lane elision #2691 has_sideeffects + counter-lane elision) — 16 cards on macro-emission patterns, LINQ semantics, and tooling
  2. dasImgui PR make it compile on my ubuntu setup #38 CI matrix resurrection — 5 cards on dasHV/libhv Windows quirks, ImGui macOS shortcuts, and the cascade-guard pattern

Docs-only — no code changes.

What's in here

linq_fold / macro-emission patterns

LINQ semantics

Tooling / ops

Correction (existing card)

dasImgui PR #38 — CI matrix resurrection (5 new cards)

Test plan

  • No code changes — nothing to test
  • Cards added via mouse__add so similarity-block already vetted (highest sim 0.10 for any new card)
  • Cross-links via [[slug]] from the corrected fold card to the two new related cards
  • Cross-references between the dasImgui PR make it compile on my ubuntu setup #38 cards (cascade-guard ↔ Windows-16-POST ↔ ANY-route)

🤖 Generated with Claude Code

…ssion

Cards added in the course of the linq_fold splice rewrite + PR #2691
(has_sideeffects + counter-lane elision). Topics:

linq_fold / macro-emission patterns:
- daslang-generic-instance-detect-via-fromgeneric — func.fromGeneric is
  the canonical "which generic was this instantiated from?" link;
  func.name on typed instances is mangled.
- daslib-macro-boost-has-sideeffects-predicate — new public predicate,
  full classification table, known limitations, test plumbing.
- qmacro-invoke-source-bind-typedecl-modifier-iter-vs-array — typedecl
  block-param const/ref handling differs between iterator and array
  sources; the two diagnostic error messages tell you which branch you
  picked wrong.
- qmacro-gensym-per-callsite-via-lineinfo — backtick-prefixed names +
  line+column suffix, force_at / force_generated / can_shadow.
- my-fold-macro-emits-a-loop-with-for-it-in-source-... (UPDATED) —
  peel_each pattern corrected for generic-instance detection + positive
  array gate + block-param typedecl handling.

LINQ semantics:
- are-there-parity-tests-in-tests-linq-that-compare-fold-output-to-...
- which-typedecl-predicates-identify-types-where-length-expr-is-...
- why-does-each-arr-fail-with-unsafe-when-not-source-of-for-loop-...
- what-s-the-right-sqlite-linq-chain-form-for-aggregates-sum-min-max-...
- my-macro-substitutes-it-for-a-projection-expression-via-template-...
- when-a-call-macro-needs-to-pick-copy-vs-move-init-for-a-projection-...
- where-does-nolint-rule-go-when-a-lint-warning-is-emitted-from-inside-...

Tooling / ops:
- how-do-i-run-dastest-in-benchmark-only-mode-and-what-s-the-command-...
- cpp-profiler-macos-samply-instruments.md
- what-s-the-end-to-end-checklist-for-adding-a-new-daslib-das-module-...
- how-do-i-call-a-dasimgui-or-any-managed-c-method-on-a-struct-field-...

Updated:
- why-does-my-dastest-integration-test-hang-at-readiness-gate-failed-...
  — original card pointed at a require-order red herring; real cause
  was ref_time_ticks() returning ns on POSIX while wait_until_ready's
  deadline math assumed μs. Fix landed in PR #2685.

No code changes — docs only.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Five cards captured while landing dasImgui PR #38 — the dastest
integration suite running across the 3-OS GitHub Actions matrix.
Docs-only — no code changes.

  - imgui-playwright-windows-ci-16-post-libhv-stall — dasHV/libhv on
    GitHub-hosted windows-latest stalls after exactly 16 POST
    /command per subprocess. Empirically counted from
    DASLIVE_HV_LOG=stderr logs. Local Win11 unaffected. Workaround:
    1-POST polling helpers + Windows-only --exclude of 7 high-POST
    tests with a 4-call safety margin.

  - imgui-harness-headless-timeout-sec-cascade-guard — new
    --headless-timeout-sec=N CLI flag on the imgui_harness 5-helper
    surface. Playwright passes (test_timeout - 5) so a panicked test
    can't leave a zombie daslang-live holding port 9090
    (daslang's `finally` is skipped on panic). Cascade-prevention
    pattern generalizes to any spawned-subprocess-owning-a-port
    layout.

  - imgui-macos-configmacosxbehaviors-shortcut-is-super-not-ctrl —
    ImGui sets io.ConfigMacOSXBehaviors = true on macOS; the
    "shortcut key" becomes Super (Cmd), not Ctrl. Synth-IO tests
    must branch on snap?["io"]?["config_macos_behaviors"] and use
    ["Super"] mods on macOS. Surfaced after the cascade-fix made
    the symptom observable; Copilot diagnosed it via
    config_macos_behaviors snapshot extension.

  - why-does-daslang-live-s-post-shutdown-return-200-ok-but-the-
    subprocess-never-actually-exits-on-linux-macos — libhv v1.3.4
    `pathHandlers` is std::unordered_map; ANY("*") catch-all
    enumerates BEFORE specific paths on Linux libstdc++,
    intermittently on Windows MSVC. Every request hits the help
    handler, /shutdown's request_exit() never runs. Workaround
    landed via daslang PR #2688 (drops ANY, serves help from
    GET("/")). Upstream libhv bug unreported as of 2026-05-16.

  - why-does-my-lint-macro-fire-on-the-wrapper-module-that-
    legitimately-uses-the-forbidden-symbols-even-though-i-scope-
    visit-module — [lint_macro] runs PER MODULE during the require
    chain; getThisModule rebinds per per-module pass, so
    visit_module(prog.getThisModule) ALSO walks the wrapper that
    legitimately uses the forbidden symbols. Wrapper modules must
    carry the defensive opt-out (options _allow_xxx_calls = true),
    same convention as imgui_lint.das's _allow_imgui_legacy.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Docs-only update adding a batch of new “mouse-data” knowledge cards captured during the linq_fold splice rewrite work, plus one correction to an existing readiness-gate troubleshooting card.

Changes:

  • Added 16 new documentation cards covering linq_fold/macro-emission patterns, LINQ semantics questions, and a few tooling/ops notes.
  • Updated the existing “readiness gate FAILED” troubleshooting card to correct the root-cause explanation and recommended fix patterns.
  • Added cross-links between related cards for the each(...) peeling / typedecl-modifier / side-effect detection topics.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
mouse-data/docs/why-does-my-dastest-integration-test-hang-at-readiness-gate-failed-when-external-curl-to-status-works-fine-is-it-a-require-order.md Updates readiness-gate troubleshooting write-up with corrected root cause and fix guidance.
mouse-data/docs/why-does-each-arr-fail-with-unsafe-when-not-source-of-for-loop-outside-a-for-and-what-s-the-alternative-in-a-linq-chain.md New card explaining each(arr) safety constraints and alternatives in pipe chains.
mouse-data/docs/which-typedecl-predicates-identify-types-where-length-expr-is-statically-resolvable-in-daslang-macros.md New card summarizing TypeDecl predicates relevant to emitting length(...) from macros.
mouse-data/docs/where-does-nolint-rule-go-when-a-lint-warning-is-emitted-from-inside-a-qmacro-expr-and-fires-at-the-user-s-call-site-rather-than.md New card documenting correct // nolint: placement for lint reports originating inside qmacro_expr.
mouse-data/docs/when-a-call-macro-needs-to-pick-copy-vs-move-init-for-a-projection-should-i-emit-static-if-typeinfo-is-workhorse-e-proj-or-decid.md New card advising macro-time _type branching vs runtime static_if for workhorse decisions.
mouse-data/docs/what-s-the-right-sqlite-linq-chain-form-for-aggregates-sum-min-max-average-and-what-operators-aren-t-supported-as-sql-chain-term.md New card describing sqlite_linq aggregate terminal forms and unsupported terminal patterns.
mouse-data/docs/what-s-the-end-to-end-checklist-for-adding-a-new-daslib-das-module-so-docs-build-cleanly.md New card outlining doc-generation registration steps for new daslib/*.das modules.
mouse-data/docs/qmacro-invoke-source-bind-typedecl-modifier-iter-vs-array.md New card explaining how to choose typedecl modifiers for invoke source binding (iterator vs array).
mouse-data/docs/qmacro-gensym-per-callsite-via-lineinfo.md New card showing a LineInfo-based gensym pattern for per-callsite identifiers in macros.
mouse-data/docs/my-macro-substitutes-it-for-a-projection-expression-via-template-replacevariable-it-proj-apply-template-but-the-result-fails-to.md New card describing the ExprRef2Value substitution trap with Template.replaceVariable + apply_template.
mouse-data/docs/my-fold-macro-emits-a-loop-with-for-it-in-source-acc-reserve-length-source-but-the-reserve-doesn-t-fire-when-the-chain-starts-wi.md New/rewritten card documenting each(<array>) peeling and correct gating for reserve/length optimizations.
mouse-data/docs/how-do-i-run-dastest-in-benchmark-only-mode-and-what-s-the-command-line-syntax.md New card documenting dastest benchmark-only CLI invocation patterns.
mouse-data/docs/how-do-i-call-a-dasimgui-or-any-managed-c-method-on-a-struct-field-that-s-bound-as-a-raw-pointer-e-g-addfontfromfilettf-on-getio.md New card explaining how to call methods on managed C++ struct fields bound as raw pointers.
mouse-data/docs/daslib-macro-boost-has-sideeffects-predicate.md New card documenting has_sideeffects(expr) and intended usage/limitations.
mouse-data/docs/daslang-generic-instance-detect-via-fromgeneric.md New card explaining func.fromGeneric for identifying specialized generic calls.
mouse-data/docs/cpp-profiler-macos-samply-instruments.md New card recommending macOS C++ sampling profiler workflows for daslang.
mouse-data/docs/are-there-parity-tests-in-tests-linq-that-compare-fold-output-to-the-underlying-linq-operators.md New card describing where LINQ operator parity coverage effectively lives in the test suite.
Comments suppressed due to low confidence (3)

mouse-data/docs/why-does-each-arr-fail-with-unsafe-when-not-source-of-for-loop-outside-a-for-and-what-s-the-alternative-in-a-linq-chain.md:36

  • This document has two separate "## Questions" sections at the end, which results in duplicated content. Please keep a single "## Questions" block and remove the second header + repeated question.
## Questions
- Why does `each(arr)` fail with "unsafe when not source of for-loop" outside a for, and what's the alternative in a linq chain?
- error[31013] '__::builtin`each`' is unsafe — how to fix?
- When can I use `each(arr)` in a linq pipe chain?

## Questions
- Why does `each(arr)` fail with "unsafe when not source of for-loop" outside a for, and what's the alternative in a linq chain?

mouse-data/docs/what-s-the-right-sqlite-linq-chain-form-for-aggregates-sum-min-max-average-and-what-operators-aren-t-supported-as-sql-chain-term.md:40

  • The document ends with a duplicated "## Questions" section (the first question is repeated under a second header). Please remove the second header + duplicate question.
## Questions
- What's the right sqlite_linq chain form for aggregates (sum/min/max/average), and what operators aren't supported as `_sql` chain terminals?
- Why does `_sum(_.price)` fail in `_sql` with "can't locate variable '_'"?
- How do I express `any`/`all`/distinct-count/take-count in `_sql`?

## Questions
- What's the right sqlite_linq chain form for aggregates (sum/min/max/average), and what operators aren't supported as `_sql` chain terminals?

mouse-data/docs/how-do-i-run-dastest-in-benchmark-only-mode-and-what-s-the-command-line-syntax.md:46

  • There are two "## Questions" sections at the end (duplicated first question). Please remove the second header + repeated question to keep the doc clean and avoid duplicate indexing.
## Questions
- How do I run dastest in benchmark-only mode and what's the command-line syntax?
- What's the dastest --bench command line?
- How do I filter dastest benchmarks by name?

## Questions
- How do I run dastest in benchmark-only mode and what's the command-line syntax?


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +34 to +36

## Questions
- Where does `// nolint:RULE` go when a lint warning is emitted from inside a `qmacro_expr` and fires at the user's call site rather than at the macro source?
Comment on lines +35 to +37

## Questions
- Are there parity tests in tests/linq/ that compare `_fold` output to the underlying linq operators?
Comment on lines +44 to +46

## Questions
- What's the end-to-end checklist for adding a new daslib/*.das module so docs build cleanly?
Comment on lines 18 to 31
External `curl http://localhost:9090/status` from a sibling shell returns 200 with proper status JSON throughout — only the popen parent's poll loop "can't see it". Reproduces on macOS and Linux; appears to NOT reproduce on Windows (which is the trap — see below).

# Root cause

`live/live_api` was required BEFORE `imgui_app + glfw/glfw_boost + opengl/* + glfw_live + opengl_live` somewhere in the requirer chain (usually a wrapper module like `imgui/imgui_harness`). The `[_macro] installing` in `live_api.das` calls `fork_debug_agent_context(@@debug_agent)` at compile time. If that fork happens before GLFW is initialized in the live runtime, the resulting LiveApiServer becomes unreachable from a popen parent on Windows.
**`ref_time_ticks()` returns nanoseconds on POSIX, but the wait-loop math assumes microseconds.**

Filed: [#2677](https://github.com/GaijinEntertainment/daScript/issues/2677). Distinct from #2675 (`ANY("*")` route shadowing).
`src/hal/performance_time.cpp` defines `ref_time_ticks()` per platform:

# Fix (mechanical)
| Platform | Returns |
|---|---|
| Linux | `tv_sec * 1e9 + tv_nsec` — **nanoseconds** |
| macOS | `clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW)` — **nanoseconds** |
| Windows | `QueryPerformanceCounter().QuadPart` — counter ticks, freq depends on hardware (often ~10 MHz, accidentally close to 1 MHz / microsecond scaling) |

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in c24e4b5. Updated the card to reflect current performance_time.cpp reality:

@borisbat borisbat changed the title mouse-data/docs: 16 new + 1 updated card from linq_fold + Phase 2A session mouse-data/docs: 21 new + 1 updated card from linq_fold + dasImgui PR #38 May 16, 2026
borisbat and others added 2 commits May 16, 2026 16:35
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
… post-PR #2685 ns normalization

Agent-Logs-Url: https://github.com/GaijinEntertainment/daScript/sessions/97224dec-45d1-4968-a3dd-8e5f37274983

Co-authored-by: borisbat <272689+borisbat@users.noreply.github.com>
@borisbat borisbat merged commit cb12ed3 into master May 17, 2026
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.

3 participants