# Changelog

## Score

- CAI 56 → 63 (+7.7)
- Rubric changed (rubric-2026.09.10 → rubric-2026.09.18) — scores are not directly comparable.

## Lenses

- Code Health 78 → 77 (-0.1)
- Architecture 98 → 92 (-5.8)
- Maturity 58 → 65 (+6.4)
- Readiness 74 → 70 (-3.3)
- Security 39 → 54 (+15.3)
- Performance 90 (new)

## Resolved (17)

- Change coupling: mod.rs ↔ read.rs (src/grain/compile/mod.rs)
- Change coupling: verify.rs ↔ mod.rs (src/grain/bytecode/verify.rs)
- Change coupling: verify.rs ↔ mod.rs (src/grain/bytecode/verify.rs)
- Documentation: no licence statement (README.md)
- Duplicated block (12 lines × 2) (src/grain/compile/mod.rs)
- Duplicated block (12 lines × 2) (src/grain/vm/mod.rs)
- Duplicated block (16 lines × 2) (src/eval/eval_context.rs)
- Duplicated block (8 lines × 2) (src/grain/vm/mod.rs)
- Engine::eval_op_assignment (cognitive 35) (src/eval/stmt.rs)
- Engine::eval_op_assignment (cyclomatic 39) (src/eval/stmt.rs)
- FnPtr::call_raw (cognitive 18) (src/types/fn_ptr.rs)
- Hotspot: src/eval/chaining.rs (src/eval/chaining.rs)
- Hotspot: src/eval/expr.rs (src/eval/expr.rs)
- Hotspot: src/eval/indexing.rs (src/eval/indexing.rs)
- Hotspot: src/packages/array_basic.rs (src/packages/array_basic.rs)
- Hotspot: src/types/dynamic.rs (src/types/dynamic.rs)
- Members sharing a duplicated core (4 members, 50+ identical tokens) (src/func/native.rs)

## New (24)

- Change coupling: verify.rs ↔ mod.rs (src/grain/bytecode/verify.rs)
- Change coupling: verify.rs ↔ mod.rs (src/grain/bytecode/verify.rs)
- Dependency hygiene PARTLY measured — Cargo dependencies read, no committed lock to grade for currency
- Duplicated block (10 lines × 2) (src/grain/bytecode/op.rs)
- Duplicated block (10 lines × 2) (src/grain/compile/mod.rs)
- Duplicated block (12–14 lines × 2) (src/grain/vm/mod.rs)
- Duplicated block (5 lines × 2) (src/func/native.rs)
- Duplicated block (7 lines × 2) (src/grain/vm/mod.rs)
- Engine::eval_fn_call_expr (cognitive 30) (src/func/call.rs)
- Engine::eval_fn_call_expr (cyclomatic 16) (src/func/call.rs)
- Excessive duplication of execution methods with nearly identical semantics. `consume`, `eval`, and `run` appear to execute scripts/ASTs. The distinction between them is not immediately obvious from the signatures (e.g., does `consume` store it? does `eval` return a value? does `run` just execute?). Having three verbs for essentially the same action (executing code) creates cognitive load.
- FileTooLong: func/native.rs (src/func/native.rs)
- FnPtr::_call_raw (cognitive 19) (src/types/fn_ptr.rs)
- Fragmented function registration on Module. There are specific methods for getters, setters, indexers, and generic functions, plus a `raw` variant. This duplicates the logic found in `Engine` and `TypeBuilder` but with even more variation. `set_fn` vs `set_native_fn` is unclear.
- Hotspot: src/grain/bytecode/op.rs (src/grain/bytecode/op.rs)
- Inconsistent naming and grouping for compilation methods. `compile` takes a script string, `compile_file` takes a path, `compile_expression` takes a string but implies a different AST structure. The `_with_scope` variants are repetitive. `compile_into_self_contained` is an outlier in naming convention.
- Inconsistent type registration API. `register_type` takes no arguments (likely inferring name), `register_type_with_name` takes a string name, and `register_type_with_name_raw` takes identifiers. Meanwhile, `build_type` returns a builder for complex definitions. The existence of three distinct methods for simple type registration with slight signature variations is confusing.
- Low cohesion: DynamicSerializer (LCOM4 14) (src/serde/ser.rs)
- Low cohesion: ImmutableString (LCOM4 12) (src/types/immutable_string.rs)
- Members sharing a duplicated core (4 members, 50+ identical tokens) (src/func/native.rs)
- …and 4 more

## Changes since last survey

- 38 commits — 28 feature/other, 10 fixes

## By area

- src/grain — 13 commits
- (repo) — 10 commits
- (root) — 8 commits
- src/bin — 2 commits
- src/eval — 2 commits
- src/api — 1 commit
- src/func — 1 commit
- tests/grain — 1 commit

## Notable commits

- fix: Fix VM bug in call!(fnptr, args...) syntax.
- fix: Fix bug in VM and accept call/curry methods anywhere in a chain.
- fix: Fix bug in VM: is_shared
- fix: Fix bug in loop lowering.
- fix: Fix errors under no_ast.
- fix: Fix feature gate
- fix: Fix feature gating
- fix: Fix missing verify on switch statement constants.
- fix: Fix no_ast build: remove misplaced feature gate in formatting.rs
- fix: Merge branch 'fix'
- change: Add AGENTS.md
- change: Avoid cloning GlobalRuntimeState unnecessarily.
- change: Clean up docs.
- change: Gate compact_str behind an opt-in `compact_str` feature.
- change: Leave switch subject on stack and avoid putting it into scope.
- change: Lower NOOP instead of fragment.
- change: Merge branch 'main' of https://github.com/rhaiscript/rhai
- change: Merge pull request #1163 from rhaiscript/vm-speed-up-chaining-assign
- change: Merge pull request #1164 from rhaiscript/vm-revise-walk-property
- change: Merge pull request #1165 from rhaiscript/vm-optimize-switch
- …and 18 more
