Skip to content

Register optimization schemas with register_strategy - #885

Open
Eijebong wants to merge 1 commit into
taskcluster:mainfrom
Eijebong:opt-schema-in-register
Open

Register optimization schemas with register_strategy#885
Eijebong wants to merge 1 commit into
taskcluster:mainfrom
Eijebong:opt-schema-in-register

Conversation

@Eijebong

Copy link
Copy Markdown
Contributor

Instead of hardcoding the schema, make it part of the registration of the strategy, this allows for people to add their own strategy without having to work around OptimizationSchema which is painful and brittle.

The slight drawback from this is that we lose the documentation in the task schema about what is possible since it's now deferred to the strategies themselves, and that we now validate optimizations twice, first to check that it's a dict then to check that it matches the strategy.

Fixes#368

@Eijebong
Eijebong requested a review from a team as a code ownerDecember 24, 2025 02:18
@Eijebong

Copy link
Copy Markdown
ContributorAuthor

An example of what it looks after this change: Eijebong/Archipelago-index@bee7fca

Instead of hardcoding the schema, make it part of the registration of
the strategy, this allows for people to add their own strategy without
having to work around `OptimizationSchema` which is painful and brittle.
The slight drawback from this is that we lose the documentation in
the task schema about what is possible since it's now deferred to the
strategies themselves, and that we now validate optimizations twice,
first to check that it's a dict then to check that it matches the
strategy.
Fixestaskcluster#368
@Eijebong
Eijebongforce-pushed the opt-schema-in-register branch from d5c2724 to cf8e2f6CompareDecember 24, 2025 02:19
@EijebongEijebong added the BREAKING CHANGE Backwards incompatible request that will require major version bump label Dec 24, 2025
@EijebongEijebong changed the title Register the optimization schema with register_strategyRegister optimization schemas with register_strategyDec 25, 2025

@bhearsumbhearsum left a comment

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.

This looks like a very reasonable usability improvement. Even outside of the fact that it makes optimizations more extensible, it moves the schemas of the built-in optimizations to a more sensible place.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BREAKING CHANGEBackwards incompatible request that will require major version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

allow for custom optimization strategies

2 participants

@Eijebong@bhearsum