Skip to content

fix(ADR-0046): serve package docs at runtime, not just in the compiled artifact#1808

Merged
xuyushun441-sys merged 1 commit into
mainfrom
fix/adr-0046-docs-runtime-serving
Jun 13, 2026
Merged

fix(ADR-0046): serve package docs at runtime, not just in the compiled artifact#1808
xuyushun441-sys merged 1 commit into
mainfrom
fix/adr-0046-docs-runtime-serving

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Problem

Package docs (src/docs/*.md, ADR-0046) compiled into a bundle never reached the runtime. GET /meta/doc returned {"type":"doc","items":[]} and docs were invisible in the console — even though os build produced them and a pure-artifact boot served them fine. This is the actual reason "the showcase has no docs": the data was never there to render.

Root cause — two gaps, one per load path

  1. os dev / os serve (config-load path). With an objectstack.config.ts present, serve re-derives metadata from defineStack(...). The markdown docs are not part of defineStack — they're a compile-time augmentation (compile.ts step 3d, collectAndLintDocs). So the dev/serve path loaded zero docs. serve.ts now collects src/docs/*.md into the stack on the config-load path too — collection only (additive; never blocks boot).

  2. MetadataPlugin artifact loader. ARTIFACT_FIELD_TO_TYPE (packages/metadata/src/plugin.ts) omitted docs → doc, so the bundle's docs array was skipped on that load path. Added the mapping for parity with the ObjectQL engine's metadataArrayKeys, plus a _parseAndRegisterArtifact regression test.

Verification (live)

Boot /meta/doc before after
os dev / serve (config) items:[] showcase_index, showcase_docs_guide
pure artifact already worked ✅ still works

servicePayload now carries docs into registerApp; list + single-item (/meta/doc/showcase_index with content) both resolve. @objectstack/metadata 9/9 tests pass (incl. new regression); CLI typecheck clean.

Scope

Backend/runtime only. The console-side docs portal + nav entry is a separate objectui PR.

🤖 Generated with Claude Code

…d artifact

Package docs (src/docs/*.md) compiled into a bundle never reached the runtime:
GET /meta/doc returned [] and docs were invisible in the console even though
os build produced them and a pure-artifact boot served them.

Root cause (two gaps on the two load paths):

1. os dev / os serve load metadata from objectstack.config.ts via defineStack(),
   which never carries the markdown docs — those are a compile-time augmentation
   (compile.ts step 3d). serve.ts now collects src/docs/*.md into the stack on
   the config-load path as well (collection only, additive, never blocks boot),
   so docs serve in dev exactly as from a built artifact. Verified: showcase
   /meta/doc returns showcase_index + showcase_docs_guide on a config boot.

2. The MetadataPlugin artifact loader's ARTIFACT_FIELD_TO_TYPE omitted
   docs -> doc, so the bundle's docs array was dropped on that path. Added the
   mapping for parity with the ObjectQL engine's metadataArrayKeys, plus a
   _parseAndRegisterArtifact regression test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 13, 2026 4:14am

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests tooling size/s labels Jun 13, 2026
@xuyushun441-sys
xuyushun441-sys merged commit 2c8e607 into main Jun 13, 2026
12 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the fix/adr-0046-docs-runtime-serving branch June 13, 2026 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants