feat: add object operation to construct maps with evaluated values (#253)#254
feat: add object operation to construct maps with evaluated values (#253)#254andreasronge merged 2 commits intomainfrom
Conversation
Adds the 'object' operation to PTC-JSON that enables constructing maps where values can be evaluated expressions. This fixes a critical gap in the memory contract and allows the system prompt example to work correctly. - Add object operation definition to schema (fields: map type) - Add validate_object/2 for recursive field validation in validator - Implement eval_object and evaluate_object_field_value in operations - Update system prompt memory example to use object instead of invalid merge pattern - Add comprehensive unit and E2E tests for object operation - Update ptc-json-specification.md documentation - Regenerate priv/ptc_schema.json with new operation - Update schema tests to expect 42 operations instead of 41 Closes #253 🤖 Generated with Claude Code Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
PR Review: feat: add object operation to construct maps with evaluated valuesSummaryThis PR implements issue #253 by adding the What's Good
Issues (Must Fix)
Suggestions (Optional)
SecurityNo security concerns. The operation evaluates expressions through the existing sandboxed interpreter. Documentation
VerdictRequest Changes - The implementation is correct and follows existing patterns well, but missing tests specified in issue #253 must be added for completeness. The fixes are mechanical and follow existing patterns in the codebase. |
|
@claude please fix these issues from PR review: Issue 1: Missing validation tests for object operationLocation:
Issue 2: Moduledoc not updated with object operationLocation: Please fix ALL issues above in a SINGLE commit. Make minimal changes to resolve each issue. |
Auto-Triage SummaryDecisions Made
Reasoning
Status
All issues are mechanical fixes that follow existing patterns in the codebase. Once fixes are applied, the PR will be complete per issue #253 requirements. |
…uledoc - Add three validation tests for object operation in collection_test.exs: * Test error propagation in field expressions * Test validation fails when fields parameter is missing * Test validation fails when fields parameter is not a map - Update moduledoc in operations.ex to include 'object' in Phase 3 operations list - Add catch-all clause in validator.ex to properly handle invalid field types 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Fix SummaryAll issues from the PR review have been addressed: Issue 1: Missing validation tests for object operation ✅Added three validation tests to
Issue 2: Moduledoc not updated with object operation ✅Updated
Additional Fix ✅Fixed the validator in
All tests pass and precommit checks are clean. |
PR Review: feat: add object operation to construct maps with evaluated valuesSummaryThis PR implements issue #253 by adding the What's Good
Issues (Must Fix)None. All issues from the previous review have been properly addressed. Suggestions (Optional)None. The implementation is appropriately scoped and complete. SecurityNo security concerns. The operation evaluates expressions through the existing sandboxed interpreter with established resource limits. Documentation
VerdictApprove - The implementation is complete, well-tested, and follows established codebase patterns. All requirements from issue #253 are met, including the validation tests that were added after the previous review. The 448 JSON tests and 72 schema tests pass. |
Auto-Triage Summary (Cycle 1 of 3)Status: Already Triaged ✅This PR has already completed a full triage cycle:
Current State
The PR is ready for auto-merge once all checks pass. |
Summary
Implements issue #253: adds the
objectoperation to PTC-JSON that constructs maps with evaluated expression values, fixing the memory contract that was previously impossible to express correctly.Changes
objectoperation definition withfieldsparameter (map type)validate_object/2for recursive field validation of operation valueseval_objectandevaluate_object_field_valueto evaluate fields with expressionsobjectinstead of the invalidmergepatternvarreferencesobjectoperationsTest Plan
✅ All new tests pass
✅ All existing tests pass
✅ Credo passes
✅ Code format passes
✅ Compilation succeeds with warnings as errors
Verification
The implementation enables the memory contract to work correctly:
{"program":{"op":"object","fields":{"my-key":{"op":"var","name":"x"},"result":42}}}Closes #253
🤖 Generated with Claude Code
Co-Authored-By: Claude Haiku 4.5 noreply@anthropic.com