Skip to content

Comments

Cache card-api module in host test adapter#4028

Draft
IanCal wants to merge 1 commit intomainfrom
card-api-caching-host-tests
Draft

Cache card-api module in host test adapter#4028
IanCal wants to merge 1 commit intomainfrom
card-api-caching-host-tests

Conversation

@IanCal
Copy link
Contributor

@IanCal IanCal commented Feb 19, 2026

Summary

  • cache https://cardstack.com/base/card-api once per test run in TestRealmAdapter
  • shim each loader with the shared module so subsequent adapters avoid repeated imports
  • reuse the shared card-api path in openFile and harden loader-shim behavior for in-flight imports

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: debd649bf5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +464 to +467
if (sharedCardApiModule) {
shimSharedCardApi(loader, sharedCardApiModule);
return sharedCardApiModule;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep card-api module loader-scoped

Returning a previously imported sharedCardApiModule for every new Loader makes later adapters execute card-api code with the first loader's import.meta.loader, because card-api closes over that value (myLoader() in packages/base/card-api.gts) and uses it for runtime imports (for example in createFromSerialized / override loading). In multi-realm tests, this can resolve modules through the wrong loader and miss per-loader shims established in prepareInstances, leading to incorrect or failed card deserialization in subsequent adapters.

Useful? React with 👍 / 👎.

@github-actions
Copy link

Preview deployments

@github-actions
Copy link

Host Test Results

    1 files  ±0      1 suites  ±0   1h 26m 1s ⏱️ - 16m 41s
1 854 tests ±0  1 822 ✅  - 18  14 💤 ±0   0 ❌ ± 0  18 🔥 +18 
1 869 runs  ±0  1 819 ✅  - 36  14 💤 ±0  18 ❌ +18  18 🔥 +18 

For more details on these errors, see this check.

Results for commit debd649. ± Comparison against base commit f3482af.

@IanCal IanCal marked this pull request as draft February 19, 2026 17:31
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