feat(scope-eval): add new package for evaluating operations in isolated scopes#145
feat(scope-eval): add new package for evaluating operations in isolated scopes#145
Conversation
commit: |
Policy Compliance AssessmentSummary
Violations detailsCritical Violations
Advisory Notes
Detailed Analysis✅ No-Sleep Test Synchronization Policy (Recommended)Status: COMPLIANT All tests in
|
|
Policy bot ftw 💪🏻 We should agree on what template the agent will follow when it creates a PR summary. Parts of it are really helpful, but others are just noise. For example, saying how many tests are there for each function doesn't really contribute anything and causes eyes to glaze over. If we can train it to stick to our PR template that would be very helpful. In particular, we have developed a culture of leading with why not how. Hence Motivation, not Summary It just makes it so much faster to review, and with the volume of PRs increasing (a good thing) we should make our PR descriptions as slick as possible so they can slide right through. |
- Remove verbose summary tables and counts - Only list violations, not compliant items - Keep feedback concise and actionable - When compliant, just say 'No violations found.' Addresses feedback from #145
Policy Review1 violation found:
All other files comply with both policies:
|
c7b9f0c to
65b3912
Compare
Policy Review1 violation found:
The function should be refactored to return { *Symbol.iterator { ... } } to enable deferred execution and reusability, matching the pattern used by box() and other stream helpers. |
…ed scopes Adds @effectionx/scope-eval package that provides: - useEvalScope(): Create an isolated scope for evaluating operations and inspecting their side effects (like context values) - box(): Execute an operation and capture result as Result<T> - unbox(): Extract value from Result<T>, throwing on error This enables testing patterns where you need to evaluate operations in a separate scope and access context values set by those operations.
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
- Remove duplicate box() function definition - Apply Stateless Streams policy (use *[Symbol.iterator] pattern) - Fix formatting (tabs -> spaces)
…s policy Resource/hook functions like useScope(), useEvalScope() are designed to set up state within a scope and are not meant to be stored and reused like stream operations.
65b3912 to
fd9ab62
Compare
Policy ReviewNo violations found. All code in this PR complies with the policies defined in .policies/index.md:
|
- Create new result package with box() and unbox() utilities - Update scope-eval to depend on @effectionx/result - Re-export box/unbox from scope-eval for convenience - Move box/unbox tests to result package
Policy ReviewNo violations found. All code changes comply with the project policies:
|
Re-export these from effection for convenience so users can import everything result-related from one place.
Policy ReviewNo violations found. Compliance SummaryStateless Stream Operations Policy (.policies/stateless-streams.md):
No-Sleep Test Synchronization Policy (.policies/no-sleep-test-sync.md):
Policy Clarification:
|
Policy ReviewNo violations found. Summary: All changes comply with the project policies:
|
|
Ok,Err, and Result are all available from effection core. I'm totally ok including |
Per feedback: Ok, Err, and Result are available from effection core, so box and unbox can stay in scope-eval without a separate package.
Policy ReviewNo violations found. SummaryThis PR adds the Policy Compliance:
The code follows all applicable policies. |
Motivation
When testing Effection operations, we often need to:
Approach
@effectionx/scope-evaluseEvalScope()Create isolated scopes for evaluating operations:
box()/unbox()Utilities for capturing operation results:
Policy Clarification
Also clarifies that
use*resource functions (likeuseEvalScope()) are exempt from the Stateless Streams policy, since they follow Effection's convention for scope-bound resources.