Skip to content

Commit 3a1fed4

Browse files
committed
relaxes ai_model naming
Signed-off-by: Aminu Oluwaseun Joshua <[email protected]>
1 parent 7c92525 commit 3a1fed4

File tree

5 files changed

+8
-28
lines changed

5 files changed

+8
-28
lines changed

crates/manifest/src/compat.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ pub fn v1_to_v2_app(manifest: v1::AppManifestV1) -> Result<v2::AppManifest, Erro
4242
.map(|(key, var)| Ok((id_from_string(key)?, var)))
4343
.collect::<Result<_, Error>>()?;
4444

45-
let ai_models = component
46-
.ai_models
47-
.into_iter()
48-
.map(id_from_string)
49-
.collect::<Result<_, Error>>()?;
5045
let allowed_http = convert_allowed_http_to_allowed_hosts(
5146
&component.allowed_http_hosts,
5247
component.allowed_outbound_hosts.is_none(),
@@ -71,7 +66,7 @@ pub fn v1_to_v2_app(manifest: v1::AppManifestV1) -> Result<v2::AppManifest, Erro
7166
exclude_files: component.exclude_files,
7267
key_value_stores: component.key_value_stores,
7368
sqlite_databases: component.sqlite_databases,
74-
ai_models,
69+
ai_models: component.ai_models,
7570
build: component.build,
7671
tool: Default::default(),
7772
allowed_outbound_hosts,

crates/manifest/src/schema/v2.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -796,21 +796,6 @@ mod tests {
796796
}
797797
}
798798

799-
#[test]
800-
fn test_valid_kebab_ids() {
801-
for valid in [
802-
"default",
803-
"mixed-case-words",
804-
"letters1-then2-numbers345",
805-
"gpt-oss:20b",
806-
"gpt-4",
807-
] {
808-
if let Err(err) = KebabId::try_from(valid.to_string()) {
809-
panic!("{valid:?} should be value: {err:?}");
810-
}
811-
}
812-
}
813-
814799
#[test]
815800
fn test_invalid_snake_ids() {
816801
for invalid in [

crates/manifest/tests/ui/invalid/bad_kebab_component_ref.err

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ TOML parse error at line 7, column 13
22
|
33
7 | component = "1-2-3"
44
| ^^^^^^^
5-
'-'-separated words must start with an ASCII letter or digit; got '1'
5+
'-'-separated words must start with an ASCII letter; got '1'
66

crates/manifest/tests/ui/invalid/bad_variable_name.err

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ TOML parse error at line 7, column 1
22
|
33
7 | "bad+name" = { required = true }
44
| ^^^^^^^^^^
5-
'_'-separated words may only contain alphanumeric ASCII (plus ':' inside words); got '+'
5+
'_'-separated words may only contain alphanumeric ASCII; got '+'

crates/serde/src/id.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,23 @@ impl<const DELIM: char, const LOWER: bool> TryFrom<String> for Id<DELIM, LOWER>
4444
));
4545
}
4646
}
47-
for (i, word) in id.split(DELIM).enumerate() {
47+
for word in id.split(DELIM) {
4848
if word.is_empty() {
4949
return Err(format!("{DELIM:?}-separated words must not be empty"));
5050
}
5151
let mut chars = word.chars();
5252
let first = chars.next().unwrap();
53-
if !(first.is_ascii_alphabetic() || (i > 0 && first.is_ascii_digit())) {
53+
if !first.is_ascii_alphabetic() {
5454
return Err(format!(
55-
"{DELIM:?}-separated words must start with an ASCII letter or digit; got {first:?}"
55+
"{DELIM:?}-separated words must start with an ASCII letter; got {first:?}"
5656
));
5757
}
5858
let word_is_uppercase = first.is_ascii_uppercase();
5959
for ch in chars {
60-
if ch.is_ascii_digit() || ch == ':' {
60+
if ch.is_ascii_digit() {
6161
} else if !ch.is_ascii_alphanumeric() {
6262
return Err(format!(
63-
"{DELIM:?}-separated words may only contain alphanumeric ASCII (plus ':' inside words); got {ch:?}"
63+
"{DELIM:?}-separated words may only contain alphanumeric ASCII; got {ch:?}"
6464
));
6565
} else if ch.is_ascii_uppercase() != word_is_uppercase {
6666
return Err(format!("{DELIM:?}-separated words must be all lowercase or all UPPERCASE; got {word:?}"));

0 commit comments

Comments
 (0)