Skip to content

config-remote-sync: record which state the run read in telemetry - #6120

Open
ilyakuz-db wants to merge 7 commits into
mainfrom
fix/configsync-state-telemetry
Open

config-remote-sync: record which state the run read in telemetry#6120
ilyakuz-db wants to merge 7 commits into
mainfrom
fix/configsync-state-telemetry

Conversation

@ilyakuz-db

@ilyakuz-db ilyakuz-db commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Changes

bundle_config_remote_sync_event records what a run found but nothing about which resource state it read. Adds:

Field Meaning
state_serial the state file's own monotonic counter
state_lineage its lineage UUID, generated by the CLI (uuid.New())
state_source "local" or "remote"
states_available_count how many of the four candidates (direct/terraform × local/remote) were found; 0 = ran against a synthesized empty state
state_resource_ids the resource ids present in the state that was read
selected_resource_ids the resource ids the run was asked to sync via --select-ids

The two id fields share one message (BundleConfigRemoteSyncResourceIds) so they can be compared directly. Field names, comments, per-type data labels, and the 1000-per-type cap are copied from the sibling bundle deploy command — see libs/telemetry/protos/bundle_deploy.go:27-33 and phases.ResourceIdLimit (bundle/phases/deploy.go:327, which exists because the telemetry upload has a short timeout).

No separate selector/matched counters: those are the lengths of the id lists, and the matched set is their intersection. states_available_count is kept because it is not derivable — a state file holding zero resources and no state file at all both yield an empty id set.

IndexDeployedResources is extracted from ResolveResourceSelectors so the telemetry reuses the same index rather than duplicating the id-parsing logic.

Why

no deployed <type> resource with id <id> currently has several indistinguishable causes, each with a different fix:

  • the bundle's resource state is missing entirely → states_available_count: 0
  • a stale local state outranked a fresher remote one (PullResourcesState picks the highest serial, and AlwaysPull does not overwrite a local winner) → state_source: "local" with a high state_serial
  • the state read belongs to a different target or bundle → state_lineage differs from the deploy's, and state_resource_ids holds ids other than the requested one
  • the id is genuinely stale → requested id absent from an otherwise healthy state

All four are reproducible locally today only by re-running with --log-level debug. Everything above is already in StateDesc at the point telemetry is collected — it just wasn't recorded.

Privacy: types, counts, system-generated identifiers, and resource ids (same labels the deploy event already uses). No state paths, no resource keys or names, and no target names — the target is user-authored configuration, and BundleDeployEvent likewise records only target_count. Permissions/grants sub-resources are skipped: they index under the parent's type with a path-shaped object id that is not selectable and would be path-redacted.

Tests

Acceptance snapshots cover the emitted payload on both enginesbundle/telemetry/config-remote-sync{,-save,-recreate,-error} and bundle/config-remote-sync/{job_fields,resolve_variables}. The error case pins states_available_count: 0 and the save case pins the id payload, so both of the informative-zero and id-reporting paths are asserted rather than described.

resolve_variables needed a state_serial replacement: the terraform path writes state more times than the direct path for the same script, so the value legitimately differs per engine and is not what that test asserts.

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/bundle/ - needs approval

7 files changed
Suggested: @denik
Also eligible: @andrewnester, @anton-107, @janniklasrose, @lennartkats-db, @pietern, @shreyas-goenka

/bundle/ - needs approval

Files: bundle/configsync/select.go, bundle/configsync/telemetry.go
Suggested: @denik
Also eligible: @andrewnester, @anton-107, @janniklasrose, @lennartkats-db, @pietern, @shreyas-goenka

/cmd/bundle/ - needs approval

Files: cmd/bundle/config_remote_sync.go
Suggested: @denik
Also eligible: @andrewnester, @anton-107, @janniklasrose, @lennartkats-db, @pietern, @shreyas-goenka

/libs/telemetry/ - needs approval

Files: libs/telemetry/protos/bundle_config_remote_sync.go
Eligible: @simonfaltum, @renaudhartert-db, @hectorcast-db, @parthban-db, @tanmay-db, @Divyansh-db, @tejaskochar-db, @mihaimitrea-db, @chrisst, @rauchy

Any maintainer (@andrewnester, @anton-107, @denik, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db, @janniklasrose, @lennartkats-db) can approve all areas.
See OWNERS for ownership rules.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 5f537fb

Run: 30661450780

Env 🟨​KNOWN 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
🟨​ aws linux 3 1 4 319 1065 6:57
🟨​ aws windows 3 1 4 315 1065 8:05
🟨​ azure linux 3 1 4 319 1064 6:39
🟨​ azure windows 3 1 4 315 1064 8:33
💚​ gcp linux 1 5 319 1065 4:41
💚​ gcp windows 1 5 315 1065 6:11
8 interesting tests: 4 SKIP, 3 KNOWN, 1 RECOVERED
Test Name aws linux aws windows azure linux azure windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestFetchRepositoryInfoAPI_FromRepo 🟨​K 🟨​K 🟨​K 🟨​K 🙈​S 🙈​S
🟨​ TestFetchRepositoryInfoAPI_FromRepo/root 🟨​K 🟨​K 🟨​K 🟨​K
🟨​ TestFetchRepositoryInfoAPI_FromRepo/subdir 🟨​K 🟨​K 🟨​K 🟨​K
Top 4 slowest tests (at least 2 minutes):
duration env testname
5:08 aws windows TestAccept
5:02 azure windows TestAccept
4:00 gcp windows TestAccept
2:01 gcp windows TestAccept/bundle/deploy/mlops-stacks/DATABRICKS_BUNDLE_ENGINE=terraform

@ilyakuz-db

Copy link
Copy Markdown
Contributor Author

The BundleConfigRemoteSyncResourceIds struct (field names, comments, and the 1000-per-type cap) is copied from the sibling bundle deploy command's event: libs/telemetry/protos/bundle_deploy.go lines 27-33 for the id arrays and comment, and phases.ResourceIdLimit (bundle/phases/deploy.go:327) for the cap, which exists because the telemetry upload has a short timeout.

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.

2 participants