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

fix: Resolve handful of CLI issues #1318

Merged
merged 5 commits into from
Apr 11, 2023
Merged

Conversation

orpheuslummis
Copy link
Contributor

@orpheuslummis orpheuslummis commented Apr 10, 2023

Relevant issue(s)

Resolves #1321
Resolves #1319
Resolves #1317
Resolves #1316
Resolves #1315

Description

See resolved issues.

Tasks

  • I made sure the code is well commented, particularly hard-to-understand areas.
  • I made sure the repository-held documentation is changed accordingly.
  • I made sure the pull request title adheres to the conventional commit style (the subset used in the project can be found in tools/configs/chglog/config.yml).
  • I made sure to discuss its limitations such as threats to validity, vulnerability to mistake and misuse, robustness to invalidation of assumptions, resource requirements, ...

How has this been tested?

Manually

@orpheuslummis orpheuslummis added bug Something isn't working action/no-benchmark Skips the action that runs the benchmark. area/cli Related to the CLI binary labels Apr 10, 2023
@orpheuslummis orpheuslummis added this to the DefraDB v0.5 milestone Apr 10, 2023
@orpheuslummis orpheuslummis requested a review from a team April 10, 2023 13:13
@orpheuslummis orpheuslummis self-assigned this Apr 10, 2023
@codecov
Copy link

codecov bot commented Apr 10, 2023

Codecov Report

Merging #1318 (2e8a4b8) into develop (3b0c55b) will increase coverage by 0.10%.
The diff coverage is 79.16%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1318      +/-   ##
===========================================
+ Coverage    70.53%   70.63%   +0.10%     
===========================================
  Files          184      184              
  Lines        17786    17784       -2     
===========================================
+ Hits         12545    12562      +17     
+ Misses        4287     4270      -17     
+ Partials       954      952       -2     
Impacted Files Coverage Δ
cli/cli.go 20.93% <ø> (ø)
cli/errors.go 0.00% <ø> (ø)
cli/start.go 44.81% <0.00%> (+1.13%) ⬆️
config/config.go 74.38% <80.00%> (-0.05%) ⬇️
cli/init.go 40.00% <100.00%> (+6.66%) ⬆️
cli/root.go 55.40% <100.00%> (+2.15%) ⬆️

... and 3 files with indirect coverage changes

@@ -112,6 +114,12 @@ func (cfg *Config) LoadWithRootdir(withRootdir bool) error {
return err
}

// using absolute rootdir for robustness
cfg.Rootdir, err = filepath.Abs(cfg.Rootdir)
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Have you tested that this all works on database restart? I.e. to make sure #1293 isnt re-introduced

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I confirm that it works on database restart

@orpheuslummis orpheuslummis force-pushed the orpheus/fix/cli-varia branch from 7df76b6 to afbd42d Compare April 11, 2023 03:04
Copy link
Contributor

@AndrewSisley AndrewSisley left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for cleaning up the commits it made it much easier to link issue to code-change :)

One suggestion added that would be good to get a response to before merge.


datastore:
# Store can be badger | memory
# badger: fast pure Go key-value store optimized for SSDs (https://github.com/dgraph-io/badger)
# memory: in-memory version of badger
store: {{ .Datastore.Store }}
badger:
# The path to the database data file(s), relative paths here will be converted to absolute file paths
# on database start.
# The path to the database data file(s).
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: I do think it is worth documenting that we will mutate the config file and replace relative paths with absolute paths. I see that as potentially surprising behaviour, and a behaviour that may potentially mess with CI systems (e.g. config files are sometimes directly pulled from source control, and impromptu edits can mess with the next pull)

Copy link
Contributor Author

@orpheuslummis orpheuslummis Apr 11, 2023

Choose a reason for hiding this comment

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

Currently we don't overwrite the config file. We write a config file when it doesn't exist. For now, the paths written are absolute paths, although what would be nicer is to have relative paths there, but which will probabIy be enabled by a refactor of config.

Copy link
Contributor

Choose a reason for hiding this comment

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

for future reference - we chatted over discord, and I was wrong here - it doesnt mutate existing files :)

Copy link
Collaborator

@fredcarle fredcarle left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@shahzadlone shahzadlone left a comment

Choose a reason for hiding this comment

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

LGTM

@orpheuslummis orpheuslummis merged commit 946c9d2 into develop Apr 11, 2023
@orpheuslummis orpheuslummis deleted the orpheus/fix/cli-varia branch April 11, 2023 18:40
shahzadlone pushed a commit that referenced this pull request Apr 13, 2023
Resolves #1321
Resolves #1319
Resolves #1317
Resolves #1316
Resolves #1315
shahzadlone pushed a commit to shahzadlone/defradb that referenced this pull request Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/no-benchmark Skips the action that runs the benchmark. area/cli Related to the CLI binary bug Something isn't working
Projects
None yet
4 participants