Skip to content

Commit c38ccf7

Browse files
committed
fix(tools): match native rss search errors
Map leaf-symlink search-root cap::fs_list failures to wrong_type with operating-system operation failed, matching native SearchFiles.
1 parent c0eae13 commit c38ccf7

2 files changed

Lines changed: 2 additions & 23 deletions

File tree

‎rss/tools/search_files.rss‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,7 @@ fn walk_search(state: map, path: string, depth: int) -> map {
595595
let mut mapped_code: string = code;
596596
let mut mapped_message: string = types::map_string(error, "message", "");
597597
if mapped_message == "symlinks are not followed" {
598+
mapped_code = "wrong_type";
598599
mapped_message = "operating-system operation failed";
599600
} else {
600601
if code == "wrong_type" {

‎tests/rss_file_tool_tests.rs‎

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -900,29 +900,7 @@ fn search_caps_invalid_paths_and_symlinks_match_native() {
900900
&leaf_link_arguments,
901901
);
902902
let rss_leaf_link = run_rss_search(&fixture, &fixture.config(), leaf_link_arguments);
903-
let expected_leaf_link = json!({
904-
"ok": false,
905-
"content": "",
906-
"data": {},
907-
"error": {
908-
"code": "path_denied",
909-
"message": "operating-system operation failed"
910-
},
911-
"truncated": false,
912-
"artifacts": []
913-
});
914-
assert_eq!(
915-
canonical_envelope(&rss_leaf_link.result),
916-
expected_leaf_link
917-
);
918-
assert_eq!(
919-
native_leaf_link
920-
.error
921-
.as_ref()
922-
.map(|error| error.message.as_str()),
923-
Some("operating-system operation failed")
924-
);
925-
assert!(!native_leaf_link.ok);
903+
assert_exact_envelope(&native_leaf_link, &rss_leaf_link.result);
926904

927905
let mut config = fixture.config();
928906
config.max_search_matches = 1;

0 commit comments

Comments
 (0)