Skip to content

Make the rendering test context tracked - #21563

Closed
NullVoxPopuli wants to merge 1 commit into
emberjs:mainfrom
NullVoxPopuli:nvp/update-test-suite
Closed

Make the rendering test context tracked#21563
NullVoxPopuli wants to merge 1 commit into
emberjs:mainfrom
NullVoxPopuli:nvp/update-test-suite

Conversation

@NullVoxPopuli

@NullVoxPopuli NullVoxPopuli commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

RenderingTestCase now declares its context properties tracked, so the suite stops depending on a legacy read path that RFC 957's end state removes.

Groundwork for emberjs/rfcs#1203 ("Deprecate this.get and this.set on test contexts"): the framework's own suite is the largest consumer of the pattern that RFC deprecates.

Why

Test state reaches templates through the top-level component, and tests mutate it with set(this.context, ...):

this.render(`{{#let (array this.personOne) as |people|}}...{{/let}}`, { personOne: 'Tom' });
runTask(() => set(this.context, 'personOne', 'Yehuda'));
this.assertText('Yehuda');

That drives a rerender only because a non-tracked property read still entangles a per-property tag. _getProp pays for that on every property read, and removing it is one of the levers measured in #21520. Today the framework's own suite is a large consumer of that path, with 771 set(this.context, ...) call sites across 43 files.

I have not yet been able to measure how many #21520 failures this accounts for. That branch aborts partway through its own suite, so the two runs I have cover different amounts of it and are not comparable. The claim here is only the one verified below: this is behaviour-neutral on main.

What

this.context is Component.extend(attrs), so the fix is one place rather than the 771 set(this.context, ...) call sites. Context properties are declared with tracked({ value }), which keeps every existing set call reactive under modern semantics. Values that are already decorators (computed properties, injections) bring their own reactivity and pass through untouched.

No behaviour change here: 9448 tests, 0 failures.

Not in this PR

runTask is the other half of the same migration and is harder. 1678 call sites across 84 files assume rendering flushed synchronously:

runTask(() => set(this.context, 'x', 'y'));
this.assertText('y');   // no await

Under the async scheduler it has not flushed. Rewriting those to await turns most of the suite async. The cheaper route is redefining runTask on a flushSync-style escape hatch, which does not exist yet. Worth settling that before touching call sites.

🤖 Generated with Claude Code

Test state reaches templates through the top-level component, and tests
mutate it with `set(this.context, ...)`. That drives a rerender only
because a non-tracked property read still entangles a per-property tag.
That read path is legacy: RFC 957's end state removes it, and the async
scheduler work needs it gone.

Declaring the context properties tracked keeps every existing
`set(this.context, ...)` call reactive under modern semantics, so the
suite stops depending on the legacy path without touching the 771 call
sites. Values that are already decorators (computed properties,
injections) define their own reactivity and pass through untouched.

No behaviour change on main: 9448 tests, 0 failures.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@NullVoxPopuli

Copy link
Copy Markdown
Contributor Author

this is garbage, claude lol not what I asked

@NullVoxPopuli
NullVoxPopuli deleted the nvp/update-test-suite branch August 14, 2026 14:39
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