posit-dev / publisher

MIT License
3 stars 0 forks source link

Add recursive parameter to inspection API #1929

Closed mmarchetti closed 3 days ago

mmarchetti commented 3 days ago

Intent

This PR implements a recursive option to the POST /api/inspect endpoint.

Part of https://github.com/posit-dev/publisher/issues/1850

Type of Change

Approach

Walk the tree, inspecting every directory we find. The built-in exclusions are applied to avoid excess directory traversals.

Currently, performance is not great. On my machine, running in this source repo:

Automated Tests

There are no tests for this endpoint yet; that needs to change.

Directions for Reviewers

$(just executable-path) ui -vv --listen=localhost:9001 &
curl -s -XPOST -d '{}' 'localhost:9001/api/inspect?recursive=true&dir=test/sample-content' | jq
curl -s -XPOST -d '{}' 'localhost:9001/api/inspect?recursive=true' | jq
curl -s -XPOST -d '{}' 'localhost:9001/api/inspect?recursive=true&dir=test/sample-content&entrypoint=simple.py' | jq
sagerb commented 3 days ago

My timings (intel Mac) are similar:

While bad, I think it would still be acceptable for now.