Files
LithosAnanake/src/test_runner/modules
Robert Allan JamesandClaude Sonnet 5 4e7dcdf889 Add FENCE word (SDK v1.9.0 scoping); fix severe pre-existing FORGET use-after-free
FENCE ( -- ) exposes the dict_fence_latest/dict_fence_here state FORGET
already honored internally, letting callers (e.g. a future SDK capsule)
raise the boundary after loading their own content -- no new VM fields,
no policy logic beyond exposing existing state.

Writing a direct test for it surfaced a real, severe, pre-existing bug in
FORGET's relink logic, unrelated to FENCE itself and reproducible with the
original boot-time fence alone:

- Forgetting the single newest word incorrectly destroyed every other word
  back to the fence too, not just the target.
- Forgetting an older word (correctly cascading to remove newer words too,
  per FORTH-79 semantics) crashed with SIGSEGV.

Root cause: the relink code's target_prev pointer was, by construction,
always inside the range the preceding loop had just freed whenever target
wasn't vm->latest -- so writing through it was a use-after-free every time
that branch executed. Fixed by removing the target_prev tracking and both
branches entirely; vm->latest unconditionally becomes target_next (target's
own captured, still-valid link) after the free loop, correct in every case.

Added a FENCE test suite to dictionary_manipulation_words_test.c (Module 14)
including the exact regression case (forgetting the newest word must not
disturb an older one). Verified zero warnings and identical POST/dict_hash
results across all three kernel architectures.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-19 05:57:18 -04:00
..

src/test_runner/modules/

Per-category test files, one per FORTH-79 word category plus integration/stress/adversarial suites, run in this order by test_runner.c (POST order).

Word-category tests (validate each src/word_source/*.c file): arithmetic_words_test.c, mixed_arithmetic_words_test.c, stack_words_test.c, control_words_test.c, defining_words_tests.c, memory_words_test.c, return_stack_words_test.c, double_words_test.c, logical_words_test.c, io_words_test.c, string_words_test.c, block_words_test.c, format_words_test.c, system_words_test.c, dictionary_words_test.c, dictionary_manipulation_words_test.c, vocabulary_words_test.c, starforth_words_test.c, mama_forth_words_test.c, acl_words_test.c.

Cross-cutting tests:

  • integration_tests.c — multi-word interaction tests.
  • stress_tests.c — load/volume tests.
  • break_me_tests.c — adversarial/fuzzing tests.

Note: not every src/word_source/*.c file has a dedicated test module here (e.g. defer_words.c, log_words.c, inference_words.c, lifecycle_words_hosted.c, editor_words.c are exercised indirectly via integration tests or the tools/hermes_*.sh smoke tests rather than a standalone *_test.c module).