fix(objectgateway): 取消整桶独占前置并按维护停写更新
build / build (push) Failing after 2m29s

现象:共享桶部署下网关启动即报 gateway_auditor_key_required,残留过期
审计文件则每次 Execute 报 gateway_exclusive_writer_evidence_unverified;
用户已改为“停目标写入容器→更新→启动”的维护式更新。

根因:Gateway.Ready 强制 Isolation.Verify,main 强制 Ed25519 公钥,等于
把整桶独占证明当作发布前置;这与共享桶、沿用原 AK 的实际部署矛盾。

取舍:删除审计校验与相关 env 依赖,保留 journal、治理 PG 只读 authority、
plan/owner/attempt/epoch 绑定、intent-before-send、单次写与精确版本回滚。
create 仅在精确版本读回且仍为 current 时提交;发现外部 latest 只返回冲突,
不在 confirm 阶段删除(journal create intent 已提交,删除会变成无 delete
intent/receipt 的未记账副作用并让 intent 永久 held)。同 key 不自动合并。

证据:真实二进制无审计/残留审计两环境通过;kg-pgtest-writeset 一次性库 +
随机 MinIO 桶跑 14 个网关用例(含共享桶共存写者、同 key 既有对象拒绝、
精确回滚)全过;umask 022 下 make verify 本地必需项全 success。
This commit is contained in:
姚章浩
2026-11-04 09:45:47 +08:00
parent 017765763a
commit a55319d972
25 changed files with 510 additions and 171 deletions
@@ -54,7 +54,7 @@ func OpenR10AdmissionFixture(t *testing.T) R10AdmissionFixture {
authority := &GatewayGovernanceAuthority{Pool: reader, ArchiveRoot: fx.archiveRoot, TargetID: "r10-admission", Provider: "minio", Bucket: fx.bucket}
endpoint := os.Getenv("KG_LIBRARY_TEST_S3_ENDPOINT")
scope := objectgateway.Digest([]byte("minio\x00" + endpoint + "\x00" + fx.bucket))
gateway := &objectgateway.Gateway{Pool: governancePool, Scope: scope, Backend: &objectgateway.S3Backend{Client: fx.objects.s3.client, Bucket: fx.bucket, MaxBytes: 1 << 20}, Authority: authority, Isolation: gatewayFixtureIsolation{}, MaxBytes: 1 << 20}
gateway := &objectgateway.Gateway{Pool: governancePool, Scope: scope, Backend: &objectgateway.S3Backend{Client: fx.objects.s3.client, Bucket: fx.bucket, MaxBytes: 1 << 20}, Authority: authority, MaxBytes: 1 << 20}
token := objectgateway.Digest([]byte("r10-admission-data"))
server := httptest.NewServer(objectgateway.HTTPServer{Gateway: gateway, DataToken: token, ControlToken: objectgateway.Digest([]byte("r10-admission-control"))})
t.Cleanup(server.Close)
@@ -128,7 +128,7 @@ func TestContractGatewayAuthorityFrozenPlanIsolated(t *testing.T) {
t.Fatal("privileged controller reader accepted")
}
backend := &gatewayCountBackend{Backend: &objectgateway.S3Backend{Client: fx.objects.s3.client, Bucket: fx.bucket, MaxBytes: 1 << 20}}
gateway := &objectgateway.Gateway{Pool: governancePool, Scope: fx.bucket, Backend: backend, Authority: authority, Isolation: gatewayFixtureIsolation{}, MaxBytes: 1 << 20}
gateway := &objectgateway.Gateway{Pool: governancePool, Scope: fx.bucket, Backend: backend, Authority: authority, MaxBytes: 1 << 20}
data := objectgateway.Digest([]byte("authority-data"))
server := httptest.NewServer(objectgateway.HTTPServer{Gateway: gateway, DataToken: data, ControlToken: objectgateway.Digest([]byte("authority-control"))})
defer server.Close()
@@ -9,10 +9,6 @@ import (
"knowledge-governance/internal/objectgateway"
)
type gatewayFixtureIsolation struct{}
func (gatewayFixtureIsolation) Verify(context.Context) error { return nil }
// Test controller issues the grant only after the saga has frozen its actual
// plan. Production controller delivery is a separate integration prerequisite.
type gatewayFixtureController struct {
@@ -35,7 +31,7 @@ func TestContractGatewayActualSagaRollbackIsolated(t *testing.T) {
before := universeDump(t, fx.pool)
snapshot := sealSourceSnapshot(t, fx, nil)
target := fx.target(t)
gateway := &objectgateway.Gateway{Pool: fx.pool, Scope: fx.bucket, Backend: &objectgateway.S3Backend{Client: fx.objects.s3.client, Bucket: fx.bucket, MaxBytes: 1 << 20}, Isolation: gatewayFixtureIsolation{}, MaxBytes: 1 << 20}
gateway := &objectgateway.Gateway{Pool: fx.pool, Scope: fx.bucket, Backend: &objectgateway.S3Backend{Client: fx.objects.s3.client, Bucket: fx.bucket, MaxBytes: 1 << 20}, MaxBytes: 1 << 20}
token := objectgateway.Digest([]byte("data-fixture"))
server := httptest.NewServer(objectgateway.HTTPServer{Gateway: gateway, DataToken: token, ControlToken: objectgateway.Digest([]byte("control-fixture"))})
defer server.Close()