Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cell-manifest-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
path: gocell-web

# 后端 cells 源(公开仓库 ghbvf/gocell),checkout 为 gocell-web 的同级目录
# (cell-manifest 默认读 ../gocell/cells)。
# (cell-manifest 默认读 ../gocell/corecells)。
- name: Checkout gocell (backend cells)
uses: actions/checkout@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions packages/devboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> 开发者平台聚合视图:Cells / Groups / Coverage / Contracts / Deps(Batch 5/6)
>
> **对应后端 cell**:无(聚合派生视图)。Cells 数据由构建期从后端 `../gocell/cells/*/cell.yaml` + `slices/*/slice.yaml` 派生(见下)。
> **对应后端 cell**:无(聚合派生视图)。Cells 数据由构建期从后端 `../gocell/corecells/*/cell.yaml` + `slices/*/slice.yaml` 派生(见下)。

## 对外 exports

Expand Down Expand Up @@ -35,7 +35,7 @@ PDP 门:后端无 `contract`/`dep`/`group` resource,路由守卫降级到 `r
`tools/cell-manifest/` 镜像 `tools/codegen` 模式:构建期读后端 `cell.yaml` + `slice.yaml` → 派生 `src/manifest/cells.generated.ts`(`/* eslint-disable */` + DO-NOT-EDIT banner,prettier-ignored)。

- 单源派生 + CI `git diff --exit-code`(`.github/workflows/cell-manifest-diff.yml`)守门,业务包手改生成物即红 → 违反不可表达(Hard)。
- 本地重跑:`GOCELL_CELLS_DIR=../gocell/cells pnpm cell-manifest`(CI 把 `ghbvf/gocell` checkout 为同级目录,默认路径生效)。
- 本地重跑:`GOCELL_CELLS_DIR=../gocell/corecells pnpm cell-manifest`(CI 把 `ghbvf/gocell` checkout 为同级目录,默认路径生效)。
- `slice.yaml` 的 `contractUsages[].role`:`serve`/`publish` → cell **produces**;`call`/`subscribe` → **consumes**;跨 cell 的 consume→produce 解析出 `dependsOnCells` / `requiredByCells`。
- **不可派生字段**(运行时 QPS/p95/健康分、tasks、SLOC、version、oncall)→ 显式降级为 "—" / `UnavailablePanel`,**绝不伪造**。需后端健康端点(BR-001)才补。

Expand Down
156 changes: 153 additions & 3 deletions packages/devboard/src/manifest/cells.generated.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable */
// AUTO-GENERATED by tools/cell-manifest — DO NOT EDIT BY HAND.
// Source: gocell/cells/**
// Source: gocell/corecells/**
// Regenerate: pnpm cell-manifest (CI guards via git diff --exit-code)
import type { CellManifest } from './types'

Expand Down Expand Up @@ -149,6 +149,50 @@ export const CELL_MANIFEST: CellManifest = {
],
"waivers": []
},
{
"id": "policymanage",
"belongsToCell": "accesscore",
"consistencyLevel": "L2",
"lifecycle": "asset",
"contractUsages": [
{
"contract": "event.policy.updated.v1",
"role": "publish"
},
{
"contract": "http.policy.create.v1",
"role": "serve"
},
{
"contract": "http.policy.get.v1",
"role": "serve"
},
{
"contract": "http.policy.update.v1",
"role": "serve"
},
{
"contract": "http.policy.delete.v1",
"role": "serve"
},
{
"contract": "http.policy.list.v1",
"role": "serve"
}
],
"unitTests": [
"unit.policymanage.service"
],
"contractTests": [
"contract.event.policy.updated.v1.publish",
"contract.http.policy.create.v1.serve",
"contract.http.policy.get.v1.serve",
"contract.http.policy.update.v1.serve",
"contract.http.policy.delete.v1.serve",
"contract.http.policy.list.v1.serve"
],
"waivers": []
},
{
"id": "rbacassign",
"belongsToCell": "accesscore",
Expand Down Expand Up @@ -328,6 +372,25 @@ export const CELL_MANIFEST: CellManifest = {
"contractTests": [],
"waivers": []
},
{
"id": "sessionverifyrpc",
"belongsToCell": "accesscore",
"consistencyLevel": "L0",
"lifecycle": "experimental",
"contractUsages": [
{
"contract": "grpc.auth.session.verify.v1",
"role": "serve"
}
],
"unitTests": [
"unit.sessionverifyrpc.server"
],
"contractTests": [
"contract.grpc.auth.session.verify.v1.serve"
],
"waivers": []
},
{
"id": "setup",
"belongsToCell": "accesscore",
Expand Down Expand Up @@ -368,6 +431,10 @@ export const CELL_MANIFEST: CellManifest = {
"contract": "event.auth.bootstrap-failed.v1",
"role": "publish"
},
{
"contract": "event.policy.updated.v1",
"role": "publish"
},
{
"contract": "event.role.assigned.v1",
"role": "publish"
Expand Down Expand Up @@ -404,6 +471,10 @@ export const CELL_MANIFEST: CellManifest = {
"contract": "event.user.updated.v1",
"role": "publish"
},
{
"contract": "grpc.auth.session.verify.v1",
"role": "serve"
},
{
"contract": "http.auth.login.v1",
"role": "serve"
Expand Down Expand Up @@ -471,6 +542,26 @@ export const CELL_MANIFEST: CellManifest = {
{
"contract": "http.auth.user.update.v1",
"role": "serve"
},
{
"contract": "http.policy.create.v1",
"role": "serve"
},
{
"contract": "http.policy.delete.v1",
"role": "serve"
},
{
"contract": "http.policy.get.v1",
"role": "serve"
},
{
"contract": "http.policy.list.v1",
"role": "serve"
},
{
"contract": "http.policy.update.v1",
"role": "serve"
}
],
"consumes": [
Expand Down Expand Up @@ -697,13 +788,18 @@ export const CELL_MANIFEST: CellManifest = {
{
"contract": "http.audit.list.v1",
"role": "serve"
},
{
"contract": "http.audit.get.v1",
"role": "serve"
}
],
"unitTests": [
"unit.auditquery.service"
],
"contractTests": [
"contract.http.audit.list.v1.serve"
"contract.http.audit.list.v1.serve",
"contract.http.audit.get.v1.serve"
],
"waivers": []
}
Expand All @@ -713,6 +809,10 @@ export const CELL_MANIFEST: CellManifest = {
"contract": "event.audit.appended.v1",
"role": "publish"
},
{
"contract": "http.audit.get.v1",
"role": "serve"
},
{
"contract": "http.audit.list.v1",
"role": "serve"
Expand Down Expand Up @@ -1106,7 +1206,57 @@ export const CELL_MANIFEST: CellManifest = {
"accesscore",
"auditcore"
]
},
{
"id": "syscore",
"name": "SysCore",
"domain": "Sys",
"type": "support",
"consistencyLevel": "L1",
"lifecycle": "asset",
"durabilityMode": "durable",
"owner": {
"team": "platform",
"role": "cell-owner"
},
"goStructName": "SysCore",
"schemaPrimary": "cell_syscore",
"requires": [],
"l0Dependencies": [],
"smokeTests": [
"smoke.syscore.startup"
],
"slices": [
{
"id": "healthread",
"belongsToCell": "syscore",
"consistencyLevel": "L0",
"lifecycle": "asset",
"contractUsages": [
{
"contract": "http.admin.health.cells.v1",
"role": "serve"
}
],
"unitTests": [
"unit.healthread.service"
],
"contractTests": [
"contract.http.admin.health.cells.v1.serve"
],
"waivers": []
}
],
"produces": [
{
"contract": "http.admin.health.cells.v1",
"role": "serve"
}
],
"consumes": [],
"dependsOnCells": [],
"requiredByCells": []
}
],
"generatedFrom": "gocell/cells/**/{cell.yaml,slices/*/slice.yaml}"
"generatedFrom": "gocell/corecells/**/{cell.yaml,slices/*/slice.yaml}"
}
4 changes: 2 additions & 2 deletions packages/devboard/src/stores/useCellsStore.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ describe('useCellsStore', () => {
expect(store.selectedId).toBeNull()
})

it('cells returns all manifest cells (length 3)', () => {
it('cells returns all manifest cells (length 4)', () => {
const store = useCellsStore()
expect(store.cells).toBe(CELL_MANIFEST.cells)
expect(store.cells.length).toBe(3)
expect(store.cells.length).toBe(4)
})

it('byId returns a known cell entry', () => {
Expand Down
4 changes: 2 additions & 2 deletions tools/cell-manifest/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# @gocell/cell-manifest

> Cell manifest 单向派生器:后端 `gocell/cells/*/cell.yaml` + `slices/*/slice.yaml` → `packages/devboard/src/manifest/cells.generated.ts`。
> Cell manifest 单向派生器:后端 `gocell/corecells/*/cell.yaml` + `slices/*/slice.yaml` → `packages/devboard/src/manifest/cells.generated.ts`。

是 AI-robust「Hard」约束的执行体(`ai-robust.md` §载体决策原则 第 1 条):单源 YAML 派生 + CI `git diff --exit-code` 守门(`.github/workflows/cell-manifest-diff.yml`),业务包手改生成物在 CI 不可表达。生成文件带 `: CellManifest` 类型注解(来自 devboard 的规范 `./types`),任何形状漂移在 `@gocell/devboard typecheck` 失败。

Expand All @@ -10,7 +10,7 @@
pnpm cell-manifest # = pnpm -F @gocell/cell-manifest generate
```

- **源路径**:默认 `<repo>/../gocell/cells`(gocell-web 与后端 gocell 同级 checkout;CI 亦如此布局)。可经环境变量 `GOCELL_CELLS_DIR` 覆盖(如 git worktree 本地开发:`GOCELL_CELLS_DIR=../gocell/cells pnpm cell-manifest`)。
- **源路径**:默认 `<repo>/../gocell/corecells`(gocell-web 与后端 gocell 同级 checkout;CI 亦如此布局)。可经环境变量 `GOCELL_CELLS_DIR` 覆盖(如 git worktree 本地开发:`GOCELL_CELLS_DIR=../gocell/corecells pnpm cell-manifest`)。
- **产物**:`packages/devboard/src/manifest/cells.generated.ts`,带 `/* eslint-disable */` + DO-NOT-EDIT banner(已加入 `eslint.config.js` ignores + `.prettierignore`)。

## 派生规则
Expand Down
4 changes: 2 additions & 2 deletions tools/cell-manifest/src/derive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ describe('buildManifest', () => {

it('generatedFrom is the static note (deterministic, no timestamp)', () => {
const manifest = buildManifest([])
expect(manifest.generatedFrom).toBe('gocell/cells/**/{cell.yaml,slices/*/slice.yaml}')
expect(manifest.generatedFrom).toBe('gocell/corecells/**/{cell.yaml,slices/*/slice.yaml}')
})

it('[blind-spot] determinism: buildManifest twice on same input → deep-equal', () => {
Expand Down Expand Up @@ -657,7 +657,7 @@ describe('renderManifestModule', () => {
it('produces a TS module string with CELL_MANIFEST export', () => {
const manifest: CellManifest = {
cells: [],
generatedFrom: 'gocell/cells/**/{cell.yaml,slices/*/slice.yaml}',
generatedFrom: 'gocell/corecells/**/{cell.yaml,slices/*/slice.yaml}',
}
const output = renderManifestModule(manifest)
expect(output).toContain('/* eslint-disable */')
Expand Down
4 changes: 2 additions & 2 deletions tools/cell-manifest/src/derive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export function buildManifest(rawCells: RawCellWithSlices[]): CellManifest {

return {
cells: finalEntries,
generatedFrom: 'gocell/cells/**/{cell.yaml,slices/*/slice.yaml}',
generatedFrom: 'gocell/corecells/**/{cell.yaml,slices/*/slice.yaml}',
}
}

Expand All @@ -327,7 +327,7 @@ export function renderManifestModule(m: CellManifest): string {
return [
'/* eslint-disable */',
'// AUTO-GENERATED by tools/cell-manifest — DO NOT EDIT BY HAND.',
'// Source: gocell/cells/**',
'// Source: gocell/corecells/**',
'// Regenerate: pnpm cell-manifest (CI guards via git diff --exit-code)',
"import type { CellManifest } from './types'",
'',
Expand Down
4 changes: 2 additions & 2 deletions tools/cell-manifest/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @gocell/cell-manifest — IO orchestration layer.
*
* Reads cell.yaml + slices/[x]/slice.yaml from GOCELL_CELLS_DIR (defaults to
* ../gocell/cells relative to repo root), derives CellManifest via pure
* ../gocell/corecells relative to repo root), derives CellManifest via pure
* derive.ts functions, and writes the generated TS module to
* packages/devboard/src/manifest/cells.generated.ts.
*
Expand All @@ -18,7 +18,7 @@ import { buildManifest, renderManifestModule } from './derive'

const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url))
const REPO_ROOT = resolve(SCRIPT_DIR, '../../..')
const CELLS_DIR = resolve(process.env['GOCELL_CELLS_DIR'] ?? join(REPO_ROOT, '../gocell/cells'))
const CELLS_DIR = resolve(process.env['GOCELL_CELLS_DIR'] ?? join(REPO_ROOT, '../gocell/corecells'))
const OUT = join(REPO_ROOT, 'packages/devboard/src/manifest/cells.generated.ts')

function main(): void {
Expand Down
Loading