Skip to content

Add pre-operation validation hooks for mental model create/refresh#271

Merged
cdbartholomew merged 1 commit intomainfrom
feat/mental-model-refresh-validation
Feb 1, 2026
Merged

Add pre-operation validation hooks for mental model create/refresh#271
cdbartholomew merged 1 commit intomainfrom
feat/mental-model-refresh-validation

Conversation

@cdbartholomew
Copy link
Contributor

Summary

  • Adds MentalModelRefreshContext dataclass for pre-operation validation context
  • Adds validate_mental_model_refresh method to OperationValidatorExtension
  • Wires up pre-operation validation in both create and refresh mental model HTTP routes
  • Extensions can now reject mental model operations before async LLM work is queued

Changes

File Change
hindsight-api/hindsight_api/extensions/operation_validator.py Add MentalModelRefreshContext and validate_mental_model_refresh hook
hindsight-api/hindsight_api/extensions/__init__.py Export MentalModelRefreshContext
hindsight-api/hindsight_api/api/http.py Wire up pre-operation validation in create/refresh endpoints

Test plan

  • Verify create mental model route calls validate_mental_model_refresh before creating
  • Verify refresh mental model route calls validate_mental_model_refresh before refreshing
  • Verify rejected operations return correct status code and reason
  • Verify operations proceed normally when no validator is configured

… model create/refresh

Wire up validate_mental_model_refresh hook in the HTTP routes for both
create and refresh mental model endpoints, allowing extensions to reject
operations (e.g. insufficient credits) before queuing async LLM work.
@cdbartholomew cdbartholomew merged commit 35127d5 into main Feb 1, 2026
24 of 26 checks passed
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