Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

Commit 39cdae2

Browse files
merge: #3496
3496: Drop ActionKind from ActionPrototype edge (ENG-2434) r=nickgerace a=nickgerace ## Description This PR drops `ActionKind` from the `ActionPrototype` variant within `EdgeWeightKind`. This information is available within the `ActionPrototype` node and we should not store duplicate information unless strictly necessary. <img src="https://media4.giphy.com/media/v8ysebDNM6jRnlBw8u/giphy.gif"/> Co-authored-by: Nick Gerace <nick@systeminit.com>
2 parents cd2dc69 + 6696744 commit 39cdae2

4 files changed

Lines changed: 4 additions & 13 deletions

File tree

lib/dal/src/action.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ impl Action {
133133
let change_set = ctx.change_set()?;
134134
let id = change_set.generate_ulid()?;
135135
let node_weight = NodeWeight::new_content(change_set, id, ContentAddress::Action(hash))?;
136-
let action_prototype = ActionPrototype::get_by_id(ctx, prototype_id).await?;
137136

138137
let workspace_snapshot = ctx.workspace_snapshot()?;
139138

@@ -142,10 +141,7 @@ impl Action {
142141
workspace_snapshot
143142
.add_edge(
144143
id,
145-
EdgeWeight::new(
146-
change_set,
147-
EdgeWeightKind::ActionPrototype(action_prototype.kind),
148-
)?,
144+
EdgeWeight::new(change_set, EdgeWeightKind::ActionPrototype)?,
149145
prototype_id,
150146
)
151147
.await?;

lib/dal/src/action/prototype.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl ActionPrototype {
196196
workspace_snapshot
197197
.add_edge(
198198
schema_variant_id,
199-
EdgeWeight::new(change_set, EdgeWeightKind::ActionPrototype(kind))?,
199+
EdgeWeight::new(change_set, EdgeWeightKind::ActionPrototype)?,
200200
id,
201201
)
202202
.await?;

lib/dal/src/workspace_snapshot/edge_weight.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use thiserror::Error;
77

88
use crate::change_set::ChangeSet;
99
use crate::workspace_snapshot::vector_clock::{VectorClock, VectorClockError, VectorClockId};
10-
use crate::ActionKind;
1110

1211
#[derive(Debug, Error)]
1312
pub enum EdgeWeightError {
@@ -23,7 +22,7 @@ pub type EdgeWeightResult<T> = Result<T, EdgeWeightError>;
2322
pub enum EdgeWeightKind {
2423
Action,
2524
/// A function used by a [`SchemaVariant`] to perform an action that affects its resource
26-
ActionPrototype(ActionKind),
25+
ActionPrototype,
2726
/// A function defined for a secret defining [`SchemaVariant`] to be executed before funcs on
2827
/// components that have a secret of that kind
2928
AuthenticationPrototype,

lib/dal/src/workspace_snapshot/graph.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,11 +1696,6 @@ impl WorkspaceSnapshotGraph {
16961696
// This is the key for an entry in a map.
16971697
EdgeWeightKind::Contain(Some(key)) => hasher.update(key.as_bytes()),
16981698

1699-
// This is the kind of the action.
1700-
EdgeWeightKind::ActionPrototype(kind) => {
1701-
hasher.update(kind.to_string().as_bytes())
1702-
}
1703-
17041699
EdgeWeightKind::Use { is_default } => {
17051700
hasher.update(is_default.to_string().as_bytes())
17061701
}
@@ -1713,6 +1708,7 @@ impl WorkspaceSnapshotGraph {
17131708
// in the edge itself.
17141709
EdgeWeightKind::AuthenticationPrototype
17151710
| EdgeWeightKind::Action
1711+
| EdgeWeightKind::ActionPrototype
17161712
| EdgeWeightKind::Contain(None)
17171713
| EdgeWeightKind::FrameContains
17181714
| EdgeWeightKind::PrototypeArgument

0 commit comments

Comments
 (0)