Skip to content

perf(services): gate service-desc rebuild on data_version (PERF-4)#618

Merged
tempus2016 merged 1 commit into
mainfrom
perf/service-desc-fingerprint
Jun 26, 2026
Merged

perf(services): gate service-desc rebuild on data_version (PERF-4)#618
tempus2016 merged 1 commit into
mainfrom
perf/service-desc-fingerprint

Conversation

@tempus2016

Copy link
Copy Markdown
Owner

PERF-4 — Cheaper service-description fingerprint

_async_update_service_descriptions fires on every coordinator listener update. Before its short-circuit it hydrated every child/chore/reward/penalty/bonus/group from its stored dict and repr()-ed the whole option set as the change fingerprint — on every fire, even when nothing relevant changed.

Fix

The dynamic selectors mirror those collections, which only change via a save (bumping storage.data_version, added in PERF-2). Use that O(1) counter as the fingerprint and short-circuit before any hydration; build the option lists only when the version actually changed. Conservative: it never misses a real change (every entity mutation saves), at worst it rebuilds on an unrelated save.

Verification

test_service_desc_fingerprint.py: hydration skipped when version unchanged; runs again after a bump. Ruff clean.

Part of the v4.3.1 audit fix campaign. No version bump / release.

_async_update_service_descriptions ran on every coordinator listener
fire and, BEFORE its short-circuit, hydrated every child/chore/reward/
penalty/bonus/group from its dict and repr()-ed the lot as a change
fingerprint. The dynamic selectors only change via a save (which bumps
storage.data_version), so use that O(1) counter as the fingerprint and
short-circuit before any hydration. Entities are built only when the
version actually changed.

Tests: rebuild skipped when version unchanged; rebuilt after a bump.
@github-actions github-actions Bot added backend Python integration code tests Test suite labels Jun 26, 2026
@tempus2016 tempus2016 merged commit 0787750 into main Jun 26, 2026
10 checks passed
@tempus2016 tempus2016 deleted the perf/service-desc-fingerprint branch June 26, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Python integration code tests Test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant