Repository navigation
fix: audit hardening, retry/timeout & state fixes, and prepare v0.3.0 - #22
Merged
Merged
Conversation
- s3client: prevent invalid or lower AWS_MAX_ATTEMPTS / profile max_attempts from overriding or breaking resolved MaxAttempts without mutating process env, while preserving AWS_CA_BUNDLE and shared TLS/region settings - s3client: preserve clean io.EOF in idleTimeoutBody when idle timer races final chunk read, and strengthen retry-quota test coverage - cmd: avoid binding unvalidated target endpoint during source-only scan, delay diff --issues-jsonl creation until after S3 client init, and escape db_path in scan logs - config: validate endpoint TCP port bounds (1..65535) and isolate config/CLI test suites from ambient shell env vars - store: resolve symlinks in OpenExisting before checking uncheckpointed WAL files - migrator: distinguish local spool disk errors from source S3 stream read errors - fakes3: encode literal '+' as %2B under encoding-type=url and handle max-keys=0 - package & docs: normalize tar.gz ownership to root:root, document AWS_CA_BUNDLE and new pagination/timeout/retry options across all 8 languages, and bump default version to 0.3.0
There was a problem hiding this comment.
🟡 Changes recommended
The retry override can silently suppress errors for a missing AWS_DEFAULT_PROFILE, and the symlink regression test does not exercise OpenExisting’s handling of uncheckpointed WAL.
2 open issues
What changed in this PR
This PR hardens the S3 migration tool’s retry handling, state safety, and error reporting, while preparing the v0.3.0 release.
Changes:
- Fix retry-budget precedence, timeout EOF handling, scan target binding, and diff output creation.
- Strengthen endpoint validation, symlink-aware database opening, spool error attribution, and regression coverage.
- Normalize archive ownership and update release references, CLI help, and localized configuration guides.
| File | Description |
|---|---|
scripts/test_package.py |
Tests normalized archive ownership. |
scripts/package.py |
Normalizes tar ownership and updates fallback version. |
README.md |
Updates installation examples to v0.3.0. |
README_ZH.md |
Updates Chinese installation examples. |
README_KO.md |
Updates Korean release and configuration guidance. |
README_JA.md |
Updates Japanese release and configuration guidance. |
README_IT.md |
Updates Italian release and configuration guidance. |
README_FR.md |
Updates French release and configuration guidance. |
README_ES.md |
Updates Spanish release and configuration guidance. |
README_DE.md |
Updates German release and configuration guidance. |
Makefile |
Updates fallback build version. |
internal/store/store.go |
Resolves database symlinks before WAL checks. |
internal/store/audit_test.go |
Adds a symlink-target WAL check test. |
internal/s3client/timeout.go |
Preserves EOF during timeout races. |
internal/s3client/timeout_test.go |
Tests retry quotas, configuration precedence, and EOF races. |
internal/s3client/client.go |
Isolates resolved retries from ambient AWS settings. |
internal/migrator/migrator.go |
Distinguishes local spool failures from source errors. |
internal/migrator/audit_transfer_test.go |
Tests local spool error attribution. |
internal/fakes3/fakes3.go |
Fixes plus-sign escaping and zero-size listings. |
internal/config/safety_test.go |
Tests invalid endpoint ports. |
internal/config/config.go |
Validates endpoint TCP port ranges. |
internal/config/config_test.go |
Clears ambient configuration for tests. |
docs/MANUAL.md |
Updates release examples and documents tuning flags. |
docs/MANUAL_ZH.md |
Updates Chinese release examples and tuning flags. |
docs/MANUAL_KO.md |
Expands Korean configuration and troubleshooting guidance. |
docs/MANUAL_JA.md |
Expands Japanese configuration and troubleshooting guidance. |
docs/MANUAL_IT.md |
Expands Italian configuration and troubleshooting guidance. |
docs/MANUAL_FR.md |
Expands French configuration and troubleshooting guidance. |
docs/MANUAL_ES.md |
Expands Spanish configuration and troubleshooting guidance. |
docs/MANUAL_DE.md |
Expands German configuration and troubleshooting guidance. |
config.example.yaml |
Lists AWS_CA_BUNDLE in configuration comments. |
cmd/root.go |
Adjusts target binding, JSONL creation, and path escaping. |
cmd/helptext.go |
Sets v0.3.0 and lists custom CA configuration. |
cmd/help_test.go |
Checks custom CA help text. |
cmd/cli_regression_test.go |
Adds retry, state-binding, and JSONL regression tests. |
Review effort: Balanced
| } | ||
|
|
||
| func loadAWSConfigWithoutEnvMaxAttempts(ctx context.Context, ep config.Endpoint, creds awsv2.CredentialsProvider) (awsv2.Config, *http.Transport, error) { | ||
| explicitProfile := os.Getenv("AWS_PROFILE") != "" |
Comment on lines
+222
to
+224
| if canonical, err := filepath.EvalSymlinks(path); err == nil { | ||
| path = canonical | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Comprehensive codebase and post-
v0.2.0change audit fixes, regression tests, i18n documentation synchronization, andv0.3.0release preparation:internal/s3client/client.go)awsconfig.LoadDefaultConfig(NewEnvConfig) from failing on invalid/non-integerAWS_MAX_ATTEMPTSwhenMaxAttemptsis already resolved via--max-attemptsorMAX_ATTEMPTS, without mutating process-wide environment variables, while preservingAWS_CA_BUNDLEand shared profileca_bundle/region/sdk_ua_app_id.awsconfig.WithRetryer(...)and clearo.RetryMaxAttempts = 0insides3.NewFromConfigsos3.New'sfinalizeRetryMaxAttemptsnever overwrites the resolved attempt budget with a lowerAWS_MAX_ATTEMPTSor shared-configmax_attempts, nor leaks ambientAWS_MAX_ATTEMPTSinto derived test clients.internal/s3client/timeout.go)io.EOFwhen the per-read idle timer fires concurrently with the final chunk read, avoiding spuriouscontext.DeadlineExceededfailures on completed object reads.TestRetryQuotaDoesNotExhaustAcrossSustainedTransientTimeoutsso the negative control genuinely drains the 500-token SDK retry quota (64 * 9 = 576 > 500) and add unit tests forAWS_MAX_ATTEMPTS/ profile precedence andio.EOFtimer races.cmd/root.go)new.endpoint(e.g. fromconfig.example.yaml) during source-onlymigration scan, while keepingmigration runtarget binding ahead ofBeginScan()so target mismatches fail before invalidating an existing completed scan.migration diff --issues-jsonlfile creation until after S3 client initialization succeeds so TLS/CA configuration errors do not leave an empty.jsonlfile blocking retries.db_pathviasafeoutput.Escapeinscancompletion logs.1..65535) ininternal/configat startup.filepath.EvalSymlinksinstore.OpenExistingbeforehasNoUncheckpointedWALso symlinked DB paths cannot mask active-walfiles and open withimmutable=1.CreateTemp/Write/Seek) from source S3 stream read errors (sourceReadError) ininternal/migrator.internal/fakes3encoding-type=urlkey escaping so literal+is encoded as%2Band handlemax-keys=0.v0.3.0Bump.tar.gzarchive member ownership to0:0(root:root) inscripts/package.py.AWS_CA_BUNDLEand synchronizelist_max_keys/response_header_timeout/max_attemptsacrosscmd/helptext.go,config.example.yaml, and all 8 localizedREADME*.mdanddocs/MANUAL*.mdguides; update default version references to0.3.0.Verification
go vet -tags real_s3 ./...go test -race -count=1 ./...(including hermeticity under ambientAWS_MAX_ATTEMPTS/LIST_MAX_KEYS/WORKERS)python3 -m unittest discover -s scripts -v