Skip to content

fix(composition): route foreign methods to their selected service - #1196

Closed
gael-obin wants to merge 4 commits into
codefly-dev:mainfrom
gael-obin:fix/foreign-method-service-selector
Closed

gael-obin wants to merge 4 commits into
codefly-dev:mainfrom
gael-obin:fix/foreign-method-service-selector

Conversation

@gael-obin

@gael-obin gael-obin commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

When a module publishes multiple RPC services, foreign protocol methods need an explicit serving service. Consume foreign_methods[].service in the existing hop-route, per-service policy-table and permission-generation paths. Unselected declarations retain single-service inference; ambiguous, unknown and shadowing destinations are refused.

Fix at the CLI composition owner, using Core's existing module-contract seam. This preserves host-table filtering and adds no addresses, owner-specific names or separate routing mechanism.

Depends on Core's service selector. Core’s selector is now merged upstream at b71ee8cd6ed01abb09e164a74ee913d7ade1bf85. This supersedes the former fork-only availability blocker. This PR remains draft until its Core pin is updated to the reviewed available revision and the combined CLI is qualified. No local replacement is committed. Robin consumes this capability in its Python tool PR.

Merged upstream main d6d937867174fdfd021e7e7a320ce8ab5a163896 (v0.1.219) in 55a80a14. Its fixture-fragment composition, solution Runnable generation, whole-module withdrawal and empty-hop-route delivery are retained. The hop test conflict retains both the foreign-service selection tests and the upstream empty-group regression. Empty group delivery and explicit foreign service placement are complementary responsibilities; upstream does not supersede this selector fix.

Validation against the combined Core/CLI source through the existing temporary task Go workspace: focused fixturefragments, orchestration, gitops, environments, generation and run tests passed; CLI reference check and build passed. Existing coverage includes explicit selection, legacy omission, invalid/ambiguous selection, policy conflicts and host filtering. The built CLI generated Robin's actual four-fragment fixture; independent comparison preserved all 14 prior grants with four documented additions. Robin contracts and Runnable drift checks pass with this build. Fresh independent architecture/elegance review found no blocking integration defect.

Standalone GOWORK=off compilation remains blocked on publishing/selecting the Core dependency. No full CLI matrix, hosted deployment or newly adopted live fixture is claimed. This PR remains an unpublished dependency change, not release qualification.

@gael-obin
gael-obin marked this pull request as ready for review October 27, 2026 18:31
codefly-dev/core#856 merged as b71ee8cd, so the `service:` field this
branch consumes is available from an upstream module revision. Replace
the pre-merge pin, which left every compiling job failing on
`method.Service undefined (type module.ForeignMethod has no field or
method Service)`.

Verified with GOWORK=off: `go build ./...` and `go vet ./...` clean
across the module, and the three packages this branch changes pass
`go test -count=1` — pkg/gitops, pkg/orchestration and cmd/generate.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… policy walk

golangci-lint v2.14.0 refused the selector work in three places, all of
them new in this branch:

  pkg/gitops/method_policies.go:276        rangeValCopy, 136 bytes (gocritic)
  pkg/orchestration/hop_configurations.go:284  rangeValCopy, 152 bytes (gocritic)
  pkg/gitops/method_policies.go:201        cyclomatic complexity 32 > 30 (gocyclo)

Extracting publishesProtobuf answers two of them at once: the manifest
walk stops copying a Service per iteration, and ServiceMethodPolicies
sheds the branches that pushed it over the complexity ceiling. The hop's
shadow check indexes its endpoints rather than copying a RouteEndpoint
per iteration.

No behaviour changes: same predicates, same refusal messages, same order.

Verified with GOWORK=off: `golangci-lint run` reports 0 issues across
pkg/gitops, pkg/orchestration and cmd/generate on the same linter
version CI pins, `go build ./...` is clean, and all three packages pass
`go test -count=1`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
auto-merge was automatically disabled October 27, 2026 19:32

Head branch was pushed to by a user without write access

@gael-obin gael-obin closed this Oct 29, 2026
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