Skip to content

Add persisted telemetry maintenance - #342

Open
gmemuriuki wants to merge 3 commits into
telemetry/recording-transactionfrom
telemetry/recording-maintenance
Open

gmemuriuki wants to merge 3 commits into
telemetry/recording-transactionfrom
telemetry/recording-maintenance

Conversation

@gmemuriuki

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR adds opportunistic telemetry maintenance to the persisted recording transaction. It does not activate recording in production.

Private state records the last accepted day on which maintenance was attempted and rejects a marker beyond the latest-opened-day high-water mark. Scheduling requires an accepted lifecycle observation, records attempts rather than success, and survives telemetry clear and identifier rotation.

A single-use maintenance token travels through preparation and the persisted-recording receipt. Publication releases it only after private state has been replaced and public writes have been attempted, so cleanup cannot run from a pre-persistence failure path.

Maintenance performs one non-recursive, best-effort scan under the telemetry lock. It removes D31 event and metric files plus abandoned regular replacement temporaries, ignores symlinks, directories, and unknown names, and continues after individual inspection or removal failures. Replacement temporaries now live under that one cleanup root.

Tests cover canonical state round trips, marker validation and lifecycle preservation, D30/D31 retention, future files, temporary cleanup, lock-file survival, per-entry failures, publication failure, and token ordering.

Disclosure questions

AI disclosure.

  • The AI tool authored large parts of the code

Questions for reviewers.

Is the persisted attempt throttle paired with the receipt-carried token sufficient to keep cleanup ordered, bounded, and incapable of running before the state that scheduled it is durable?

@gmemuriuki
gmemuriuki force-pushed the telemetry/recording-maintenance branch from 0b71316 to b67e26c Compare October 14, 2026 07:14
@gmemuriuki
gmemuriuki added this pull request to stack #331 October 14, 2026 07:16
@gmemuriuki gmemuriuki self-assigned this Oct 14, 2026
@gmemuriuki
gmemuriuki force-pushed the telemetry/recording-maintenance branch from b67e26c to 4f7fdbe Compare October 14, 2026 07:51
@nikomatsakis
nikomatsakis force-pushed the telemetry/recording-maintenance branch from 4f7fdbe to 322fe43 Compare October 16, 2026 09:02
@gmemuriuki
gmemuriuki force-pushed the telemetry/recording-maintenance branch 3 times, most recently from 121b351 to 82f02a8 Compare October 21, 2026 07:23
@nikomatsakis
nikomatsakis force-pushed the telemetry/recording-maintenance branch 8 times, most recently from d24b961 to 6fa88e1 Compare October 27, 2026 12:47
@gmemuriuki
gmemuriuki force-pushed the telemetry/recording-maintenance branch 2 times, most recently from 65c7a99 to 5e37ed0 Compare October 28, 2026 13:24
Create private-state and metric replacement temporaries inside the
locked telemetry directory. This gives cleanup one narrow root while
preserving atomic replacement when the config and telemetry
directories share a filesystem.
Record the last accepted day on which maintenance was attempted and
validate it against the private-state high-water mark. Require an
accepted recording observation before minting the single-use
maintenance token.
Remove D31 daily files and abandoned regular temporaries with one
best-effort scan under the telemetry lock. Release maintenance
authority only after private state persists and publication has been
attempted.
@gmemuriuki
gmemuriuki force-pushed the telemetry/recording-maintenance branch from 5e37ed0 to c4bdeb0 Compare October 29, 2026 12:58
@gmemuriuki
gmemuriuki removed this pull request from stack #331 November 15, 2026 17:01
@gmemuriuki
gmemuriuki added this pull request to stack #504 November 15, 2026 17:01
@gmemuriuki
gmemuriuki removed this pull request from stack #504 November 15, 2026 18:26
@gmemuriuki
gmemuriuki added this pull request to stack #506 November 15, 2026 18:26

This branch has not been deployed

No deployments
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.

1 participant