Commit Graph

55 Commits

Author SHA1 Message Date
David Dworken
3875bddddc Add ability to configure log-level and update many log lines to use the correct log level, fixes #211 #219 2024-08-25 11:50:46 -07:00
Pavel Griaznov
8da11eb3fa run "make fmt" (#233) 2024-08-11 12:19:41 -07:00
David Dworken
45b67cb2b9 Add additional fallback method for retrieving the CWD to further improve the situation for #226 2024-07-09 18:40:50 -07:00
David Dworken
1ff299c86a Make bash support lenient with empty history lines, which seems to happen for the first command or two of new installs 2024-02-18 17:54:45 -08:00
David Dworken
3f1d5c9cd0 Improve debug log message to include more relevant information 2023-11-24 16:46:22 -08:00
David Dworken
b3e145d764 Enable presaving by default rather than having it gated behind BetaMode 2023-11-24 16:46:22 -08:00
David Dworken
05088d4bed Add comment to explain some confusing logic that we do have to keep 2023-11-19 09:41:05 +01:00
David Dworken
d8b83b9429 Add getTimestamp command as an internal command that will be used as an alternative to date since date on MacOS doesn't support nanosecond granularity 2023-11-18 12:01:40 -08:00
David Dworken
5f9ff9e158 Fix bug that caused unreleased presaving feature to accidentally save entries that were prefixed with a space 2023-10-30 17:42:09 -07:00
David Dworken
449a4d0000 Add better handling for race condition with deleting presaved entries 2023-10-15 13:00:34 -07:00
David Dworken
4bcc5fb335 Periodically call query endpoint and retrieve data to ensure that the local DB is always reasonably up to date 2023-10-15 12:29:50 -07:00
David Dworken
fca2b1441f Always include user and device ID in API request headers, so that they're available in all server-side handlers 2023-10-14 10:52:51 -07:00
David Dworken
851283df8d Add TODO 2023-10-12 19:34:09 -07:00
David Dworken
dc19fa3a17 Roll-forward "Make history entry start times more precise (down to the nanosecond) to make the recorded runtime more accurate, since currently start times are rounded to the nearest second. Though
note that 'date' on MacOS doesn't support %N, so this doesn't apply to MacOS"

This reverts commit 6281ae0601.
2023-10-10 07:44:15 -07:00
David Dworken
6281ae0601 Revert "Make history entry start times more precise (down to the nanosecond) to make the recorded runtime more accurate, since currently start times are rounded to the nearest second. Though note that 'date' on MacOS doesn't support %N, so this doesn't apply to MacOS"
This reverts commit d404a73c9b since it appears to be causing test failures for linux
2023-10-07 20:05:21 -07:00
David Dworken
d404a73c9b Make history entry start times more precise (down to the nanosecond) to make the recorded runtime more accurate, since currently start times are rounded to the nearest second. Though note that 'date' on MacOS doesn't support %N, so this doesn't apply to MacOS 2023-10-07 14:47:54 -07:00
David Dworken
2c77c3d9c9 Fix bug with bash presaving that caused commands to not get properly recorded due to presaving looking like a duplicate command 2023-09-29 21:03:12 -07:00
David Dworken
0b57034c39 Revert "Revert all commits since v0.223 to enable me to release a patch on top of v0.223"
This reverts commit 68ed9f2d5d.
2023-09-29 18:21:23 -07:00
David Dworken
68ed9f2d5d Revert all commits since v0.223 to enable me to release a patch on top of v0.223 2023-09-28 22:15:30 -07:00
David Dworken
fdec51bd14 Update presaving for bash to use history 1 rather than BASH_COMMAND to ensure we don't log bash functions 2023-09-28 22:14:53 -07:00
David Dworken
89014a8674 Add workaround for bash issues with pre-saving 2023-09-28 22:13:41 -07:00
David Dworken
6d5a86a8bb Revert all commits since v0.223 to enable me to release a patch on top of v0.223 2023-09-28 21:49:37 -07:00
David Dworken
d14dc1cd50 Update presaving for bash to use history 1 rather than BASH_COMMAND to ensure we don't log bash functions 2023-09-26 19:41:12 -07:00
David Dworken
0db27d4217 Add workaround for bash issues with pre-saving 2023-09-24 16:35:00 -07:00
David Dworken
e92c702402 Another exclusion for presaving 2023-09-24 14:19:11 -07:00
David Dworken
c21d443fa6 Make presaving query slightly more specific, and delete res.RowsAffected check since it can cause flaky errors if a command is run twice very quickly 2023-09-23 20:02:05 -07:00
David Dworken
3253883198 Fix syncing consistency bug, but with the caveat that there is currently no easy/practical way to write tests for this 2023-09-23 19:57:41 -07:00
David Dworken
16f2751975 Add offline checking for deleting presaved entries so that hishtory works while offline 2023-09-23 19:32:35 -07:00
David Dworken
ab12fa4d47 Fix consistency bug where ClientConfig would get out of date between different parts of the code 2023-09-23 12:40:57 -07:00
David Dworken
51ca2578b7 Follow up to e3d54e: Same thing for querying for pre-saved entries 2023-09-22 19:59:19 -07:00
David Dworken
2c9aa099d2 Fix bug in offline sync code that contained off-by-one error leading to missed entries 2023-09-22 19:31:22 -07:00
David Dworken
3f0adbc324 Add support for deleting pre-saved entries on the remote server 2023-09-22 19:00:37 -07:00
David Dworken
9b847c5e35 Further optimize client-server roundtrips by including deletion and dump requests in submit responses (follow up to 1e43de689f) 2023-09-22 13:49:29 -07:00
David Dworken
a5f11af150 Add initial code to support unique per-entry IDs
This code has two caveats for old entries:
1. the ID is being backfiled with a random per-(device,entry) ID. So the ID won't match cross-device.
2. the server-side ID will still be a random ID that is unrelated to the entry ID
2023-09-22 13:16:24 -07:00
David Dworken
2a5a6d65c4 Roll-forward "Add preliminary support for persisting pre-saved history entries remotely"
This rolls-forward commit 66916c27cb.
2023-09-22 13:13:46 -07:00
David Dworken
66916c27cb Revert "Add preliminary support for persisting pre-saved history entries remotely"
This reverts commit ff98a7907c. That commit is incomplete since it doesn't include support for the continous deletion of pre-saved history entries as soon as they
finish running. Support for this will require a good bit more work/thought, so reverting for and keeping this code in the git history.
2023-09-21 12:39:20 -07:00
David Dworken
ff98a7907c Add preliminary support for persisting pre-saved history entries remotely 2023-09-21 12:39:04 -07:00
David Dworken
1e43de689f Optimize number of round-trip HTTP connections made by the client by having the submit handler return metadata about whether there are pending dump/deletion requests
For now, I'm still keeping the dedicated endpoints for those functionalities, but since most of the time there are no dump/deletion requests this should cut down the number of requests made by the client by 2/3.
2023-09-21 11:35:24 -07:00
David Dworken
69047109ac Skip presaving the presave command, since it is currently spamming the recorded history entries in bash 2023-09-19 13:35:11 -07:00
David Dworken
e6c76eb222 Make WHERE query for deleting presaved entries stricter and re-add in the error check that was removed in 713ee96a96 2023-09-17 14:38:48 -07:00
David Dworken
713ee96a96 Delete error checking branch that isn't necessary because the filter condition above is much more precise now 2023-09-17 12:06:19 -07:00
David Dworken
30ba0bd35c Presaving clean up improvements: Skip presaving empty commands and make timestamp format clearer 2023-09-14 21:04:23 -07:00
David Dworken
57c5a69f7d Fix bug where we failed to delete pre-saved history entries due to race conditions causing the DB to be locked 2023-09-12 18:55:13 -07:00
David Dworken
c311b09844 Improve error messages when we fail to delete pre-saved history entries 2023-09-12 15:53:52 -07:00
David Dworken
2ccbb8d587 Store timestamps in DB in Unix time, and display them in the Local time for consistent TZs in displays, and to ensure ordering is correct
This fixes a bug where entries could be out of order if they were recorded on machines in different TZs (e.g. if one machine had the TZ set to UTC). Admittedly, this commit isn't a perfect fix since
it doesn't change all the existing hishtory entries to be stored in UTC, but this just means that the ordering bug will continue to exist for historical entries, but be fixed for new entries. And
for our purposes, that is good enough. :)

 # Please enter the commit message for your changes. Lines starting
2023-09-09 12:28:01 -07:00
David Dworken
c5bdee9ad5 Merge pull request #102 from lsmoura/sergio/no-ctx-ptr
Remove context pointers since there is no need to pass around a pointer to an interface
2023-09-06 19:58:08 -07:00
Sergio Moura
a12b0e5f6f no context pointers 2023-09-05 15:45:17 -04:00
Sergio Moura
83ad8c7b1f wrap errors with %w instead of using %v 2023-09-05 15:08:55 -04:00
David Dworken
5e44159a0b Remove extraneous fmt.Println from beta-mode feature for pre-saving history entries 2023-08-27 22:11:22 -07:00
David Dworken
2490082088 no-op refactoring: Move history entry building code from lib.go to cmd file for saving history entries 2023-08-27 22:05:24 -07:00