harbor run -t datacurve/boa-hierarchical-evaluation-cancellationharbor download datacurve/boa-hierarchical-evaluation-cancellationHosts need cancellation across nested evaluations, module phases, and queued jobs without discarding Context.
Implement evaluation cancellation with parent/child handles and cancellation checkpoints.
Context::{new_evaluation_handle, new_child_evaluation_handle, eval_with_evaluation, enqueue_job_with_evaluation, run_jobs_with_evaluation},
Script::evaluate_with_evaluation,
Module::{evaluate_with_evaluation, load_link_evaluate_with_evaluation},
and EvaluationHandle::{child, cancel, cancel_with_reason, is_cancelled, cancellation_reason}.Script::evaluate_with_evaluation and both Module::*_with_evaluation entry points, argument order is (handle, context) after &self.Context handle-aware argument order is:
eval_with_evaluation(source, handle),
enqueue_job_with_evaluation(job, handle),
and run_jobs_with_evaluation(handle).Context::{eval_with_evaluation, enqueue_job_with_evaluation, run_jobs_with_evaluation} must each return a fallible result with the same result-shape category as its non-handle analog.cancel_with_reason must accept any caller value convertible into the engine value type.cancel and cancel_with_reason return bool indicating whether that call performed the first effective cancellation.cancellation_reason(context) must return an optional value (None when not cancelled, Some(reason) when cancelled).cancellation_reason(context) must surface inherited ancestor cancellation reason unless the descendant already has its own first effective reason.cancel and cancel_with_reason must report whether the call performed the first effective cancellation.Context usage.Module::evaluate_with_evaluation and Module::load_link_evaluate_with_evaluation must reject with the same cancellation reason value that cancelled the handle.
For an already-cancelled handle, Module::evaluate_with_evaluation must still return success with a rejected promise.Module::load_link_evaluate_with_evaluation must check cancellation at phase boundaries so cancellation after load but before evaluate still rejects and prevents side effects.Context::enqueue_job_with_evaluation(job, handle) must fail immediately when handle is already cancelled and must not enqueue that job.cancellation_reason(context) must produce an Error-like value whose string contains AbortError.Context::run_jobs_with_evaluation(handle) must fail immediately when handle is already cancelled and must not drain queued jobs in that failed call.IMPORTANT: Please work on this in a new branch from main and commit everything when you are done.