Skip to content

Reject feature and structure types the game no longer has - #263

Open
ItsMeBrianD wants to merge 1 commit into
mainfrom
claude/project-thread-vxpnt4
Open

ItsMeBrianD wants to merge 1 commit into
mainfrom
claude/project-thread-vxpnt4

Conversation

@ItsMeBrianD

@ItsMeBrianD ItsMeBrianD commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Brian · project thread

Problem

GlowLichen(...) passed mms check but wrote "type": "minecraft:glow_lichen", which the game rejects. The 26.3 feature type is multiface_growth (renamed in 1.19). vanilla-mcdoc still has a minecraft:feature_config[glow_lichen] case, tagged only #[since="1.17"], and every dispatcher case turns into a helper.

The schema re-validation missed it for the same reason. Both the helper lookup and sema.Validate call hasDispatchKey, and that function accepted any dispatcher case even when the game's registry doesn't list it.

The same thing happened with other stale cases. Feature types: random_patch, flower, no_bonemeal_flower, emerald_ore, ice_patch, no_surface_ore. Structure types: village, pillager_outpost, bastion_remnant.

Fix

When a dispatched struct's key field is #[id=...] of a registry the spec pack has (taken from mcmeta, the game's own list), that registry now decides which keys are valid. Dispatcher cases outside it are ignored, both for helpers and for the raw type = ... form. Nothing is hard-coded: the registry and the mcdoc case types already sit in the spec pack.

For a better message: when a stale case uses the same mcdoc type as exactly one live key, the error names that key. For example, 'GlowLichen' does not make a ConfiguredFeature; this version calls it MultifaceGrowth(...). Fixing the helper would only have duplicated MultifaceGrowth, so the helper is dropped rather than repaired.

Unchanged: the raw type = glow_lichen form still reports two errors on one span (the case-key error and the id check). That was already the case for any unknown type.

Tests

  • New golden test sema/testdata/stale_types.mms.
  • go test ./... in engine/ passes, including the example goldens.

Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Validation messages now show the current name when a dispatcher case or helper has been renamed, instead of offering a closest-match suggestion.
    • When a key registry is available, validation now recognizes only keys listed in that registry. If the registry is unavailable, existing fallback checks remain in place.
    • Added coverage for stale feature and structure names, including expected validation messages for unsupported helpers and types.

vanilla-mcdoc still has feature_config cases for types the game dropped or
renamed (glow_lichen became multiface_growth in 1.19; also random_patch,
flower, no_bonemeal_flower, emerald_ore, ice_patch, no_surface_ore, and the
structure types village, pillager_outpost, bastion_remnant). Each became a
helper, so GlowLichen(...) passed mms check and wrote a feature the game
rejects. The schema re-validation missed it for the same reason: both used
hasDispatchKey, which accepted any dispatcher case.

When a dispatched struct's key field names a registry the spec pack has
(from mcmeta, the game's own list), that registry now decides the valid
keys. A stale name whose mcdoc case is the same type as one live key gets
"this version calls it MultifaceGrowth(...)".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AX3Tt34s2brddqiaMJbZyW
@ItsMeBrianD ItsMeBrianD self-assigned this Nov 11, 2026
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Dispatcher key checks now use a known key registry to filter valid keys. When a stale dispatcher key has a unique live replacement, diagnostics can report the renamed key or helper. Test fixtures and expected output cover stale and current type names.

Changes

Dispatcher key validation and diagnostics

Layer / File(s) Summary
Registry filtering and renamed-key resolution
engine/sema/types.go
When a key registry is known, dispatcher key checks use registry membership. The new renamed-key lookup returns a replacement only when exactly one live key shares the stale key’s dispatcher reference.
Renamed names in diagnostics and test coverage
engine/sema/structs.go, engine/sema/testdata/stale_types.mms, engine/sema/testdata/stale_types.golden
Unknown-key and helper diagnostics report renamed equivalents when available; otherwise, they retain closest-match suggestions. The fixture and golden output cover stale and current type spellings.

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

Change: Bug fix

Suggested reviewers: claude

Merge Risk: Minimal · up to 8aa84

No confirmed issue currently prevents merging after normal checks.

Pre-merge checks: Passed 5

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 change: rejecting stale feature and structure types that no longer exist in the game.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files. (2 skipped: 2 unsupported.)

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the keys at dawn,
Finds stale names, then hops along.
A fresh name fits the registry,
The helpers match with clarity.
The burrow hums; the tests are done.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1b6eb8ae-e74d-4305-834a-48aca2f9182e
Commits

Reviewing files that changed from the base of the PR and between 68f08ea and 8aa84d5.

Files selected for processing: 4

  • engine/sema/structs.go
  • engine/sema/testdata/stale_types.golden
  • engine/sema/testdata/stale_types.mms
  • engine/sema/types.go

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

This branch has not been deployed

No deployments
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