-
Notifications
You must be signed in to change notification settings - Fork 6
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
fix: resolve issues with skuid-cli
#205
Conversation
Resolves skuid#138 Addresses the fatal termination portion of 141 & 142
Resolves 141 Resolves 142 Resolves 143 Resolves 144
Resolves skuid#172 - Intentionally not adding tests in this commit for a few reasons: 1) There are no existing tests; 2) the existing flags package has bugs (see skuid#170) and contains a lot of duplicate & unecessary code; 3) Due to the existing bugs, any tests written would would be to validate broken behaviors. The added code in this PR behaves exactly like Flag[string] does, the only difference in the backing value. If/When the Flags package issues are resolved, proper tests can be added. - The approach for "one-time use" concept is very primitive. There is a TODO in the code to reflect that a proper secure storage method of the password in memory and one-time use solution is needed. Without knowing whther or not Skuid supports refresh tokens, it didn't make sense to overengineer a solution for this at this point. The approach taken is an improvement over what existed even if not ideal. - The previous code contained a Refresh metho in the auth package that was not used anywhere (except for a test so eliminated it. As with the one-time use, once its known whether or not Skuid supports refresh tokens, a proper Refresh can be implemented so support skuid#173.
Resolves skuid#174 Resolves skuid#176 Note that this commit does not address the related information mentioned in skuid#174 regarding testability but it does create a new logrus instance for every reset rather than using the StandardLogger global which is a step towards addressing overall testability and reducing cost of code maintenance.
…uld be empty so minimize iterations Related skuid#178
All other information from this comment still applies. |
I considered a few different options here including naming the flag `overwrite` instead of `no-clean` or making it an enum with `replace` | `overwrite`. Also considered changing the default behavior to not `clean`. In the end, the only real way to know what the default should be is to know more about the "average" user persona and their use cases so for now, just leaving the existing default to avoid any breaking changes and adding a `no-clean` option since `replace/overwrite` could be a little ambiguous. This is easy enough to change so input is welcomed and happy to make adjustments. Resolves skuid#217
…s passed Resolves skuid#219
Removing JSONTime type which was added in ce913dc but wasn't used in that commit and still does not appear to be used anywhere.
…r codebase This commit started with the goal of improving logging (skuid#220) to help aid with identifying when outcomes were not as expected due to the many issues currently present in the CLI and on the server-side. During the course of improving the logging which required going through essentially every line of code in the codebase, many new issues were identified and fixes for nearly all of them implemented. Additionally,validations of all steps in the CLI were improved to and logs emitted with the results. Lastly, the code was significnatly refactored in many areas to improve code maintainability (skuid#230). Due to the size of this commit, there is too much to explain in detail in a commit message. See forthcoming comment in skuid#205 for full details of this commit. Resolves skuid#59 Resolves skuid#165 Resolves skuid#199 Resolves skuid#218 Resolves skuid#220 Resolves skuid#221 Resolves skuid#222 Resolves skuid#223 Resolves skuid#224 Resolves skuid#228 Resolves skuid#230 Resolves skuid#231
…unexpected plans Resolves skuid#225
…efore cloud data service Resolves skuid#227
Windows does not support SIGTSTP (Ctrl+Z), not worth introducing platform specific solution for this as handling signals is only in-place to provide a more graceful shutdown UI wise (as opposed to having to clean-up resources, etc.) so simply eliminating SIGTSTP from being handled.
TL;DR
Up until this batch of issues/commits, I have avoided any type of significant refactoring of the existing code base (except for where it was necessary to resolve an issue(s)) due to the high risk of regression that may be introduced given the lack of unit tests and the high complexity of the code structure as written (e.g., 200+ line methods with many different things all being performed inline). However, given all the issues still present even with all the fixes/improvements in this PR, having meaningful log messages was critical to be able to identify where things are not working as expected. As an example, if v0.6.7 had anything resembling adequate logging such as what now exists in this PR, identifying root cause of issues that have been found would have been much simpler. To that end, to address #220, refactoring the code in the remaining areas that hadn't been refactored yet was necessary in order to not further complicate an already unnecessarily complex/difficult to follow code base. Along that line, #230 was created so that #220 & #230 could be addressed in tandem as they are essential for each other to produce the originally desired outcome of #220. This commit covers a large amount of ground issue wise as a single commit as it would have been nearly impossible to split up into smaller commits since logging is foundational to everything. It contains the refactor itself along with addressing issues related to logging and many bugs found during the refactor while significantly improving readability of the code, thus lowering the overall cost of maintainability. Below is a summary of what has been accomplished in the 16 issues addressed since my last PR comment above: LoggingNote Due to all the issues with v0.6.7 and all the open issues in this repo, logging is very extensive as it's required for two primary reasons:
Once the outstanding server API issues are resolved and the CLI stable, the amount of logging can be reduced to a more "reasonable" level
Log FilesLog files can now be evaluated when
Coding Structure/Style
General
Resolves #59 |
Most of these tests are overkill/unnecessary, however given history of this repo and the significant amount of regressions introduced with prior commits, add some basic coverage to uncovered areas to minimize risk of future regressions being introduced
Important
This PR is a Work-in-progress (WIP) and should NOT be merged yet. Please review details below carefully.
Jira Issue URL
N/A
High-Level Description
This PR is a WIP and should not be merged yet. It contains proposed fixes to many of the issues currently open in the repo as well as workarounds for issues that aren't directly tied to the CLI itself but exist server side for APIs that the CLI relies on.
Of the 108 issues I've created recently in this repo, this PR currently addresses in full or in-part, 79 of them. I'm also currently working on addressing approximately 3 more of them (the remaining issues beyond those require Skuid to resolve directly as they either involve documentation updates and/or server-side API fixes). I hope to have those commits pushed in the next week, time permitting.
I am submitting this PR now vs. waiting until fully complete since there was recent activity from Skuid so I'm hopeful that this means other issues will be reviewed as well so want to start the ball rolling on gaining input on the issues themselves and the proposed changes in this PR as I suspect and hope there will be at least some discussion before things can be finalized and merged.
Unfortunately, trying to manage separate PRs for each issue individually would have been nearly impossible given the number of issues present in the cli and the fact that solutions to some issues were dependent on solutions to other issues. For this reason and while not typical of a PR, I'm submitting a single PR that contains all of them as trying to manage them individually would have been a futile effort.
As referenced throughout the 108 issues, version 0.6.7 of the CLI is not reliable and only under a very specific set of circumstances, does it complete in an expected manner. In most cases, it either fails entirely or performs unexpectedly. In short, there are issues in the Docs, issues in the CLI itself and issues in the APIs. All of these lead to significant risk of unexpected outcomes when deploying to NLX sites, especially given that the CLI is documented as a solution for migrating to
production
environments.Given all the above, it would be ideal if this PR was reviewed ASAP so solutions for these issues can be officially released and users of the CLI can start to have confidence that management of their NLX sites via the CLI is predictable and reliable.
Regarding the PR itself, a few things:
Go
so while the high number of issues has given me ample opportunity to learn the language, the code should be reviewed closely by someone with at least a mid-level ofGo
experienceSkuid Review Required
so when reviewing, beyond general review mentioned in 1 & 2 above, you can specifically look for this comment text to identify where I knew for certain that Skuid input/review was needed.production purposes
.Phrasal
support in--since
has been removed - see comments in commit message for details.Year/Week/Day
in--since
parsing is now static values. It's unclear what the expected behavior for treatment of these options was in 0.6.7 since there were no tests or documentation so this may or may not be a breaking change but mentioning it as a breaking change for clarity. See comments in commit message for details.--trace
,--verbose
,--diagnostic
have been deprecated - see comments in commit message--no-console-logging
flag added - see commit--log-level
and--debug
flag added - see commit--skip-data-sources
flag added - this is a temporary flag to workaround bug/perf:deploy
command takes a long time to complete #150 and can be removed once that issue is resolved. See commit.--no-clean
flag added - see commitSKUID_FLAG_NAME
(e.g.,SKUID_LOG_DIRECTORY
). Any previous environment variables that did not follow this pattern have been deprecated. See commit for details.Looking forward to hearing from Skuid on this PR and the related open issues and helping to bring the CLI to a state of stability and reliability for Skuid customers!
Changelog:
Individual commits contain references to the issue(s) that it resolves and/or is related to so linking will be done via commit message. Happy to list them all here once everything is finalized.
In the meantime, here is a spreadsheet that contains a cross-reference to all 108 issues I've created in this repo (+1 that already existed in this repo) along with the commits that target the issue and a "note" column with anything extra that is worth mentioning (e.g.,
this is something only skuid can fix
).SkuidCLIIssueTracker.xlsx
Additional Information
Below is a summary of high-level changes that were made beyond just the baseline of addressing the core issues/bugs:
Regarding the PR itself, a few things
Item 5.2. Some examples of these changes are:--since
flag is buried inside of a much larger function that orchestrates the entire retrieval process. There is no way, short of full integration tests of which there would have to be many to test all the scenarios of parsingsince
to test that parsingsince
behaves as expected. This code was refactored here and here and tests written against behaviors here and here.fs
package allowing forMapFS
to be used, dependency injection (e.g.,fs.FS
, FileUtil) and separatedfilters
(each themselves individually testable e.g., MetadataArchiveFilter). In short, test coverage went from near 0% to 100% for everything related toArchive
.