Skip to content

Copy createServicePolicy to base-data-service#9350

Draft
mcmire wants to merge 1 commit into
mainfrom
copy-create-service-policy-to-base-data-service
Draft

Copy createServicePolicy to base-data-service#9350
mcmire wants to merge 1 commit into
mainfrom
copy-create-service-policy-to-base-data-service

Conversation

@mcmire

@mcmire mcmire commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Explanation

Currently createServicePolicy lives in controller-utils, as originally we wrote it as an abstract utility that could theoretically be used for any kind of data access. However, there are a few reasons why this is suboptimal now:

  1. controller-utils is too large and serves as a dependent of almost every package in the monorepo, so extreme care must be taken when changing this package to avoid breaking changes.
  2. createServicePolicy was added before we formalized data services. Now we have a BaseDataService class, and this class sets up createServicePolicy by default, so it's highly unlikely that createServicePolicy will be used independently going forward.
  3. Also, we only use createServicePolicy for HTTP requests, so making it abstract is kind of unnecessary.

This commit deprecates the existing exports in controller-utils, copies them to base-data-service, and changes BaseDataService to use the copied version instead.

In the future we will remove the symbols from controller-utils and modify createServicePolicy further so it works better for HTTP requests.

References

No ticket yet, but this is related to https://consensyssoftware.atlassian.net/browse/WPC-1037 in that BaseDataService needs to be more fully-fledged to be as easy to use.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Currently `createServicePolicy` lives in `controller-utils`, as
originally we wrote it as an abstract utility that could theoretically
be used for any kind of data access. However, there are a few reasons
why this is suboptimal now:

1. `controller-utils` is too large and serves as a dependent of almost
   every package in the monorepo, so extreme care must be taken when
   changing this package to avoid breaking changes.
2. `createServicePolicy` was added before we formalized data services.
   Now we have a `BaseDataService` class, and this class sets up
   `createServicePolicy` by default, so it's highly unlikely that
   `createServicePolicy` will be used independently going forward.
3. Also, we only use `createServicePolicy` for HTTP requests, so
   making it abstract is kind of unnecessary.

This commit deprecates the existing exports in `controller-utils`,
copies them to `base-data-service`, and changes `BaseDataService` to use
the copied version instead.

In the future we will remove the symbols from `controller-utils` and
modify `createServicePolicy` further so it works better for HTTP
requests.
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