Skip to content

Commit aa5e30c

Browse files
gustavoavenameta-codesync[bot]
authored andcommitted
restricted_paths: rename test builder to with_path_restriction_metadata
Summary: ## This stack Decouple restricted_paths config from the manifest_id store (T277178795). Replace `path_acls` (path -> ACL) with per-path `PathRestrictionMetadata` carrying the REPO_REGION ACL and optional permission-request group, so a future `read_only` flag can freeze manifest-id-store growth without dropping enforcement. Thrift `path_acls` is retained as a parser fallback. The configerator thrift source is the separately-published D109697491. ## This diff (no-op) Rename `RestrictedPathsConfigBuilder::with_path_acl_str` to `with_path_restriction_metadata` and update all callsites. Pure rename — no behaviour change. Reviewed By: lmvasquezg Differential Revision: D109827028 fbshipit-source-id: 15f4f263c87fb3f9eb5f768a3ed8893571f5ba87
1 parent 52b7416 commit aa5e30c

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

‎eden/mononoke/repo_attributes/restricted_paths/src/lib.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,8 +1030,8 @@ mod tests {
10301030
#[mononoke::fbinit_test]
10311031
async fn test_with_config(fb: FacebookInit) -> Result<()> {
10321032
let config = RestrictedPathsConfigBuilder::new()
1033-
.with_path_acl_str("restricted/dir", "SERVICE_IDENTITY:restricted_acl")?
1034-
.with_path_acl_str("other/restricted", "SERVICE_IDENTITY:other_acl")?
1033+
.with_path_restriction_metadata("restricted/dir", "SERVICE_IDENTITY:restricted_acl")?
1034+
.with_path_restriction_metadata("other/restricted", "SERVICE_IDENTITY:other_acl")?
10351035
.build();
10361036

10371037
let repo_restricted_paths = build_test_restricted_paths(fb, config).await?;
@@ -1044,7 +1044,7 @@ mod tests {
10441044
async fn test_path_matching(fb: FacebookInit) -> Result<()> {
10451045
let restricted_acl = MononokeIdentity::from_str("SERVICE_IDENTITY:restricted_acl")?;
10461046
let config = RestrictedPathsConfigBuilder::new()
1047-
.with_path_acl_str("restricted/dir", &restricted_acl.to_string())?
1047+
.with_path_restriction_metadata("restricted/dir", &restricted_acl.to_string())?
10481048
.build();
10491049

10501050
let repo_restricted_paths = build_test_restricted_paths(fb, config).await?;
@@ -1191,7 +1191,7 @@ mod tests {
11911191
#[mononoke::fbinit_test]
11921192
async fn test_disabled_mode_keeps_config_authoritative_lookup(fb: FacebookInit) -> Result<()> {
11931193
let config = RestrictedPathsConfigBuilder::new()
1194-
.with_path_acl_str("restricted/dir", "SERVICE_IDENTITY:restricted_acl")?
1194+
.with_path_restriction_metadata("restricted/dir", "SERVICE_IDENTITY:restricted_acl")?
11951195
.build();
11961196
let restricted_paths =
11971197
build_test_restricted_paths_with_options(fb, config, DummyAclProvider::new(fb)?, false)

‎eden/mononoke/repo_attributes/restricted_paths/src/test_utils.rs‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ impl RestrictedPathsConfigBuilder {
5353
}
5454
}
5555

56-
pub(crate) fn with_path_acl_str(mut self, path: &str, identity: &str) -> Result<Self> {
56+
pub(crate) fn with_path_restriction_metadata(
57+
mut self,
58+
path: &str,
59+
identity: &str,
60+
) -> Result<Self> {
5761
self.config.path_restriction_metadata.insert(
5862
NonRootMPath::new(path)?,
5963
PathRestrictionMetadata {
@@ -150,7 +154,7 @@ mod tests {
150154
#[mononoke::test]
151155
fn test_restricted_paths_config_builder_sets_common_fields() -> Result<()> {
152156
let config = RestrictedPathsConfigBuilder::new()
153-
.with_path_acl_str("restricted", "REPO_REGION:restricted_acl")?
157+
.with_path_restriction_metadata("restricted", "REPO_REGION:restricted_acl")?
154158
.build();
155159

156160
assert!(config.use_manifest_id_cache);

0 commit comments

Comments
 (0)