Skip to content

refactor(controller): map GetChangedTargets request through internal/mapper - #327

Merged
justinwon777 merged 1 commit into
mainfrom
justin.won/validate
Oct 8, 2026
Merged

justinwon777 merged 1 commit into
mainfrom
justin.won/validate

Conversation

@justinwon777

@justinwon777 justinwon777 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Add entity.GetChangedTargetsRequest and mapper.ProtoToGetChangedTargetsRequest. The mapper validates both revisions and the same-remote rule. The controller maps the request once and passes entity values to the helpers. This removes validateGetChangedTargetsRequest and its TODO.

Test Plan

go test ./controller ./internal/... ./entity. The validation cases moved to internal/mapper/changed_targets_test.go.

Issue

in prep for #325

@justinwon777
justinwon777 requested review from a team as code owners October 8, 2026 07:39
// (e.g. a missing-deadline "missing TTL" reject) becomes a visible request failure
// rather than silent degradation.
func (c *controller) serveChangedTargetsFromCache(ctx context.Context, e *metrics.Emitter, logger *zap.Logger, request *pb.GetChangedTargetsRequest, stream pb.TangoServiceGetChangedTargetsYARPCServer, repositoryID string, maxDist int32, start time.Time) (bool, error) {
func (c *controller) serveChangedTargetsFromCache(ctx context.Context, e *metrics.Emitter, logger *zap.Logger, request entity.GetChangedTargetsRequest, outputConfig *pb.OutputConfig, stream pb.TangoServiceGetChangedTargetsYARPCServer, repositoryID string, maxDist int32, start time.Time) (bool, error) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

output config will be removed here when filter logic is moved to handler

…mapper

Add entity.GetChangedTargetsRequest and mapper.ProtoToGetChangedTargetsRequest.
The mapper validates both revisions and the same-remote rule. The controller
maps the request once and passes entity values to the helpers. This removes
validateGetChangedTargetsRequest and its TODO.

An unknown computation strategy now fails at the top of the handler as a user
error, instead of later in the graph fetch goroutine.

Test plan: go test ./controller ./internal/... ./entity. The validation cases
moved to internal/mapper/changed_targets_test.go.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@justinwon777
justinwon777 merged commit 5221d5e into main Oct 8, 2026
10 checks passed
@justinwon777
justinwon777 deleted the justin.won/validate branch October 8, 2026 15:24
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