Skip to content

Stable decorators - #20868

Merged
ef4 merged 33 commits into
mainfrom
stable-field-decorators
Sep 29, 2026
Merged

ef4 merged 33 commits into
mainfrom
stable-field-decorators

Conversation

@ef4

@ef4 ef4 commented Mar 9, 2025 •

Copy link
Copy Markdown
Contributor

Working on support for the stage3 decorator spec.

This branch is an attempt at complete drop-in support for all our decorators, even the wacky and wonderful old ones. I have the entire ember test suite passing locally.

My goal here is to show everything working with only the tiniest possible semantic changes and no mandatory syntactic change to auto-accessors.

You are still likely to want to convert to auto-accessors because they will perform much better. But keeping the old syntax working, even at a perf cost, would greatly ease upgrades.

Known semantic changes

  • initialization order of field decorators changes to match the normal (non-decorated) field initialization order. Previously, decorated properties could actually influence the initialization order by pulling on each other.

TODO

  • implement auto-accessor versions of tracked and service. (I've already done this on prior attempts, it's the easier part. But I'll need to segregate them in their own test suite area, because I'm trying to keep everything working under both builds, and the old build won't support the syntax.)
    • accessor tracked
    • accessor service
  • reflect the change in the types. This is kinda annoying, because TypeScript's stable decorators are not allowed to use declare. We probably can't make ember's own build typecheck under both configurations, but we can probably offer enough overrides to demonstrate different apps working under both configurations.
  • in CI, run the ember test suite with stable decorators
  • in CI, run one or more of the smoke test apps with stable decorators.
  • Question: should the accessor form of tracked get all the same computed property interop as the field form?
    • Pro argument: yes because people don't know where they're relying on the interop
    • Con argument:
      • meta.writeDescriptors can't happen at class construction time, it would need to happen via addInitializer the first time a class is instantiated. (Our field form of tracked does a bunch of that, but the messiness there is more excusable since that's the allowed-to-be-slower legacy form.) This injects a little code into every object instantiation. Even in new apps that don't actually need it.
    • I think the best answer here would require some related work on how to segregate off the computed system so that it's still available when you need it and not there when you don't.

@ef4
ef4 force-pushed the stable-field-decorators branch from 829a516 to 2dac217 Compare March 9, 2025 21:32
Rollup was actually dropping a side-effect that was intentionally part of a test.
@github-actions

github-actions Bot commented Jan 6, 2026

Copy link
Copy Markdown
Contributor
Estimated Asset Sizes

Diff

--- main/out.txt	2026-01-06 18:46:40.000000000 +0000
+++ pr/./pr-20759770739/out.txt	2026-01-06 19:35:12.000000000 +0000
@@ -1,46 +1,46 @@
 ╔═══════╤═══════════╤═══════════╗
 ║       │ Min       │ Gzip      ║
 ╟───────┼───────────┼───────────╢
-║ Total │ 352.11 KB │ 203.55 KB ║
+║ Total │ 353.32 KB │ 205.03 KB ║
 ╚═══════╧═══════════╧═══════════╝
 
-╔══════════════════════╤═══════════╤══════════╗
-║ @ember/*             │ Min       │ Gzip     ║
-╟──────────────────────┼───────────┼──────────╢
-║ Total                │ 313.81 KB │ 181.8 KB ║
-╟──────────────────────┼───────────┼──────────╢
-║ -internals           │ 36.61 KB  │ 26 KB    ║
-║ application          │ 13.24 KB  │ 8.03 KB  ║
-║ array                │ 13.05 KB  │ 7.54 KB  ║
-║ canary-features      │ 304 B     │ 419 B    ║
-║ component            │ 2.05 KB   │ 1.57 KB  ║
-║ controller           │ 1.96 KB   │ 1.45 KB  ║
-║ debug                │ 11.73 KB  │ 8.14 KB  ║
-║ deprecated-features  │ 31 B      │ 77 B     ║
-║ destroyable          │ 561 B     │ 383 B    ║
-║ enumerable           │ 259 B     │ 387 B    ║
-║ helper               │ 1.08 KB   │ 830 B    ║
-║ instrumentation      │ 2.43 KB   │ 1.78 KB  ║
-║ modifier             │ 1.22 KB   │ 987 B    ║
-║ object               │ 35.98 KB  │ 22.1 KB  ║
-║ owner                │ 159 B     │ 178 B    ║
-║ renderer             │ 630 B     │ 491 B    ║
-║ routing              │ 59.37 KB  │ 33.91 KB ║
-║ runloop              │ 2.36 KB   │ 1.5 KB   ║
-║ service              │ 1 KB      │ 858 B    ║
-║ template             │ 654 B     │ 538 B    ║
-║ template-compilation │ 429 B     │ 366 B    ║
-║ template-compiler    │ 123.33 KB │ 59.68 KB ║
-║ template-factory     │ 370 B     │ 351 B    ║
-║ test                 │ 923 B     │ 627 B    ║
-║ utils                │ 4.11 KB   │ 3.63 KB  ║
-║ version              │ 55 B      │ 131 B    ║
-╚══════════════════════╧═══════════╧══════════╝
+╔══════════════════════╤═══════════╤═══════════╗
+║ @ember/*             │ Min       │ Gzip      ║
+╟──────────────────────┼───────────┼───────────╢
+║ Total                │ 314.56 KB │ 182.99 KB ║
+╟──────────────────────┼───────────┼───────────╢
+║ -internals           │ 36.64 KB  │ 26.27 KB  ║
+║ application          │ 13.24 KB  │ 8.11 KB   ║
+║ array                │ 13.05 KB  │ 7.63 KB   ║
+║ canary-features      │ 304 B     │ 419 B     ║
+║ component            │ 2.05 KB   │ 1.56 KB   ║
+║ controller           │ 1.96 KB   │ 1.4 KB    ║
+║ debug                │ 11.73 KB  │ 8.12 KB   ║
+║ deprecated-features  │ 31 B      │ 77 B      ║
+║ destroyable          │ 561 B     │ 383 B     ║
+║ enumerable           │ 259 B     │ 387 B     ║
+║ helper               │ 1.08 KB   │ 797 B     ║
+║ instrumentation      │ 2.43 KB   │ 1.78 KB   ║
+║ modifier             │ 1.22 KB   │ 986 B     ║
+║ object               │ 36.7 KB   │ 22.64 KB  ║
+║ owner                │ 159 B     │ 178 B     ║
+║ renderer             │ 630 B     │ 503 B     ║
+║ routing              │ 59.37 KB  │ 34.29 KB  ║
+║ runloop              │ 2.36 KB   │ 1.44 KB   ║
+║ service              │ 1 KB      │ 829 B     ║
+║ template             │ 654 B     │ 534 B     ║
+║ template-compilation │ 429 B     │ 366 B     ║
+║ template-compiler    │ 123.33 KB │ 59.68 KB  ║
+║ template-factory     │ 370 B     │ 351 B     ║
+║ test                 │ 923 B     │ 627 B     ║
+║ utils                │ 4.11 KB   │ 3.65 KB   ║
+║ version              │ 55 B      │ 131 B     ║
+╚══════════════════════╧═══════════╧═══════════╝
 
 ╔═════════════════╤══════════╤══════════╗
 ║ @glimmer/*      │ Min      │ Gzip     ║
 ╟─────────────────┼──────────┼──────────╢
-║ Total           │ 38.29 KB │ 21.76 KB ║
+║ Total           │ 38.77 KB │ 22.04 KB ║
 ╟─────────────────┼──────────┼──────────╢
 ║ destroyable     │ 2.78 KB  │ 1.38 KB  ║
 ║ encoder         │ 81 B     │ 171 B    ║
@@ -53,7 +53,7 @@
 ║ program         │ 252 B    │ 333 B    ║
 ║ reference       │ 548 B    │ 544 B    ║
 ║ runtime         │ 10.32 KB │ 5.22 KB  ║
-║ tracking        │ 1.34 KB  │ 1.18 KB  ║
+║ tracking        │ 1.81 KB  │ 1.46 KB  ║
 ║ util            │ 1.85 KB  │ 1.59 KB  ║
 ║ validator       │ 15.53 KB │ 6.9 KB   ║
 ║ vm              │ 495 B    │ 569 B    ║

Details

This PRmain
╔═══════╤═══════════╤═══════════╗
║       │ Min       │ Gzip      ║
╟───────┼───────────┼───────────╢
║ Total │ 353.32 KB │ 205.03 KB ║
╚═══════╧═══════════╧═══════════╝

╔══════════════════════╤═══════════╤═══════════╗
║ @ember/*             │ Min       │ Gzip      ║
╟──────────────────────┼───────────┼───────────╢
║ Total                │ 314.56 KB │ 182.99 KB ║
╟──────────────────────┼───────────┼───────────╢
║ -internals           │ 36.64 KB  │ 26.27 KB  ║
║ application          │ 13.24 KB  │ 8.11 KB   ║
║ array                │ 13.05 KB  │ 7.63 KB   ║
║ canary-features      │ 304 B     │ 419 B     ║
║ component            │ 2.05 KB   │ 1.56 KB   ║
║ controller           │ 1.96 KB   │ 1.4 KB    ║
║ debug                │ 11.73 KB  │ 8.12 KB   ║
║ deprecated-features  │ 31 B      │ 77 B      ║
║ destroyable          │ 561 B     │ 383 B     ║
║ enumerable           │ 259 B     │ 387 B     ║
║ helper               │ 1.08 KB   │ 797 B     ║
║ instrumentation      │ 2.43 KB   │ 1.78 KB   ║
║ modifier             │ 1.22 KB   │ 986 B     ║
║ object               │ 36.7 KB   │ 22.64 KB  ║
║ owner                │ 159 B     │ 178 B     ║
║ renderer             │ 630 B     │ 503 B     ║
║ routing              │ 59.37 KB  │ 34.29 KB  ║
║ runloop              │ 2.36 KB   │ 1.44 KB   ║
║ service              │ 1 KB      │ 829 B     ║
║ template             │ 654 B     │ 534 B     ║
║ template-compilation │ 429 B     │ 366 B     ║
║ template-compiler    │ 123.33 KB │ 59.68 KB  ║
║ template-factory     │ 370 B     │ 351 B     ║
║ test                 │ 923 B     │ 627 B     ║
║ utils                │ 4.11 KB   │ 3.65 KB   ║
║ version              │ 55 B      │ 131 B     ║
╚══════════════════════╧═══════════╧═══════════╝

╔═════════════════╤══════════╤══════════╗
║ @glimmer/*      │ Min      │ Gzip     ║
╟─────────────────┼──────────┼──────────╢
║ Total           │ 38.77 KB │ 22.04 KB ║
╟─────────────────┼──────────┼──────────╢
║ destroyable     │ 2.78 KB  │ 1.38 KB  ║
║ encoder         │ 81 B     │ 171 B    ║
║ env             │ 38 B     │ 87 B     ║
║ global-context  │ 886 B    │ 545 B    ║
║ manager         │ 977 B    │ 627 B    ║
║ node            │ 175 B    │ 249 B    ║
║ opcode-compiler │ 1.11 KB  │ 905 B    ║
║ owner           │ 159 B    │ 202 B    ║
║ program         │ 252 B    │ 333 B    ║
║ reference       │ 548 B    │ 544 B    ║
║ runtime         │ 10.32 KB │ 5.22 KB  ║
║ tracking        │ 1.81 KB  │ 1.46 KB  ║
║ util            │ 1.85 KB  │ 1.59 KB  ║
║ validator       │ 15.53 KB │ 6.9 KB   ║
║ vm              │ 495 B    │ 569 B    ║
║ wire-format     │ 1.84 KB  │ 1.35 KB  ║
╚═════════════════╧══════════╧══════════╝
╔═══════╤═══════════╤═══════════╗
║       │ Min       │ Gzip      ║
╟───────┼───────────┼───────────╢
║ Total │ 352.11 KB │ 203.55 KB ║
╚═══════╧═══════════╧═══════════╝

╔══════════════════════╤═══════════╤══════════╗
║ @ember/*             │ Min       │ Gzip     ║
╟──────────────────────┼───────────┼──────────╢
║ Total                │ 313.81 KB │ 181.8 KB ║
╟──────────────────────┼───────────┼──────────╢
║ -internals           │ 36.61 KB  │ 26 KB    ║
║ application          │ 13.24 KB  │ 8.03 KB  ║
║ array                │ 13.05 KB  │ 7.54 KB  ║
║ canary-features      │ 304 B     │ 419 B    ║
║ component            │ 2.05 KB   │ 1.57 KB  ║
║ controller           │ 1.96 KB   │ 1.45 KB  ║
║ debug                │ 11.73 KB  │ 8.14 KB  ║
║ deprecated-features  │ 31 B      │ 77 B     ║
║ destroyable          │ 561 B     │ 383 B    ║
║ enumerable           │ 259 B     │ 387 B    ║
║ helper               │ 1.08 KB   │ 830 B    ║
║ instrumentation      │ 2.43 KB   │ 1.78 KB  ║
║ modifier             │ 1.22 KB   │ 987 B    ║
║ object               │ 35.98 KB  │ 22.1 KB  ║
║ owner                │ 159 B     │ 178 B    ║
║ renderer             │ 630 B     │ 491 B    ║
║ routing              │ 59.37 KB  │ 33.91 KB ║
║ runloop              │ 2.36 KB   │ 1.5 KB   ║
║ service              │ 1 KB      │ 858 B    ║
║ template             │ 654 B     │ 538 B    ║
║ template-compilation │ 429 B     │ 366 B    ║
║ template-compiler    │ 123.33 KB │ 59.68 KB ║
║ template-factory     │ 370 B     │ 351 B    ║
║ test                 │ 923 B     │ 627 B    ║
║ utils                │ 4.11 KB   │ 3.63 KB  ║
║ version              │ 55 B      │ 131 B    ║
╚══════════════════════╧═══════════╧══════════╝

╔═════════════════╤══════════╤══════════╗
║ @glimmer/*      │ Min      │ Gzip     ║
╟─────────────────┼──────────┼──────────╢
║ Total           │ 38.29 KB │ 21.76 KB ║
╟─────────────────┼──────────┼──────────╢
║ destroyable     │ 2.78 KB  │ 1.38 KB  ║
║ encoder         │ 81 B     │ 171 B    ║
║ env             │ 38 B     │ 87 B     ║
║ global-context  │ 886 B    │ 545 B    ║
║ manager         │ 977 B    │ 627 B    ║
║ node            │ 175 B    │ 249 B    ║
║ opcode-compiler │ 1.11 KB  │ 905 B    ║
║ owner           │ 159 B    │ 202 B    ║
║ program         │ 252 B    │ 333 B    ║
║ reference       │ 548 B    │ 544 B    ║
║ runtime         │ 10.32 KB │ 5.22 KB  ║
║ tracking        │ 1.34 KB  │ 1.18 KB  ║
║ util            │ 1.85 KB  │ 1.59 KB  ║
║ validator       │ 15.53 KB │ 6.9 KB   ║
║ vm              │ 495 B    │ 569 B    ║
║ wire-format     │ 1.84 KB  │ 1.35 KB  ║
╚═════════════════╧══════════╧══════════╝

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

📊 Size report

Tarball size — 1.2 MB → 1.2 MB

dist/dev   0.6%↑

File Before (Size / Brotli) After (Size / Brotli)
./packages/@ember/object/compat.js 5.2 kB / 1.3 kB 11%↑5.8 kB / 5%↑1.4 kB
./packages/@ember/object/core.js 32 kB / 7.8 kB 0.4%↑32.1 kB / 0.4%↑7.8 kB
./packages/@ember/object/index.js 7.6 kB / 2.1 kB 7%↑8.1 kB / 6%↑2.2 kB
./packages/@ember/object/lib/computed/computed_macros.js 23 kB / 3.3 kB -0.54%↓22.9 kB / -0.12%↓3.3 kB
./packages/@ember/object/lib/computed/reduce_computed_macros.js 35 kB / 5.5 kB -0.31%↓34.9 kB / -0.05%↓5.5 kB
./packages/@glimmer/tracking/index.js 4.8 kB / 1.6 kB 14%↑5.5 kB / 10%↑1.8 kB
./packages/shared-chunks/api-{hash}.js 26.3 kB / 5.9 kB -60.2%↓10.4 kB / -59.4%↓2.4 kB
./packages/shared-chunks/computed-{hash}.js 33.9 kB / 7.9 kB 0.7%↑34.1 kB / 0.5%↑7.9 kB
./packages/shared-chunks/decorator-{hash}.js 4.7 kB / 1.3 kB 160%↑12.1 kB / 150%↑3.3 kB
./packages/shared-chunks/injected_property-{hash}.js 2.1 kB / 777 B 69%↑3.6 kB / 38%↑1.1 kB
./packages/shared-chunks/mandatory-{hash}.js 3.7 kB / 1.1 kB 4%↑3.9 kB / 3%↑1.1 kB
./packages/shared-chunks/tracked-{hash}.js 10.7 kB / 3.1 kB 20%↑12.9 kB / 13%↑3.5 kB
Total (Includes all files) 2.1 MB / 505.4 kB 0.6%↑2.1 MB / 0.6%↑508.6 kB

dist/prod   0.6%↑

File Before (Size / Brotli) After (Size / Brotli)
./packages/@ember/object/compat.js 2.9 kB / 973 B 14%↑3.3 kB / 8%↑1.1 kB
./packages/@ember/object/core.js 26.2 kB / 6.4 kB 0.5%↑26.3 kB / 0.7%↑6.5 kB
./packages/@ember/object/index.js 6 kB / 1.8 kB 6%↑6.4 kB / 6%↑1.9 kB
./packages/@glimmer/tracking/index.js 3.7 kB / 1.3 kB 18%↑4.4 kB / 11%↑1.5 kB
./packages/shared-chunks/computed-{hash}.js 27.9 kB / 6.5 kB 0.9%↑28.2 kB / 0.4%↑6.6 kB
./packages/shared-chunks/decorator-{hash}.js 3.7 kB / 1.1 kB 179%↑10.2 kB / 165%↑2.9 kB
./packages/shared-chunks/injected_property-{hash}.js 1.6 kB / 627 B 75%↑2.8 kB / 48%↑926 B
./packages/shared-chunks/lookup-{hash}.js 337 B / 172 B 43%↑481 B / 13%↑194 B
./packages/shared-chunks/tracked-{hash}.js 7.9 kB / 2.5 kB 23%↑9.6 kB / 15%↑2.9 kB
Total (Includes all files) 1.9 MB / 462.6 kB 0.6%↑1.9 MB / 0.6%↑465.5 kB

smoke-tests/v2-app-template/dist   0.9%↑

File Before (Size / Brotli) After (Size / Brotli)
./assets/api-{hash}.js 299.1 kB / 80.1 kB 1%↑301.9 kB / 0.9%↑80.8 kB
./assets/modules-{hash}.js 30 kB / 9.4 kB 1%↑30.3 kB / 0.7%↑9.4 kB
Total (Includes all files) 351.8 kB / 97.3 kB 0.9%↑354.9 kB / 0.8%↑98.1 kB

smoke-tests/v2-app-hello-world-template/dist   1%↑

File Before (Size / Brotli) After (Size / Brotli)
./assets/main-{hash}.js 135 kB / 37.7 kB 1%↑136.6 kB / 1%↑38.1 kB
Total (Includes all files) 135.4 kB / 37.8 kB 1%↑136.9 kB / 1%↑38.2 kB

🤖 This report was automatically generated by wyvox/pkg-size

ef4 and others added 4 commits September 27, 2026 14:00
- Teach the glimmer-workspace `@test` decorator and suite runner to work
  under 2023-11 decorators (tag the function rather than relying on
  prototype enumerability).
- Support stable decorators in `nativeDescDecorator`, which main now
  applies to getters on Component.
- Add `onClassFinalized`, which queues per-class setup on the decorator
  metadata object and flushes it from `CoreObject.proto()` or on first
  construction. Use it for computed, action and nativeDescDecorator so
  they target the declaring class (not a subclass) and are visible to
  class-level introspection like `metaForProperty` before any instance
  exists.
- Route `@service foo` fields through the same computed path as legacy
  decorators so injections are registered in the class meta.
- Expose `VITE_` env vars again now that main sets `envPrefix`.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Our public decorator types now include standard decorator signatures
alongside their legacy ones, so they type check with or without
`experimentalDecorators`:

- `tracked` (fields, accessors, and `@tracked({ ... })`), `cached`
- `computed` (bare and with keys), computed macros, `alias`
- `action`, `dependentKeyCompat`
- `service`/`inject` and controller `inject` (fields and accessors)

`readOnly()`/`oneWay()` now preserve the decorator's type so chained
decorators keep working under both modes.

Internally, decorated `declare` fields (which standard decorators
disallow) become regular fields, and new `type-check:*-stable-decorators`
scripts check both the internals and a new stable-decorators type-tests
suite with `experimentalDecorators: false`. CI runs both.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@ef4
ef4 force-pushed the stable-field-decorators branch from 1f703f7 to 4440cfb Compare September 27, 2026 18:12
ef4 and others added 3 commits September 27, 2026 14:23
Add a third decorator variant for the test suite,
VITE_STABLE_DECORATORS=typescript, alongside babel's legacy decorators
(decorator-transforms) and babel's 2023-11 decorators. It compiles our
sources with `ts.transpileModule` (standard decorators, ES2022 target)
before babel runs, and drops babel's decorator plugins. CI runs it as a
new variant.

TypeScript's emit only provides decorator metadata when `Symbol.metadata`
already exists, which it doesn't in browsers yet, while babel falls back
to `Symbol.for('Symbol.metadata')`. `onClassFinalized` depends on that
metadata, so define `Symbol.metadata` with babel's fallback when it's
missing, and assert clearly if a class still ends up without metadata.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Rather than defining `Symbol.metadata` for every app, leave it to apps
that compile with TypeScript's decorator emit, as TypeScript's own docs
advise. Ember now looks the key up lazily (so it honors whatever the app
installed, falling back to babel's `Symbol.for('Symbol.metadata')`), and
the assertion for a class without metadata explains the polyfill. The
test suite's TypeScript mode adds the polyfill to the test page, the way
an app would.

Also add a smoke-test scenario that builds a v2 (vite) app with
TypeScript's emit: a vite plugin runs `ts.transpileModule` over the app's
own code before babel (and adds the polyfill), and babel's
decorator-transforms plugin is removed. It shares its app and test files
with the babel 2023-11 scenario, plus a TypeScript test covering field
`@tracked`/`@service`, `@cached` and `@action`.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@ef4
ef4 marked this pull request as ready for review September 27, 2026 21:34
@ef4

ef4 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor Author

This is now essentially ready. It would be good to do some benchmarking.

The tests run three ways:

  • the old way (legacy decorators as implemented by decorator-transforms)
  • the new way, as implemented by @babel/plugin-proposal-decorators with { version: '2023-11' }.
  • the new way, as implemented by TypeScript's own code emit.

The most practical option for apps who want to be early adopters is @babel/plugin-proposal-decorators with { version: '2023-11' }. That's a more natural switch since it's only swapping one babel plugin for another. And it brings its own polyfill for Symbol.metadata.

If you instead let TypeScript transpile your decorators, you need to follow TypeScript's instructions about adding your own Symbol.metadata polyfill.

Either way, it's expected that you'll get better performance if you update field decorators to auto accessor decorators (but field decorators continue to work).

@NullVoxPopuli-ai-agent

This comment was marked as outdated.

@NullVoxPopuli-ai-agent

This comment was marked as outdated.

@NullVoxPopuli

This comment was marked as outdated.

@NullVoxPopuli-ai-agent

This comment was marked as outdated.

@NullVoxPopuli

NullVoxPopuli commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Here are the results with 50 samples each

Also ignore how the table is in the bottom right corner of the window. This needs more CSS finesse 🙈

p50
image

p75
image

the p90 for this one bench very much favors accessors
image

It's still pretty close.

So, I think the benefits here are good enough!

NullVoxPopuli-ai-agent pushed a commit to NullVoxPopuli-ai-agent/rere-benchmark that referenced this pull request Sep 28, 2026
Four ember result sets for the stage 3 decorators PR:

- main 74fb9ba2e8, legacy decorators (decorator-transforms)
- PR 0ea35167d7, legacy decorators
- PR, @babel/plugin-proposal-decorators 2023-11, `@tracked` fields
- PR, same plugin, `@tracked accessor`

Each file pools 5 mirrored rounds (50 samples per bench) at 8x
throttle, all runs pinned to CPUs 4-7.

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

Copy link
Copy Markdown
Contributor

huzzah! I fixed the table alignment in the bench viewer app 🙈 haha

if (elementDescriptor) {
return decorator(elementDescriptor[0], elementDescriptor[1], elementDescriptor[2]);
} else if (modernArgs) {
// TODO: cast is a lie, keeping the public types unchanged for now

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.

a TODO for this PR?

...args: any[]
): TrackedDecorator | DecoratorPropertyDescriptor | TrackedValue<any> {
if (isModernDecoratorArgs(args)) {
// TODO: cast is a lie, keeping the public types unchanged for now

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.

a TODO for this PR?

`You attempted to set a default value for ${decoratorArgs[1].name?.toString()} with the @tracked({ value: 'default' }) syntax. You can only use this syntax with classic classes. For native classes, you can use class initializers: @tracked field = 'default';`,
!hasInitialValue
);
// TODO: cast is a lie, keeping the public types unchanged for now

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.

a TODO for this PR?

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.

lol controller inject

@ef4

ef4 commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

Taking notes from tooling team meeting discussion of this feature:

  • the PR is safe and low risk
  • but we want to write a minimal RFC so the teaching story is clear, particularly for addon authors
  • after this change, we can choose to update the app blueprint to build the new way, at which point we probably also offer a lint-fix for making tracked etc into auto-accessors.
  • but we don't want to create a learning gap for addon authors, and we should do some tooling work to make sure they can author following the same defaults as apps, without impacting their compatibility matrix against ember versions that only support legacy decorator calling
  • we originally planned to eventually let v2 addons ship with their decorators untranspiled, but the stage 3 -> 2.7 downgrade for decorators makes that feel further away, and it might be better to give addon authors ember-specific tooling to desugar just our supported decorators to existing ember public APIs
    • tracked recently shipped a plain function form
    • cached should arguably also have a plain function form
    • service could get inlined as a getter using all longstanding public API
    • all the rest of our decorators are in the legacy half of things that we expect to deprecate and remove along with old Ember.Object.

@ef4

ef4 commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

I am on the hook to write the aforementioned RFC & docs, but I'm going to land this PR now as it's green, reviewed, and safe. I don't want to keep rebasing it.

@ef4
ef4 merged commit 0abb844 into main Sep 29, 2026
69 checks passed
@ef4
ef4 deleted the stable-field-decorators branch September 29, 2026 18:35
@github-actions github-actions Bot mentioned this pull request Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants