Skip to content

Remove multiple entrypoints into Goal code#12668

Closed
L-as wants to merge 4 commits intoNixOS:masterfrom
L-as:me/remove-multiple-entrypoints
Closed

Remove multiple entrypoints into Goal code#12668
L-as wants to merge 4 commits intoNixOS:masterfrom
L-as:me/remove-multiple-entrypoints

Conversation

@L-as
Copy link
Copy Markdown
Member

@L-as L-as commented Mar 17, 2025

Motivation

The CFG was made clearer after the switch to coroutines,
but there was still a relic of the old system via handleChildOutput, handleEOF, timedOut, and cleanup.

This PR removes all 4 of these overridable methods from Goal, and leaves only handleChildOutput and timedOut
as the interface with Worker.

Context

Related to #12628.

Probably conflicts a bit with #12663.

Replaces draft PR #12632.


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@L-as L-as requested a review from Ericson2314 as a code owner March 17, 2025 23:06
@L-as
Copy link
Copy Markdown
Member Author

L-as commented Mar 17, 2025

Nevermind, internal compiler error... I only tested with Clang.

Worked around

@L-as
Copy link
Copy Markdown
Member Author

L-as commented Mar 17, 2025

Even after working around it, spurious segfaults when testing with GCC...

My bug! Clang just didn't trigger it.

@L-as L-as force-pushed the me/remove-multiple-entrypoints branch from aac0ed7 to 78d0faa Compare March 18, 2025 00:05
@Ericson2314 Ericson2314 force-pushed the me/remove-multiple-entrypoints branch 2 times, most recently from 59e89ba to 4041b24 Compare March 21, 2025 16:14
unsigned long & logSize,
std::string & currentLogLine,
size_t & currentLogLinePos,
std::list<std::string> & logTail
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a lot of function arguments. Maybe this could be moved into a struct? (Possibly in a future PR.)

Copy link
Copy Markdown
Member

@Ericson2314 Ericson2314 Mar 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edolstra I think the end game is just to move the closure inline, and all of this stuff can just become captures, not arguments to a builder function.

@Ericson2314 Ericson2314 force-pushed the me/remove-multiple-entrypoints branch 6 times, most recently from 53a81e3 to e40d63c Compare March 26, 2025 19:11
L-as added 4 commits April 18, 2025 12:49
Instead, there is a `std::function`, which can be set just in time, that
is called.
You call `childStarted`, instead of `worker.childStarted`,
which takes a lambda that handles the child output.

The handler can return true to end it early.

This commit breaks timeouts, but the next one fixes it.
This removes the last additional entry point into Goal's subclasses,
such that the CFG in the subclasses is now trivial to see.
@Ericson2314 Ericson2314 force-pushed the me/remove-multiple-entrypoints branch from e40d63c to 2c1defe Compare April 18, 2025 16:50
@Ericson2314
Copy link
Copy Markdown
Member

I believe this has now been done (!)

@Ericson2314 Ericson2314 closed this Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants