Skip to content

Address review: drop cache, simplify pluralize, collapse setup-resolver#21326

Merged
NullVoxPopuli merged 4 commits intoemberjs:nvp/strict-resolver-rfc-1132from
NullVoxPopuli-ai-agent:strict-resolver-review-cleanup
Apr 20, 2026
Merged

Address review: drop cache, simplify pluralize, collapse setup-resolver#21326
NullVoxPopuli merged 4 commits intoemberjs:nvp/strict-resolver-rfc-1132from
NullVoxPopuli-ai-agent:strict-resolver-review-cleanup

Conversation

@NullVoxPopuli-ai-agent
Copy link
Copy Markdown
Contributor

Addresses the review feedback on #21303:

  • cache.js"how much do we care about keeping this cache around? (it's from ember-string)" → dropped. dasherize is now a plain .replace(...).toLowerCase().replace(...) in strict-resolver/string.js; for module-lookup workloads at boot time the cache was just noise.
  • strict-resolver.ts:134 (IRREGULAR_PLURALS)"we don't need to specify this list -- the class that has `modules = ` assignable on it should be able to specify their inflection rules" → removed the built-in irregulars.
  • strict-resolver.ts:145 (consonant-y regex)"is this true? does ember-resolver do this?" → no, it doesn't. Removed alongside the -s/-es suffix rule. #plural is back to naive type + 's', matching ember-resolver. Consumers that want children / people / buses register them via the plurals constructor option (same mechanism already used for config).
  • -setup-resolver.js"let's remove this function, I think" → deleted; basic-test.js instantiates StrictResolver directly in beforeEach.
  • scenarios.ts"can we also add a strict application to the v2 app scenarios? I thiiiiiink we just need to overwrite the app.js in that scenario" → yes. Added strictResolver as a second variant of v2AppScenarios (alongside embroiderVite); it merges a strict-resolver app.js over the template's default, so every test that runs against v2AppScenarios now also runs against the strict-resolver configuration.
  • package.json:232 (generated alias list)"let's save that for another PR, yea?" → deferred.

Tests updated: the suffix/irregular/y→ies cases are gone; one test remains proving that registering { child: 'children' } via plurals lets you do child:alice explicitly.

🤖 Generated with Claude Code

NullVoxPopuli and others added 3 commits April 20, 2026 10:26
Feedback from the review of PR emberjs#21303:

  - "how much do we care about keeping this cache around?" (it's from
    ember-string) — drop the Cache helper and its test file. dasherize
    is now a plain `replace.toLowerCase().replace` in strict-resolver/
    string.js. For the workloads the resolver sees (module lookups
    during boot) the cache is noise.

  - "we don't need to specify this list -- the class that has
    `modules = ` assignable on it should be able to specify their
    inflection rules" — drop the built-in IRREGULAR_PLURALS table and
    the -s/-es / consonant-y suffix rules. Pluralization is back to
    naive `type + 's'`, matching ember-resolver's behavior. Consumers
    that want children / people / buses register them up-front via the
    `plurals` constructor option, same as they already do for `config`.

  - "is this true? does ember-resolver do this?" — the regex-based
    rules weren't in ember-resolver either; they're gone alongside
    the irregulars.

  - "let's remove this function, I think" — delete the setupResolver
    helper and its file; basic-test.js now instantiates StrictResolver
    directly in beforeEach.

  - "can we also add a strict application to the v2 app scenarios? I
    thiiiiiink we just need to overwrite the app.js in that scenario"
    — yes: add `strictResolver` as a variant of v2AppScenarios (in
    addition to embroiderVite). basic-test.ts now runs against both
    v2 configurations.

Tests updated to match: the suffix/irregular/y→ies cases are removed;
one test left behind proves that registering a custom plural still
lets you do `child: 'children'` explicitly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CI revealed that basic-test.ts includes a route template (`templates/
example-gjs-route.gjs`) that exports a `.gjs` Component class — a v2
convention that works under embroiderVite (via compat-modules) but
doesn't render with the strict resolver: owner.lookup('template:
example-gjs-route') hands back the Component and rendering fails to
produce [data-test=\"model-field\"], so the acceptance test fails.

That's a real gap worth fixing, but it belongs in a separate PR that
can focus on template-as-component lookup under the strict resolver.
For now, drop the v2AppScenarios variant and leave the strictResolver
function available via strictAppScenarios (used by the dedicated
strict-resolver-test.ts / strict-resolver-substates-test.ts).

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

Update: the v2AppScenarios `strictResolver` variant exposed a real bug but in a place I don't want to tackle inside this PR. `basic-test.ts` includes `templates/example-gjs-route.gjs` — a route template that is a `.gjs` Component class. Under `embroiderVite` (compat-modules) that renders fine; under the strict resolver `owner.lookup('template:example-gjs-route')` returns the Component class as expected, but rendering never produces `[data-test="model-field"]`, so the acceptance test fails.

That's a template-as-component lookup gap in the strict resolver (probably an interaction with how `@model` flows when the "template" is actually a Component). I reverted the v2AppScenarios variant for now; `strictResolver` is still available via `strictAppScenarios` so the dedicated strict-resolver test files keep their coverage. Happy to take the template-as-component fix on as a follow-up PR once this one lands.

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.

should this now just go in the strict-resolver file?

Follow-up to review: with cache.js gone, `string.js` was a 9-line file
exporting just dasherize. Inline it as a private helper in
strict-resolver.ts and delete the strict-resolver/ subdirectory (plus
dasherize_test.js — dasherize's behavior is exercised via
resolver.normalize(...) tests in basic-test.js).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@NullVoxPopuli NullVoxPopuli merged commit dfe4b5c into emberjs:nvp/strict-resolver-rfc-1132 Apr 20, 2026
39 checks passed
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.

2 participants