feat: implement ObjectFinder with ambiguity resolution #319

Merged
freemo merged 3 commits from feature/m1-object-finder into master 2026-03-16 19:54:36 +00:00
Owner

Summary

Implements ObjectFinder (#294) that resolves text references to game objects with support for:

  • Scopes: :room, :inventory, :equipment, :area, :all
  • Matching strategies: exact name, partial name, ordinal ("2nd sword"), adjective+noun ("rusty sword")
  • Results: SingleMatch (resolved object), AmbiguityPrompt (numbered options), or ObjectNotFoundError

Components

  • ObjectFinder - Main resolver class with #resolve(text, scope:) and #resolve_disambiguation(prompt, selection)
  • AmbiguityPrompt - Immutable value object for multiple matches, generates "Which X do you mean?" prompts
  • ObjectNotFoundError - Immutable value object for failed lookups with scope-aware messages

Test Coverage

  • 44 unit test scenarios covering all matching strategies, scopes, disambiguation, and edge cases
  • 3 integration test scenarios for validation pipeline integration

Files Changed

  • lib/aethyr/core/input_handlers/validation/object_finder.rb
  • lib/aethyr/core/input_handlers/validation/ambiguity_prompt.rb
  • lib/aethyr/core/input_handlers/validation/object_not_found_error.rb
  • tests/unit/object_finder.feature
  • tests/unit/step_definitions/object_finder_steps.rb
  • tests/integration/object_finder_integration.feature
  • tests/integration/step_definitions/object_finder_integration_steps.rb

Dependencies

This PR depends on the Validation Pipeline (#293) which is on branch feature/m1-validation-pipeline.

Closes #294

## Summary Implements ObjectFinder (#294) that resolves text references to game objects with support for: - **Scopes**: `:room`, `:inventory`, `:equipment`, `:area`, `:all` - **Matching strategies**: exact name, partial name, ordinal ("2nd sword"), adjective+noun ("rusty sword") - **Results**: SingleMatch (resolved object), AmbiguityPrompt (numbered options), or ObjectNotFoundError ## Components - `ObjectFinder` - Main resolver class with `#resolve(text, scope:)` and `#resolve_disambiguation(prompt, selection)` - `AmbiguityPrompt` - Immutable value object for multiple matches, generates "Which X do you mean?" prompts - `ObjectNotFoundError` - Immutable value object for failed lookups with scope-aware messages ## Test Coverage - **44 unit test scenarios** covering all matching strategies, scopes, disambiguation, and edge cases - **3 integration test scenarios** for validation pipeline integration ## Files Changed - `lib/aethyr/core/input_handlers/validation/object_finder.rb` - `lib/aethyr/core/input_handlers/validation/ambiguity_prompt.rb` - `lib/aethyr/core/input_handlers/validation/object_not_found_error.rb` - `tests/unit/object_finder.feature` - `tests/unit/step_definitions/object_finder_steps.rb` - `tests/integration/object_finder_integration.feature` - `tests/integration/step_definitions/object_finder_integration_steps.rb` ## Dependencies This PR depends on the Validation Pipeline (#293) which is on branch `feature/m1-validation-pipeline`. Closes #294
freemo force-pushed feature/m1-object-finder from bcc7905b01 to aa390d2c3e 2026-03-16 16:56:43 +00:00 Compare
freemo force-pushed feature/m1-object-finder from aa390d2c3e to 737bbac4b2 2026-03-16 17:31:19 +00:00 Compare
freemo force-pushed feature/m1-object-finder from 737bbac4b2 to 61479a7d10 2026-03-16 19:54:27 +00:00 Compare
freemo merged commit 61479a7d10 into master 2026-03-16 19:54:36 +00:00
freemo deleted branch feature/m1-object-finder 2026-03-16 19:54:36 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: aethyr/Aethyr#319
No description provided.