`new_in_static` corpus test fails at runtime: `scope.node._scopes is not iterable`

Open
#7,266 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
65/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
aws, typescript

Research direction

Start with tests/valid/new_in_static.test.w and reproduce it using the tools/hangar pnpm commands for the tf-aws and sim cases. Trace the runtime handling of new X() in scope with a raw constructs.Construct, and inspect the constructs dependency and packages/@winglang/sdk references to _scopes. Done means the test can be re-enabled and both target cases pass while the unaffected new_in_static_lib.w case remains passing.

Written by the indexing model from the issue text.

Description

What

tests/valid/new_in_static.test.w fails on the current main, for both the wing compile -t tf-aws and wing test -t sim cases:

Error: scope.node._scopes is not iterable
  --> new_in_static.test.w:9:12
 9 |     return new cloud.Bucket() in scope;
   |            ^
at createBucket .../tests/valid/new_in_static.test.w:9:12
at .../tests/valid/new_in_static.test.w:48:14

The failing path is a new X() in scope where scope is a bare constructs.Construct:

class MyClass {
  pub static createBucket(scope: c.IConstruct): cloud.Bucket {
    return new cloud.Bucket() in scope;   // <-- throws at runtime
  }
}

let scope = new c.Construct();
let bucket = MyClass.createBucket(scope); // line 48

Likely cause

node._scopes is an internal field of the constructs library, not Wing SDK code (grep -r _scopes packages/@winglang/sdk/src is empty). This looks like a constructs version incompatibility: a newer constructs changed/removed node._scopes, so the codegen/helper that resolves an explicit in scope against a raw Construct now iterates something that no longer exists.

How it surfaced

GitHub Actions on this repo was halted from 2025-07-23 until it was re-enabled on 2026-08-31. This failure is pre-existing on main and was simply not being caught while CI was down — it is unrelated to the change that surfaced it (the Wing Console sign-in removal / CI cleanup on claude/resume-qlgc79).

Action taken

To unblock CI (the release build's quality gate), the corpus test has been skipped via a skip: true meta-comment on tests/valid/new_in_static.test.w, rather than left red. This issue tracks re-enabling it once the new X() in scope runtime path is fixed. The new_in_static_lib.w compile case is unaffected and still runs.

Repro

cd tools/hangar && pnpm test:generate && pnpm run vitest new_in_static

Related: #6067 (the feature this test exercises).

Dominant language
TypeScript
Stars
5.4k
Forks
217
Avg merge
3h 45m
Merged PRs (30d)
1

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from winglang/wing

All issues in winglang/wing

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.