Skip to content

Commit

Permalink
fix(dal): ensure we don't search for funcs by name
Browse files Browse the repository at this point in the history
When installing a generated variant, we need to check for the func by funcid rather than name because if we use name we can find a corresponding name and could end up with a conflicting func in a package

This was manifesting itself as a regenerate showing old func variants
  • Loading branch information
stack72 committed Jul 19, 2024
1 parent 7eef287 commit 864e12c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/dal/src/pkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ pub enum PkgError {
TakingOutputSocketAsInputForPropUnsupported(String, String),
#[error("transactions error: {0}")]
Transactions(#[from] TransactionsError),
#[error(transparent)]
UlidDecode(#[from] ulid::DecodeError),
#[error("url parse error: {0}")]
Url(#[from] ParseError),
#[error("workspace error: {0}")]
Expand Down
7 changes: 5 additions & 2 deletions lib/dal/src/pkg/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use si_pkg::{
};
use std::collections::HashSet;
use std::fmt::Debug;
use std::str::FromStr;
use std::{collections::HashMap, path::Path};
use telemetry::prelude::*;
use tokio::sync::Mutex;
Expand Down Expand Up @@ -952,8 +953,10 @@ pub async fn import_only_new_funcs(
Func::get_by_id_or_error(ctx, func_id).await?
} else {
// Find or create the func for the provided spec.
let func = if let Some(func_id) = Func::find_id_by_name(ctx, &func_spec.name()).await? {
Func::get_by_id_or_error(ctx, func_id).await?
let func = if let Some(func) =
Func::get_by_id(ctx, FuncId::from_str(func_spec.unique_id())?).await?
{
func
} else {
create_func(ctx, &func_spec, false).await?
};
Expand Down

0 comments on commit 864e12c

Please sign in to comment.