Skip to content

Refactor weaver-syntax tests and helpers#38

Merged
leynos merged 20 commits intomainfrom
terragon/add-weaver-syntax-crate-p1ovqh
Dec 16, 2025
Merged

Refactor weaver-syntax tests and helpers#38
leynos merged 20 commits intomainfrom
terragon/add-weaver-syntax-crate-p1ovqh

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Dec 11, 2025

Summary

  • Refactors the test harness and support utilities for the weaver-syntax crate, reorganising unit, behavioural, and end-to-end tests under crates/weaver-syntax. Adds extensive end-to-end and BDD test coverage with insta snapshots.
  • Wires the weaver-syntax crate into the workspace and updates workspace test tooling and dependencies.
  • Keeps and expands Tree-sitter-based syntactic analysis, language detection, pattern matching, and rewriting capabilities exposed by the weaver-syntax crate.
  • Updates documentation surface (roadmap, users guide, and weaver design) to reflect the integrated weaver-syntax testing surface and components.

Changes

Crate and testing harness

  • Added crates/weaver-syntax with modules for error handling, language detection, parsing, pattern compilation, matching, metavariables, rewriting, and syntactic locking.
  • Refactored and reorganised tests under crates/weaver-syntax:
    • Unit, behavioural, and test harness modules (mod.rs, unit.rs, behaviour.rs) alongside a dedicated tests/ directory for end-to-end testing.
    • Behavioural tests and step definitions implemented in crates/weaver-syntax/src/tests/behaviour.rs with BDD scaffolding.
    • End-to-end tests added under crates/weaver-syntax/tests/e2e with associated insta snapshots and a feature file at crates/weaver-syntax/tests/features/weaver_syntax.feature.
  • Introduced centralised metavariable handling and matcher infrastructure (metavariables.rs, matcher/ modules) to support pattern matching and rewriting in tests.
  • Wired the weaver-syntax crate into the workspace with its own Cargo.toml and integration with workspace test tooling and dependencies.
  • Updated workspace cargo dependencies to support the new crate’s test and development workflow.

End-to-end tests and snapshots

  • Added comprehensive end-to-end tests and corresponding insta snapshot harnesses to validate language detection, parsing, pattern matching, and rewriting across languages.
  • Included snapshots for language detection, parse errors, and validation failures.

Pattern matching, metavariables, and rewriting

  • Introduced a complete pattern language with metavariable handling and capture representations.
  • Implemented a rewriting engine with template substitution and change tracking.
  • Added dedicated metavariables utilities and placeholder handling to support pattern compilation and matching in tests.

Syntactic locking and error reporting

  • Implemented a Tree-sitter based syntactic lock to validate code prior to semantic checks.
  • Added error reporting structures and parsers per-language, surfaced in tests and end-to-end snapshots.

Language detection and parsing support

  • Implemented language detection from file extensions and path-based detection.
  • Wired Tree-sitter-based parsers for Rust, Python, and TypeScript.

Documentation and roadmap

  • Updated docs/roadmap.md to reflect the weaver-syntax crate integration and its testing surface.
  • Updated docs/users-guide.md to describe the syntactic lock, pattern matching, and rewriting capabilities exposed by weaver-syntax.
  • Expanded docs/weaver-design.md with an illustrative diagram of the weaver-syntax module and its components.

Workspace wiring

  • Wired the weaver-syntax crate into the workspace, including its dedicated Cargo.toml and integration with workspace test tooling and dependencies.
  • Adjusted workspace dependencies to support the new crate’s test and development workflow.

📎 Task: https://www.terragonlabs.com/task/2042b5de-5e37-46c2-95d5-9e20ce878851

Loading
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.

1 participant