Files
mtusi2026lab2-fork/evidence/criteria/08-code-checks.md

13 KiB

Проверки кода и race detector

Дата сбора: 2026-10-01T17:33:15.537043+00:00.

Команды выполняются в корне репозитория, Linux/WSL. Контекст Compose: COMPOSE_PROJECT_NAME=messenger-evidence-final-20261001-02, COMPOSE_FILE=compose.yaml:src/experiments/evidence/compose.override.yaml. Параметры стенда и запуск: 07-compose-secrets.md.

Команда

make check

Фактический вывод

python3 scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.

Код завершения: 0.

Команда

make test-backend

Фактический вывод

docker compose --env-file .env --profile test run --build --rm backend-tests
 Container messenger-evidence-final-20261001-02-redis-1  Running
 Container messenger-evidence-final-20261001-02-db-1  Running
#1 [internal] load local bake definitions
#1 reading from stdin 668B done
#1 DONE 0.0s

#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 673B 0.1s done
#2 DONE 0.1s

#3 [internal] load metadata for docker.io/library/golang:1.22.2-bookworm
#3 DONE 0.0s

#4 [internal] load .dockerignore
#4 transferring context: 268B 0.1s done
#4 DONE 0.1s

#5 [builder 1/6] FROM docker.io/library/golang:1.22.2-bookworm@sha256:d0902bacefdde1cf45528c098d14e55d78c107def8a22d148eabd71582d7a99f
#5 resolve docker.io/library/golang:1.22.2-bookworm@sha256:d0902bacefdde1cf45528c098d14e55d78c107def8a22d148eabd71582d7a99f 0.0s done
#5 DONE 0.0s

#6 [internal] load build context
#6 transferring context: 2.29kB 0.3s done
#6 DONE 0.3s

#7 [builder 2/6] WORKDIR /src
#7 CACHED

#8 [builder 3/6] COPY go.mod go.sum ./
#8 CACHED

#9 [builder 4/6] RUN go mod download
#9 CACHED

#10 [builder 5/6] COPY src/backend ./src/backend
#10 CACHED

#11 [builder 6/6] RUN CGO_ENABLED=0     GOOS=linux     go build     -trimpath     -ldflags="-s -w"     -o /out/messenger     ./src/backend
#11 CACHED

#12 exporting to image
#12 exporting layers
#12 exporting layers 6.5s done
#12 exporting manifest sha256:67960608769cd4d209b647e2f7288a4e8ac5b8b4b67ebcb24822fdafd823154d 0.0s done
#12 exporting config sha256:a0862f609ccefc5db0f99a6c243f1432740529f1f40aea7d58053dce896fb0cd 0.0s done
#12 exporting attestation manifest sha256:3f32213473e1962c043bf8d6bf1fa8d6d55bb62a0cc4562817967d7e23e9c8a9 0.0s done
#12 exporting manifest list sha256:e634ac0eb2717ec6176f1a1ab38c271e9c5299a2ff337c407321ff93650da26b
#12 exporting manifest list sha256:e634ac0eb2717ec6176f1a1ab38c271e9c5299a2ff337c407321ff93650da26b 0.0s done
#12 naming to docker.io/library/messenger-evidence-final-20261001-02-backend-tests:latest done
#12 unpacking to docker.io/library/messenger-evidence-final-20261001-02-backend-tests:latest
#12 unpacking to docker.io/library/messenger-evidence-final-20261001-02-backend-tests:latest 2.0s done
#12 DONE 8.7s

#13 resolving provenance for metadata file
#13 DONE 0.0s
?   	messenger/src/backend	[no test files]
?   	messenger/src/backend/handlers	[no test files]
?   	messenger/src/backend/repositories	[no test files]
?   	messenger/src/backend/services	[no test files]
=== RUN   TestConcurrentMessageCreation
--- PASS: TestConcurrentMessageCreation (3.95s)
=== RUN   TestConcurrentRegistrationSameUsername
--- PASS: TestConcurrentRegistrationSameUsername (1.88s)
=== RUN   TestChatTransactionRollsBackAfterMemberInsertFailure
--- PASS: TestChatTransactionRollsBackAfterMemberInsertFailure (2.17s)
=== RUN   TestShortSessionTTLAndLogout
    grade4_test.go:118: GET /api/v1/users/me: HTTP 200
    grade4_test.go:134: SESSION_TTL_SECONDS=2: expiry observed after 2.091926168s
    grade4_test.go:135: GET /api/v1/users/me: HTTP 401
    grade4_test.go:146: GET /api/v1/users/me: HTTP 401
--- PASS: TestShortSessionTTLAndLogout (2.75s)
=== RUN   TestWrongPasswordAndLogoutHTTP
--- PASS: TestWrongPasswordAndLogoutHTTP (1.37s)
=== RUN   TestDependencyFailuresReturnUnavailable
redis: 2026/10/01 17:34:53 pool.go:426: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
redis: 2026/10/01 17:34:54 pool.go:426: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
redis: 2026/10/01 17:34:55 pool.go:426: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
--- PASS: TestDependencyFailuresReturnUnavailable (2.46s)
=== RUN   TestHistoryQueryPlanAtTenThousandMessages
=== RUN   TestHistoryQueryPlanAtTenThousandMessages/first
    grade4_test.go:281: first page EXPLAIN (ANALYZE, BUFFERS): [
          {
            "Plan": {
              "Node Type": "Limit",
              "Parallel Aware": false,
              "Async Capable": false,
              "Startup Cost": 0.29,
              "Total Cost": 4.29,
              "Plan Rows": 51,
              "Plan Width": 69,
              "Actual Startup Time": 0.020,
              "Actual Total Time": 0.029,
              "Actual Rows": 51,
              "Actual Loops": 1,
              "Shared Hit Blocks": 3,
              "Shared Read Blocks": 0,
              "Shared Dirtied Blocks": 0,
              "Shared Written Blocks": 0,
              "Local Hit Blocks": 0,
              "Local Read Blocks": 0,
              "Local Dirtied Blocks": 0,
              "Local Written Blocks": 0,
              "Temp Read Blocks": 0,
              "Temp Written Blocks": 0,
              "Plans": [
                {
                  "Node Type": "Index Scan",
                  "Parent Relationship": "Outer",
                  "Parallel Aware": false,
                  "Async Capable": false,
                  "Scan Direction": "Forward",
                  "Index Name": "messages_history_idx",
                  "Relation Name": "messages",
                  "Alias": "messages",
                  "Startup Cost": 0.29,
                  "Total Cost": 784.70,
                  "Plan Rows": 9999,
                  "Plan Width": 69,
                  "Actual Startup Time": 0.019,
                  "Actual Total Time": 0.024,
                  "Actual Rows": 51,
                  "Actual Loops": 1,
                  "Index Cond": "((chat_id = '469ccc02-1f52-49a1-bfac-3a030e303a89'::uuid) AND (ROW(created_at, id) > ROW('0001-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))",
                  "Rows Removed by Index Recheck": 0,
                  "Shared Hit Blocks": 3,
                  "Shared Read Blocks": 0,
                  "Shared Dirtied Blocks": 0,
                  "Shared Written Blocks": 0,
                  "Local Hit Blocks": 0,
                  "Local Read Blocks": 0,
                  "Local Dirtied Blocks": 0,
                  "Local Written Blocks": 0,
                  "Temp Read Blocks": 0,
                  "Temp Written Blocks": 0
                }
              ]
            },
            "Planning": {
              "Shared Hit Blocks": 6,
              "Shared Read Blocks": 0,
              "Shared Dirtied Blocks": 0,
              "Shared Written Blocks": 0,
              "Local Hit Blocks": 0,
              "Local Read Blocks": 0,
              "Local Dirtied Blocks": 0,
              "Local Written Blocks": 0,
              "Temp Read Blocks": 0,
              "Temp Written Blocks": 0
            },
            "Planning Time": 0.095,
            "Triggers": [
            ],
            "Execution Time": 0.065
          }
        ]
=== RUN   TestHistoryQueryPlanAtTenThousandMessages/late
    grade4_test.go:281: late page EXPLAIN (ANALYZE, BUFFERS): [
          {
            "Plan": {
              "Node Type": "Limit",
              "Parallel Aware": false,
              "Async Capable": false,
              "Startup Cost": 0.29,
              "Total Cost": 14.48,
              "Plan Rows": 51,
              "Plan Width": 69,
              "Actual Startup Time": 0.014,
              "Actual Total Time": 0.022,
              "Actual Rows": 51,
              "Actual Loops": 1,
              "Shared Hit Blocks": 3,
              "Shared Read Blocks": 0,
              "Shared Dirtied Blocks": 0,
              "Shared Written Blocks": 0,
              "Local Hit Blocks": 0,
              "Local Read Blocks": 0,
              "Local Dirtied Blocks": 0,
              "Local Written Blocks": 0,
              "Temp Read Blocks": 0,
              "Temp Written Blocks": 0,
              "Plans": [
                {
                  "Node Type": "Index Scan",
                  "Parent Relationship": "Outer",
                  "Parallel Aware": false,
                  "Async Capable": false,
                  "Scan Direction": "Forward",
                  "Index Name": "messages_history_idx",
                  "Relation Name": "messages",
                  "Alias": "messages",
                  "Startup Cost": 0.29,
                  "Total Cost": 278.27,
                  "Plan Rows": 999,
                  "Plan Width": 69,
                  "Actual Startup Time": 0.013,
                  "Actual Total Time": 0.019,
                  "Actual Rows": 51,
                  "Actual Loops": 1,
                  "Index Cond": "((chat_id = '469ccc02-1f52-49a1-bfac-3a030e303a89'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.009001+00'::timestamp with time zone, '11292e18-2dac-4a73-b29f-13fa5ea58f92'::uuid)))",
                  "Rows Removed by Index Recheck": 0,
                  "Shared Hit Blocks": 3,
                  "Shared Read Blocks": 0,
                  "Shared Dirtied Blocks": 0,
                  "Shared Written Blocks": 0,
                  "Local Hit Blocks": 0,
                  "Local Read Blocks": 0,
                  "Local Dirtied Blocks": 0,
                  "Local Written Blocks": 0,
                  "Temp Read Blocks": 0,
                  "Temp Written Blocks": 0
                }
              ]
            },
            "Planning": {
              "Shared Hit Blocks": 0,
              "Shared Read Blocks": 0,
              "Shared Dirtied Blocks": 0,
              "Shared Written Blocks": 0,
              "Local Hit Blocks": 0,
              "Local Read Blocks": 0,
              "Local Dirtied Blocks": 0,
              "Local Written Blocks": 0,
              "Temp Read Blocks": 0,
              "Temp Written Blocks": 0
            },
            "Planning Time": 0.046,
            "Triggers": [
            ],
            "Execution Time": 0.034
          }
        ]
--- PASS: TestHistoryQueryPlanAtTenThousandMessages (0.82s)
    --- PASS: TestHistoryQueryPlanAtTenThousandMessages/first (0.00s)
    --- PASS: TestHistoryQueryPlanAtTenThousandMessages/late (0.00s)
=== RUN   TestMessengerWorkflow
--- PASS: TestMessengerWorkflow (0.92s)
=== RUN   TestCreateMessageBlankText
--- PASS: TestCreateMessageBlankText (0.51s)
=== RUN   TestCreateMessageFromChatOutsider
--- PASS: TestCreateMessageFromChatOutsider (0.89s)
=== RUN   TestListMessagesPagination
--- PASS: TestListMessagesPagination (0.54s)
=== RUN   TestMessageLessUsesIDForEqualTimestamps
--- PASS: TestMessageLessUsesIDForEqualTimestamps (0.00s)
=== RUN   TestListPageByChatUsesCursorAndLimit
--- PASS: TestListPageByChatUsesCursorAndLimit (0.54s)
=== RUN   TestListPageByChatReturnsNonNilEmptyPage
--- PASS: TestListPageByChatReturnsNonNilEmptyPage (0.13s)
=== RUN   TestPasswordKDFUsesSaltAndFullUTF8Password
--- PASS: TestPasswordKDFUsesSaltAndFullUTF8Password (1.43s)
=== RUN   TestStoredPasswordUsesArgon2id
--- PASS: TestStoredPasswordUsesArgon2id (0.51s)
=== RUN   TestBearerRequiredIgnoresXUserID
--- PASS: TestBearerRequiredIgnoresXUserID (0.00s)
=== RUN   TestMessageCursorPreservesPosition
--- PASS: TestMessageCursorPreservesPosition (0.00s)
=== RUN   TestCreateUserInvalidJSON
--- PASS: TestCreateUserInvalidJSON (0.00s)
=== RUN   TestCreateUserDuplicateUsername
--- PASS: TestCreateUserDuplicateUsername (0.88s)
PASS
ok  	messenger/src/backend/tests	22.994s

Код завершения: 0.

Команда

docker compose --env-file .env run --rm --no-deps backend-tests go vet ./src/backend/...

Фактический вывод

(вывода нет)

Код завершения: 0.

Команда

docker compose --env-file .env exec -T frontend npm run build

Фактический вывод


> messenger-test-ui@1.0.0 build
> tsc --noEmit && vite build

vite v8.3.0 building client environment for production...
transforming...
✓ 19 modules transformed.
rendering chunks...
computing gzip size...
dist/index.html                   0.42 kB │ gzip:  0.31 kB
dist/assets/index-CtrGgTvu.css    8.42 kB │ gzip:  2.49 kB
dist/assets/index-TO2XpdBJ.js   233.91 kB │ gzip: 73.31 kB

✓ built in 618ms

Код завершения: 0.

Команда

docker compose --env-file .env exec -T frontend npm run build

Фактический вывод


> messenger-test-ui@1.0.0 build
> tsc --noEmit && vite build

vite v8.3.0 building client environment for production...
transforming...
✓ 19 modules transformed.
rendering chunks...
computing gzip size...
dist/index.html                   0.42 kB │ gzip:  0.31 kB
dist/assets/index-CtrGgTvu.css    8.42 kB │ gzip:  2.49 kB
dist/assets/index-TO2XpdBJ.js   233.91 kB │ gzip: 73.31 kB

✓ built in 394ms

Код завершения: 0.