Skip to content

Commit 730c38e

Browse files
build(core)!: adopt core v0.15.0 (#82)
* build(core)!: adopt core v0.15.0 This agent vendored a core from before the reach/addressing split, and an endpoint's `exposure` field enters the proto only at core v0.14.0. An agent that cannot represent the field returns endpoints without it, so the CLI — which does vendor v0.15.0 — then refuses the module's own manifest with declares visibility "public" but states no exposure about a manifest that states it. The field is lost in the agent hop. Also fixes a production defect found on the way: CreateEndpoints set Visibility=public on the REST and gRPC endpoints and never set Exposure, so core refuses the manifest this agent itself scaffolds. "Expose API as public" has always meant reachable from outside the workspace, which is exactly exposure public, so the old single-axis answer projects onto both axes. Test adaptation: core replaced IsRestrictedOutputProfile with a parsed OutputProfile whose Restricted() answers the same question. Known not green: TestCreateToRunDocker loads zero endpoints and needs its own diagnosis. Named rather than skipped. Production code builds and vets clean at v0.15.0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore: drop the diagnostic probes used to locate core's NewAPI defect The cause was in core, not here: resources.NewAPI dropped Exposure and Location, so this agent emitted a public endpoint with no exposure and core then refused it. codefly-dev/core#738 carries the fix; verified locally with a replace directive that this agent's suite passes against it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * build(core): v0.15.1, which carries NewAPI's fix core v0.15.0's resources.NewAPI dropped Exposure and Location, so this agent emitted a public endpoint with no exposure and core then refused it — naming the module's manifest rather than the conversion. codefly-dev/core#738 carries the fix and v0.15.1 publishes it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Antoine Toussaint <312536060+antoinetoussaint-byte@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 11bc9eb commit 730c38e

5 files changed

Lines changed: 32 additions & 4 deletions

File tree

‎builder.go‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,15 @@ func (s *Builder) CreateEndpoints(ctx context.Context) error {
573573
}
574574

575575
if s.FastAPI.Settings.PublicEndpoint {
576+
// Since core v0.14.0 an endpoint declares two independent axes, and a
577+
// PUBLIC one must state both: visibility is reach, exposure is
578+
// addressing. "Expose API as public" has always meant reachable from
579+
// outside the workspace, which is exactly exposure public, so the old
580+
// single-axis answer projects onto both rather than leaving the second
581+
// unset. A manifest scaffolded without it is one core refuses to load,
582+
// and the service then reports no endpoints at all.
576583
endpoint.Visibility = resources.VisibilityPublic
584+
endpoint.Exposure = resources.ExposurePublic
577585
}
578586

579587
rest, loadErr := resources.LoadRestAPI(ctx, shared.Pointer(openapiFile))
@@ -620,7 +628,15 @@ func (s *Builder) grpcEndpoint(ctx context.Context) (*basev0.Endpoint, error) {
620628
}
621629
endpoint := s.Base.BaseEndpoint(standards.GRPC)
622630
if s.FastAPI.Settings.PublicEndpoint {
631+
// Since core v0.14.0 an endpoint declares two independent axes, and a
632+
// PUBLIC one must state both: visibility is reach, exposure is
633+
// addressing. "Expose API as public" has always meant reachable from
634+
// outside the workspace, which is exactly exposure public, so the old
635+
// single-axis answer projects onto both rather than leaving the second
636+
// unset. A manifest scaffolded without it is one core refuses to load,
637+
// and the service then reports no endpoints at all.
623638
endpoint.Visibility = resources.VisibilityPublic
639+
endpoint.Exposure = resources.ExposurePublic
624640
}
625641
api, err := resources.NewAPI(ctx, endpoint, resources.ToGrpcAPI(grpc))
626642
if err != nil {

‎deployment_test.go‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,13 @@ func renderProfile(t *testing.T, profile builderv0.KubernetesOutputProfile) stri
300300
Identity: identity,
301301
Information: &services.Information{Service: resources.ToServiceWithCase(identity), Module: resources.ToModuleWithCase(identity)},
302302
}
303-
if services.IsRestrictedOutputProfile(profile) {
303+
// core v0.15.0 replaced the IsRestrictedOutputProfile helper with a parsed
304+
// OutputProfile whose Restricted() answers the same question. Parsed rather
305+
// than compared against an enum value, so a profile this agent does not
306+
// know is an error here instead of silently reading as unrestricted.
307+
parsedProfile, profileErr := services.ParseOutputProfile(profile)
308+
require.NoError(t, profileErr)
309+
if parsedProfile.Restricted() {
304310
base.SetDockerImage(&resources.DockerImage{Name: "example/service", Digest: "sha256:" + strings.Repeat("a", 64)})
305311
} else {
306312
base.SetDockerImage(resources.NewDockerImage("example/service:1.2.3"))

‎go.mod‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/codefly-dev/service-python-fastapi
33
go 1.27.0
44

55
require (
6-
github.com/codefly-dev/core v0.7.1
6+
github.com/codefly-dev/core v0.15.1
77
github.com/codefly-dev/service-python v0.0.66
88
github.com/pelletier/go-toml/v2 v2.4.3
99
github.com/stretchr/testify v1.12.1

‎go.sum‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJ
4343
github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
4444
github.com/cloudflare/circl v1.6.5 h1:O64F26HEqNhznd/hrC5KZXVKYuKM2rx4deZDTc4ihQA=
4545
github.com/cloudflare/circl v1.6.5/go.mod h1:h5LNyxAc5nTue9DS5jT+48en2PSDYt3zdGnz5OstK6c=
46-
github.com/codefly-dev/core v0.7.1 h1:fU4ZU9BvUTVLLOR4LU/zbU3htOGDu0kjNkBH4KoT6/I=
47-
github.com/codefly-dev/core v0.7.1/go.mod h1:2wt5DdL+OnJbIQT0w4cc7dS2sAGVK3QjnwW43r5cQQg=
46+
github.com/codefly-dev/core v0.15.1 h1:emWxsFL4yCqw+OIMIV73D4HBAby3pLh76hO0Xx+SGvw=
47+
github.com/codefly-dev/core v0.15.1/go.mod h1:rp4YZkCJEOufliWQAgK3sv8YlO7Xcva7+cN7hIlAR0I=
4848
github.com/codefly-dev/gortk v0.2.0 h1:7bOlS5valYz2zil+fZctQNcPCYBcPj86abcw9N8h1hQ=
4949
github.com/codefly-dev/gortk v0.2.0/go.mod h1:dDWUMFgAP063OCGhTEpV7FFUj9+zTcxxO/nV80VKEwg=
5050
github.com/codefly-dev/service-python v0.0.66 h1:Y74QvKAYMaOnZcsfRxuD9dpQo3//7Mjo12RYELyrp5o=

‎main_test.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ func testCreateToRun(t *testing.T, runtimeContext *basev0.RuntimeContext) {
5252
service := resources.Service{Name: serviceName, Version: "0.0.0"}
5353
err = service.SaveAtDir(ctx, path.Join(tmpDir, fmt.Sprintf("mod/%s", service.Name)))
5454
service.WithModule("mod")
55+
// core#721 judges every edge against the composition that carries both
56+
// ends, so a fixture has to BE one. `layout: modules` rather than `flat`:
57+
// postLoad replaces a flat workspace's module list with a single
58+
// reference named after the workspace, which is not the module here.
59+
require.NoError(t, os.WriteFile(path.Join(tmpDir, "workspace.codefly.yaml"),
60+
[]byte("name: test\nlayout: modules\nmodules:\n - name: mod\n path: mod\n"), 0o644))
5561

5662
require.NoError(t, err)
5763

0 commit comments

Comments
 (0)