Repository navigation
feat: reconcile votes, follows, totals and merges - #34
Merged
Merged
Conversation
Votes and follows are admitted only on posts that exist, aren't hidden and aren't merged; votes need a verified email. The vote reconciler follows the post for each new voter once, records their organizations and GitHub username, and deletes votes whose post has been gone for 30 days. The post-votes reconciler applies the vote totals and trending score with server-side apply, leaving sync's GitHub fields alone, and re-tallies hourly. The merge reconciler moves votes and follows off a merged post.
4 tasks done
|
Please fix before merging: votes and follows get stuck when a post is merged into an already-merged or hidden post. The controller tries to create them on that target, its own webhook rejects them, and it retries indefinitely. This was reproduced with the controllers and webhooks running together. Follow the merge chain to a valid final target, handle unavailable targets explicitly without losing user intent, and add a test with admission webhooks enabled. The existing controller-only tests miss this interaction. |
…e targets Follow status.mergedInto to the first post that isn't merged before moving votes and follows, so they never land on a post the vote webhook refuses. When the chain ends at a missing or hidden post, loops, or is too long, keep them on the merged post and record a VotesMoved=False condition instead of retrying; changes to posts in the chain requeue the posts merged into them. Adds an envtest that runs the reconcilers and admission webhooks together.
Contributor
Author
|
Fixed in d47ce42.
|
scotwells
previously approved these changes
Nov 18, 2026
mattdjenkinson
dismissed
scotwells’s stale review
November 18, 2026 04:16
The base branch was changed.
scotwells
approved these changes
Nov 18, 2026
4 tasks done
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.
Closes #7. Stacked on #33.
Votes and follows as CRDs: admission checks, plus the operator's reconcilers for what the Postgres version did in one transaction.
Admission
The
votevalidating webhook runs on creates of votes and subscriptions.iam.miloapis.com/emailVerified). Milo's own gate does this too, but it's behind a feature gate.It reads posts from the operator's cache, which sees hidden posts because the operator has
posts/hidden.Reconcilers
votereason: voted), then setsstatus.subscribed, so a follow the voter deletes isn't recreated. Records organizations and linked GitHub username; these Milo lookups are best effort. Marks votes on a deleted post withfeedback.miloapis.com/orphaned-atand deletes them after 30 days unless the post returns.post-votesspec.postRef.name. Appliesstatus.votes.{total,datum,linked,trendingScore}with server-side apply asfeedback-operator, and skips the write when nothing changed. Re-queues hourly while a post has a trending score.mergestatus.mergedInto, plus their votes and followsAll steps use deterministic names (
<post>.<user>) and treat AlreadyExists and NotFound as done, so retries and crashes are safe.Behaviour changes from the Postgres version
feedback-syncmust write post status with server-side apply under its own field manager. A plain status update would wipe the operator's fields. This will be in sync's own PR.Milo RBAC
The operator also lists
organizationmembershipsanduseridentitiesin Milo, for the voter lookups.Tests
VoteCheckunit tests: missing, hidden and merged posts; unverified email blocks votes but not follows.task test,go test -race -count=3on the reconciler tests,go vet ./..., andtask generatewith no diff