---
title: Turned the MDX-never-reads-data rule into a pre-commit failure
description: Added a pre-commit hook that fails the commit if any MDX file imports from @/data/*, imports @/lib/data-registry, or string-references a content/data/*.jsonl path. Closes F10 from the concept audit.
section: meta
tags: [meta, changelog, mdx, pre-commit, tooling, architecture, data-registry, adr-003]
genre: index
lastUpdated: 2026-04-23
url: https://fardiniqbal.com/docs/changelog/2026-04-23-mdx-boundary-pre-commit-guard
---


MDX pages on this site aren't supposed to read data directly — they go through registered components like `<TrendChart>` or `<NowPanel>` that call `src/lib/<wing>/source.ts` or `data-registry.ts`. That boundary was a convention in AGENTS.md and ADR-003, which means it held right up until it didn't. I added `scripts/check-mdx-boundary.ts` to the pre-commit chain to make it a compile error instead of a vibe.

The script walks every `content/docs/**/*.mdx` and flags three things: imports from `@/data/*`, imports of `@/lib/data-registry`, and bare string literals pointing at `content/data/*.jsonl`. On violation it fails the commit with the file, line, offending text, and a one-line pointer at the right integration path. I skipped the staged-vs-unstaged dance — scanning the whole docs tree is fast enough that I'd rather not reason about what a rebase or cherry-pick leaves in the index. Closes F10 from the concept audit.
