Skip to content

[codex] Add external snippet provenance comments#609

Draft
danielporterda wants to merge 2 commits into
mainfrom
snippet-provenance-comments
Draft

[codex] Add external snippet provenance comments#609
danielporterda wants to merge 2 commits into
mainfrom
snippet-provenance-comments

Conversation

@danielporterda
Copy link
Copy Markdown
Contributor

@danielporterda danielporterda commented May 21, 2026

What changed

Adds a searchable source-snippet HTML comment to generated external snippet MDX files. The comment records the source repo, source path, source commit hash, snippet name, and extraction location.

The generator keeps import-leading MDX valid by placing the provenance comment after the import block when a generated snippet starts with import statements.

This refresh also updates the wrapper copy target to the current checked-in tree under docs-main/snippets/external, documents that location in the update workflow, and adds provenance comments to existing checked-in snippet files that still map cleanly to current extraction config.

Why

This creates a stable text-search join between generated snippet files and the source repository state that produced them, which is the first step toward auditing orphaned or stale external snippets.

Refresh and run status

  • Rebased onto latest main at 25425b81c5c7d7948a14dd7d02faeb381235f8ec.
  • Added provenance comments to 665 existing config-mapped snippet files.
  • Left 139 older checked-in snippet files unchanged because they are not represented by the current extraction config; adding synthetic provenance there would be misleading.
  • Extraction succeeded for cn-quickstart, daml-shell, scribe, splice, and wallet-gateway.
  • Extraction failed for stale source/config entries in canton, daml, and dpm; those failures happen before a trustworthy full corpus copy can be made.

Validation

  • direnv exec . node --check scripts/generateOutputDocs.js
  • direnv exec . node --check scripts/helpers/generateOutputDocs.js
  • direnv exec . python3 -m py_compile scripts/generate_external_snippets.py
  • direnv exec . npm run generate:external-snippets -- --list
  • git diff --check

@danielporterda danielporterda force-pushed the snippet-provenance-comments branch from 2d0d1ee to 05ee0c1 Compare May 28, 2026 16:10
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