Skip to content

Introduce action-based contract system#46

Merged
afuno merged 11 commits intomainfrom
feature/SRV-359/entity_4
Dec 23, 2025
Merged

Introduce action-based contract system#46
afuno merged 11 commits intomainfrom
feature/SRV-359/entity_4

Conversation

@afuno
Copy link
Member

@afuno afuno commented Dec 22, 2025

No description provided.

Restructure Treaty to use actions as the primary contract abstraction, moving away
from the previous request/response split model. Actions now encapsulate both request
and response definitions with built-in versioning and execution support.

Major changes:
- Introduce Action as the core contract unit with base class and result handling
- Move context handling (callable, DSL, workspace) under action namespace
- Move REST info building and DSL under action/info/rest
- Move executor inventory management under action/executor
- Implement action-specific request and response entities with their own validators
- Add comprehensive versioning system for actions:
  * Semantic versioning support
  * Version collection and factory
  * Version resolver and executor
  * Request execution context per version
- Add action inventory system for managing multiple action definitions
- Move controller DSL to use new action-based structure
- Remove top-level base and result classes (now under action)
- Remove standalone request/response/versions/context/executor/inventory modules
- Update all documentation (API reference, core concepts, getting started, entities, etc.)
- Update all specs to work
@afuno afuno added this to the v1.0.0 milestone Dec 22, 2025
@afuno afuno self-assigned this Dec 22, 2025
@afuno afuno marked this pull request as ready for review December 22, 2025 10:43
afuno added 10 commits December 22, 2025 17:54
- Removed `Info::Rest` namespace and consolidated classes under `Info`.
- Moved `Builder`, `DSL`, and `Result` from `Rest` to `Info`.
- Updated `Base` class to reference the new `Info::DSL` location.
- Adjusted specs to reflect namespace changes, including validation of `Info::Result`.
- Simplified structure for better clarity and reduced redundancy within the `Info` module.
- Added detailed documentation to `Inventory::Collection` and `Versions::Collection`.
- Included purpose, usage, delegated methods, examples, and custom method descriptions for clarity.
- Updated comments to align with internal standards for documentation style.
- Added comprehensive documentation for `Executor::Inventory`, including purpose, usage, caching behavior, access patterns, and method examples.
- Described dynamic method handling (`method_missing` and `respond_to_missing?`), hash-based access (`to_h`), and debugging representation (`inspect`).
- Included private helper method `find_inventory_item` for internal item lookup with error handling.
- Ensures clear guidelines for usage and behavior explanation.
- Added comprehensive class-level documentation to `Request::Attribute::Builder`, detailing purpose, usage, inheritance, and DSL example.
- Documented key methods (`create_attribute`, `deep_copy_attribute`) with parameters, behavior, and return value explanations.
- Updated comments to align with internal documentation standards for clarity and maintainability.
- Added comprehensive class-level documentation for `Request::Validator`, `Factory`, `Entity`, and `Attribute`, detailing their purposes, usage, validation flow, and implementation.
- Introduced detailed comments for key methods, providing parameter explanations, expected behaviors, and return value descriptions.
- Enhanced the documentation for `Response::Validator`, `Factory`, `Entity`, and `Attribute` to outline differences from their request counterparts and describe response-specific behaviors.
- Updated nested attribute handling, default behaviors, and error handling across request/response components per internal documentation standards.
- Added comprehensive documentation for the versioning system, including `Resolver`, `Workspace`, `Request`, `Factory`, `Executor`, and `DSL` components.
- Detailed version resolution, validation, and execution logic, including error handling for deprecated or missing versions.
- Enhanced documentation for `Execution::Request` to explain supported executor types (Class, String, Proc) and the execution flow.
- Documented `Workspace` orchestration for resolving, validating, executing, and building results.
- Added detailed comments to align with internal standards, ensuring clarity and maintainability.
- Added detailed documentation for `DSL`, `Callable`, and `Workspace` modules, providing insights into their purpose, usage, architecture, and method chains.
- Explained the relationship between class-level `Callable` methods, instance-level `Workspace` methods, and `Versions::Workspace` execution.
- Described the `call!` method's flow, including parameter passing, version resolution, and execution delegation.
- Aligned comments with internal documentation standards for clarity and maintainability.
- Added detailed documentation for `Inventory::Factory`, `Inventory`, `Result`, and `Entity::Builder`, outlining their purpose, usage, and method-level explanations.
- Explained the `Factory`'s `provide` method for defining inventory items with various source types (Symbol, Proc, direct values) and its validation.
- Documented `Inventory` lazy evaluation, usage examples, and source validation.
- Enhanced commentary for `Result`, including attributes (`data`, `status`, `version`) and debugging support.
- Clarified `Entity::Builder` defaults (attributes required by default) and key methods (`create_attribute`, `deep_copy_attribute`).
- Standardized comments to meet internal documentation best practices for better readability and maintainability.
- Introduced `Treaty::Action::Base` as the core base class for action definitions.
- Added usage examples to demonstrate versioning, request/response structures, and delegation to services.
- Documented the purpose and structure of `Treaty::Action` with references to key components.
- Included guidance for inheriting and extending the base class, covering versions and execution.
- Standardized type documentation across Treaty components to use full namespace references, ensuring clarity and consistency.
- Updated return type annotations for `Factory`, `Collection`, `Attribute`, and `Version` classes to specify their full paths (e.g., `Treaty::Action::Inventory::Collection`).
- Enhanced method-level comments in `Entity` and `Action` modules to reflect precise input/output expectations.
- Improved code readability and maintainability by aligning with internal annotation best practices.
@afuno afuno merged commit acc8f41 into main Dec 23, 2025
25 of 27 checks passed
@afuno afuno deleted the feature/SRV-359/entity_4 branch December 23, 2025 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant