Skip to content

guides: remove duplicate config files - #2360

Open
kenjenkins wants to merge 1 commit into
mainfrom
kenjenkins/deduplicate-example-code
Open

guides: remove duplicate config files#2360
kenjenkins wants to merge 1 commit into
mainfrom
kenjenkins/deduplicate-example-code

Conversation

@kenjenkins

Copy link
Copy Markdown
Contributor

Summary

Many of the Guides pages have example config files in the content/docs/examples/guides folder. Most of these have both .yaml and .yaml.md versions of the config. The plain .yaml files are used in automated tests, while the .yaml.md files are the ones actually included in the site source.

This opens up the possibility that the tested configurations could drift out of sync with the rendered guides.

Instead, let's use the webpack "raw loader" to include the plain .yaml files in the guide pages directly, using explicit components instead of the Markdown backtick fences (```).

Related

n/a

AI disclosure

Refactor performed by Claude Opus 4.5.

Checklist

  • reference any related issues
  • disclosed AI usage (or wrote "none") per AI_POLICY.md

Many of the Guides pages have example config files in the
content/docs/examples/guides folder. Most of these have both .yaml and
.yaml.md versions of the config. The plain .yaml files are used in
automated tests, while the .yaml.md files are the ones actually included
in the site source.

This opens up the possibility that the tested configurations could drift
out of sync with the rendered guides.

Instead, let's use the webpack "raw loader" to include the plain .yaml
files in the guide pages directly, using explicit <CodeBlock> components
instead of the Markdown backtick fences (```).

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
@kenjenkins
kenjenkins requested a review from desimone September 8, 2026 23:26
@kenjenkins
kenjenkins requested a review from a team as a code owner September 8, 2026 23:26
@kenjenkins
kenjenkins requested review from nickytonline and removed request for a team September 8, 2026 23:26
@netlify

netlify Bot commented Sep 8, 2026

Copy link
Copy Markdown

Deploy Preview for pomerium-docs ready!

Name Link
🔨 Latest commit b46f4ea
🔍 Latest deploy log https://app.netlify.com/projects/pomerium-docs/deploys/6aa099b455d8070008d122a9
😎 Deploy Preview https://deploy-preview-2360--pomerium-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@greptile-apps

greptile-apps Bot commented Sep 8, 2026

Copy link
Copy Markdown

Greptile Summary

This PR removes duplicated fenced YAML mirrors and changes 15 guide pages to render the tested plain YAML fixtures directly through Docusaurus CodeBlock components. The consolidation prevents displayed examples from drifting from tested fixtures, but the new resource paths are filesystem-absolute and therefore prevent the migrated pages from compiling.

  • Deletes 29 duplicate .yaml.md files.
  • Imports retained YAML fixtures through webpack raw-loader.
  • Replaces imported MDX components with explicit YAML CodeBlock components.

Confidence Score: 4/5

The PR is not safe to merge until the raw-loader resource paths are made repository-relative, because the migrated guide pages cannot compile as written.

All 15 changed guides pass filesystem-absolute /content/... resources to webpack raw-loader even though the files exist only below the repository root; correcting the imports to use @site/content/... addresses the blocking failure.

Files Needing Attention: All changed files under content/docs/guides/, especially content/docs/guides/ad-guard.mdx and content/docs/guides/jit.mdx

Important Files Changed

Filename Overview
content/docs/guides/ad-guard.mdx Migrates both examples to raw-loader, but the /content/... resource paths resolve outside the repository and break compilation.
content/docs/guides/jit.mdx Migrates the Compose example using the same unresolved filesystem-absolute raw-loader path.
content/docs/guides/forgejo.mdx Preserves the guide content while adopting the same build-breaking raw-loader path pattern.
content/docs/guides/transmission.mdx Uses CodeBlock correctly, but both newly imported YAML resources require the @site alias or relative paths.

Fix all with Greploop Fix All in Claude Code Fix All in Codex

Reviews (1): Last reviewed commit: "guides: remove duplicate config files" | Re-trigger Greptile

Comment on lines +15 to +16
import Config from '!!raw-loader!/content/examples/guides/ad-guard/config.yaml';
import Compose from '!!raw-loader!/content/examples/guides/ad-guard/docker-compose.yaml';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Absolute imports break builds

These raw-loader requests use /content/... as the resource path. After the ! separator, webpack treats the leading slash as a filesystem-absolute path, so it looks outside the repository for /content/examples/.... The repository's working raw-loader imports instead use @site/content/... or relative paths. As a result, the migrated guides cannot resolve these modules during MDX compilation. The same pattern appears in all 15 changed guide pages; use @site/content/... for each resource.

Red test proving the current paths do not resolve:

import assert from 'node:assert/strict';
import { existsSync } from 'node:fs';
import test from 'node:test';

const imports = [
  '!!raw-loader!/content/examples/guides/ad-guard/config.yaml',
  '!!raw-loader!/content/examples/guides/ad-guard/docker-compose.yaml',
];

test('raw-loader resource paths resolve', () => {
  for (const request of imports) {
    const resource = request.slice(request.lastIndexOf('!') + 1);
    assert.ok(existsSync(resource), `webpack resource does not exist: ${resource}`);
  }
});

This test is red because /content/examples/guides/ad-guard/config.yaml does not exist at the filesystem root; the retained file is beneath the repository root.

Context Used: For every finding, write a red test with proof and... (source)

Fix in Claude Code Fix in Codex

@nickytonline

Copy link
Copy Markdown
Member

@desimone can probably chime in here but I think there was two on purpose? One for actually testing the guide and one for content? That said, removing duplicates makes sense to me if the tests can still build with the configs.

@kenjenkins

Copy link
Copy Markdown
Contributor Author

@nickytonline if we have separate configuration files for the docs content and the tests, this opens up the possibility for the two to get out of sync. If this were to happen, then the tests would no longer verify that the docs content is correct. In contrast, if there is only one copy of the configuration files, then the tests should accurately verify the correctness of the docs content.

But please do let me know if I'm misunderstanding something about the setup here.

@nickytonline

Copy link
Copy Markdown
Member

@nickytonline if we have separate configuration files for the docs content and the tests, this opens up the possibility for the two to get out of sync. If this were to happen, then the tests would no longer verify that the docs content is correct. In contrast, if there is only one copy of the configuration files, then the tests should accurately verify the correctness of the docs content.

But please do let me know if I'm misunderstanding something about the setup here.

I'm definitely pro one config for each, I just thought there was a reason we needed to have duplicates for the tests, that's all.

We're probably good to merge this if all checks pass.

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.

2 participants