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

Switch to taskwarrior v3.X backend #546

Merged
merged 10 commits into from
May 12, 2024
Merged

Conversation

RedEtherbloom
Copy link
Contributor

Addresses #545.

See my comment on the issue for additional details.

I chose to drop Support for Taskwarrior v2.X.
This should avoid, while not technically necessary, ugly version specific fixes in the code, if significant differences between v2.X and v3.X surface.

.ok_or_else(|| anyhow!("Unable to get task files max time"))
fn get_task_database_mtime(&self) -> Result<SystemTime> {
let data_dir = shellexpand::tilde(&self.config.data_location);
let database_path = Path::new(data_dir.as_ref()).join("taskchampion.sqlite3");
Copy link
Owner

Choose a reason for hiding this comment

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

I haven't had the chance to look into taskwarrior v3 yet, but isn't taskchampion an entirely different tool?

Copy link
Contributor Author

@RedEtherbloom RedEtherbloom Mar 29, 2024

Choose a reason for hiding this comment

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

The project is a bit hidden in the subfolder of the taskwarrior repository (taskchampion README).
As far as I understood it used to be it's own separate tool up until 2 years ago.

Taskchampion is now the new storage backend for taskwarrior, as far as I understand it.

To quote:

TaskChampion implements the task storage and synchronization behind Taskwarrior. It includes an implementation with Rust and C APIs, allowing any application to maintain and manipulate its own replica. It also includes a specification for tasks and how they are synchronized, inviting alternative implementations of replicas or task servers.

See the documentation for more!

NOTE: Taskwarrior is currently in the midst of a change to use TaskChampion as its storage. Until that is complete, the information here may be out-of-date.

The taskchampion.sqlite3 gets created during the v2->v3 import phase, deprecating the .data files.

(The docs seem still a bit unstable, but I'm planning to read a bit more into taskchampions and libshared over the next weeks. Maybe I'll discover some more potential performance boosts?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Update: I ran into a problem with the tests, where a specific one fails after the taskwarrior update. I haven't fully understood the reason why yet, as I haven't looked through the testdata(and therefore don't quite get why test_draw_task_report_with_extended_modify_command expects there to be 26 tasks).
If I could ask you a few questions about the codebase after you get back from your vaccation(I don't know how to reach you outside of Github and asking every question on github gets a bit awkward), that would be great.

What will also (soft) block the merge for now is the changes which read-only commands now modify the database mtime(due to the new urgency setting getting updated).
Softblocked because this sends two active tui instances in a loop of running update, therefore modifying the database which then triggers the update of the other instance.
(Is more than 1 instance active a supported use case, or did that run into bugs even before the upgrade?)

I really have to read through the taskchampion docu, the replika structure should be what is in-built to avoid such scenarios.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason for the failing tests was most likely that I forgot to bump the taskwarrior version for CI/CD.
(As they ran error free locally)

Should be fixed now, it will require a manual approval from you to run though.

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks so much for making the PR and for working on this! I'm back from my vacation, happy to answer any questions.

In the meantime, I'll look into this more as well. I will update my local install to the latest version of taskwarrior to test this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks so much for making the PR and for working on this! I'm back from my vacation, happy to answer any questions.

In the meantime, I'll look into this more as well. I will update my local install to the latest version of taskwarrior to test this PR.

Glad that I can be of help!

What's the best way to reach you, this PR is getting a bit hard to read.
I could offer Matrix/Telegram/Signal/E-Mail(including GPG) etc.
We could alternatively use the Github Discussions feature.

(A first question would be the reasoning behind the current release options. Are incremental, debug and disabled lto a leftover from debugging?)

Copy link
Owner

Choose a reason for hiding this comment

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

Email is probably easiest! GitHub Discussions works too. I'm on the Ratatui discord if you want to ping me there that works too. I don't actively check Matrix but could sign up to if you want to chat there.

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 just sent you a DM in Discord(this message is meant as a second factor that I sent it. I'd like to avoid linking my Discord to my Github directly)

@@ -3763,13 +3767,22 @@ pub fn remove_tag(task: &mut Task, tag: &str) {
}

#[cfg(test)]
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 took the liberty of applying some outstanding clippy suggestions.

Most of these should be negligible, correct me if I'm wrong.

Two are imo controversial but justifiable, number one is this lint.
Context:
let shell = message.as_str().replace("'", "'");
triggers the clippy warning for a single char pattern, it's suggestion ''' is imo more confusing than helpful.

mod tests {
use std::{ffi::OsStr, fmt::Write, fs::File, io, path::Path};
use std::{ffi::OsStr, fmt::Write, fs::File, io, path::{Path, PathBuf}};

use ratatui::{backend::TestBackend, buffer::Buffer};

use super::*;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The second, potentially more controversial one(as I don't know if there was specific reasoning for compile time embedding).

Mostly a minor improvement, intended so that the different TASKDATA can be specified for the tests without a recompile.
It has the additional free benefit that it avoids 4 compiler warnings if the developers chosen IDE needs additional work to start rust-analzyer in the direnv context(e.g. VSCode requires the direnv extension. It is not required for the inbuilt terminal, so VSCode seems to do some shell magic under the hood).

@kdheepak kdheepak merged commit c3f2d06 into kdheepak:main May 12, 2024
11 checks passed
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.

2 participants