lab5: закрытие остаточных замечаний

Validate tRNS semantics and bind PLTE entry count to the IHDR bit depth so malformed PNGs are rejected with 415 instead of failing in the worker. Refuse replay of an older failed version while a newer pipeline job exists, preventing loss of the shared staging source, and retire version-stale queued jobs as superseded instead of republishing them forever.
This commit is contained in:
Vladislav Kunetskiy
2026-10-31 01:46:26 +03:00
parent 624f76b7d0
commit ac30972d48
14 changed files with 357 additions and 33 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
# make test-queue 2026-10-30T22:19:06Z
# make test-queue 2026-10-30T22:43:35Z
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 student-tests/lab5_async.py --base-url "http://localhost:8080"
worker down: 202 queued, content 409, queued attachment linked, API restarted
worker restarted: ready, thumbnail and original downloadable, staging cleared
+4 -1
View File
@@ -1,4 +1,4 @@
# make test-attachments 2026-10-30T22:19:04Z
# make test-attachments 2026-10-30T22:43:33Z
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 student-tests/attachments_negative.py --base-url "http://localhost:8080"
10 MiB + 1 body: 413
empty body: 415
@@ -10,6 +10,9 @@ valid zlib, invalid PNG scanline filter: 415
invalid PNG color type/bit depth pair: 415
duplicate PNG IHDR: 415
trailing bytes after PNG zlib stream: 415
tRNS on RGBA PNG: 415
short tRNS on RGB PNG: 415
PLTE entries exceed palette bit depth: 415
dangerous filenames: 400
foreign attachment metadata/content: 404
empty text without attachments: 400
+3 -1
View File
@@ -1,8 +1,10 @@
# make test-faults 2026-10-30T22:19:30Z
# make test-faults 2026-10-30T22:43:58Z
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 student-tests/lab5_faults.py --base-url "http://localhost:8080"
permanent failure: failed/injected_failure, content 409, failed attachment not linkable, registry visible
replay: failed -> queued -> ready, one thumbnail
replay ready job: refused
replay older failed version while v2 queued: refused, state intact
v2 published after older replay refusal
replay of failed reprocess: queued projection restored, then ready at pipeline 2
transient exhaustion: attempts=5, retry_exhausted, four retries, DLQ message present
crash after first variant: redelivered, same three variants, attempts=2
+2 -2
View File
@@ -1,2 +1,2 @@
ok mtusi-messenger/internal/storage/postgres 9.691s
ok mtusi-messenger/internal/storage/redis 1.246s
ok mtusi-messenger/internal/storage/postgres 9.740s
ok mtusi-messenger/internal/storage/redis 1.237s
+9 -9
View File
@@ -3,18 +3,18 @@ level=info msg="golangci-lint has version 2.13.2 built with go1.27.1 from (unkno
level=info msg="[config_reader] Config search paths: [./ /Users/vladislav/Projects/mtusi2026lab5 /Users/vladislav/Projects /Users/vladislav /Users /]"
level=info msg="[config_reader] Used config file .golangci.yml"
level=info msg="[config_reader] Module name \"mtusi-messenger\""
level=info msg="[goenv] Read go env for 6.440209ms: map[string]string{\"GOCACHE\":\"/Users/vladislav/Library/Caches/go-build\", \"GOROOT\":\"/opt/homebrew/Cellar/go/1.27.1/libexec\"}"
level=info msg="[goenv] Read go env for 7.230292ms: map[string]string{\"GOCACHE\":\"/Users/vladislav/Library/Caches/go-build\", \"GOROOT\":\"/opt/homebrew/Cellar/go/1.27.1/libexec\"}"
level=info msg="[lintersdb] Active 50 linters: [asasalint bodyclose canonicalheader containedctx contextcheck copyloopvar depguard durationcheck errcheck errname errorlint exhaustive exptostd fatcontext forbidigo forcetypeassert gocheckcompilerdirectives gocritic gofumpt goimports gomoddirectives gosec govet ineffassign intrange makezero misspell musttag nilerr nilnil noctx nolintlint perfsprint prealloc reassign recvcheck revive rowserrcheck sloglint sqlclosecheck staticcheck testifylint thelper tparallel unconvert unparam unused usestdlibvars usetesting wastedassign]"
level=info msg="[loader] Using build tags: [integration]"
level=info msg="[loader] Go packages loading at mode 8767 (compiled_files|deps|exports_file|imports|files|name|types_sizes) took 200.621833ms"
level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 10.581125ms"
level=info msg="[linters_context/goanalysis] analyzers took 0s with no stages"
level=info msg="[loader] Go packages loading at mode 8767 (deps|exports_file|files|imports|name|compiled_files|types_sizes) took 285.717958ms"
level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 10.492667ms"
level=info msg="[linters_context/goanalysis] analyzers took 21.264339055s with top 10 stages: goimports: 5.91549475s, revive: 3.740582125s, gosec: 1.775157082s, unparam: 1.224420001s, wastedassign: 868.611793ms, buildir: 477.238122ms, buildssa: 376.629332ms, nilness: 292.332672ms, sloglint: 234.71729ms, gofumpt: 218.928999ms"
level=info msg="[runner/exclusion_rules] Skipped 14 issues by rules: [Path: \"_test\\\\.go\", Linters: \"gosec, prealloc, forcetypeassert, unparam\"]"
level=info msg="[runner] Issues before processing: 887, after processing: 0"
level=info msg="[runner] Processors filtering stat (in/out): exclusion_paths: 887/887, path_absoluter: 887/887, cgo: 887/887, invalid_issue: 887/887, exclusion_rules: 298/6, filename_unadjuster: 887/887, path_relativity: 887/887, nolint_filter: 6/0, generated_file_filter: 887/298"
level=info msg="[runner] processing took 3.023042ms with stages: generated_file_filter: 1.594792ms, nolint_filter: 794.292µs, path_relativity: 317.917µs, exclusion_rules: 278.458µs, invalid_issue: 13.25µs, cgo: 12.166µs, path_absoluter: 6.167µs, filename_unadjuster: 2.875µs, sort_results: 875ns, max_same_issues: 625ns, exclusion_paths: 416ns, fixer: 250ns, path_prettifier: 209ns, diff: 167ns, source_code: 167ns, max_per_file_from_linter: 125ns, path_shortener: 125ns, max_from_linter: 83ns, uniq_by_line: 83ns, severity-rules: 0s"
level=info msg="[runner] linters took 663.901083ms with stages: goanalysis_metalinter: 660.828ms"
level=info msg="[runner] Processors filtering stat (in/out): path_absoluter: 887/887, cgo: 887/887, filename_unadjuster: 887/887, generated_file_filter: 887/298, exclusion_paths: 887/887, invalid_issue: 887/887, path_relativity: 887/887, exclusion_rules: 298/6, nolint_filter: 6/0"
level=info msg="[runner] processing took 2.876665ms with stages: generated_file_filter: 1.76725ms, nolint_filter: 552.542µs, path_relativity: 268.125µs, exclusion_rules: 249.625µs, invalid_issue: 13.541µs, cgo: 12.251µs, path_absoluter: 6.125µs, sort_results: 2.875µs, filename_unadjuster: 2.792µs, max_same_issues: 333ns, fixer: 291ns, path_shortener: 249ns, max_per_file_from_linter: 209ns, exclusion_paths: 208ns, path_prettifier: 166ns, diff: 42ns, uniq_by_line: 41ns, max_from_linter: 0s, source_code: 0s, severity-rules: 0s"
level=info msg="[runner] linters took 2.891797125s with stages: goanalysis_metalinter: 2.888879125s"
0 issues.
level=info msg="File cache stats: 0 entries of total size 0B"
level=info msg="Memory: 10 samples, avg is 91.9MB, max is 127.5MB"
level=info msg="Execution took 882.402625ms"
level=info msg="Memory: 33 samples, avg is 393.4MB, max is 704.0MB"
level=info msg="Execution took 3.196263875s"
+1 -1
View File
@@ -1,3 +1,3 @@
# make test 2026-10-30T22:19:26Z
# make test 2026-10-30T22:43:54Z
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 tests/smoke.py --base-url "http://localhost:8080"
PASS: lab5 public API scenario; infrastructure and grading evidence remain separate.
+17 -17
View File
@@ -6,35 +6,35 @@ env -u APP_ENV -u SERVER_HOST -u SERVER_PORT -u SERVER_READ_HEADER_TIMEOUT -u SE
? mtusi-messenger/cmd/s3init [no test files]
? mtusi-messenger/cmd/worker [no test files]
? mtusi-messenger/internal/broker [no test files]
ok mtusi-messenger/internal/config 1.556s
ok mtusi-messenger/internal/domain 2.720s
ok mtusi-messenger/internal/config 2.864s
ok mtusi-messenger/internal/domain 2.165s
? mtusi-messenger/internal/failpoint [no test files]
ok mtusi-messenger/internal/health 1.789s
ok mtusi-messenger/internal/imagecheck 2.116s
ok mtusi-messenger/internal/imageproc 3.443s
ok mtusi-messenger/internal/logger 2.441s
ok mtusi-messenger/internal/health 3.964s
ok mtusi-messenger/internal/imagecheck 1.632s
ok mtusi-messenger/internal/imageproc 1.734s
ok mtusi-messenger/internal/logger 3.393s
? mtusi-messenger/internal/outbox [no test files]
ok mtusi-messenger/internal/platform/cache 3.537s
ok mtusi-messenger/internal/platform/cache 2.618s
? mtusi-messenger/internal/platform/cache/mocks [no test files]
ok mtusi-messenger/internal/platform/objectstore 3.995s
ok mtusi-messenger/internal/platform/password 4.080s
ok mtusi-messenger/internal/platform/token 3.091s
ok mtusi-messenger/internal/service/attachment 4.331s
ok mtusi-messenger/internal/platform/objectstore 3.077s
ok mtusi-messenger/internal/platform/password 2.238s
ok mtusi-messenger/internal/platform/token 4.261s
ok mtusi-messenger/internal/service/attachment 5.207s
? mtusi-messenger/internal/service/attachment/mocks [no test files]
ok mtusi-messenger/internal/service/chat 4.626s
ok mtusi-messenger/internal/service/chat 4.889s
? mtusi-messenger/internal/service/chat/mocks [no test files]
ok mtusi-messenger/internal/service/message 4.943s
ok mtusi-messenger/internal/service/message 5.511s
? mtusi-messenger/internal/service/message/mocks [no test files]
ok mtusi-messenger/internal/service/session 5.870s
ok mtusi-messenger/internal/service/session 4.899s
? mtusi-messenger/internal/service/session/mocks [no test files]
ok mtusi-messenger/internal/service/user 6.026s
ok mtusi-messenger/internal/service/user 3.864s
? mtusi-messenger/internal/service/user/mocks [no test files]
ok mtusi-messenger/internal/storage/postgres 5.253s
ok mtusi-messenger/internal/storage/postgres 5.476s
? mtusi-messenger/internal/storage/postgres/internal/sqlcgen [no test files]
? mtusi-messenger/internal/storage/postgres/migrations [no test files]
? mtusi-messenger/internal/storage/redis [no test files]
? mtusi-messenger/internal/storage/redis/mocks [no test files]
ok mtusi-messenger/internal/transport/rest 6.240s
ok mtusi-messenger/internal/transport/rest 5.863s
? mtusi-messenger/internal/transport/rest/internal/oas [no test files]
? mtusi-messenger/internal/transport/rest/mocks [no test files]
? mtusi-messenger/internal/worker [no test files]