this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

internal/core/adt: document why toComplete hook must stay

Disabling the post-task toComplete hook in runTask causes
three categories of regressions:

1. Cycle detection: self-referential list indexing returns
the let-bound reference instead of _.
(TestEvalV3/eval/disjunctions/indexElimination)
2. Unexpanded references: existence-check comprehensions
leave references unresolved instead of substituting the
concrete value.
(TestEvalV3/cycle/compbottomnofinal/large)
3. Disjunction defaults: nested definition chains gain
spurious defaults, and some disjunctions collapse early.
(TestEvalV3/comprehensions/issue3929/{reduced,full})

Root cause: toComplete is set in scheduleVertexConjuncts
when the arc's evaluation is still in progress. Without the
deferred completeNodeTasks(attemptOnly) call those nodes
never signal allAncestorsProcessed or process remaining
valueKnown|fieldConjunctsKnown tasks.

Also update eval stats for issue3929 to reflect the
current state of the evaluator.

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: I5a7793178532998821b75c6608115cdf0c0513ef
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1236179
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>

+28 -6
+6 -6
cue/testdata/comprehensions/issue3929.txtar
··· 211 211 Retain: 0 212 212 213 213 Unifications: 96 214 - Conjuncts: 262 215 - Disjuncts: 53 214 + Conjuncts: 278 215 + Disjuncts: 62 216 216 217 - NumCloseIDs: 99 217 + NumCloseIDs: 102 218 218 219 - ConjunctInfos: 157 220 - MaxConjunctInfos: 6 221 - MaxReqSets: 13 219 + ConjunctInfos: 161 220 + MaxConjunctInfos: 7 221 + MaxReqSets: 14 222 222 MaxRedirect: 3 223 223 -- out/compile -- 224 224 --- in.cue
+22
internal/core/adt/sched.go
··· 708 708 ctx.freeScope = ctx.freeScope[:len(ctx.freeScope)-1] 709 709 710 710 // TODO(pushdown): try to remove once transitioned. 711 + // 712 + // Disabling this block causes three categories of regressions: 713 + // 1. Cycle detection: self-referential list indexing (e.g. 714 + // x: [x[0]][0]) loses its cycle sentinel and returns the 715 + // let-bound reference instead of _. 716 + // Test: TestEvalV3/eval/disjunctions/indexElimination 717 + // 2. Unexpanded references: existence-check comprehensions 718 + // (if Y.host != _|_) leave references like Y_2.host unresolved 719 + // instead of substituting the concrete value "mod.test". 720 + // Test: TestEvalV3/cycle/compbottomnofinal/large 721 + // 3. Disjunction default handling: nested definition chains that 722 + // contain if-guarded disjunctions (e.g. imagePullPolicy) gain 723 + // spurious defaults, and disjunction values that should remain 724 + // as "a"|"b" collapse to a concrete value prematurely. 725 + // Tests: TestEvalV3/comprehensions/issue3929/{reduced,full} 726 + // 727 + // Root cause: toComplete is set in scheduleVertexConjuncts when the 728 + // arc being scheduled is still in progress (getBareState != nil). 729 + // Without the post-task completeNodeTasks(attemptOnly) call, those 730 + // nodes never signal allAncestorsProcessed or process remaining 731 + // valueKnown|fieldConjunctsKnown tasks, leaving evaluation 732 + // half-finished. 711 733 if n := t.node; n.toComplete { 712 734 n.toComplete = false 713 735 n.completeNodeTasks(attemptOnly)