Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force directory param to be required on API calls and refactor config-based watchers to work in subdirectories #1953

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

sagerb
Copy link
Collaborator

@sagerb sagerb commented Jul 11, 2024

refactored changes to make dir mandatory for API calls. Updated watchers for package files to work with subdirectories, and updated package views to work in subdirectories. Updated Bus callbacks to be typesafe.

Intent

Refactored changes to make dir mandatory for API calls.
Updated watchers for package files to work with subdirectories
Updated package views to work in subdirectories.
Updated Bus callbacks to be typesafe.

Resolves #1855
Resolves #1949

Type of Change

    • Bug Fix
    • New Feature
    • Breaking Change
    • Documentation
    • Refactor
    • Tooling

Directions for Reviewers

Use VSCode to open project's subdirectory directly as well as from a few parent subdirectories up.
With these projects, verify the functionality related to packages for both R and Python projects.
Be sure to both manually and automatically update the package file, along with verifying that a non-default package file name within the active config file will be watched and update within the view.

…ers for package files to work with subdirectories, and updated package views to work in subdirectories. Updated Bus callbacks to be typesafe.
contentRecord.projectDir,
".posit",
"publisher",
contentRecord.configurationName,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you clarify why this changed from cfg.configurationPath? Also, does it need a .toml suffix?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah I'm a bit confused by this as well. We have the configurationPath why not just use that as before with new RelativePattern and without making our own path?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll check, but I think this was probably just an oversight. I'll mark this and the other as being switched back and will test it from there. I'm sure the both of you are probably right.

Copy link
Collaborator

@dotNomad dotNomad left a comment

Choose a reason for hiding this comment

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

Marking this one to have the discussion around the API module pattern change.

get(configName: string, params?: { dir?: string }) {
get(configName: string, params: { dir: string }) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I understand this is to avoid us from forgetting the dir param when we should include it, but I do think we should discuss the value we are losing here. With this change the api module diverges from representing the API.

Personally I would prefer the module be a 1-1 with the actual API functionality. Mainly because I believe it causes confusion for anyone who isn't intimately familiar with the patterns of this code base why a URL param (which is normally optional) is not optional here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let's discuss.

Comment on lines +73 to -74
params: { dir: string; entrypoint?: string; recursive?: boolean },
python?: string,
params?: { dir?: string; entrypoint?: string; recursive?: boolean },
Copy link
Collaborator

Choose a reason for hiding this comment

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

I found this switch very confusing. The Axios functions, and all of our others do data or parameters to fill the data/URL, and then params. Seeing the function change elsewhere really got me scratching my head before I came back here to discover the movement.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did not like it either, but it comes at the language requirement to maintain the order of required then optional parameters. I'm good with refactoring this to avoid this awkwardness, but I do want to maintain the typescript parameter checks as they were invaluable to the refactoring work I was doing and I believe to what we have yet to do in the future.

contentRecord.projectDir,
".posit",
"publisher",
contentRecord.configurationName,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah I'm a bit confused by this as well. We have the configurationPath why not just use that as before with new RelativePattern and without making our own path?

Copy link
Collaborator

@dotNomad dotNomad left a comment

Choose a reason for hiding this comment

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

Marking approved - after discussion we created #1973 to clean this up as a follow-up

Base automatically changed from sagerb-use-projectDir-for-select-active-configuration to main July 16, 2024 19:03
@sagerb sagerb merged commit edcd8b5 into main Jul 16, 2024
12 checks passed
@sagerb sagerb deleted the sagerb-use-project-dir-for-files branch July 16, 2024 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants