Skip to content

Commit 92346bb

Browse files
authored
fix: Audit 07/27 (#2069)
* Fix unknown layer. * Bump.
1 parent e54482b commit 92346bb

4 files changed

Lines changed: 33 additions & 0 deletions

File tree

.yarn/versions/3e67dece.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
releases:
2+
"@moonrepo/cli": patch
3+
"@moonrepo/core-linux-arm64-gnu": patch
4+
"@moonrepo/core-linux-arm64-musl": patch
5+
"@moonrepo/core-linux-x64-gnu": patch
6+
"@moonrepo/core-linux-x64-musl": patch
7+
"@moonrepo/core-macos-arm64": patch
8+
"@moonrepo/core-macos-x64": patch
9+
"@moonrepo/core-windows-x64-msvc": patch

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
#### 🐞 Fixes
6+
7+
- Fixed a regression where an unknown/unconfigured `layer` would trigger a violation error.
8+
39
## 1.39.2
410

511
#### 🐞 Fixes

crates/project-constraints/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ pub fn enforce_layer_relationships(
7373
return Ok(());
7474
}
7575

76+
// Unknown layers can depend on anything, since we don't know what it is!
77+
if source.layer == LayerType::Unknown {
78+
return Ok(());
79+
}
80+
7681
let mut allowed = vec![];
7782
let mut found_layer = false;
7883

crates/project-constraints/tests/constraints_test.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use moon_common::Id;
2+
use moon_config::schematic::ConfigEnum;
23
use moon_config::{DependencyScope, StackType};
34
use moon_project::{LayerType, Project, ProjectConfig};
45
use moon_project_constraints::{enforce_layer_relationships, enforce_tag_relationships};
@@ -438,6 +439,18 @@ mod by_layer {
438439
.unwrap();
439440
}
440441

442+
#[test]
443+
fn unknown_can_use_everything() {
444+
for layer in LayerType::variants() {
445+
enforce_layer_relationships(
446+
&create_project("foo", LayerType::Unknown),
447+
&create_project("bar", layer),
448+
&DependencyScope::Production,
449+
)
450+
.unwrap();
451+
}
452+
}
453+
441454
mod config {
442455
use super::*;
443456

0 commit comments

Comments
 (0)