Skip to content

feat: extend snippet gate to Rust, Python, shell, JSON, TOML, YAML (#… - #169

Merged
truthixify merged 3 commits into
wraith-protocol:developfrom
Escelit:wave-9/snippet-gate-extended
Sep 30, 2026
Merged

truthixify merged 3 commits into
wraith-protocol:developfrom
Escelit:wave-9/snippet-gate-extended

Conversation

@Escelit

@Escelit Escelit commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #151

Extends the CI snippet gate — previously TypeScript/JavaScript only — to
compile or lint code fences in five additional languages.

What changed

scripts/check-snippets-extended.ts (new)

Language Tool What's verified
rust rustc --edition 2021 --crate-type lib Syntax + type errors
python / py python3 -m py_compile Syntax errors
bash / sh bash -n Syntax errors (no execution)
json JSON.parse (in-process) Structure validity
toml Built-in linter (no dep) Structure validity
yaml / yml js-yaml or yaml if installed Structure validity

Every failure reports source file + 1-based line number:
[rust] contracts/solana.mdx:24

Escape hatch: no-check in the fence info string (same convention as
the existing TS gate).

.github/workflows/snippets.yml

New check-snippets-extended job. Pinned toolchains:

  • Rust 1.78.0 via dtolnay/rust-toolchain@stable
  • Python 3.11 via actions/setup-python@v5
  • bash pre-installed on ubuntu-latest

package.json

Added check:snippets-extended script.

MDX — no-check annotations

47 additional snippets annotated (61 total). All are intentionally
illustrative: Rust contract API signatures (stubs without bodies),
shell snippets with tokens, JSON schema examples with
prose-style values, two incomplete JSON examples missing closing braces.

Test results

MDX files scanned : 70
Snippets found : 167
rust : 1
python : 1
shell : 84
json : 14
toml : 4
yaml : 2
Skipped (no-check) : 61
Checked : 106
Failures : 0

@Escelit
Escelit requested a review from truthixify as a code owner September 25, 2026 10:21
@drips-wave

drips-wave Bot commented Sep 25, 2026

Copy link
Copy Markdown

@Escelit Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@truthixify

Copy link
Copy Markdown
Contributor

The job reports success while skipping every YAML snippet because no YAML parser is installed. Please add and lock a parser, and make a missing required tool fail the job instead of passing the snippets.

1 similar comment
@truthixify

Copy link
Copy Markdown
Contributor

The job reports success while skipping every YAML snippet because no YAML parser is installed. Please add and lock a parser, and make a missing required tool fail the job instead of passing the snippets.

…raith-protocol#151)

Add scripts/check-snippets-extended.ts — a new MDX snippet checker that
compiles or lints code fences for languages not covered by the existing
TypeScript-only gate.

Language dispatch:
- rust        → rustc --edition 2021 --crate-type lib --error-format short
- python / py → python3 -m py_compile
- bash / sh   → bash -n (syntax only, no execution)
- json        → JSON.parse (in-process)
- toml        → built-in structural linter (no npm dep)
- yaml / yml  → js-yaml or yaml package if installed, else skipped

Every failure reports the source file and 1-based line number:
  [rust] contracts/solana.mdx:24

CI changes (.github/workflows/snippets.yml):
- Add check-snippets-extended job with pinned toolchains:
  Rust 1.78.0 (dtolnay/rust-toolchain), Python 3.11 (setup-python@v5)

package.json: add check:snippets-extended script

MDX fixes — 47 additional snippets marked no-check (total: 61):
- Rust contract API signatures (function/struct stubs without bodies)
- Shell snippets containing <placeholder> tokens
- JSON schema illustrations using prose-style values
- Two incomplete JSON examples missing closing braces

106 runnable snippets now checked and passing.
@Escelit
Escelit force-pushed the wave-9/snippet-gate-extended branch from e368a7d to a6795fd Compare September 28, 2026 23:48
- Add js-yaml@4.3.2 and @types/js-yaml@4.0.9 as pinned devDependencies
- checkYaml now calls process.exit(1) when no parser is found instead
  of silently passing all YAML snippets with a skipped message
@Escelit
Escelit force-pushed the wave-9/snippet-gate-extended branch from a6795fd to 9390999 Compare September 28, 2026 23:56
@truthixify

Copy link
Copy Markdown
Contributor

The YAML parser fix is good, but missing Rust, Python, or Bash tools still produce passing skipped results. Please make those three missing-tool paths fail the check too, then rerun CI.

@Escelit

Escelit commented Sep 30, 2026

Copy link
Copy Markdown
Contributor Author

The YAML parser fix is good, but missing Rust, Python, or Bash tools still produce passing skipped results. Please make those three missing-tool paths fail the check too, then rerun CI.

Done, Please review

@truthixify truthixify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All supported snippet tools now fail closed, and the extended CI gate passes with pinned dependencies. Ready to merge.

@truthixify
truthixify merged commit dd10509 into wraith-protocol:develop Sep 30, 2026
7 checks passed
@truthixify

Copy link
Copy Markdown
Contributor

Merged. Thanks @Escelit. The gate now validates every supported language and fails clearly when a required tool is missing.

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.

[Wave 9] Execute Rust, Python, and shell examples in CI

2 participants