Skip to content

Make file.list_recent() work without args#2002

Draft
KCarretto wants to merge 2 commits intomainfrom
feature/eldritch-file-list-recent-defaults-7332547565275857859
Draft

Make file.list_recent() work without args#2002
KCarretto wants to merge 2 commits intomainfrom
feature/eldritch-file-list-recent-defaults-7332547565275857859

Conversation

@KCarretto
Copy link
Collaborator

Modified implants/lib/eldritch/stdlib/eldritch-libfile components to allow list_recent method to accept Option<String> and Option<i64>. Default values are / and 10 respectively. Tests added.


PR created automatically by Jules for task 7332547565275857859 started by @KCarretto

Modify `file.list_recent()` to use optional arguments.
If not provided, the `path` defaults to `/` and the `limit` defaults to `10`.

This makes it simpler to use `file.list_recent()` from the eldritch REPL.

Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2731    ±0 2731    ±0 0    ±0 0    ±0 0    ±0 0    ±0 1ms    ±0

Previous Results

Build 🏗️ Result 🧪 Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
#1469 2731 2731 0 0 0 0 43.9s

Insights

Average Tests per Run Total Flaky Tests Total Failed Slowest Test (p95)
2731 0 0 5m 51s

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
eldritch-libfile: std::list_recent_impl::tests::test_list_recent_default_args 3 4m 12s 5m 51s
eldritch-libfile: std::list_recent_impl::tests::test_list_recent_default_args 3 4m 12s 5m 51s
eldritch-libfile: std::list_recent_impl::tests::test_list_recent_default_args 3 4m 12s 5m 51s
TestDockerExecutor_Build_ContextCancellation 1 5.5s 5.5s
eldritch-libsys: std::dll_inject_impl::tests::test_dll_inject_simple 1 5.2s 5.2s
TestInteractiveShell 1 5.1s 5.1s
TestOtherStreamOutput 1 5.0s 5.0s
imix::bin/imix: install::tests::test_install_execution 3 1.6s 4.7s
imix::bin/imix: install::tests::test_install_execution 3 1.6s 4.7s
imix::bin/imix: install::tests::test_install_execution 3 1.6s 4.7s

🎉 No failed tests in this run. | 🍂 No flaky tests in this run.

Github Test Reporter by CTRF 💚

🔄 This comment has been updated

pub fn list_recent(path: Option<String>, limit: Option<i64>) -> Result<Vec<String>, String> {
let mut entries = Vec::new();
let root = Path::new(&path);
let path_str = path.unwrap_or_else(|| "/".to_string());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On windows this should default to the root of the drive

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a check to use C:\ as the default path on Windows, and / otherwise.

// Take limit
let limit = if limit < 0 { 0 } else { limit as usize };
let result = entries.into_iter().take(limit).map(|e| e.path).collect();
let limit_usize = if limit_val < 0 { 0 } else { limit_val as usize };
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Limit should have a minimum value of 1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the check to ensure limit is at least 1.

- Use C:\ as default on Windows
- Ensure limit is at least 1

Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant