feat(cli): lint ```metadata doc embeds — body + reference liveness (ADR-0051 P1)#1965
Merged
Conversation
…ess (ADR-0051 P1)
Completes the ADR-0051 P1 publish lint. `collectAndLintDocs` (run by
`os compile` / `os lint`, which already pass the assembled stack) now
also validates every ```metadata fence:
- body shape: `type` ∈ {state_machine, flow, permission} (did-you-mean
on a typo'd type), `name` required, `object` required for
state_machine.
- reference liveness against the package's OWN metadata: the object +
named state_machine rule, the flow, or the permission set must exist
in this stack. A dead same-package reference is a build error (same
posture as docs/broken-link), with did-you-mean hints. Cross-package
embeds are out of v1 scope.
Note: scans share `stripCode()` which DELETES fenced blocks, so the
embed scan walks raw lines instead. The body parser mirrors the
objectui-side one so build-time and render-time agree.
Tests: 8 cases (valid trio, unknown type, missing name/object, dead
object/rule/flow/permission refs, non-metadata fences ignored, locale
variants). Verified the real app-showcase doc lints clean (no false
positives) with a typo'd-ref negative control.
No CLI build fix was needed: a clean dependency-ordered build
(`turbo run build --filter=@objectstack/cli`, 52/52) passes; the
previously-seen `validate-expressions.ts` / adr-0048-test errors were
stale/unbuilt local `dist`, not a code defect.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 15 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Completes the ADR-0051 P1 publish lint — the last P1 item after the ADR (#1940), spec (#1942), renderer (objectui#1774), and showcase doc (#1951), all merged.
collectAndLintDocs(run byos compile/os lint, which already pass the assembled stack) now also validates every```metadatafence:type∈ {state_machine, flow, permission} (did-you-mean on a typo'd type),namerequired,objectrequired forstate_machine.state_machinerule, the flow, or the permission set must exist in this stack. A dead same-package reference is a build error (same posture asdocs/broken-link), with did-you-mean hints. Cross-package embeds are out of v1 scope.Notes
stripCode(), which deletes fenced blocks — so the embed scan walks raw lines instead. The body parser mirrors the objectui-side one so build-time and render-time agree.dist: a clean dependency-ordered build —turbo run build --filter=@objectstack/cli— passes 52/52 (incl.cli:build).@objectstack/formula's current source already has thescope/warningsAPI thevalidate-expressions.tserrors referenced, and the adr-0048 test resolves oncestudio/setup/accountare built. So this PR is purely the lint.Verification
vitest run collect-docs→ 44 passed (8 new lint cases: valid trio, unknown type, missing name/object, dead object/rule/flow/permission refs, non-metadata fences ignored, locale variants).pnpm --filter @objectstack/cli build→ exit 0.app-showcasedoc: 0 issues (no false positives); a typo'd-ref negative control correctly flagsdocs/metadata-embed-ref.🤖 Generated with Claude Code