767 Commits

Author SHA1 Message Date
Julio López
e456f78fa2 fix(providers): execute rclone with non-cancelling context (#5040)
- test rclone after canceling starting context
- execute rclone with non-cancelling context
- create initial SFTP connection with non-canceling context
- nit: use context.WithoutCancel instead of Background
- Fixes #5039
- Ref #4972
2025-11-25 23:05:28 -08:00
Julio López
e1e1e0d807 fix(providers): allow S3 versioned tests cleanup to succeed (#5038)
- allow S3 versioned tests cleanup to succeed
- use ContextForCleanup
2025-11-24 22:32:51 -08:00
Nathan Baulch
ea1bdb1541 chore(ci): enable noctx linter (#4972)
* pass context in webdav helpers
* fix typo in function name
2025-11-19 21:46:28 -08:00
Julio Lopez
3d4cd24117 refactor(general): make purpose a string parameter (#5015)
Make purpose parameter a string.

Refactor TestDeriveKeyFromMasterKey
- make variables local to the test and rename accordingly
- make the purpose a `const (untyped) string`
2025-11-19 19:40:59 -08:00
Julio Lopez
7b64425ab1 chore(ci): pass context in helpers for running docker (#5012)
- Ref: #4972
2025-11-18 22:44:40 -08:00
Julio Lopez
7586b21b1f chore(general): use contexts in tests (#5009)
Ref:
- Subset of the changes proposed by @NathanBaulch in #4972
2025-11-18 17:47:23 -08:00
Julio Lopez
3b2f44f3f1 refactor(general): leverage testing.T.Context in testlogging (#5008)
Ref:

- https://pkg.go.dev/testing@latest#T.Context
2025-11-18 10:42:39 -08:00
Julio Lopez
7db061ee71 build(deps): Go 1.25 (#4987)
Upgrade to Go 1.25
Leverage `WaitGroup.Go` in Go 1.25
2025-11-17 16:42:12 -08:00
Julio Lopez
1aaf433cdc build(deps): use stdlib context package (#5001) 2025-11-17 15:59:46 -08:00
Julio Lopez
70f8d678d0 fix(general): handle errors closing writable descriptors (#4998) 2025-11-16 23:07:51 -08:00
Julio Lopez
070c15b888 chore(general): avoid wrapping always-nil error (#4997) 2025-11-16 22:55:35 -08:00
Julio Lopez
f1127b228e chore(general): check bounds for memory allocation (#4995) 2025-11-16 21:36:18 -08:00
Julio Lopez
c60ebebb17 chore(ci): make socket activation test more robust (#4985)
Objective: make the tests more robust and reduce random failures.

Preliminary refactoring:
- Accept testing.TB in testenv helpers. This is needed to
  use `require.EventuallyWithT` in socket activation tests.
- Rename parameters for clarity

Tests refactoring:
- use t.Cleanup instead of defer where appropriate
- create file handlers in test routine instead of go routines
- remove unnecessary var declaration
- increased wait time to 30 seconds.
- allow running socket activation test on Darwin

Ref:
- #3283
- #3313
- #3318
2025-11-13 19:02:57 -08:00
Julio Lopez
bb20d9e11a chore(ci): enable wsl_v5:{assign,expr} linter settings (#4982)
Enable wsl_v5 settings:
- assign
- expr
2025-11-12 23:12:06 -08:00
Julio Lopez
80eda18f99 chore(ci): enable wsl_v5:err linter (#4928) 2025-11-12 22:15:27 -08:00
Nathan Baulch
657fda216a chore(ci): upgrade to golangci-lint 2.6.1 (#4973)
- upgrade to golangci-lint 2.6.1
- updates for gosec
- updates for govet
- updates for perfsprint
- updates modernize

Leaves out modernize:omitempty due to conflicts with tests
2025-11-11 21:27:10 -08:00
Julio Lopez
19af93f2b1 refactor(ci): enable wsl_v5:return linter (#4975)
Also, disable redundant nakedret linter
2025-11-11 16:53:10 -08:00
Nathan Baulch
557940c524 chore(ci): upgrade to golangci-lint v2.5.0 (#4931)
Upgrades golangci-lint to v2.5.0

Enables:
- wsl_v5

Disables:
- embeddedstructfieldcheck
- noinlineerr (not used in this codebase)
- noctx (temporarily)
- godot
- wsl (deprecated)

Co-authored-by: Julio Lopez <1953782+julio-lopez@users.noreply.github.com>
2025-11-11 12:37:07 -08:00
lyndon-li
83bd4d45da feat(general): maintenance stats for drop deleted contents and compact indexes (#4948) 2025-11-04 11:40:20 -08:00
Julio Lopez
952058a744 refactor(general): fix field names in CompactSingleEpochStats (#4947)
- Followup to #4941
2025-11-02 21:01:10 -08:00
lyndon-li
29ee7b18ea compact single epoch stats (#4941)
Add stats to maintenance phase: `CompactSingleEpoch`
2025-11-02 20:38:23 -08:00
lyndon-li
ed7ef85a2d feat(general): add stats to maintenance run - AdvanceEpoch (#4937) 2025-10-30 23:11:15 -07:00
Julio Lopez
356930b1a9 refactor(general): simplify function and generics signatures (#4930) 2025-10-29 12:32:51 -07:00
Julio Lopez
5ca49e8eb4 refactor(general): lastSettledEpochNumber() helper (#4927) 2025-10-28 21:17:45 -07:00
Julio Lopez
2b2efeb031 refactor(general): fix return value order to match return names (#4926) 2025-10-28 18:28:01 -07:00
Julio Lopez
736ee451b9 refactor(general): rename GenerateRangeCheckpointStats fields (#4925)
- Rename GenerateRangeCheckpointStats fields for consistency
- Add marshaling test for GenerateRangeCheckpointStats
2025-10-28 17:32:39 -07:00
lyndon-li
930793c754 feat(general) maintenance stats for generate range checkpoint (#4924) 2025-10-28 16:48:28 -07:00
Julio Lopez
c3dc18f7e5 fix typo (#4920) 2025-10-27 16:12:20 -07:00
lyndon-li
727fea0801 feat(general): add maintenance phase stats - CleanupSupersededIndexes (#4916) 2025-10-27 12:49:38 -07:00
Julio Lopez
25b1492d65 fix(general): field and variable names (#4911)
Fixes field names in CleanupMarkersStats persistent struct.
Also renames variables for consistency.

- Followup fix for: #4900 add stats to maintenance run - CleanupMarkers 
- Ref: #4848
2025-10-24 16:09:36 -07:00
lyndon-li
e3e4e09bc8 feat(general): add stats to maintenance run - CleanupMarkers (#4900) 2025-10-24 13:49:40 -07:00
Julio Lopez
bab11c181d nit: remove unused constant (#4906) 2025-10-23 22:19:56 -07:00
Julio Lopez
4cbd7026a6 refactor(general): leverage maps.Clone (#4905) 2025-10-23 19:45:29 -07:00
Julio Lopez
c5cd3c5651 refactor(general): modernize bloop (#4904) 2025-10-23 17:49:20 -07:00
Julio Lopez
995e7fd893 refactor(general): modernize (#4903)
Applies the modernize changes for the following categories:

- mapsloop
- stringsseq
- stringscutprefix
- sortslice
2025-10-23 17:11:38 -07:00
Julio Lopez
af62386ecd chore(general): modernize min/max (#4898) 2025-10-22 22:22:54 -07:00
Julio Lopez
3853ecf81f chore(general): remove unused pproflogging package (#4850) 2025-10-01 15:30:30 -07:00
Jarek Kowalski
0f7253eb66 feat(general): rewrote content logs to always be JSON-based and reorganized log structure (#4822)
This is a breaking change to users who might be using Kopia as a library.

### Log Format

```json
{"t":"<timestamp-rfc-3389-microseconds>", "span:T1":"V1", "span:T2":"V2", "n":"<source>", "m":"<message>", /*parameters*/}
```

Where each record is associated with one or more spans that describe its scope:

* `"span:client": "<hash-of-username@hostname>"`
* `"span:repo": "<random>"` - random identifier of a repository connection (from `repo.Open`)
* `"span:maintenance": "<random>"` - random identifier of a maintenance session
* `"span:upload": "<hash-of-username@host:/path>"` - uniquely identifies upload session of a given directory
* `"span:checkpoint": "<random>"` - encapsulates each checkpoint operation during Upload
* `"span:server-session": "<random>"` -single client connection to the server
* `"span:flush": "<random>"` - encapsulates each Flush session
* `"span:maintenance": "<random>"` - encapsulates each maintenance operation
* `"span:loadIndex" : "<random>"` - encapsulates index loading operation
* `"span:emr" : "<random>"` - encapsulates epoch manager refresh
* `"span:writePack": "<pack-blob-ID>"` - encapsulates pack blob preparation and writing

(plus additional minor spans for various phases of the maintenance).

Notable points:

- Used internal zero allocation JSON writer for reduced memory usage.
- renamed `--disable-internal-log` to `--disable-repository-log` (controls saving blobs to repository)
- added `--disable-content-log` (controls writing of `content-log` files)
- all storage operations are also logged in a structural way and associated with the corresponding spans.
- all content IDs are logged in a truncated format (since first N bytes that are usually enough to be unique) to improve compressibility of logs (blob IDs are frequently repeated but content IDs usually appear just once).

This format should make it possible to recreate the journey of any single content throughout pack blobs, indexes and compaction events.
2025-09-27 17:11:13 -07:00
Julio Lopez
490fa4b5b3 feat(cli): extend stats for content verification (#4830)
Track and report errors separately according to the type of error:
- missing pack
- truncated pack
- unreadable content.

Add a counter stat for the contents that are
read and fully verified (via `GetContent`).

Count errors grouped by pack ID using a `CountersMap`.
This allows determining the number of referenced contents
that were missing in a particular pack.

Report the counter stats via structured logging.

---

Sample output:

$ kopia content verify --progress-interval=0.5s --download-percent=100
Listing blobs...
Listed 102 blobs.
Verifying contents...
  Verified 1 contents, 0 errors, estimating...
  Verified 279 contents, 0 errors, estimating...
  Verified 512 of 624 contents (82.1%), 0 errors, remaining 0s, ETA 2025-09-17 23:03:38 PDT
Finished verifying contents
verifyCounters:	{"verifiedContents":624,"totalErrorCount":0,"contentsInMissingPacks":0,\
"contentsInTruncatedPacks":0,"unreadableContents":0,"readContents":624,\
"missingPacks":0,"truncatedPacks":0,"corruptedPacks":0}
2025-09-17 23:36:09 -07:00
meld-cp
77f2e5581f feat(ui): added locale to UIPreferences (#4741) 2025-08-08 14:41:35 -07:00
Jarek Kowalski
0733cb4d2a fix(server): fixed scheduling bug (#4732)
This was a very stupid bug introduced in
https://github.com/kopia/kopia/pull/4682

Fixes #4729
2025-07-22 00:51:29 +00:00
Julio Lopez
347adbfff1 fix(general): add {peta,exa}byte prefixes (#4707)
- add {peta,exa}byte prefixes
- add test cases for units conversion
- refactor tests for units package
2025-07-01 18:39:01 -07:00
Julio Lopez
89d1bbc743 chore(general): minor cleanups (#4704)
- use `slices.Clone`
- remove stale `.gometalinter.json`
- unexport `maintenance.dropDeletedContents`
- rename `fetchIndexBlob`
- use `require` in `TestTimeFuncWiring`
2025-07-01 12:05:50 -07:00
Leonardo Cecchi
a8fc80f47c feat(cli): add --disable-file-logging to suppress log file output (#4686) 2025-06-26 14:42:30 -07:00
Jarek Kowalski
4256e87d56 fix(server): fix snapshot scheduling in the event of machine goes to sleep (#4682)
Fix snapshot scheduling in the event of machine goes to sleep

- Fixes #3512
2025-06-24 12:47:11 -07:00
Julio Lopez
126395f292 refactor(general): migrate to crypto/{hkdf,pbkdf2,sha3} (#4678)
Functional changes:

- Key derivation no longer panics, instead it returns an
  error on failed condition checks.
- Migration to crypto/hkdf required changes in various
  function signatures, adding an error return value for
  propagating key derivation errors up the calling chain.
  Tests were refactored to account for the signature change as well.


Non-functional changes:
- migrate to crypto/pbkdf2
- migrate to crypto/sha3
- migrate to crypto/hkdf
- add deriveHMACSecret function to simplify caller function
- simplify deriveHMACSecret
- fix test: specify non-empty HMACSecret
2025-06-19 21:25:02 -07:00
Julio Lopez
735adfcf85 refactor(general): small misc. cleanups (#4666)
* remove unnecessary type argument
* modernize with max
* unexport getPartial and update comment
* unexport getFull
* verifyNotCached helper
* use require helpers
* leverage verify[Not]Cached
* use windowsOSName const
* fix comment wrapping
* require in stat_test
* use 512 as the write size and log allocated size
* rename const to expectedMinAllocSize
* write a single byte to test file
* add TestGetBlockSizeFromCurrentFS
* require Positive
* log before invariant check
2025-06-13 23:56:37 -07:00
Nathan Baulch
19d92613a6 chore(general): typos (#4659) 2025-06-10 17:24:14 -07:00
Julio Lopez
e1d065aee1 refactor(general): misc cleanups (#4652)
- use raw strings for readability, removes escaping
- clarify comment
- add self-documenting message to test assertion
- always cleanup test file
- refactor(test): cleanup TestParseSnapListAllExeTest
- nit: call getLogOutputPrefix once
- rename SkipTestUnlessLinux
- inline TestSkipUnlessCI
- rename SkipTestOnCIUnlessLinuxAMD64
2025-06-04 22:58:01 -07:00
Julio Lopez
206a5fb161 nit: continue in loop and reduce indentation (#4623) 2025-06-04 22:27:02 -07:00