You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix two-phase CA derivation resolution and StorePath type safety
Fix several issues with the `ca-resolve-two-phase` branch:
- Fix `find_build_step_outputs` SQL: `?` → `$1` (PostgreSQL), add
`s.build = o.build` join condition
- Fix dep graph propagation: when resolving a CA derivation, remove
the original step from each dependent's deps and replace with the
resolved step, so downstream steps become runnable
- Skip two-phase resolution for CA floating drvs with only `Opaque`
inputs (no `Built` deps) — these are already resolved
- Replace `resolvedToStep` (integer FK) with `resolvedDrvPath` (text
basename) so output lookups work across builds by drv path
So it turns out that only scheduled or finishes steps go in the DB
with the current desing. Steps which totally pending (blocked on other
steps, for example) just live in memory. So we won't get our step
number at resolution time to use as a foreign key.
Instead, we can just write down the drv path, which is enough for the
in-memory step, and only when that step is processsed will something
end up in the data base.
- Remove eager `create_build_step` for resolved steps — the DB entry
is created when the step is actually dispatched
very much corresponds to the above
- Skip dyn-drv integration test (dynamic derivation resolution not
yet implemented in Hydra)
Our passing it was very much a lie before. Our failing it now is more
honest.
- Add unit tests for `resolve_drv_output_chains` with resolved steps
-- If this step was resolved, look up outputs from
359
+
-- the resolved drv's successful buildstep instead.
360
+
-- resolvedDrvPath is a bare basename; drvPath is a
361
+
-- full path, so strip the directory prefix to compare.
358
362
LEFT JOIN buildsteps sr
359
-
ON s.build = sr.build AND s.resolvedToStep = sr.stepnr
363
+
ON sr.drvPath = $2 || '/' || s.resolvedDrvPath
364
+
AND sr.status = 0
360
365
JOIN buildstepoutputs o
361
-
ON s.build = o.build AND (s.stepnr = o.stepnr OR sr.stepnr = o.stepnr)
366
+
ON o.build = COALESCE(sr.build, s.build)
367
+
AND o.stepnr = COALESCE(sr.stepnr, s.stepnr)
362
368
WHERE s.drvPath = r.drv_path
363
369
AND o.name = i.chain[r.step]
364
370
AND o.path IS NOT NULL
365
-
AND (s.status = 0 OR (s.status = 13 AND sr.status = 0))
371
+
AND (s.status = 0 OR s.status = 13)
366
372
ORDER BY s.build DESC
367
373
LIMIT 1
368
374
) sub
@@ -378,6 +384,7 @@ impl Connection {
378
384
",
379
385
)
380
386
.bind(&json_input)
387
+
.bind(store_dir.to_str())
381
388
.fetch_all(&mut*self.conn)
382
389
.await?;
383
390
@@ -698,11 +705,31 @@ impl Transaction<'_> {
698
705
#[tracing::instrument(skip(self), err)]
699
706
pubasyncfnfind_build_step_outputs(
700
707
&mutself,
701
-
drv_path:&str,
702
-
) -> sqlx::Result<BTreeMap<String,String>>{
703
-
let items:Vec<(String,String)> = sqlx::query_as("SELECT o.name, o.path FROM buildstepoutputs o JOIN buildsteps s ON s.stepnr = o.stepnr WHERE s.drvpath = ? AND o.path IS NOT NULL").bind(drv_path).fetch_all(&mut*self.tx).await?;
0 commit comments