Skip to content

fix(tw): isolate Taskwarrior data with TASKDATA and serialize CLI ops - #474

Open
NaitikVerma6776 wants to merge 1 commit into
CCExtractor:mainfrom
NaitikVerma6776:fix/471-taskwarrior-isolation
Open

NaitikVerma6776 wants to merge 1 commit into
CCExtractor:mainfrom
NaitikVerma6776:fix/471-taskwarrior-isolation

Conversation

@NaitikVerma6776

Copy link
Copy Markdown
Contributor

Summary

  • Stop using the shared /root/.task database: task now runs with TASKDATA and TASKRC inside each request temp dir (cmd.Dir alone was not enough).
  • Remove rm -rf /root/.task from fetch/add/complete/delete/modify helpers.
  • Serialize all Taskwarrior CLI helpers with a mutex so GET /tasks and mutation jobs cannot overlap.
  • Log the real fetch error on GET /tasks; return [] instead of 500 when the task list is empty.

Fixes #471

Test plan

  • go test ./utils/ ./utils/tw/ (Taskwarrior tests still need task on PATH)
  • In the backend container: after a fetch/add, confirm TASKDATA is the temp dir (not /root/.task) and /root/.task is not deleted as part of the request
  • Overlap GET /tasks with an in-flight add/edit; sync should not fail with SQLite 1032 from a concurrent wipe
  • Empty task list still returns 200 with []
  • Failed fetch still returns 500 and logs the underlying error

cmd.Dir was not enough; Taskwarrior still used /root/.task and GET /tasks
wiped it. Point TASKDATA/TASKRC at the per-request temp dir, drop the
shared rm -rf, lock all CLI helpers, and log fetch errors.

Fixes CCExtractor#471
@github-actions

Copy link
Copy Markdown

Thank you for opening this PR!

Before a maintainer takes a look, it would be really helpful if you could walk through your changes using GitHub's review tools.

Please take a moment to:

  • Check the "Files changed" tab
  • Leave comments on any lines for functions, comments, etc. that are important, non-obvious, or may need attention
  • Clarify decisions you made or areas you might be unsure about and/or any future updates being considered.
  • Finally, submit all the comments!

More information on how to conduct a self review:
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-proposed-changes-in-a-pull-request

This helps make the review process smoother and gives us a clearer understanding of your thought process.

Once you've added your self-review, we'll continue from our side. Thank you!

This branch has not been deployed

No deployments
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.

GET /tasks is not serialized and Taskwarrior data isolation may race through shared /root/.task

1 participant