Skip to content

Remove multiple entrypoints into Goal code #12668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

L-as
Copy link
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
Member Author

L-as commented Mar 17, 2025

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

Worked around

@L-as
Copy link
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
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
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 5 times, most recently from 6081257 to 53a81e3 Compare March 24, 2025 21:08
L-as added 4 commits March 26, 2025 15:11
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 53a81e3 to e40d63c Compare March 26, 2025 19:11
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