From 6fcfbf1def49eaa89b8b1c8eb8e70f738a160c62 Mon Sep 17 00:00:00 2001 From: Codex Bot Date: Thu, 19 Nov 2026 19:30:05 +0800 Subject: [PATCH] Rename shared backend to Bedrock [skip ci] --- .gitea/workflows/check.yml | 6 +++--- .gitea/workflows/deploy.yml | 6 +++--- README.md | 10 ++++++---- cmd/{foundry => bedrock}/main.go | 8 ++++---- deploy/check-canvas-real.sh | 4 ++-- deploy/codex-worker.sh | 6 +++--- deploy/release.sh | 10 +++++----- docs/research-api.md | 4 ++-- go.mod | 2 +- internal/platform/canvas_ai_apply.go | 2 +- internal/platform/canvas_ai_image_inputs.go | 2 +- internal/platform/canvas_ai_images.go | 2 +- internal/platform/canvas_ai_integration_test.go | 2 +- internal/platform/canvas_ai_model_integration_test.go | 2 +- internal/platform/canvas_ai_models.go | 2 +- internal/platform/canvas_ai_real_test.go | 2 +- internal/platform/canvas_ai_runs.go | 2 +- internal/platform/canvas_ai_scheduler.go | 2 +- .../canvas_headless_worker_integration_test.go | 2 +- internal/platform/http.go | 4 ++-- internal/platform/integration_test.go | 2 +- 21 files changed, 42 insertions(+), 40 deletions(-) rename cmd/{foundry => bedrock}/main.go (96%) diff --git a/.gitea/workflows/check.yml b/.gitea/workflows/check.yml index ff52e99..965edab 100644 --- a/.gitea/workflows/check.yml +++ b/.gitea/workflows/check.yml @@ -1,5 +1,5 @@ # 分支推送和 PR 检查:格式/编译、隔离数据库回归、固定版本 headless 客户端以及 HTTP smoke。 -name: Foundry Go checks +name: Bedrock Go checks on: [push, pull_request] jobs: @@ -19,7 +19,7 @@ jobs: set -eu test -z "$(gofmt -l cmd internal)" go test -mod=readonly ./... - go build -mod=readonly -o bin/foundry ./cmd/foundry + go build -mod=readonly -o bin/bedrock ./cmd/bedrock # 仅 push 可使用已配置秘密做占位码探测,不能替代真实用户 OAuth 登录。 - name: Check Slack OAuth configuration and endpoint if: gitea.event_name == 'push' @@ -98,7 +98,7 @@ jobs: PORT: '18080' run: | set -eu - ./bin/foundry & + ./bin/bedrock & server_pid=$! trap 'kill "$server_pid" 2>/dev/null || true' EXIT curl --silent --show-error --fail --retry 5 --retry-connrefused http://127.0.0.1:18080/healthz diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 5bd714c..b284236 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -1,5 +1,5 @@ # 仅 main 的相关路径变更触发发布;工作分支验证不应运行此生产切换。 -name: Deploy Foundry Core +name: Deploy Bedrock on: push: branches: [main] @@ -34,7 +34,7 @@ jobs: set -eu test -z "$(gofmt -l cmd internal)" go test -mod=readonly ./... - CGO_ENABLED=0 go build -mod=readonly -o bin/foundry ./cmd/foundry + CGO_ENABLED=0 go build -mod=readonly -o bin/bedrock ./cmd/bedrock # secrets 仅注入进程环境,项目/引导 JSON 来自 Actions Variables,release 再检查内容。 - name: Deploy and verify backend readiness env: @@ -44,4 +44,4 @@ jobs: SLACK_CLIENT_SECRET: ${{ secrets.SLACK_CLIENT_SECRET }} FOUNDRY_PROJECTS: ${{ vars.FOUNDRY_PROJECTS }} FOUNDRY_ONBOARDING: ${{ vars.FOUNDRY_ONBOARDING }} - run: bash deploy/release.sh bin/foundry + run: bash deploy/release.sh bin/bedrock diff --git a/README.md b/README.md index c614c8b..d1ff9c6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# 造物工坊 · Foundry Core +# 基岩 · Bedrock + +基岩(Bedrock,原 Foundry Core)为多个项目提供共享后端。现有部署继续使用原 API 域名、环境变量和已发布的 HTTP 协议标识。 共享后端的第一版提供 Google 登录。各项目通过同一个 HTTPS API 登录,在私有 PostgreSQL 的认证库中维护独立账号和会话。项目业务库可分别配置独立的数据库和角色。 @@ -343,7 +345,7 @@ generation failures are terminal step/run results, not successful empty content. #### Remote verification and deployment Normal `ces-control` CI runs formatting, tests, builds, migration checks and -isolated PostgreSQL integration tests. `deploy/check-canvas-real.sh bin/foundry` +isolated PostgreSQL integration tests. `deploy/check-canvas-real.sh bin/bedrock` is an explicit remote-runner-only real-model verification; it does not run in normal CI. Set `FOUNDRY_CANVAS_IMAGE_MODELS` to backend names already verified for image output. The check starts a temporary CLI worker and database and removes @@ -368,9 +370,9 @@ numbered migrations and confirm capabilities before migrating a real canvas. Production deployment of merge commit `b4e537b4adedeb524971cbbdd3f52c61257b10da` succeeded on the confirmed ECS runner on 2026-11-06. Main checks -[run 912](https://gitea.entroia.com/Zayden-Jung/foundry-core/actions/runs/912) +[run 912](https://gitea.entroia.com/Zayden-Jung/Bedrock/actions/runs/912) and deployment -[run 913](https://gitea.entroia.com/Zayden-Jung/foundry-core/actions/runs/913) +[run 913](https://gitea.entroia.com/Zayden-Jung/Bedrock/actions/runs/913) both succeeded. The base URL is `https://api.foundry.entroia.com`. The deployed capabilities endpoint reported contract `canvas-v2-2026-11-06` with both text and image available; the worker uses the backend verified above. diff --git a/cmd/foundry/main.go b/cmd/bedrock/main.go similarity index 96% rename from cmd/foundry/main.go rename to cmd/bedrock/main.go index 5b8d55a..d371903 100644 --- a/cmd/foundry/main.go +++ b/cmd/bedrock/main.go @@ -11,10 +11,10 @@ import ( "os" "time" - "gitea.entroia.com/Zayden-Jung/foundry-core/internal/auth" - "gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex" - "gitea.entroia.com/Zayden-Jung/foundry-core/internal/platform" - "gitea.entroia.com/Zayden-Jung/foundry-core/internal/research" + "gitea.entroia.com/Zayden-Jung/Bedrock/internal/auth" + "gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex" + "gitea.entroia.com/Zayden-Jung/Bedrock/internal/platform" + "gitea.entroia.com/Zayden-Jung/Bedrock/internal/research" "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/stdlib" ) diff --git a/deploy/check-canvas-real.sh b/deploy/check-canvas-real.sh index c9afd05..a7bfece 100644 --- a/deploy/check-canvas-real.sh +++ b/deploy/check-canvas-real.sh @@ -46,13 +46,13 @@ docker run -d --name "$worker" --init --network bridge --user 1000:1000 \ --tmpfs /tmp:rw,nosuid,nodev,size=128m --tmpfs /work:ro,nosuid,nodev \ --tmpfs /home/node/.codex:rw,nosuid,nodev,size=32m,uid=1000,gid=1000 --workdir /work \ -e "FOUNDRY_CANVAS_IMAGE_MODELS=$FOUNDRY_CANVAS_IMAGE_MODELS" \ - --mount "type=bind,source=$binary,target=/opt/foundry,readonly" \ + --mount "type=bind,source=$binary,target=/opt/bedrock,readonly" \ --mount "type=bind,source=$cli,target=/opt/codex,readonly" \ --mount "type=bind,source=$login/auth.json,target=/home/node/.codex/auth.json,readonly" \ --mount "type=bind,source=$login/models_cache.json,target=/home/node/.codex/models_cache.json,readonly" \ --mount "type=bind,source=$scratch/run,target=/run/foundry-codex" \ --mount type=bind,source=/etc/ssl/certs/ca-certificates.crt,target=/etc/ssl/certs/ca-certificates.crt,readonly \ - node:24-bookworm-slim /opt/foundry codex-worker >/dev/null + node:24-bookworm-slim /opt/bedrock codex-worker >/dev/null for attempt in {1..30}; do if [[ -S "$scratch/run/worker.sock" ]]; then break; fi; sleep 1; done test -S "$scratch/run/worker.sock" diff --git a/deploy/codex-worker.sh b/deploy/codex-worker.sh index 7855734..1d7549e 100644 --- a/deploy/codex-worker.sh +++ b/deploy/codex-worker.sh @@ -27,16 +27,16 @@ if [[ -s "$dir/canvas.env" ]]; then canvas_env=(--env-file "$dir/canvas.env"); f # CLI/二进制只读挂载,Core 只看到 socket,不共享本登录目录。 # 容器参数分工:--init 负责子进程收尾,资源上限限制进程数/内存,cap-drop 与 no-new-privileges 收紧权限。 # /tmp 可写用于临时任务,/work 只读且设为工作目录;没有 -p,因此不向宿主发布 worker 的 TCP 端口。 -# 挂载中 /opt/foundry 是 Go worker,/opt/codex 是预装 Node CLI;执行 CLI 才是这里需要 Node 环境的原因。 +# 挂载中 /opt/bedrock 是 Go worker,/opt/codex 是预装 Node CLI;执行 CLI 才是这里需要 Node 环境的原因。 # 最后一行的 codex-worker 参数选中 main.go 的 worker 分支,而不是启动普通 Foundry HTTP API。 docker run -d --name foundry-codex-worker --restart unless-stopped --init \ --network bridge --user 1000:1000 --cap-drop ALL --security-opt no-new-privileges \ --read-only --pids-limit 128 --memory 1g --tmpfs /tmp:rw,nosuid,nodev \ --tmpfs /work:ro,nosuid,nodev --workdir /work \ - --mount "type=bind,source=$binary,target=/opt/foundry,readonly" \ + --mount "type=bind,source=$binary,target=/opt/bedrock,readonly" \ --mount "type=bind,source=$base/codex-cli,target=/opt/codex,readonly" \ --mount "type=bind,source=$dir/home,target=/home/node/.codex" \ --mount "type=bind,source=$dir/run,target=/run/foundry-codex" \ --mount "type=bind,source=/etc/ssl/certs/ca-certificates.crt,target=/etc/ssl/certs/ca-certificates.crt,readonly" \ "${canvas_env[@]}" \ - node:24-bookworm-slim /opt/foundry codex-worker + node:24-bookworm-slim /opt/bedrock codex-worker diff --git a/deploy/release.sh b/deploy/release.sh index 1b36849..fb1083a 100644 --- a/deploy/release.sh +++ b/deploy/release.sh @@ -63,7 +63,7 @@ python3 "$(dirname "$0")/migrate.py" # 每次发布使用独立二进制目录供只读挂载;本脚本不清除旧 release 目录。 release=$(mktemp -d "$foundry/release.XXXXXXXX") -install -m 755 "$1" "$release/foundry" +install -m 755 "$1" "$release/bedrock" # 容器内监听全部接口供同网络的代理访问;端口 8080 没有在此发布到宿主公网,TLS 由 Traefik 处理。 export HOST=0.0.0.0 PORT=8080 PUBLIC_ORIGIN="$origin" @@ -113,7 +113,7 @@ if [[ -d "$codex_dir" ]]; then # 用当前 release 的同一份 Go 二进制启动 worker,避免 Core/worker 的画布产物协议不一致。 # 目录探测只验证 socket 和非空模型目录,不执行一次真实生成,也不验证模型账户额度。 worker_ready=false - if bash "$(dirname "$0")/codex-worker.sh" "$release/foundry" >/dev/null; then + if bash "$(dirname "$0")/codex-worker.sh" "$release/bedrock" >/dev/null; then for attempt in {1..20}; do if docker exec foundry-codex-worker node -e ' const http = require("node:http"); @@ -157,7 +157,7 @@ if [[ -d "$codex_dir" ]]; then ) fi -# 使用现成 node 镜像作为运行载体,实际启动 /opt/foundry 这个 Go 可执行文件,不在此 docker build。 +# 使用现成 node 镜像作为运行载体,实际启动 /opt/bedrock 这个 Go 可执行文件,不在此 docker build。 # Node 供就绪探测使用;CA bundle 供 Go 的 HTTPS 客户端使用,二者的证书来源不能混为一谈。 # Core 只挂载 IPC/授权表,不挂载 CLI 登录;以非 root、只读根文件系统和裁剪能力运行。 docker run -d --name "$candidate" "${codex_mounts[@]}" "${mail_env[@]}" "${slack_env[@]}" "${research_env[@]}" --network "$network" \ @@ -167,8 +167,8 @@ docker run -d --name "$candidate" "${codex_mounts[@]}" "${mail_env[@]}" "${slack --read-only --memory 1g \ --mount "type=bind,source=$ca_bundle,target=/etc/ssl/certs/ca-certificates.crt,readonly" \ -e SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \ - --mount "type=bind,source=$release/foundry,target=/opt/foundry,readonly" \ - node:24-bookworm-slim /opt/foundry >/dev/null + --mount "type=bind,source=$release/bedrock,target=/opt/bedrock,readonly" \ + node:24-bookworm-slim /opt/bedrock >/dev/null # 候选或路由失败时删除本次新 Core;旧 Core 由 route 成功探测后才停止。 cleanup_candidate() { diff --git a/docs/research-api.md b/docs/research-api.md index 1d6f2eb..36b3510 100644 --- a/docs/research-api.md +++ b/docs/research-api.md @@ -1,6 +1,6 @@ # Shared research API -This work belongs to Thesisly 研迹 and uses Foundry Core rather than a separate +This work belongs to Thesisly 研迹 and uses Bedrock rather than a separate application backend. The corpus is public; account sessions and future private collections remain project scoped. @@ -8,7 +8,7 @@ collections remain project scoped. `internal/research` implements the HTTP contract and a PostgreSQL repository based on the fixed Paper Atlas `a3b677b` schema (TEXT/BIGINT columns, native -English title/abstract search index). `cmd/foundry` enables it only when +English title/abstract search index). `cmd/bedrock` enables it only when `FOUNDRY_RESEARCH_DATABASE_URL` is configured. The Paper Atlas migration is now published: 21 tables passed its independent count/content-hash acceptance. A dedicated `foundry_research_reader` role has SELECT on the ten tables consumed here, schema USAGE, and read-only defaults. diff --git a/go.mod b/go.mod index 41b4c89..80c0492 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,5 @@ // Foundry Go 模块身份,internal 包的导入前缀必须与此一致。 -module gitea.entroia.com/Zayden-Jung/foundry-core +module gitea.entroia.com/Zayden-Jung/Bedrock // CI 从此读取工具链版本,避免开发和远程构建使用不同语言契约。 go 1.25.0 diff --git a/internal/platform/canvas_ai_apply.go b/internal/platform/canvas_ai_apply.go index 96e0c17..eb3d59c 100644 --- a/internal/platform/canvas_ai_apply.go +++ b/internal/platform/canvas_ai_apply.go @@ -6,7 +6,7 @@ import ( "database/sql" "encoding/json" "errors" - "gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex" + "gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex" ) // startCanvasStep 持工作区锁解析目标当前 owner,再检查租约、编辑权限与内容指纹,成功才将 queued 改 running。 diff --git a/internal/platform/canvas_ai_image_inputs.go b/internal/platform/canvas_ai_image_inputs.go index 9ef3a69..2b7914f 100644 --- a/internal/platform/canvas_ai_image_inputs.go +++ b/internal/platform/canvas_ai_image_inputs.go @@ -16,7 +16,7 @@ import ( "strings" "time" - "gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex" + "gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex" ) // canvasPublicIP 排除本地/私有/链路/保留测试网和已列元数据地址,IPv4 映射先 Unmap 再检查。 diff --git a/internal/platform/canvas_ai_images.go b/internal/platform/canvas_ai_images.go index 3a19708..42daf0f 100644 --- a/internal/platform/canvas_ai_images.go +++ b/internal/platform/canvas_ai_images.go @@ -8,7 +8,7 @@ import ( "encoding/hex" "errors" - "gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex" + "gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex" ) // persistCanvasImage 完整解码 worker 图片并核对 MIME,以 outputID 作为幂等键存原图。 diff --git a/internal/platform/canvas_ai_integration_test.go b/internal/platform/canvas_ai_integration_test.go index 8bbfe80..7586498 100644 --- a/internal/platform/canvas_ai_integration_test.go +++ b/internal/platform/canvas_ai_integration_test.go @@ -21,7 +21,7 @@ import ( "sync/atomic" "testing" - "gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex" + "gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex" ) // TestCanvasAIJobLifecycle 通过真实准入/认领/写回验证几何并发、内容冲突、取消、租约恢复、图片和传播失败分支。 diff --git a/internal/platform/canvas_ai_model_integration_test.go b/internal/platform/canvas_ai_model_integration_test.go index 1f6aec0..36a9450 100644 --- a/internal/platform/canvas_ai_model_integration_test.go +++ b/internal/platform/canvas_ai_model_integration_test.go @@ -22,7 +22,7 @@ import ( "sync/atomic" "testing" - "gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex" + "gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex" ) // TestCanonicalAIAdmissionAndLifecycle 需隔离 PLATFORM_TEST_DATABASE_URL,覆盖 owner 迁移、代数失效及 v2 确定拒绝恢复。 diff --git a/internal/platform/canvas_ai_models.go b/internal/platform/canvas_ai_models.go index c86caf8..376aefc 100644 --- a/internal/platform/canvas_ai_models.go +++ b/internal/platform/canvas_ai_models.go @@ -7,7 +7,7 @@ import ( "net/http" "time" - "gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex" + "gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex" ) // canvasAIModels 要求 board 可读;worker 不可用时返回空目录及原因,不把基础能力发现变成请求失败。 diff --git a/internal/platform/canvas_ai_real_test.go b/internal/platform/canvas_ai_real_test.go index 0eb1d6d..78db848 100644 --- a/internal/platform/canvas_ai_real_test.go +++ b/internal/platform/canvas_ai_real_test.go @@ -19,7 +19,7 @@ import ( "strings" "testing" - "gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex" + "gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex" ) // Opt in only on the confirmed remote runner with its dedicated CLI worker. diff --git a/internal/platform/canvas_ai_runs.go b/internal/platform/canvas_ai_runs.go index f0ed13a..eacaef8 100644 --- a/internal/platform/canvas_ai_runs.go +++ b/internal/platform/canvas_ai_runs.go @@ -13,7 +13,7 @@ import ( "time" "unicode/utf8" - "gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex" + "gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex" ) // appendAIEvent 用单条 SQL 原子递增 run.last_seq 并插入事件,序号与业务状态一起提交。 diff --git a/internal/platform/canvas_ai_scheduler.go b/internal/platform/canvas_ai_scheduler.go index 7eb8e99..549b561 100644 --- a/internal/platform/canvas_ai_scheduler.go +++ b/internal/platform/canvas_ai_scheduler.go @@ -10,7 +10,7 @@ import ( "time" "unicode/utf8" - "gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex" + "gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex" ) // canvasQueueRun 保存本轮认领租约,后续状态写入必须匹配 Lease,旧执行者不能冒充新认领者。 diff --git a/internal/platform/canvas_headless_worker_integration_test.go b/internal/platform/canvas_headless_worker_integration_test.go index 7229a99..ab15c94 100644 --- a/internal/platform/canvas_headless_worker_integration_test.go +++ b/internal/platform/canvas_headless_worker_integration_test.go @@ -16,7 +16,7 @@ import ( "sync/atomic" "testing" - "gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex" + "gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex" ) // Only the generation transport is deterministic. Admission, claims, events, diff --git a/internal/platform/http.go b/internal/platform/http.go index 9801181..77be465 100644 --- a/internal/platform/http.go +++ b/internal/platform/http.go @@ -13,8 +13,8 @@ import ( "regexp" "strings" - "gitea.entroia.com/Zayden-Jung/foundry-core/internal/auth" - "gitea.entroia.com/Zayden-Jung/foundry-core/internal/codex" + "gitea.entroia.com/Zayden-Jung/Bedrock/internal/auth" + "gitea.entroia.com/Zayden-Jung/Bedrock/internal/codex" "github.com/jackc/pgx/v5/pgconn" ) diff --git a/internal/platform/integration_test.go b/internal/platform/integration_test.go index 02bd984..90250e0 100644 --- a/internal/platform/integration_test.go +++ b/internal/platform/integration_test.go @@ -11,7 +11,7 @@ import ( "encoding/base64" "encoding/hex" "encoding/json" - "gitea.entroia.com/Zayden-Jung/foundry-core/internal/auth" + "gitea.entroia.com/Zayden-Jung/Bedrock/internal/auth" "image" "image/png" "io" -- 2.52.0