Skip to content

feat(tools,www): typed Content Graph with deterministic generate + fail-closed CI gate (#1157, B2.4) - #1303

Merged
SisyphusZheng merged 1 commit into
devfrom
kimi/v044-b24-1157-content-graph
Sep 4, 2026
Merged

feat(tools,www): typed Content Graph with deterministic generate + fail-closed CI gate (#1157, B2.4)#1303
SisyphusZheng merged 1 commit into
devfrom
kimi/v044-b24-1157-content-graph

Conversation

@SisyphusZheng

Copy link
Copy Markdown
Member

Part of #1157 (B2.4, stage #1288). Website-side consumption of the graph's nav/SEO/locale queries lands with #1159; this PR delivers the graph itself, its adapters, validators, queries, determinism and CI drift gate.

Problem

Website/API documentation truth was hand-copied between owned repository sources (Markdown collections, PACKAGE_SURFACE.md machine blocks, the UI compiler manifest, the roadmap timeline, release truth) and public surfaces, with no typed intermediate representation and no mechanical drift gate.

Owner

B2.4 / #1157 — typed Content Graph (tools + generated www data artifact).

Before

No content graph. Adapters for the Beta.2 truth sources did not exist; duplicate ids, broken content references and false locale alternates had no fail-closed validation; there was no deterministic generate/check pipeline for cross-source content truth.

After

  • tools/lib/content-graph.ts: normalized entry / source-location / locale / reference / fingerprint schemas; fail-closed validators (duplicate ids, broken entry/route references, orphan locales, asymmetric alternate pairs, byte-identical "translations"); deterministic queries for doc routes, locale availability, search records and per-route SEO metadata; a canonical serializer with sorted entries/arrays/keys.
  • tools/lib/content-graph-adapters.ts: exactly the five Beta.2 adapters — Markdown (via the adapter-vite collection loader, no new parser), public API data (PACKAGE_SURFACE.md machine blocks, reusing extractSurfaceMap/extractExportClassMap now exported from check-package-surface.ts), compiler metadata (packages/ui/src/generated-manifest.json: tags/attributes/events/slots/CSS parts/layer/hydrate), roadmap timeline (via tools/lib/typescript-ast.ts — no hand-rolled TS parser), release truth (docs/release/release-state.json + per-release notes).
  • tools/generate-content-graph.ts + deno task generate:content-graph / deno task content-graph:check: generates www/app/data/_generated-content-graph.json (276 entries) and check-mode requires byte-identical regeneration.
  • CI gate content-graph:check registered in tools/autoflow/policy.ts (ci + release tiers) with path triggers over every graph input.

Why-not-second-owner

No public-surface change: packages are untouched; the new artifact under www/app/data is not imported by the app yet (consumption is #1159's wiring). The adapter-vite reuse is import-only, so no adapter owner change is needed.

Evidence

  • deno task generate:content-graph → 276 entries; two consecutive runs cmp byte-identical; deno task content-graph:check passes.
  • Fail-closed proof: first run against real sources correctly rejected orphan zh roadmap entries (6 failures) until the bilingual timeline was modeled as alternates.
  • Unit/integration tests: tools/lib/content-graph.test.ts + tools/lib/content-graph-adapters.test.ts — 12 passed (duplicate-id, broken-ref, false/asymmetric/orphan/untranslated-alternate cases; determinism; all four queries; real-repo graph contains all five adapter kinds).
  • deno task test — 1830 passed (105 steps) | 0 failed | 1 ignored; supabase example suite 150 passed.
  • deno fmt --check, deno lint, deno task lint:markdown, deno task typecheck — clean.
  • deno task build — green (Pagefind 150 pages; www artifact truth passed).
  • deno task test:e2e (chromium) — 167 passed, 4 failed: only the known local visual-baseline drift on architecture-islands-deep mobile screenshots (stage [B2] Element / Router core convergence, UI dogfood and continuous cleanup #1288 carried-risk build-ssg CLI crashes: Vite SSR throws "Invalid or unexpected token" when evaluating generated .less-ssg-entry.ts #2, CI green; this PR touches no rendering path).
  • Adjacent gates green: repo:hygiene, text-integrity:check, www:check-current-truth, docs:check-current, autoflow policy tests (33).

Scope

New: 2 tools/lib modules + 2 test files + 1 generator CLI + 1 generated artifact. Modified: deno.json tasks, tools/autoflow/policy.ts (gate registration), tools/check-package-surface.ts (export two existing functions — no behavior change). No frozen-semantics paths touched.

Risk

Low. All new machinery is additive; the only edit to existing logic is exporting two previously private functions. The roadmap AST extraction assumes static string fields in the route's entries record; non-static values are skipped rather than misread, and the validator fails closed if the timeline disappears.

…il-closed CI gate (#1157, B2.4)

Define the normalized entry/source-location/locale/reference/fingerprint
schemas (tools/lib/content-graph.ts) and the five Beta.2 adapters
(tools/lib/content-graph-adapters.ts): Markdown collections via the
adapter-vite collection loader, public API data from the PACKAGE_SURFACE.md
machine blocks, compiler metadata from the @openelement/ui generated
manifest, the roadmap timeline via the repo's TypeScript AST tooling, and
release truth from docs/release.

The generator (tools/generate-content-graph.ts) writes
www/app/data/_generated-content-graph.json deterministically (sorted
entries/alternates/references/keys; sha256 fingerprints) and --check is the
CI drift gate registered in the AutoFlow policy. Validation fails closed on
duplicate ids, broken entry/route references and false locale alternates
(orphan locales, asymmetric pairs, byte-identical 'translations').

Deterministic queries for doc routes, locale availability, search records
and per-route SEO metadata are exposed for the #1159 consumers.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying openelement with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8e62d22
Status: ✅  Deploy successful!
Preview URL: https://7cc69ee6.lessjs.pages.dev
Branch Preview URL: https://kimi-v044-b24-1157-content-g.lessjs.pages.dev

View logs

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

APIError: Insufficient Balance

opencode session  |  github run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant