fix(ts): resolve inferred imported constructor receivers - #1999
mikemikimike wants to merge 3 commits into
Conversation
|
This is a good fix, and it does more than your title claims — in the right direction. I would like a test for the part you did not mention. The mechanism is the right oneRouting a bare constructor name through The guard is what makes it safe, and it is worth saying why, because it is the part a reviewer would otherwise have to derive: if (bound && bound->kind == CBM_TYPE_NAMED && bound->data.named.qualified_name)
The part you did not claim
Before this change, That is a broader improvement than the imported-class case, and it is likely to move TypeScript Please add one more fixture in the same shape as the one you wrote — an inferred One shape it can still get wrongScope lookup precedes imports in Your lint note
That is a known false positive, not drift you caused. Our Thanks also for the explicit AI-assistance note and for the reproduce-first fixture — both make this quicker to review honestly. Add the stdlib test and the description line and I am happy with this. |
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
|
I rechecked the failed CI jobs. The MSan job did not reach compilation or source tests: its container build failed while resolving apt.llvm.org, so this result is an infrastructure/network failure rather than evidence against the C change. The ci-ok job still reports a generic test failure without a source-level error in the available log. Could a maintainer please rerun both jobs and confirm the source tests after the runner dependency issue is resolved? |
|
Thank you for adding the imported-constructor and |
Signed-off-by: mikemikimike <13286568797@163.com>
Signed-off-by: mikemikimike <13286568797@163.com>
a739a2d to
aa4da14
Compare
|
Follow-up: I attempted to rerun the failing Windows job with the local |
|
Thank you for chasing this, and for quoting the actual failure instead of just "CI is red" — that made the attribution quick. The red is ours, not yours. You were right that only a maintainer can rerun the job. I have done something slightly different: your branch was 77 commits behind Nothing further is needed from you. The fixtures you added are what was asked for. |
|
CI is fully green on your head, and the imported-constructor case is verified and binds: on the bug-repro board, One thing before it merges. I think I can see why the validation looked green: Two ways to close it, your choice:
Either is a small push. The rule on our side is that a red board row without its "why" is a board defect, so I cannot land it in between. Everything else is done: local suites, linter, revert-check, and the Windows guard failure is ours (#2275). Thank you for the careful work on the import case — that is the one users hit. |
|
Thanks for the detailed follow-up. I reproduced this on e032a8e with the bug-repro runner. The imported-constructor case passes, but
I also confirmed that the focused I agree that the current PR should not claim that inferred The scope of this PR will remain the imported-constructor receiver fix for #1974. |
|
That is exactly the right call, and thank you for reproducing it on the board yourself rather than taking my word for it. Once the whitelisted row with its in-case comment and the trimmed description are pushed, the only thing between this and |
…ure on Windows
Several processes first-starting together against a runtime directory
that does not exist yet -- test-windows-guards' section_cold_storm, or a
host that launches more than one MCP server on its very first run -- all
observe the final path component absent. One CreateDirectoryW wins; the
others get ERROR_ALREADY_EXISTS. win_private_directory_tree_secure()
treated that as a failure and recorded no validation detail, so every
loser exited with a bare
secure CLI coordination could not be created (endpoint)
The function called right after the walk, win_runtime_directory_secure(),
has always tolerated ERROR_ALREADY_EXISTS for the same directory, and the
POSIX walk tolerates EEXIST at the same point; only the Windows walk in
front of them did not.
Seen four times on 2026-09-21 on unrelated PRs (DeusData#1768 three attempts in
a row, DeusData#2140, DeusData#1999, DeusData#808). The racy lines date from July; the guard
began exercising them on 2026-09-03, when each guard section was given
its own empty CBM_RUNTIME_DIR, so the final component is now absent at
storm time on every run.
The walk now treats ERROR_ALREADY_EXISTS from its own CreateDirectoryW as
"the directory I wanted exists". Nothing is trusted because of that: an
ancestor still goes through win_directory_component_secure(), and the
final component through win_runtime_directory_secure(), which refuses a
non-directory or reparse point and enforces owner and DACL.
Every refusal on this path now names its component and its rule. The
walk reports the Windows error when it can neither create nor inspect a
component, and win_runtime_directory_secure() says whether the path
could not be created, cannot be inspected, exists but is not a directory,
or is a reparse point. One helper owns the wide-to-UTF-8 conversion for
these messages and the existing ancestor message now uses it too, so
src/daemon/ipc.c stays at its memory-core baseline.
Deterministic reproduction, no threads and no timing: a test seam fires
in the walk between "component observed absent" and CreateDirectoryW,
and the test plays the process that wins the creation.
daemon_ipc_windows_private_directory_survives_lost_creation_race
daemon_ipc_windows_private_directory_refuses_and_names_a_planted_file
Verification. macOS arm64 (ASan+UBSan): build clean, daemon_ipc 53 passed
(2 Windows-only skips), daemon_bootstrap 28 passed, lint-memory-core
unchanged (ipc.c stays at 146 raw sites). The two new tests are Windows-only
and have NOT been run locally: the Windows VM was down when this was written,
so the RED run on the seam-only tree and the GREEN run with this fix are
delegated to CI's windows-latest legs (test-windows shards, test-windows-guards)
by an explicit maintainer decision. If the guard suite's cold storm still
fails with this in place, the attribution above is wrong and this reverts.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
What does this PR do?
Fixes #1974.
When TypeScript infers a local variable from
new Foo(), resolve the constructor through the existing lexical/import type lookup before falling back to the current module. This preserves the imported class qualified name, so calls such asstore.findById()produce the expectedCALLSedge without changing explicitly annotated locals.The same lookup also preserves the bare qualified names registered for TypeScript standard-library classes. Inferred
new Map<string, string>()locals can therefore dispatchm.get(id)to the registeredMap.getmethod instead of falling back to weak name-only resolution.Validation
ASAN_OPTIONS=detect_leaks=0 make -f Makefile.cbm test— passed.ASAN_OPTIONS=detect_leaks=0 make -f Makefile.cbm test-focused TEST_SUITES=ts_lsp— passed (303 tests, including the inferred-stdlib receiver regression).cppcheck— passed.git diff --check— passed.scripts/lint.sh --ci— blocked by pre-existing clang-format violations insrc/mcp/mcp.c,src/pipeline/pipeline_incremental.c, andsrc/cli/cli.c; no violation was reported for the changed implementation file.make -f Makefile.cbm security— static, binary-string, and UI audits passed; the existing robustness suite reported 26/32 due to input timeouts, and install/network checks are environment-limited in WSL.Checklist
git commit -s).AI assistance
This change was prepared with AI assistance. The implementation, regression fixtures, and local validation should be reviewed by maintainers.