Skip to content

Ensure descriptions include prefix#321

Merged
petemoore merged 1 commit intomainfrom
raw-from-api
Apr 30, 2026
Merged

Ensure descriptions include prefix#321
petemoore merged 1 commit intomainfrom
raw-from-api

Conversation

@petemoore
Copy link
Copy Markdown
Member

@petemoore petemoore commented Apr 29, 2026

description_converter prepends AppConfig.description_prefix (*DO NOT EDIT* - …) to every Resource's description. It runs in the auto-generated __init__, which means it also runs in Resource.from_api(api_result). So if the live API stores a description that's missing the prefix, from_api silently injects it in memory; the in-memory current-state object then matches the desired-state object, Updater.update's c == g check returns True, and tc-admin apply skips the update — forever.

This PR fixes that. Each from_api now constructs the Resource through a new Resource._construct_without_converters helper that bypasses attrs-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. Only description_converter mutates a semantically meaningful value, and it's the one we drop on the from_api path.

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 apply will 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 apply run 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.

Client Current live description
project/autophone/gecko-t-bitbar-batt-g5 (empty)
project/autophone/gecko-t-bitbar-batt-p2 (empty)
project/autophone/gecko-t-bitbar-perf-g5 (empty)
project/autophone/gecko-t-bitbar-perf-p2 (empty)
project/autophone/gecko-t-bitbar-unit-g5 (empty)
project/autophone/gecko-t-bitbar-unit-p2 (empty)
project/packet/docker-worker (empty)
project/taskcluster/legacy-login (empty)
project/releng/generic-worker/azure-gecko-t-win10-64 Windows 10 64bit experimental production worker.
project/releng/generic-worker/azure-gecko-t-win10-64-gpu Windows 10 64bit GPU experimental production worker.
project/releng/generic-worker/bitbar-gecko-t-win10-64-ref-18 Windows 10 2018 reference laptop production worker. Hardware hosted by Bitbar
project/releng/generic-worker/bitbar-gecko-t-win10-64-ref-18t Windows 10 2018 reference laptop testing worker. Hardware hosted by Bitbar
project/releng/generic-worker/bitbar-gecko-t-win10-64-ref-hw Windows 10 2017 reference laptop production worker. Hardware hosted by Bitbar
project/releng/generic-worker/bitbar-gecko-t-win10-aarch64 Windows 10 aarch64 YogaC630 production worker. Hardware hosted by Bitbar
project/releng/generic-worker/datacenter-gecko-3-t-osx Datacenter level 3 MacOS dedicated developer and automation worker.
project/releng/generic-worker/datacenter-gecko-t-linux-beta testing non-perf tasks on linux hardware workers
project/releng/generic-worker/datacenter-gecko-t-linux-staging Datacenter Linux64 dedicated developer and automation staging worker.
project/releng/quarantine-worker Self-quarantine access for hardware workers after generic-worker fails with code 69.
project/releng/services/tooltool/bug1604706 tooltool permissions for occ
project/relman/code-review/backend-production See bug 1593749
project/relman/code-review/backend-testing See bug 1593749
project/wpt/wptsync Created in Bug 1596469 - Secret handed to :jgraham

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.
@petemoore petemoore changed the title Resource.from_api: preserve description verbatim Ensure entity descriptions include required prefix Apr 29, 2026
@petemoore petemoore changed the title Ensure entity descriptions include required prefix Ensure descriptions include prefix Apr 29, 2026
@petemoore petemoore marked this pull request as ready for review April 29, 2026 17:29
@petemoore petemoore requested a review from a team as a code owner April 29, 2026 17:29
@petemoore petemoore self-assigned this Apr 30, 2026
@petemoore petemoore moved this to In review in TC intake board Apr 30, 2026
Copy link
Copy Markdown
Contributor

@lotas lotas left a comment

Choose a reason for hiding this comment

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

lgtm

@petemoore petemoore merged commit 5ddf61b into main Apr 30, 2026
3 checks passed
@petemoore petemoore deleted the raw-from-api branch April 30, 2026 08:28
@github-project-automation github-project-automation Bot moved this from In review to Done in TC intake board Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants