diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 96bc91302..9ad95abcb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,7 +51,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "1.24.2" + go-version: "1.27.3" cache: true - name: Check formatting @@ -72,7 +72,7 @@ jobs: - name: Analyze Go correctness and unused code uses: golangci/golangci-lint-action@v8 with: - version: v2.12.2 + version: v2.15.0 args: --config .golangci-gate.yml unit-tests: @@ -98,7 +98,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "1.24.2" + go-version: "1.27.3" # setup-go keys its cache on go.sum alone, so it never refreshes. cache: false @@ -160,7 +160,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "1.24.2" + go-version: "1.27.3" cache: true cache-dependency-path: services/team-api/go.sum @@ -189,7 +189,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "1.24.2" + go-version: "1.27.3" cache: true - name: Set up Node @@ -228,7 +228,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "1.24.2" + go-version: "1.27.3" cache: true - name: Check repository content contracts @@ -258,7 +258,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "1.24.2" + go-version: "1.27.3" # setup-go keys its cache on go.sum alone, so it never refreshes. cache: false @@ -333,7 +333,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "1.24.2" + go-version: "1.27.3" cache: true - name: Set up Node @@ -388,7 +388,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "1.24.2" + go-version: "1.27.3" cache: true - name: Build @@ -408,7 +408,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "1.24.2" + go-version: "1.27.3" cache: true - name: Set up Node diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 329f9f792..1719c9b73 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -77,7 +77,7 @@ jobs: desktop/package-lock.json - uses: actions/setup-go@v5 with: - go-version: '1.24.11' + go-version: '1.27.3' - name: Install signing test dependencies run: | npm --prefix desktop ci @@ -133,7 +133,7 @@ jobs: persist-credentials: false - uses: actions/setup-go@v5 with: - go-version: '1.24.2' + go-version: '1.27.3' - uses: goto-bus-stop/setup-zig@v2 with: version: 0.13.0 @@ -147,7 +147,7 @@ jobs: - name: Install credential scanner working-directory: ${{ runner.temp }} env: - GOTOOLCHAIN: go1.24.11 + GOTOOLCHAIN: local run: go install github.com/zricethezav/gitleaks/v8@v8.30.1 - uses: actions/download-artifact@v4 with: @@ -186,7 +186,7 @@ jobs: run: test "$(uname -m)" = arm64 - uses: actions/setup-go@v5 with: - go-version: '1.24.2' + go-version: '1.27.3' - uses: actions/setup-node@v4 with: node-version: '22' @@ -269,7 +269,7 @@ jobs: persist-credentials: false - uses: actions/setup-go@v5 with: - go-version: '1.24.11' + go-version: '1.27.3' - name: Install credential scanner working-directory: ${{ runner.temp }} run: go install github.com/zricethezav/gitleaks/v8@v8.30.1 diff --git a/.github/workflows/secrets.yml b/.github/workflows/secrets.yml index cc59201d4..ebd1c305d 100644 --- a/.github/workflows/secrets.yml +++ b/.github/workflows/secrets.yml @@ -14,7 +14,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-go@v5 with: - go-version: '1.24.2' + go-version: '1.27.3' - uses: actions/setup-node@v4 with: node-version: '22' @@ -27,10 +27,8 @@ jobs: - name: Install scanner run: go install github.com/zricethezav/gitleaks/v8@v8.30.1 working-directory: ${{ runner.temp }} - # gitleaks needs Go 1.24.11 or newer. Without a pin, Go switches to the - # newest release, which can 404 while that release is still propagating. env: - GOTOOLCHAIN: go1.24.11 + GOTOOLCHAIN: local - name: Scan tracked files and new commits run: python3 scripts/secrets/check.py --history - name: Check credential and release tooling diff --git a/.github/workflows/typesafe-live.yml b/.github/workflows/typesafe-live.yml index 74c20fb98..9e96b9555 100644 --- a/.github/workflows/typesafe-live.yml +++ b/.github/workflows/typesafe-live.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.24.2' + go-version: '1.27.3' - name: Test synthetic input against TypeSafe env: TYPESAFE_API_KEY: ${{ secrets.TYPESAFE_API_KEY }} diff --git a/CHANGELOG.md b/CHANGELOG.md index a0c6b3829..de7d4e67b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,8 @@ - Client release commands now deploy and verify the exact release gateway source before uploading artifacts, with pinned retries and private/public source agreement. Ordinary main merges no longer deploy the gateway. +- Development, CI, and release builds now use Go 1.27.3. + ### Fixed - Desktop card dragging keeps working after using the repository or worktree picker. Closing a picker now removes its native webview so it cannot intercept later drops. @@ -44,6 +46,8 @@ - Team API deployment grants the scoped role, repository, and ECS revision metadata reads CloudFormation needs to deploy and verify the gateway. - Team API deployment verifies Express service revisions using the revision field AWS returns, allowing a healthy deployment to pass its final check. +- Stopping agent sessions on macOS avoids shutdown timeouts caused by slow process discovery. + ### Added - The Tasks page shows local task versions before merge and can run **Test once** against a captured checkout, including uncommitted changes and nonignored helper files. Test outcomes and transcripts are visible with separate data and history; scheduled execution continues to use the primary ref. Compounding tests use fresh mining state rather than changing real proposals or cursors. diff --git a/Makefile b/Makefile index 901370905..7447612cd 100644 --- a/Makefile +++ b/Makefile @@ -84,21 +84,22 @@ vet: $(CGO_LDFLAGS_ENV) GOCACHE=$${GOCACHE:-$(PWD)/.gocache} GOMODCACHE=$${GOMODCACHE:-$(PWD)/.gomodcache} GOTMPDIR=$${GOTMPDIR:-$(PWD)/.gotmp} go vet -mod=vendor $(CGO_TAGS) ./... @printf '<== vet\n' +# Keep test fixtures outside the repository so ancestor discovery stays isolated. test: @printf '\n==> test\n' @mkdir -p .gocache .gomodcache .gotmp - $(CGO_LDFLAGS_ENV) RZM_CODE_MODE_RUNTIME_FIXTURE="$$( [ -x '$(DEV_BINARY)' ] && echo '$(PWD)/$(DEV_BINARY)' )" GOCACHE=$${GOCACHE:-$(PWD)/.gocache} GOMODCACHE=$${GOMODCACHE:-$(PWD)/.gomodcache} GOTMPDIR=$${GOTMPDIR:-$(PWD)/.gotmp} go test -mod=vendor -tags "fts5" -race -p $(GO_TEST_PACKAGES) -parallel $(GO_TEST_PARALLEL) ./... + $(CGO_LDFLAGS_ENV) RZM_CODE_MODE_RUNTIME_FIXTURE="$$( [ -x '$(DEV_BINARY)' ] && echo '$(PWD)/$(DEV_BINARY)' )" GOCACHE=$${GOCACHE:-$(PWD)/.gocache} GOMODCACHE=$${GOMODCACHE:-$(PWD)/.gomodcache} go test -mod=vendor -tags "fts5" -race -p $(GO_TEST_PACKAGES) -parallel $(GO_TEST_PARALLEL) ./... @printf '<== test\n' test-fast: @printf '\n==> test-fast\n' @mkdir -p .gocache .gomodcache .gotmp - $(CGO_LDFLAGS_ENV) RZM_CODE_MODE_RUNTIME_FIXTURE="$$( [ -x '$(DEV_BINARY)' ] && echo '$(PWD)/$(DEV_BINARY)' )" GOCACHE=$${GOCACHE:-$(PWD)/.gocache} GOMODCACHE=$${GOMODCACHE:-$(PWD)/.gomodcache} GOTMPDIR=$${GOTMPDIR:-$(PWD)/.gotmp} go test -mod=vendor -tags "fts5" -p $(GO_TEST_PACKAGES) -parallel $(GO_TEST_PARALLEL) ./... + $(CGO_LDFLAGS_ENV) RZM_CODE_MODE_RUNTIME_FIXTURE="$$( [ -x '$(DEV_BINARY)' ] && echo '$(PWD)/$(DEV_BINARY)' )" GOCACHE=$${GOCACHE:-$(PWD)/.gocache} GOMODCACHE=$${GOMODCACHE:-$(PWD)/.gomodcache} go test -mod=vendor -tags "fts5" -p $(GO_TEST_PACKAGES) -parallel $(GO_TEST_PARALLEL) ./... @printf '<== test-fast\n' test-content: @mkdir -p .gocache .gomodcache .gotmp - $(CGO_LDFLAGS_ENV) GOCACHE=$${GOCACHE:-$(PWD)/.gocache} GOMODCACHE=$${GOMODCACHE:-$(PWD)/.gomodcache} GOTMPDIR=$${GOTMPDIR:-$(PWD)/.gotmp} go test -mod=vendor -tags "fts5 repo_content" -count=1 ./tests + $(CGO_LDFLAGS_ENV) GOCACHE=$${GOCACHE:-$(PWD)/.gocache} GOMODCACHE=$${GOMODCACHE:-$(PWD)/.gomodcache} go test -mod=vendor -tags "fts5 repo_content" -count=1 ./tests credential-check: python3 scripts/secrets/check.py @@ -116,13 +117,13 @@ integration: integration-packages: @printf '\n==> integration-packages\n' @mkdir -p .gocache .gomodcache .gotmp - $(CGO_LDFLAGS_ENV) GOCACHE=$${GOCACHE:-$(PWD)/.gocache} GOMODCACHE=$${GOMODCACHE:-$(PWD)/.gomodcache} GOTMPDIR=$${GOTMPDIR:-$(PWD)/.gotmp} go test -mod=vendor -tags "fts5 integration" -race -p $(GO_TEST_PACKAGES) -parallel $(GO_TEST_PARALLEL) $(INTEGRATION_PACKAGES) + $(CGO_LDFLAGS_ENV) GOCACHE=$${GOCACHE:-$(PWD)/.gocache} GOMODCACHE=$${GOMODCACHE:-$(PWD)/.gomodcache} go test -mod=vendor -tags "fts5 integration" -race -p $(GO_TEST_PACKAGES) -parallel $(GO_TEST_PARALLEL) $(INTEGRATION_PACKAGES) @printf '<== integration-packages\n' integration-mixed: @printf '\n==> integration-mixed\n' @mkdir -p .gocache .gomodcache .gotmp - $(CGO_LDFLAGS_ENV) GOCACHE=$${GOCACHE:-$(PWD)/.gocache} GOMODCACHE=$${GOMODCACHE:-$(PWD)/.gomodcache} GOTMPDIR=$${GOTMPDIR:-$(PWD)/.gotmp} go test -mod=vendor -tags "fts5 integration" -race -p $(GO_TEST_PACKAGES) -parallel $(GO_TEST_PARALLEL) -run "$(INTEGRATION_RUN)" $(MIXED_INTEGRATION_PACKAGES) + $(CGO_LDFLAGS_ENV) GOCACHE=$${GOCACHE:-$(PWD)/.gocache} GOMODCACHE=$${GOMODCACHE:-$(PWD)/.gomodcache} go test -mod=vendor -tags "fts5 integration" -race -p $(GO_TEST_PACKAGES) -parallel $(GO_TEST_PARALLEL) -run "$(INTEGRATION_RUN)" $(MIXED_INTEGRATION_PACKAGES) @printf '<== integration-mixed\n' # Three tiers. check-fast is the edit loop, check is the pre-commit gate, and @@ -182,7 +183,7 @@ test_all: test_coverage: @mkdir -p .gocache .gomodcache .gotmp - $(CGO_LDFLAGS_ENV) GOCACHE=$${GOCACHE:-$(PWD)/.gocache} GOMODCACHE=$${GOMODCACHE:-$(PWD)/.gomodcache} GOTMPDIR=$${GOTMPDIR:-$(PWD)/.gotmp} go test -mod=vendor -tags "fts5" -p $(GO_TEST_PACKAGES) -parallel $(GO_TEST_PARALLEL) ./... -coverprofile=coverage.out + $(CGO_LDFLAGS_ENV) GOCACHE=$${GOCACHE:-$(PWD)/.gocache} GOMODCACHE=$${GOMODCACHE:-$(PWD)/.gomodcache} go test -mod=vendor -tags "fts5" -p $(GO_TEST_PACKAGES) -parallel $(GO_TEST_PARALLEL) ./... -coverprofile=coverage.out greptile-check: @printf '\n==> greptile-check\n' @@ -403,7 +404,7 @@ desktop-install-dev: # team-api-dev runs the whole local stack with fake upstreams on port 8788 and # repository-local state; development builds of rzm start their own live # gateway on 8787 (pkg/app/teamdev), so the two never share an origin. -TEAM_API_ENV=GOCACHE=$${GOCACHE:-$(PWD)/.gocache} GOMODCACHE=$${GOMODCACHE:-$(PWD)/.gomodcache} GOTMPDIR=$${GOTMPDIR:-$(PWD)/.gotmp} GOFLAGS=-mod=mod GOTOOLCHAIN=local +TEAM_API_ENV=GOCACHE=$${GOCACHE:-$(PWD)/.gocache} GOMODCACHE=$${GOMODCACHE:-$(PWD)/.gomodcache} GOFLAGS=-mod=mod GOTOOLCHAIN=local TEAM_API_BIN=bin/$(GOOS)/team-api$(EXE_SUFFIX) TEAM_API_DEV_DIR ?= $(PWD)/.team-api-dev TEAM_API_DEV_LISTEN ?= 127.0.0.1:8788 diff --git a/desktop/src/App.test.tsx b/desktop/src/App.test.tsx index 7993a1eb5..568cabd31 100644 --- a/desktop/src/App.test.tsx +++ b/desktop/src/App.test.tsx @@ -907,6 +907,7 @@ describe("desktop shell", () => { it("keeps the worktree label quiet on the primary worktree only", async () => { start(); expect(await screen.findByRole("button", { name: "Worktree main" })).not.toHaveClass("other"); + await showFinder(/^Worktree /); choose({ choice: "open", repository: repository.id, worktree: feature, newWindow: false }); expect(await screen.findByRole("button", { name: "Worktree feature" })).toHaveClass("other"); }); diff --git a/go.mod b/go.mod index 66c231a97..6498d4130 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module github.com/atomicobject/rhizome -go 1.24.0 - -toolchain go1.24.2 +go 1.27.3 require ( github.com/asg017/sqlite-vec-go-bindings v0.1.6 diff --git a/mise.lock b/mise.lock index bb41a1c58..13d28ccee 100644 --- a/mise.lock +++ b/mise.lock @@ -30,61 +30,61 @@ url = "https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8 url_api = "https://api.github.com/repos/gitleaks/gitleaks/releases/assets/378333178" [[tools.go]] -version = "1.24.2" +version = "1.27.3" backend = "core:go" [tools.go."platforms.linux-arm64"] -checksum = "sha256:756274ea4b68fa5535eb9fe2559889287d725a8da63c6aae4d5f23778c229f4b" -url = "https://dl.google.com/go/go1.24.2.linux-arm64.tar.gz" +checksum = "sha256:a06e99309dbcbdca1a8ccd2282c3ee146e55930886e26b4f1193269587165f49" +url = "https://dl.google.com/go/go1.27.3.linux-arm64.tar.gz" [tools.go."platforms.linux-x64"] -checksum = "sha256:68097bd680839cbc9d464a0edce4f7c333975e27a90246890e9f1078c7e702ad" -url = "https://dl.google.com/go/go1.24.2.linux-amd64.tar.gz" +checksum = "sha256:65efbc80fdc1fa2cd2631cad5b481777a68e8725f34e89f50fc6ac714e379b40" +url = "https://dl.google.com/go/go1.27.3.linux-amd64.tar.gz" [tools.go."platforms.macos-arm64"] -checksum = "sha256:b70f8b3c5b4ccb0ad4ffa5ee91cd38075df20fdbd953a1daedd47f50fbcff47a" -url = "https://dl.google.com/go/go1.24.2.darwin-arm64.tar.gz" +checksum = "sha256:dd3908cf20959d798c1e06ebe5b72213f0505ce01373b40ce3110975a6cd99c2" +url = "https://dl.google.com/go/go1.27.3.darwin-arm64.tar.gz" [tools.go."platforms.macos-x64"] -checksum = "sha256:238d9c065d09ff6af229d2e3b8b5e85e688318d69f4006fb85a96e41c216ea83" -url = "https://dl.google.com/go/go1.24.2.darwin-amd64.tar.gz" +checksum = "sha256:b6f8e931e4ab497fcde6da8ae4499a58f9d258e55c8a80824a516eae5950a750" +url = "https://dl.google.com/go/go1.27.3.darwin-amd64.tar.gz" [tools.go."platforms.windows-x64"] -checksum = "sha256:29c553aabee0743e2ffa3e9fa0cda00ef3b3cc4ff0bc92007f31f80fd69892e1" -url = "https://dl.google.com/go/go1.24.2.windows-amd64.zip" +checksum = "sha256:f26081f438319757f8a1b46d7d0b2c5ec7583d4038e485e0aa725cfde7885fff" +url = "https://dl.google.com/go/go1.27.3.windows-amd64.zip" [[tools.golangci-lint]] -version = "2.12.2" +version = "2.15.0" backend = "aqua:golangci/golangci-lint" [tools.golangci-lint."platforms.linux-arm64"] -checksum = "sha256:44cd40a8c76c86755375adfeea52cfd3533cb43d7bd647771e0ae065e166df3a" -url = "https://github.com/golangci/golangci-lint/releases/download/v2.12.2/golangci-lint-2.12.2-linux-arm64.tar.gz" -url_api = "https://api.github.com/repos/golangci/golangci-lint/releases/assets/413470996" +checksum = "sha256:b4d8f17068b35ee6060cc2f69a16fb48740d706fbba81661c318649c114a6998" +url = "https://github.com/golangci/golangci-lint/releases/download/v2.15.0/golangci-lint-2.15.0-linux-arm64.tar.gz" +url_api = "https://api.github.com/repos/golangci/golangci-lint/releases/assets/647132775" provenance = "github-attestations" [tools.golangci-lint."platforms.linux-x64"] -checksum = "sha256:8df580d2670fed8fa984aac0507099af8df275e665215f5c7a2ae3943893a553" -url = "https://github.com/golangci/golangci-lint/releases/download/v2.12.2/golangci-lint-2.12.2-linux-amd64.tar.gz" -url_api = "https://api.github.com/repos/golangci/golangci-lint/releases/assets/413471054" +checksum = "sha256:9b7fe6a6bf6334b98decf8d86b11415ea7889afdabdd1959fdce23af2a9ebcea" +url = "https://github.com/golangci/golangci-lint/releases/download/v2.15.0/golangci-lint-2.15.0-linux-amd64.tar.gz" +url_api = "https://api.github.com/repos/golangci/golangci-lint/releases/assets/647132535" provenance = "github-attestations" [tools.golangci-lint."platforms.macos-arm64"] -checksum = "sha256:a9c54498731b3128f79e090be6110f3e5fffccc617b08142ed244d4126c73f29" -url = "https://github.com/golangci/golangci-lint/releases/download/v2.12.2/golangci-lint-2.12.2-darwin-arm64.tar.gz" -url_api = "https://api.github.com/repos/golangci/golangci-lint/releases/assets/413470950" +checksum = "sha256:d1e409481a8ca846c4bc97e781eb5cb1bd5c23353a0b3977a1cbda1b1b6447d5" +url = "https://github.com/golangci/golangci-lint/releases/download/v2.15.0/golangci-lint-2.15.0-darwin-arm64.tar.gz" +url_api = "https://api.github.com/repos/golangci/golangci-lint/releases/assets/647132534" provenance = "github-attestations" [tools.golangci-lint."platforms.macos-x64"] -checksum = "sha256:f6f06d94b6241521c53d15450c5209b028270bf966f842afb11c030c79f5bc16" -url = "https://github.com/golangci/golangci-lint/releases/download/v2.12.2/golangci-lint-2.12.2-darwin-amd64.tar.gz" -url_api = "https://api.github.com/repos/golangci/golangci-lint/releases/assets/413470980" +checksum = "sha256:767b899a28285e88ded2823d5dcc4bc5ef681173eb2d80f029a7b17ee4ece3b8" +url = "https://github.com/golangci/golangci-lint/releases/download/v2.15.0/golangci-lint-2.15.0-darwin-amd64.tar.gz" +url_api = "https://api.github.com/repos/golangci/golangci-lint/releases/assets/647132753" provenance = "github-attestations" [tools.golangci-lint."platforms.windows-x64"] -checksum = "sha256:bd42e3ebc8cb4ececb86941983baaf1dc221bbb04d838e94ce63b49cc91e02bb" -url = "https://github.com/golangci/golangci-lint/releases/download/v2.12.2/golangci-lint-2.12.2-windows-amd64.zip" -url_api = "https://api.github.com/repos/golangci/golangci-lint/releases/assets/413471017" +checksum = "sha256:cd7ea6063c95de245e17e5246e42bdc14bb221792c429dbd239ab3a6ade6ca6a" +url = "https://github.com/golangci/golangci-lint/releases/download/v2.15.0/golangci-lint-2.15.0-windows-amd64.zip" +url_api = "https://api.github.com/repos/golangci/golangci-lint/releases/assets/647132900" provenance = "github-attestations" [[tools.node]] diff --git a/mise.toml b/mise.toml index 68344aede..d4352bc73 100644 --- a/mise.toml +++ b/mise.toml @@ -1,8 +1,8 @@ min_version = "2026.7.0" [tools] -go = "1.24.2" -golangci-lint = "2.12.2" +go = "1.27.3" +golangci-lint = "2.15.0" gitleaks = "8.30.1" node = "22.23.1" diff --git a/pkg/app/web/server_integration_test.go b/pkg/app/web/server_integration_test.go index e1b52753e..5c593ed1c 100644 --- a/pkg/app/web/server_integration_test.go +++ b/pkg/app/web/server_integration_test.go @@ -41,6 +41,7 @@ import ( "sync" "testing" "testing/fstest" + "testing/synctest" "time" ) @@ -324,31 +325,34 @@ adaptationGuidance: writeRecipe("Exact note recipe", "exact-note-recipe", "path title") writeRecipe("Type-dependent note recipe", "typed-note-recipe", "__typename path") - runtime := &Runtime{IntelStore: fixture.intelStore} - runtime.EnableIndexGate() - runtime.MarkNoteReadReady() - srv := newFixtureServer(t, fixture, runtime) - require.False(t, runtime.IndexReady()) - - exactReq := newApplicationRequest(http.MethodPost, "/api/v1/query-recipes/exact-note-recipe/execute", bytes.NewBufferString(`{"inputs":{"path":"specs/100-demo/plan.md"}}`)) - exactReq.Header.Set("Content-Type", "application/json") - exactRes := httptest.NewRecorder() - srv.Handler().ServeHTTP(exactRes, exactReq) - require.Equal(t, http.StatusOK, exactRes.Code) - var exactRun queryrecipe.RunResult - require.NoError(t, json.Unmarshal(exactRes.Body.Bytes(), &exactRun)) - require.Empty(t, exactRun.Result.Errors) - require.Equal(t, "specs/100-demo/plan.md", exactRun.Result.Data["note"].(map[string]any)["path"]) - - typedReq := newApplicationRequest(http.MethodPost, "/api/v1/query-recipes/typed-note-recipe/execute", bytes.NewBufferString(`{"inputs":{"path":"specs/100-demo/plan.md"}}`)) - typedReq.Header.Set("Content-Type", "application/json") - typedCtx, typedCancel := context.WithTimeout(typedReq.Context(), 10*time.Millisecond) - defer typedCancel() - typedRes := httptest.NewRecorder() - srv.Handler().ServeHTTP(typedRes, typedReq.WithContext(typedCtx)) - require.Equal(t, http.StatusServiceUnavailable, typedRes.Code) - require.Equal(t, "5", typedRes.Header().Get("Retry-After")) - require.Contains(t, typedRes.Body.String(), PublicErrorIndexInitializing) + // Advance the deadline only once the selected readiness gate blocks. + synctest.Test(t, func(t *testing.T) { + runtime := &Runtime{IntelStore: fixture.intelStore} + runtime.EnableIndexGate() + runtime.MarkNoteReadReady() + srv := newFixtureServer(t, fixture, runtime) + require.False(t, runtime.IndexReady()) + + exactReq := newApplicationRequest(http.MethodPost, "/api/v1/query-recipes/exact-note-recipe/execute", bytes.NewBufferString(`{"inputs":{"path":"specs/100-demo/plan.md"}}`)) + exactReq.Header.Set("Content-Type", "application/json") + exactRes := httptest.NewRecorder() + srv.Handler().ServeHTTP(exactRes, exactReq) + require.Equal(t, http.StatusOK, exactRes.Code) + var exactRun queryrecipe.RunResult + require.NoError(t, json.Unmarshal(exactRes.Body.Bytes(), &exactRun)) + require.Empty(t, exactRun.Result.Errors) + require.Equal(t, "specs/100-demo/plan.md", exactRun.Result.Data["note"].(map[string]any)["path"]) + + typedReq := newApplicationRequest(http.MethodPost, "/api/v1/query-recipes/typed-note-recipe/execute", bytes.NewBufferString(`{"inputs":{"path":"specs/100-demo/plan.md"}}`)) + typedReq.Header.Set("Content-Type", "application/json") + typedCtx, typedCancel := context.WithTimeout(typedReq.Context(), 10*time.Millisecond) + defer typedCancel() + typedRes := httptest.NewRecorder() + srv.Handler().ServeHTTP(typedRes, typedReq.WithContext(typedCtx)) + require.Equal(t, http.StatusServiceUnavailable, typedRes.Code) + require.Equal(t, "5", typedRes.Header().Get("Retry-After")) + require.Contains(t, typedRes.Body.String(), PublicErrorIndexInitializing) + }) } func TestPublicConfiguredViews(t *testing.T) { diff --git a/pkg/harness/internal/jsonstdio/transport_darwin_test.go b/pkg/harness/internal/jsonstdio/transport_darwin_test.go new file mode 100644 index 000000000..467bc9cc8 --- /dev/null +++ b/pkg/harness/internal/jsonstdio/transport_darwin_test.go @@ -0,0 +1,33 @@ +package jsonstdio + +import ( + "context" + "os" + "path/filepath" + "testing" + "time" + + "github.com/stretchr/testify/require" +) + +func TestCloseBoundsProcessDiscovery(t *testing.T) { + connection, _ := startChild(t, "blocked-write") + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + _, err := connection.Recv(ctx) + require.NoError(t, err) + bin := t.TempDir() + require.NoError(t, os.WriteFile(filepath.Join(bin, "ps"), []byte("#!/bin/sh\nexec sleep 30\n"), 0o700)) + t.Setenv("PATH", bin+string(os.PathListSeparator)+os.Getenv("PATH")) + closeCtx, cancelClose := context.WithTimeout(context.Background(), 300*time.Millisecond) + defer cancelClose() + started := time.Now() + err = connection.Close(closeCtx) + require.Less(t, time.Since(started), 450*time.Millisecond, "process discovery must reserve time to kill and reap the child") + require.NoError(t, err) + select { + case <-connection.Exited(): + default: + t.Fatal("Close returned before reaping the child") + } +} diff --git a/pkg/proctree/proctree_unix.go b/pkg/proctree/proctree_unix.go index 085cbf312..5e48e574f 100644 --- a/pkg/proctree/proctree_unix.go +++ b/pkg/proctree/proctree_unix.go @@ -3,14 +3,10 @@ package proctree import ( - "context" "errors" "os" "os/exec" - "strconv" - "strings" "syscall" - "time" ) const supported = true @@ -25,32 +21,6 @@ func Configure(cmd *exec.Cmd) { cmd.SysProcAttr.Setsid = true } -// snapshot lists every process with its parent, session, and start time. A -// stalled ps gives up after a second rather than holding up a shutdown. -func snapshot() (map[int]proc, bool) { - ctx, cancel := context.WithTimeout(context.Background(), time.Second) - defer cancel() - out, err := exec.CommandContext(ctx, "ps", "-A", "-o", "pid=,ppid=,lstart=").Output() - if err != nil { - return nil, false - } - procs := map[int]proc{} - for _, line := range strings.Split(string(out), "\n") { - fields := strings.Fields(line) - if len(fields) < 3 { - continue - } - pid, err1 := strconv.Atoi(fields[0]) - ppid, err2 := strconv.Atoi(fields[1]) - if err1 != nil || err2 != nil { - continue - } - sid := sessionOf(pid) - procs[pid] = proc{ppid: ppid, sid: sid, start: strings.Join(fields[2:], " ")} - } - return procs, true -} - func killPID(pid int) { _ = syscall.Kill(pid, syscall.SIGKILL) } func killGroup(process *os.Process) error { diff --git a/pkg/proctree/snapshot_darwin.go b/pkg/proctree/snapshot_darwin.go new file mode 100644 index 000000000..d13424cf1 --- /dev/null +++ b/pkg/proctree/snapshot_darwin.go @@ -0,0 +1,25 @@ +package proctree + +import ( + "fmt" + + "golang.org/x/sys/unix" +) + +// Read the kernel table directly: spawning ps can consume the shutdown budget. +func snapshot() (map[int]proc, bool) { + processes, err := unix.SysctlKinfoProcSlice("kern.proc.all") + if err != nil { + return nil, false + } + procs := make(map[int]proc, len(processes)) + for _, p := range processes { + pid := int(p.Proc.P_pid) + procs[pid] = proc{ + ppid: int(p.Eproc.Ppid), + sid: sessionOf(pid), + start: fmt.Sprintf("%d.%06d", p.Proc.P_starttime.Sec, p.Proc.P_starttime.Usec), + } + } + return procs, true +} diff --git a/pkg/proctree/snapshot_ps.go b/pkg/proctree/snapshot_ps.go new file mode 100644 index 000000000..3c13dc703 --- /dev/null +++ b/pkg/proctree/snapshot_ps.go @@ -0,0 +1,37 @@ +//go:build !darwin && !windows + +package proctree + +import ( + "context" + "os/exec" + "strconv" + "strings" + "time" +) + +// snapshot lists every process with its parent, session, and start time. A +// stalled ps gives up after a second rather than holding up a shutdown. +func snapshot() (map[int]proc, bool) { + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + out, err := exec.CommandContext(ctx, "ps", "-A", "-o", "pid=,ppid=,lstart=").Output() + if err != nil { + return nil, false + } + procs := map[int]proc{} + for _, line := range strings.Split(string(out), "\n") { + fields := strings.Fields(line) + if len(fields) < 3 { + continue + } + pid, err1 := strconv.Atoi(fields[0]) + ppid, err2 := strconv.Atoi(fields[1]) + if err1 != nil || err2 != nil { + continue + } + sid := sessionOf(pid) + procs[pid] = proc{ppid: ppid, sid: sid, start: strings.Join(fields[2:], " ")} + } + return procs, true +} diff --git a/services/team-api/Dockerfile b/services/team-api/Dockerfile index 2728f686b..4d214475a 100644 --- a/services/team-api/Dockerfile +++ b/services/team-api/Dockerfile @@ -1,6 +1,6 @@ # Build from the repository root. CGO keeps SQLite available for local runs; # musl's static libc lets the deployed image contain only the binary and CAs. -FROM golang:1.26.10-alpine AS build +FROM golang:1.27.3-alpine AS build RUN apk add --no-cache build-base ca-certificates WORKDIR /src COPY go.mod go.sum ./ diff --git a/services/team-api/README.md b/services/team-api/README.md index 520337bc6..0cdbfefe3 100644 --- a/services/team-api/README.md +++ b/services/team-api/README.md @@ -91,7 +91,7 @@ TEAM_API_E2E_UPSTREAMS=live scripts/team-api/e2e.sh # the same against the rea The ARM64 container, CloudFormation template, protected OIDC workflow, and operations instructions are in [RUNBOOK.md](RUNBOOK.md). The infrastructure uses ECS Express Mode on its stable AWS hostname, one steady-state task, DynamoDB, and a 30-day CloudWatch log group. All account configuration stays in AWS or the protected GitHub `production` environment. -The image builds with Go 1.26.10 and runs the pinned `govulncheck` 1.9.0 against the compiled binary before packaging it. A finding or unavailable vulnerability database fails the build. CI builds the image without cached layers to exercise this gate. ECR does not support scanning the final `scratch` image, and the Go scan does not cover statically linked C dependencies such as SQLite or musl. +The image builds with Go 1.27.3 and runs the pinned `govulncheck` 1.9.0 against the compiled binary before packaging it. A finding or unavailable vulnerability database fails the build. CI builds the image without cached layers to exercise this gate. ECR does not support scanning the final `scratch` image, and the Go scan does not cover statically linked C dependencies such as SQLite or musl. `team-api serve` also accepts the full JSON configuration in `RHIZOME_TEAM_API_CONFIG`, injected from SSM by ECS. An explicit `--config` takes precedence. Environment configuration defaults diagnostics to JSON lines on stdout; set `diagnostics_output: "stdout"` explicitly in production. Provider keys and the Google client secret are separate ECS secret injections from Secrets Manager. `trusted_proxy_cidrs` identifies the ALB subnet CIDRs; only the final ALB-appended address is trusted, and task ingress must allow only the ALB security group. `/healthz` becomes ready after store initialization and recovery, checks no providers, and reports unavailable during shutdown. diff --git a/services/team-api/go.mod b/services/team-api/go.mod index 78675709f..e9608c17e 100644 --- a/services/team-api/go.mod +++ b/services/team-api/go.mod @@ -1,8 +1,6 @@ module github.com/atomicobject/rhizome/services/team-api -go 1.24.0 - -toolchain go1.24.2 +go 1.27.3 require ( github.com/atomicobject/rhizome v0.0.0 diff --git a/tests/integration/agent_code_progressive/index_freshness_test.go b/tests/integration/agent_code_progressive/index_freshness_test.go index 598ce866d..aa6082070 100644 --- a/tests/integration/agent_code_progressive/index_freshness_test.go +++ b/tests/integration/agent_code_progressive/index_freshness_test.go @@ -49,6 +49,8 @@ try { const before = await client.codeSymbol({ symbol: "greet", path: "src/example.py" }); assert.equal(before.ok, true, JSON.stringify(before)); assert.match(JSON.stringify(before.payload), /greet/); + // Close the runtime's SQLite handles before replacing its database files. + execFileSync(process.env.PROGRESSIVE_BINARY, ["stop"], { cwd: root, env: process.env, timeout: 30000, stdio: "pipe" }); const db = join(root, ".rhizome/db.sqlite"); const old = await stat(db); // Preserve the old store and create a different indexed database in its place.