test(imprint): add 14-case test suite for Layer 3 imprint boundary #11

Merged
will.anderson merged 1 commits from test/layer-imprint into feat/layer-imprint 2026-06-11 17:13:58 +00:00
Owner

Summary

  • 14 test cases in tests/test_imprint.el covering all six public functions declared in imprint.elh
  • Tests are plain El programs using println-based PASS/FAIL assertions (no native test framework in El)
  • All syntax follows El constraints from the review: no Bool type annotations, no &&/|| operators, no unary !

Test cases

# Function Scenario
01 imprint_current No loaded imprint (after unload) returns "base"
02 imprint_unload Double-unload is idempotent, still "base"
03 imprint_load Nonexistent id returns ok==false, error contains id
04 imprint_load Result JSON always carries "ok" field
05 imprint_respond imprint_id=="base" returns input unchanged
06 imprint_respond imprint_id=="" returns input unchanged
07 imprint_respond Unknown id (node absent) graceful fallback, no crash
08 imprint_respond After imprint_unload, respond with current id is passthrough
09 imprint_surface_knowledge Base and named paths both return a non-error String
10 imprint_surface_memory_read Returns a non-error String
11 imprint_surface_knowledge Empty imprint_id matches base-scoped result
12 imprint_respond Base path produces no [imprint: annotation in output
13 imprint_load Empty-string id returns ok==false
14 imprint_load Failed load leaves imprint_current state unchanged as "base"

Relation to review findings

Tests 03 and 13 probe the ok==false contract tied to the logic-bug findings. Tests 07 and 14 verify graceful-fallback and state-immutability invariants. Tests 05, 06, 12 nail the base/empty passthrough contract. All tests are written to pass against a corrected implementation and expose the three syntax bugs and two logic bugs from the review.

## Summary - 14 test cases in `tests/test_imprint.el` covering all six public functions declared in `imprint.elh` - Tests are plain El programs using `println`-based PASS/FAIL assertions (no native test framework in El) - All syntax follows El constraints from the review: no `Bool` type annotations, no `&&`/`||` operators, no unary `!` ## Test cases | # | Function | Scenario | |---|----------|----------| | 01 | `imprint_current` | No loaded imprint (after unload) returns "base" | | 02 | `imprint_unload` | Double-unload is idempotent, still "base" | | 03 | `imprint_load` | Nonexistent id returns ok==false, error contains id | | 04 | `imprint_load` | Result JSON always carries "ok" field | | 05 | `imprint_respond` | imprint_id=="base" returns input unchanged | | 06 | `imprint_respond` | imprint_id=="" returns input unchanged | | 07 | `imprint_respond` | Unknown id (node absent) graceful fallback, no crash | | 08 | `imprint_respond` | After imprint_unload, respond with current id is passthrough | | 09 | `imprint_surface_knowledge` | Base and named paths both return a non-error String | | 10 | `imprint_surface_memory_read` | Returns a non-error String | | 11 | `imprint_surface_knowledge` | Empty imprint_id matches base-scoped result | | 12 | `imprint_respond` | Base path produces no [imprint: annotation in output | | 13 | `imprint_load` | Empty-string id returns ok==false | | 14 | `imprint_load` | Failed load leaves imprint_current state unchanged as "base" | ## Relation to review findings Tests 03 and 13 probe the ok==false contract tied to the logic-bug findings. Tests 07 and 14 verify graceful-fallback and state-immutability invariants. Tests 05, 06, 12 nail the base/empty passthrough contract. All tests are written to pass against a corrected implementation and expose the three syntax bugs and two logic bugs from the review.
will.anderson added 1 commit 2026-06-11 16:41:30 +00:00
Covers: imprint_current base fallback, unload idempotency, load miss →
ok=false, ok field presence, respond passthrough for base/empty/unknown
IDs, graceful fallback after unload, surface_knowledge and
surface_memory_read return-type guarantees, base-scoped knowledge
equality, no-annotation invariant for base, empty-ID load rejection, and
failed-load state immutability.

Syntax follows El constraints: no Bool annotations, no &&/||, no unary !.
will.anderson merged commit 4b648f3291 into feat/layer-imprint 2026-06-11 17:13:58 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: neuron-technologies/neuron#11