Skip to content

hatch: list patternFile/patternText in the catalog and point to them from the unknown-pattern error (#2000) - #2007

Merged
echelon merged 1 commit into
storytold:mainfrom
MarekSpodBiedry:issue-2000
Oct 24, 2026
Merged

echelon merged 1 commit into
storytold:mainfrom
MarekSpodBiedry:issue-2000

Conversation

@MarekSpodBiedry

@MarekSpodBiedry MarekSpodBiedry commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2000.

run_hatch already loads patternFile / patternText through patfile::load_param before it checks the pattern name, but neither the catalog nor the error said so:

  • The hatch entry of commands now lists patternFile? (path to a .pat file) and patternText? (its contents), and notes that pattern can be built in or come from one of them.
  • The error for a name that is not built in now reads unknown pattern GRAVEL: not built in; load it with patternFile or patternText (a .pat file). It still starts with unknown pattern X, so the existing json_hatch_refuses_an_undefined_pattern test still passes.

No new built-in patterns. No behaviour change: only the help text and the error message differ.

Test: unknown_pattern_error_and_catalog_name_the_pat_file_route checks that both the error and the hatch params string name the route. It fails on main.

Summary by CodeRabbit

  • Documentation
    • The hatch command’s parameter catalog now describes options for loading user-defined patterns from a file or text.
  • Bug Fixes
    • When a requested pattern is unavailable, the error message now points to loading a .pat file and identifies the available loading options.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between f043540 and afef4a2.

📒 Files selected for processing: 1
  • crates/engine/src/cmd/hatch.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

📝 Walkthrough

The HATCH command parameters now document patternFile and patternText. The unknown-pattern error points callers to these options. A test checks the catalog text and error.

Changes: HATCH pattern discoverability

Layer / File(s) Summary
Catalog, error, and test
crates/engine/src/cmd/hatch.rs
The parameter description lists pattern-loading options. The unknown-pattern error points to them, and a test checks both updates.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other · Severity of issue fixed: Low

Possibly related PRs

  • storytold/cadcraft#954: Handles loaded user-defined hatch patterns in properties.set, using pattern data loaded by HATCH.
  • storytold/cadcraft#1443: Adds Hatch Editor support for loaded .pat patterns and user-defined hatch patterns.

Suggested reviewers: lloydnicholson, marcoarnulfo

Merge Risk: ⚪ Minimal · up to afef4

This discoverability-only change does not alter HATCH execution behavior and is ready to merge.

Architecture risk: 🟡 Medium · up to afef4

The change affects 1 system.

Changed systems: crates

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — crates (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in crates/engine/src/cmd/hatch.rs: The hatch command parameter description now documents patternFile and patternText as ways to load pattern definitions.
  • observed — Modified behavior in crates/engine/src/cmd/hatch.rs: The unknown-pattern error now says the pattern is not built in and directs callers to load it with patternFile or patternText.
  • observed — Modified behavior in crates/engine/src/cmd/hatch.rs: Added a test that requests an undefined pattern and checks that the error mentions patternFile; it also checks that the hatch command parameters mention both patternFile and patternText.

Reliability and maintainability

  • inferred — Risk-relevant change factors for crates: blast_radius_1; direct_dependents_1
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main changes: adding patternFile/patternText to the catalog and referencing them in the unknown-pattern error.
Linked Issues check Passed Issue [#2000] requires discoverability for the existing .pat loading route. The hatch catalog now lists patternFile? as a .pat file path and patternText? as its contents. The unknown-pattern…
Out of Scope Changes check Passed The pull request changes only the hatch parameter documentation, the related unknown-pattern error, and an automated test for those changes. These changes directly support issue [#2000]. No unrelate…
Full details: Linked Issues check

Explanation

Issue [#2000] requires discoverability for the existing .pat loading route. The hatch catalog now lists patternFile? as a .pat file path and patternText? as its contents. The unknown-pattern error now directs users to these parameters. The new test checks both the error and the catalog entry. No new built-in pattern is added.

Full details: Out of Scope Changes check

Explanation

The pull request changes only the hatch parameter documentation, the related unknown-pattern error, and an automated test for those changes. These changes directly support issue [#2000]. No unrelated behavior or feature change is present in the reviewed diff.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@MarekSpodBiedry
MarekSpodBiedry marked this pull request as ready for review October 23, 2026 15:45
@echelon
echelon merged commit 1a76e10 into storytold:main Oct 24, 2026
2 checks passed
@echelon

echelon commented Oct 24, 2026

Copy link
Copy Markdown
Member

Thank you @MarekSpodBiedry for this contribution — it's landed on main! 🎉 If you haven't already, please come join us on Discord: https://discord.gg/artcraft

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.

HATCH: commands hatch does not list patternFile / patternText, and "unknown pattern X" does not point to them

2 participants