Skip to content

finding(docs): two content/docs/fields snippets depend on identifiers the snippet program cannot resolve — a fabricated db handle and an undeclared ajv — each needs a ruling before #5867 can cover them #6126

Description

@yinlianghui-tw

Filed by #5867batch 3, unassigned. Both files are excluded from batch 3 by measurement, not by eye: they were re-fenced in a throwaway probe, compiled by check-doc-snippet-types, observed to redden, and the probe was restored under a trap.

Blocks 6 of the 129 blocks remaining on #5867 — 4 of them here, 2 more in the sibling card for location.mdx.

The measurement

Probe: all 23 classifier-matching plaintext fences across the 13 content/docs/fields pages re-fenced to ts, package closure rebuilt, gate run. Diagnostics, verbatim:

[semantic] content/docs/fields/auto-number.mdx:119:16 TS2304: Cannot find name 'db'.
[semantic] content/docs/fields/auto-number.mdx:119:38 TS7006: Parameter 'tx' implicitly has an 'any' type.
[semantic] content/docs/fields/object.mdx:205:17 TS2307: Cannot find module 'ajv' or its corresponding type declarations.

Both blocks pass triage's classifier — auto-number's first line is interface SequenceCounter {, object's is import Ajv from 'ajv'; — so under the ruling on #5867 they are code and should be ts fences. They cannot become ts fences while they reference these names.

1. content/docs/fields/auto-number.mdx, block at fence line 109

Under the heading Sequence Management ("The backend maintains sequence counters"). It declares interface SequenceCounter — fine, self-contained — and then:

const getNextSequence = async (object: string, field: string) => {
return await db.transaction(async (tx) => {

db is not an ObjectUI export and is declared nowhere in the workspace. It is a stand-in for whatever database handle the reader's backend supplies. tx then falls out of it as an implicit any.

The question is what this page should teach, and it is a judgement, not a mechanical fix:

Recommendation: C. It keeps everything the page actually teaches about ObjectUI (the counter shape) under the gate, and stops presenting a fabricated db API as if it were code a reader could copy.

2. content/docs/fields/object.mdx, block at fence line 204

Under Backend Validation. First line is import Ajv from 'ajv';. Measured: ajv is not resolvable from the repo root where the snippet program compiles (no node_modules/ajv), and it is declared in no workspace package.json — I grepped the root and every packages/*/package.json.

This is adjacent to #6120 but not the same shape. #6120 is about lucide-react, a dependency a workspace package does declare but that does not resolve from the root. Here nothing in the repo depends on ajv at all — it is an external library named in an illustration.

  • A — add ajv as a root devDependency purely so a doc snippet resolves. Pulls a runtime schema validator into the tree for documentation's sake; hard to justify on its own.
  • B — leave the block prose, same standing-exception cost as 1B.
  • C — rewrite the example against something the repo does depend on, or reduce it to the validation contract without naming a specific validator.

Recommendation: C, and if #6120's ruling establishes a general route for "a snippet imports a package the root cannot resolve", this should follow it rather than grow a second answer.

Scope note

⛔ Neither is fixable inside #5867's batch discipline: each needs a decision about what the documentation should say, and #5867's rule is that a reddening block is a real defect to fix, never to paper over with a FRAGMENT_MARKER — a marker on a block that is genuinely TypeScript is a lie the ledger then carries.

Refs: #5867 (parent) · #6120 (the sibling resolution-environment card) · #6121 · #6122.

Metadata

Metadata

Labels

documentationImprovements or additions to documentationdomain:devxobjectui devx stream: fix lands on .github/, scripts/ or release pipeline — devx lane cross-repopm:dispatched

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions