Skip to content

Validate Weapon field values - #55

Merged
ViTeXFTW merged 2 commits into
devfrom
t3code/weapon-value-validation
Jul 18, 2026
Merged

Validate Weapon field values#55
ViTeXFTW merged 2 commits into
devfrom
t3code/weapon-value-validation

Conversation

@ViTeXFTW

@ViTeXFTW ViTeXFTW commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • give every Weapon field a concrete schema value type
  • validate laser object references, damage/collision masks, anti-target booleans, shot-delay variants, and weapon bonus tuples
  • add the missing weapon bonus and projectile collision value sets
  • add behavior specs and a schema guard preventing Weapon fields from regressing to unknown

Root cause

The hand-written Weapon schema retained lenient unknown or generic string mappings for custom parsers and bit masks, so malformed values were accepted without diagnostics.

Impact

Weapon INI values now receive enum, flag, boolean, numeric, percentage, reference, and structured-token validation matching the engine parse table. All 76 current Weapon fields have concrete value types.

Validation

  • cargo fmt --check
  • cargo test

@greptile-apps

greptile-apps Bot commented Jul 18, 2026

Copy link
Copy Markdown

Greptile Summary

This PR tightens validation for Weapon schema values. The main changes are:

  • Concrete value types for previously lenient Weapon fields.
  • Validation for laser object references, damage and collision masks, anti-target booleans, shot-delay variants, and weapon bonus tuples.
  • New value sets for weapon bonus fields and projectile collision masks.
  • Tests for valid and invalid Weapon values plus a guard against unknown Weapon field types.

Confidence Score: 5/5

Safe to merge with minimal risk.

The changes are scoped to schema metadata and tests, and no functional issues were identified in the changed validation mappings.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • The formatting step blocked progress because cargo fmt --check failed due to cargo-fmt not being installed, as shown in the fmt rerun log.
  • A full workspace cargo test was attempted; compilation proceeded through the changed crates but the zerosyntax-server failed to compile with exit code 101, as seen in the full test log.
  • A focused schema test run passed fully, with 14 tests passing and 0 failing, including the Weapon concrete value type test, and exited with code 0.
  • A focused analysis spec test run completed with specs_hold ... ok and 1 passing, 0 failing, exiting with code 0.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
crates/analysis/tests/spec/WeaponValues.ini Adds valid and invalid Weapon samples covering references, masks, booleans, shot delays, and bonus tuples.
crates/analysis/tests/spec/WeaponValues.spec.toml Adds expected diagnostics for the new Weapon validation cases.
crates/schema/schema.json Replaces lenient Weapon field types with concrete reference, enum, flag, bool, one_of, and token_list schemas and adds missing value sets.
crates/schema/src/lib.rs Adds a schema regression test ensuring every Weapon field has a concrete value type.

Reviews (2): Last reviewed commit: "Avoid invalid laser bone validation" | Re-trigger Greptile

Comment thread crates/schema/schema.json
@ViTeXFTW

Copy link
Copy Markdown
Owner Author

@greptileai

@ViTeXFTW
ViTeXFTW merged commit 21415e2 into dev Jul 18, 2026
5 checks passed
@ViTeXFTW
ViTeXFTW deleted the t3code/weapon-value-validation branch August 13, 2026 05:29
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