Skip to content

Improve external snippet validations and extraction tests - #1412

Open
coldice wants to merge 3 commits into
mainfrom
feature/add-snippet-validations
Open

Improve external snippet validations and extraction tests#1412
coldice wants to merge 3 commits into
mainfrom
feature/add-snippet-validations

Conversation

@coldice

@coldice coldice commented Aug 18, 2026

Copy link
Copy Markdown
Contributor
  • Add two snippet validators plus tests.
  • Extend tests/test_generate_external_snippets.py to cover generateOutputDocs.js location types, indent, transforms, CLI flags, and error paths.
  • Wire npm scripts: validate-snippet-files, validate-snippet-sources.

validate-snippet-files
npm run validate-snippet-files
Checks docs-main page imports vs snippet files. Reports missing and orphan snippets. Writes snippets-missing.log / snippets-orphan.log.

usage: validate_snippet_files.py [-h] [--quiet] [--no-fail]
                                 [--output-path OUTPUT_PATH]
                                 [--delete-orphan-snippets]
  --quiet                   Only print errors (missing or orphan snippets)
  --no-fail                 Exit 0 even when missing or orphan snippets are found
  --output-path PATH        Directory for snippets-missing.log and
                            snippets-orphan.log (default: repo root)
  --delete-orphan-snippets  After writing snippets-orphan.log, delete orphan
                            snippet files

validate-snippet-sources
npm run validate-snippet-sources
Checks remote snippet configs against source-repo checkouts (lines, stringMarker, jsonIndex, regexWrap, fullFile). Writes snippet-source-errors.log.

usage: validate_snippet_sources.py [-h] [--quiet] [--no-fail]
                                   [--output-path OUTPUT_PATH]
                                   [--source-dir SOURCE_DIR]
                                   [repo]

  repo               Only validate this remote snippet repo
                     (e.g. daml, canton, splice).
                     Omit to check every repo in remote-snippet-lists.json
  --quiet            Only print source validation errors
  --no-fail          Exit 0 even when source validation errors are found
  --output-path PATH Directory for snippet-source-errors.log
                     (default: repo root)
  --source-dir PATH  Path to the git checkout for the selected repo.
                     Required with a repo name if autodiscovery cannot
                     find a unique checkout

Signed-off-by: Ibo Sy <ibo@b9lab.com>
Signed-off-by: Ibo Sy <ibo@b9lab.com>
@coldice
coldice force-pushed the feature/add-snippet-validations branch from ae1c956 to b396377 Compare August 18, 2026 12:06
@Jatinp26

Copy link
Copy Markdown
Collaborator

@danielporterda could you please the changes as well? before I merge/review it.

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.

3 participants