Unverified Commit 148c7ff0 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

Rename TaskExecutionReason::Initial to Root (#93922)

### What?

Renames the `TaskExecutionReason::Initial` variant to
`TaskExecutionReason::Root` in turbo-tasks, and updates its `as_str()`
representation from `"initial"` to `"root"`.

### Why?

The variant's doc comment already describes it as "A root task was
initially scheduled and is executed". The name `Initial` is misleading
because it suggests "first execution of any task", which overlaps
semantically with other variants like `ActivateInitial` (a task
activated for the first time with no output yet). `Root` accurately
reflects that this reason is specifically used when a root task is
scheduled, making the enum easier to read and reason about at call sites
and in traces.

### How?

- `turbopack/crates/turbo-tasks/src/task_execution_reason.rs`: rename
the enum variant `Initial` → `Root` and update the `as_str()` mapping to
return `"root"`.
- `turbopack/crates/turbo-tasks-backend/src/backend/storage_schema.rs`:
update the single construction site that used
`TaskExecutionReason::Initial` when scheduling a root task.

No behavioral changes — this is a pure rename. The other `*Initial`
variant (`ActivateInitial`) is intentionally left untouched because it
describes a different concept (first-time activation of a non-root
task).

Verified with `cargo check` and `cargo clippy` on `turbo-tasks` and
`turbo-tasks-backend`.

Closes NEXT-
Fixes #
Co-authored-by: 's avatarv-work-app[bot] <262237222+v-work-app[bot]@users.noreply.github.com>
Co-authored-by: 's avatarClaude <noreply@anthropic.com>
Co-authored-by: 's avatarTobias Koppers <sokra@users.noreply.github.com>
parent 0114ea24
...@@ -781,7 +781,7 @@ impl TaskStorage { ...@@ -781,7 +781,7 @@ impl TaskStorage {
})); }));
self.set_in_progress(InProgressState::Scheduled { self.set_in_progress(InProgressState::Scheduled {
done_event, done_event,
reason: TaskExecutionReason::Initial, reason: TaskExecutionReason::Root,
}); });
} }
......
#[derive(Debug)] #[derive(Debug)]
pub enum TaskExecutionReason { pub enum TaskExecutionReason {
/// A root task was initially scheduled and is executed /// A root task was initially scheduled and is executed
Initial, Root,
/// A task output was read, but the output is not available, so the task was scheduled and /// A task output was read, but the output is not available, so the task was scheduled and
/// executed to produce the output /// executed to produce the output
OutputNotAvailable, OutputNotAvailable,
...@@ -29,7 +29,7 @@ pub enum TaskExecutionReason { ...@@ -29,7 +29,7 @@ pub enum TaskExecutionReason {
impl TaskExecutionReason { impl TaskExecutionReason {
pub fn as_str(&self) -> &'static str { pub fn as_str(&self) -> &'static str {
match self { match self {
TaskExecutionReason::Initial => "initial", TaskExecutionReason::Root => "root",
TaskExecutionReason::OutputNotAvailable => "output_not_available", TaskExecutionReason::OutputNotAvailable => "output_not_available",
TaskExecutionReason::CellNotAvailable => "cell_not_available", TaskExecutionReason::CellNotAvailable => "cell_not_available",
TaskExecutionReason::Invalidated => "invalidated", TaskExecutionReason::Invalidated => "invalidated",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment