Skip to content

Commit 297cdab

Browse files
Merge main into issue-97-report-the-artifact-a-native-start-ran-runtime
Conflicts: go.mod/go.sum take main's newer core pin (a3bf508a), which carries the runtime-started-artifact contract; runtime.go keeps started() beside main's reworded serve-timeout comment. AGENTS.md is at its 200-line cap on main, so the started-artifact rule rides its table row and the CLAUDE.md bullet is one line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 parents 9ae227e + 953142e commit 297cdab

35 files changed

Lines changed: 5194 additions & 133 deletions

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ concurrency:
1212

1313
jobs:
1414
ci:
15-
uses: codefly-dev/core/.github/workflows/go-service-ci.yml@v0.19.4
15+
uses: codefly-dev/core/.github/workflows/go-service-ci.yml@v0.19.6
1616
with:
1717
# The Python runtime tests drive `uv` on the host (dependency sync,
1818
# pytest); it isn't on the runner by default.

‎AGENTS.md‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
This repo is one codefly agent binary: the **FastAPI specialization** of the
44
generic Python agent. It composes `github.com/codefly-dev/service-python`'s
55
`pkg/*` types and adds what FastAPI needs — uvicorn supervision and hot reload,
6-
OpenAPI-derived REST endpoints, an opt-in `grpc.aio` listener, the Dockerfile
7-
and kustomize recipes, and the scaffold a new FastAPI service is created from.
6+
OpenAPI-derived REST endpoints, an opt-in `grpc.aio` listener and Connect face,
7+
the Dockerfile and kustomize recipes, and the scaffold a new FastAPI service is created from.
88
Dependency management is `uv`; poetry is not supported.
99

1010
It does **not** own:
@@ -67,9 +67,9 @@ within reach.
6767
## Build and test
6868

6969
Derived from `.github/workflows/ci.yml`, which delegates to core's shared
70-
`go-service-ci.yml`, pinned to the linked core's tag (`@v0.19.4`; move it with
70+
`go-service-ci.yml`, pinned to the linked core's tag (`@v0.19.6`; move it with
7171
the core bump), and adds a `race` job of its own. Go comes from `go.mod`
72-
(1.27.2). All of it runs locally:
72+
(1.27.3). All of it runs locally:
7373

7474
```bash
7575
go build ./... # CI: build job
@@ -126,7 +126,8 @@ anything from it.
126126
| `runtime.go` | Init/Start/Stop/Destroy, uvicorn supervision, hot reload, the lock order |
127127
| `builder.go` | `Create` scaffolding, OpenAPI endpoint loading, Docker + kustomize recipes |
128128
| `uvsources.go` | the assembled build context: `[tool.uv.sources]` paths leaving the project |
129-
| `startedartifact.go` | what a native start reports it ran (`runtime-started-artifact/v1`) |
129+
| `uvgitsources.go` | the git commits `uv.lock` pins, declared for the caller to mirror into the build |
130+
| `startedartifact.go` | what a native start ran, reported before *every* `StartResponse` (`runtime-started-artifact/v1`) |
130131
| `probes.go`, `probe.py` | endpoint health translated to Kubernetes probes / a local probe |
131132
| `templates/` | **what ships** — embedded via `go:embed`, rendered on `Create` |
132133
| `base/` | a checked-in sample service, embedded nowhere |
@@ -147,9 +148,6 @@ into `templates/factory/code/pyproject.toml.tmpl` yourself.
147148
any dependent service. The swagger file does not exist at `Create` time — the
148149
service generates it at runtime from its own `src/openapi.py` — so absent is
149150
a normal state there, not an error to code around.
150-
- **A native start says what it ran**, before *every* `StartResponse` — core
151-
consumes the report, so the restart that keeps a process names it again, and a
152-
failed start names nothing. `startedartifact.go` owns the closure and why.
153151
- **Readiness is the endpoint's declared health check, never an open port.**
154152
Probe intents (readiness / startup / liveness) stay separate through
155153
`resources.PlanEndpointProbes`; collapsing them silently drops a predicate.
@@ -162,6 +160,13 @@ into `templates/factory/code/pyproject.toml.tmpl` yourself.
162160
same relative path resolves there; that plan claims the whole tree
163161
(`RECIPE_INVENTORY_SCOPE_TREE`), the Dockerfile-only one claims just what it
164162
emitted. Never rewrite `pyproject.toml` or `uv.lock` to make a path resolve.
163+
A git source is declared in the recipe (`git_source_downloads`) by the URL
164+
exactly as `uv.lock` records it up to its query, which is what uv hands git;
165+
the caller fetches it with its own credentials and the Dockerfile maps that
166+
URL onto the mirror; a normalized URL would miss it silently. A source core
167+
refuses, or whose URL begins an undeclared locked one (insteadOf is a
168+
prefix match), is not declared; a warning says why. An image whose own git
169+
config already rewrites a declared URL keeps that rewrite (git prefers it).
165170
- **The runtime image is pinned.** `docker-image` rejects a bare name and
166171
`:latest`. The default `ghcr.io/codefly-dev/python` companion is built from
167172
core and pinned by the digest of its multi-platform index — prefer it. Its tag
@@ -191,6 +196,5 @@ carried here:
191196
`AGENTS.md` beside what it describes, or into `.claude/skills/`. The cap and
192197
each skill's frontmatter are asserted in `conformance_test.go`, so `go test
193198
./...` enforces them with no workflow change.
194-
- There is no `CLAUDE.md`. If one is added, it is a one-line `@AGENTS.md`
195-
pointer — one canonical source, never a second copy to drift.
199+
- There is no `CLAUDE.md`; if one is added, it is a one-line `@AGENTS.md` pointer.
196200
- Treat this file as code: the PR that changes a process updates it.

‎agent.codefly.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
publisher: codefly.dev
22
kind: codefly:service
33
name: python-fastapi
4-
version: 0.0.118
4+
version: 0.0.123
55
release:
66
owner: workflow
77
workflow: releaser.yml

‎build_recipe_test.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,5 +196,7 @@ func TestBuildShipsSiblingPackages(t *testing.T) {
196196
"COPY --chown=appuser code/src code/src",
197197
"COPY --chown=appuser code/adapters code/adapters",
198198
"COPY --chown=appuser code/model_service code/model_service",
199+
// uvicorn's logging configuration and filter, written by the builder (uvicorn_logging.go).
200+
"COPY --chown=appuser code/uvicorn-log-config.json code/codefly_uvicorn_logging.py ./",
199201
}, copies)
200202
}

0 commit comments

Comments
 (0)