Conversation
description_converter prepends *DO NOT EDIT* to every Resource's description inside the attrs-generated __init__, which also runs from from_api. So when the live API stores a description that's missing the prefix, from_api silently injects it in memory, c == g returns True in Updater.update, and tc-admin apply skips the update — forever. Have each from_api build the Resource through a new private Resource._construct_without_converters helper (cls.__new__ + object.__setattr__) and pre-apply only the ordering/type converters that should still run on API data: scopes_converter, bindings_converter, schedule_converter. description_converter is the only one we skip. After this lands, tc-admin apply will reconcile resources whose live description is missing the prefix; expect a one-time wave of description-only updates on the next apply run.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
description_converterprependsAppConfig.description_prefix(*DO NOT EDIT* - …) to every Resource'sdescription. It runs in the auto-generated__init__, which means it also runs inResource.from_api(api_result). So if the live API stores a description that's missing the prefix,from_apisilently injects it in memory; the in-memory current-state object then matches the desired-state object,Updater.update'sc == gcheck returns True, andtc-admin applyskips the update — forever.This PR fixes that. Each
from_apinow constructs the Resource through a newResource._construct_without_convertershelper that bypassesattrs-generated__init__, then explicitly pre-applies only the ordering/type converters (scopes_converter,bindings_converter,schedule_converter). Those still need to run on API data — scope and binding order is semantically irrelevant, and skipping them would create permanent spurious diffs against the server's ordering. Onlydescription_convertermutates a semantically meaningful value, and it's the one we drop on thefrom_apipath.The regular constructor — used by YAML loaders and any other generator — still runs every converter as before. No public-API change for code outside
from_api.After this lands,
tc-admin applywill reconcile resources whose live description is missing the prefix. Operators should expect a one-time wave of description-only updates on their next apply run.Example: descriptions that will be reconciled in fxci-config
The following 22 Clients in Mozilla's fxci-config are managed by tc-admin and currently store a description in the live API that is missing the configured prefix. With this PR, the next
tc-admin applyrun will update each of them to include it. Other tc-admin deployments may have their own affected entities depending on how the live state has diverged.project/autophone/gecko-t-bitbar-batt-g5project/autophone/gecko-t-bitbar-batt-p2project/autophone/gecko-t-bitbar-perf-g5project/autophone/gecko-t-bitbar-perf-p2project/autophone/gecko-t-bitbar-unit-g5project/autophone/gecko-t-bitbar-unit-p2project/packet/docker-workerproject/taskcluster/legacy-loginproject/releng/generic-worker/azure-gecko-t-win10-64project/releng/generic-worker/azure-gecko-t-win10-64-gpuproject/releng/generic-worker/bitbar-gecko-t-win10-64-ref-18project/releng/generic-worker/bitbar-gecko-t-win10-64-ref-18tproject/releng/generic-worker/bitbar-gecko-t-win10-64-ref-hwproject/releng/generic-worker/bitbar-gecko-t-win10-aarch64project/releng/generic-worker/datacenter-gecko-3-t-osxproject/releng/generic-worker/datacenter-gecko-t-linux-betaproject/releng/generic-worker/datacenter-gecko-t-linux-stagingproject/releng/quarantine-workerproject/releng/services/tooltool/bug1604706project/relman/code-review/backend-productionproject/relman/code-review/backend-testingproject/wpt/wptsync