Archive the reject NUL text inputs change
This commit is contained in:
@@ -2,6 +2,11 @@ date: 2026-11-05T22:28:57.204523+00:00 commit: f591fa64e525679a31c9db7f942d36c78
|
||||
|
||||
# Доказательства
|
||||
|
||||
NUL во входных строках после повторного ревью — [review-nul-inputs/README.md](review-nul-inputs/README.md),
|
||||
код `e66e2d7d685ef8cdef74b3104bd6b5550b01c0af`: 136 unit-тестов и 18 архитектурных проверок
|
||||
offline, 17 HTTP-регрессий только собраны. Там же обязательные проверки финального агента;
|
||||
динамические свойства и нагрузка на исправленном SHA здесь не подтверждаются.
|
||||
|
||||
Исправления после независимого ревью — [review-fixes/README.md](review-fixes/README.md),
|
||||
код `2af24d7762a87173aa2d34c3464c64184b3ee8bf`. Здесь выполнены только offline-проверки;
|
||||
ниже сохранены измерения прежнего кода. Обязательные динамические проверки нового SHA
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
date: 2026-11-06 commit: e66e2d7d685ef8cdef74b3104bd6b5550b01c0af
|
||||
|
||||
# NUL во входных строках — исправление повторного ревью
|
||||
|
||||
Исходный snapshot: `82641cbd3d03718e49701a86198bdffb35c0310e`.
|
||||
Код исправлений и регрессионных тестов: `e66e2d7d685ef8cdef74b3104bd6b5550b01c0af`.
|
||||
Проверки выполнялись в существующем окружении основного репозитория. Docker, серверы,
|
||||
нагрузка, установка окружений и публикация на этом этапе не выполнялись.
|
||||
|
||||
## Исправление и доказательства
|
||||
|
||||
Basic username с NUL теперь отклоняется парсером до VerifyCredentials; guard возвращает
|
||||
стандартный `401 unauthorized` с Basic challenge. DisplayName, ChatTitle и MessageText
|
||||
отклоняют NUL своими доменными ошибками, отображаемыми в `400 invalid_request`.
|
||||
При неверном тексте PostMessageHandler сохраняет проверку членства: чужой/несуществующий
|
||||
чат даёт `404`, MessageLog.post не вызывается. Допустимый Unicode и пробелы сохраняются.
|
||||
Пароли, SQL, схема, миграции, инфраструктура и зависимости не изменены.
|
||||
|
||||
Ограничение NUL в текстовых типах сверено через Context7 с
|
||||
[документацией PostgreSQL 17](https://www.postgresql.org/docs/17/datatype-character.html).
|
||||
|
||||
- [Регрессия на старом коде](baseline-regression-corrected.txt): 19 ожидаемых падений,
|
||||
3 проверки допустимого текста проходят. SHA `5c561ea` содержит только proposal поверх
|
||||
snapshot ревью; исходники приложения ещё без исправления, новые тесты — working tree.
|
||||
- [Первоначальная попытка](baseline-regression.txt) сохранена: те же 19 падений и 3 успеха,
|
||||
но два сценария обработчика остановились на неполной заглушке Clock. После назначения
|
||||
реального datetime повтор выше подтвердил отсутствие нужного пути валидации.
|
||||
- [Проверки исправленного SHA](offline-checks.txt): `make check`, `make validate`,
|
||||
`make lint`, `make student-test PYTEST_ARGS='-q student-tests/unit'` — 136 passed,
|
||||
включая все 22 новые проверки; 18 архитектурных проверок вызваны напрямую без
|
||||
database-фикстуры. OpenSpec strict — 15/15 до архивации.
|
||||
- [Финализация](finalization-checks.txt): OpenSpec strict — 14/14 после синхронизации
|
||||
и архивации, активных changes нет; lint успешен, diff нормативных файлов, runner/state,
|
||||
зависимостей, миграций и инфраструктуры относительно исходного snapshot пуст.
|
||||
- Там же: 17 HTTP-тестов `student-tests/api/test_nul_validation.py` собраны через
|
||||
`--collect-only`, **не исполнены**. SQL, транзакции и ответы работающего HTTP-сервера
|
||||
этим этапом не проверены. Unit-тесты guard/MessageLog используют подставные порты.
|
||||
|
||||
Первый `make lint` после добавления тестов нашёл строку 102 символа при лимите 100;
|
||||
строка разбита, итоговые Ruff/format/ty успешны. Нормативные файлы не менялись.
|
||||
|
||||
## Обязательный финальный прогон
|
||||
|
||||
Команды ниже здесь **не выполнялись**. Runner передаёт их агенту нагрузки в чистом clone
|
||||
финального SHA. Нужен разрешённый собственный compose project, свободный HTTP-порт 18083,
|
||||
прочие host-порты 23000–23999 и NO_PROXY/no_proxy для localhost,127.0.0.1,::1.
|
||||
|
||||
1. `make student-test PYTEST_ARGS='-v student-tests/api/test_nul_validation.py'` — 17 сценариев
|
||||
с реальным PostgreSQL: NUL в начале/середине/конце/единственным символом, одинаковый `401`
|
||||
с неверным паролем, контрактное тело и оба X-заголовка, отсутствие созданного пользователя
|
||||
или чата после `400`, пустая история после NUL, исправленное сообщение с прежним ключом
|
||||
получает `201` и корректно повторяется; чужой и несуществующий чат одинаково дают `404`.
|
||||
2. `make student-test` — полная регрессия, особенно сессии, negative, access, idempotency и
|
||||
ранее добавленные проверки кэша. Проверить сохранение Unicode/переносов строк/табуляции.
|
||||
3. На работающем стенде через LB повторить те же NUL-запросы и исправленный повтор сообщения
|
||||
с тем же ключом через другую реплику; зафиксировать `X-Instance-Id`, `X-Request-Id`, статусы,
|
||||
историю без дублей и отсутствие `500`. NUL в JSON передавать как `\u0000`, в Basic —
|
||||
внутри Base64 синтетических credentials. Секреты и сессионные токены в evidence не писать.
|
||||
4. `make test`, `make test-persistence ACTION_SCRIPT=scripts/restart.sh`,
|
||||
`make test-failover ACTION_SCRIPT=scripts/stop-one.sh`, `make lb-check`, `make retry-check`
|
||||
и `make test-faults` — обязательные общие сценарии финальной версии по заданию runner.
|
||||
5. Сохраняются все обязательства [предыдущего исправления](../review-fixes/README.md),
|
||||
включая реальные PostgreSQL/Valkey, HAProxy, rolling/failover и измерения трека «5».
|
||||
Старые RPS/p95 относятся к прежнему коду; этот этап новых измерений не добавляет.
|
||||
|
||||
После Docker-этапа остановить только свои стенды без удаления постоянных volumes.
|
||||
Финальный отчёт оформляет отдельный агент. Этот change закрывает замечание о валидации
|
||||
минимума уровня «3»; выполнение динамических критериев «3»/«4»/«5» заново не заявляется.
|
||||
@@ -0,0 +1,125 @@
|
||||
date: 2026-11-05T23:03:20.666957+00:00 commit: 5c561eac26be15d9dca3d9f282294a351f6043e5; tests: working tree
|
||||
|
||||
$ .venv/bin/pytest -q --tb=short student-tests/unit/test_nul_inputs.py
|
||||
FFFFFFFFFFFFFFFFF...FF [100%]
|
||||
=================================== FAILURES ===================================
|
||||
____________________ test_basic_rejects_nul_username[\x00] _____________________
|
||||
student-tests/unit/test_nul_inputs.py:34: in test_basic_rejects_nul_username
|
||||
assert basic_credentials(f"Basic {raw}") is None
|
||||
E AssertionError: assert ('\x00', 'synthetic-password') is None
|
||||
E + where ('\x00', 'synthetic-password') = basic_credentials('Basic ADpzeW50aGV0aWMtcGFzc3dvcmQ=')
|
||||
___________________ test_basic_rejects_nul_username[\x00abc] ___________________
|
||||
student-tests/unit/test_nul_inputs.py:34: in test_basic_rejects_nul_username
|
||||
assert basic_credentials(f"Basic {raw}") is None
|
||||
E AssertionError: assert ('\x00abc', 'synthetic-password') is None
|
||||
E + where ('\x00abc', 'synthetic-password') = basic_credentials('Basic AGFiYzpzeW50aGV0aWMtcGFzc3dvcmQ=')
|
||||
_________________ test_basic_rejects_nul_username[abc\x00def] __________________
|
||||
student-tests/unit/test_nul_inputs.py:34: in test_basic_rejects_nul_username
|
||||
assert basic_credentials(f"Basic {raw}") is None
|
||||
E AssertionError: assert ('abc\x00def', 'synthetic-password') is None
|
||||
E + where ('abc\x00def', 'synthetic-password') = basic_credentials('Basic YWJjAGRlZjpzeW50aGV0aWMtcGFzc3dvcmQ=')
|
||||
___________________ test_basic_rejects_nul_username[abc\x00] ___________________
|
||||
student-tests/unit/test_nul_inputs.py:34: in test_basic_rejects_nul_username
|
||||
assert basic_credentials(f"Basic {raw}") is None
|
||||
E AssertionError: assert ('abc\x00', 'synthetic-password') is None
|
||||
E + where ('abc\x00', 'synthetic-password') = basic_credentials('Basic YWJjADpzeW50aGV0aWMtcGFzc3dvcmQ=')
|
||||
____________ test_nul_username_is_rejected_before_credential_lookup ____________
|
||||
student-tests/unit/test_nul_inputs.py:50: in test_nul_username_is_rejected_before_credential_lookup
|
||||
verify.assert_not_awaited()
|
||||
../../../../../.local/share/uv/python/cpython-3.14.5-macos-aarch64-none/lib/python3.14/unittest/mock.py:2471: in assert_not_awaited
|
||||
raise AssertionError(msg)
|
||||
E AssertionError: Expected mock to not have been awaited. Awaited 1 times.
|
||||
________ test_text_values_reject_nul[DisplayName-InvalidUserData-\x00] _________
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidUserData
|
||||
_______ test_text_values_reject_nul[DisplayName-InvalidUserData-\x00abc] _______
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidUserData
|
||||
_____ test_text_values_reject_nul[DisplayName-InvalidUserData-abc\x00def] ______
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidUserData
|
||||
_______ test_text_values_reject_nul[DisplayName-InvalidUserData-abc\x00] _______
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidUserData
|
||||
_________ test_text_values_reject_nul[ChatTitle-InvalidChatData-\x00] __________
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidChatData
|
||||
________ test_text_values_reject_nul[ChatTitle-InvalidChatData-\x00abc] ________
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidChatData
|
||||
______ test_text_values_reject_nul[ChatTitle-InvalidChatData-abc\x00def] _______
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidChatData
|
||||
________ test_text_values_reject_nul[ChatTitle-InvalidChatData-abc\x00] ________
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidChatData
|
||||
_______ test_text_values_reject_nul[MessageText-InvalidMessageText-\x00] _______
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidMessageText
|
||||
_____ test_text_values_reject_nul[MessageText-InvalidMessageText-\x00abc] ______
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidMessageText
|
||||
____ test_text_values_reject_nul[MessageText-InvalidMessageText-abc\x00def] ____
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidMessageText
|
||||
_____ test_text_values_reject_nul[MessageText-InvalidMessageText-abc\x00] ______
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidMessageText
|
||||
____________ test_nul_message_checks_access_without_writing[False] _____________
|
||||
student-tests/unit/test_nul_inputs.py:89: in test_nul_message_checks_access_without_writing
|
||||
chats.chat_for_member.assert_awaited_once_with(command.chat_id, command.sender_id)
|
||||
../../../../../.local/share/uv/python/cpython-3.14.5-macos-aarch64-none/lib/python3.14/unittest/mock.py:2404: in assert_awaited_once_with
|
||||
raise AssertionError(msg)
|
||||
E AssertionError: Expected chat_for_member to have been awaited once. Awaited 0 times.
|
||||
_____________ test_nul_message_checks_access_without_writing[True] _____________
|
||||
student-tests/unit/test_nul_inputs.py:88: in test_nul_message_checks_access_without_writing
|
||||
await handler(command)
|
||||
src/messenger/messaging/application/handlers.py:64: in __call__
|
||||
raise ChatNotFound("чат не найден")
|
||||
E messenger.messaging.domain.errors.ChatNotFound: чат не найден
|
||||
=========================== short test summary info ============================
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_basic_rejects_nul_username[\x00]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_basic_rejects_nul_username[\x00abc]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_basic_rejects_nul_username[abc\x00def]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_basic_rejects_nul_username[abc\x00]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_nul_username_is_rejected_before_credential_lookup
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[DisplayName-InvalidUserData-\x00]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[DisplayName-InvalidUserData-\x00abc]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[DisplayName-InvalidUserData-abc\x00def]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[DisplayName-InvalidUserData-abc\x00]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[ChatTitle-InvalidChatData-\x00]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[ChatTitle-InvalidChatData-\x00abc]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[ChatTitle-InvalidChatData-abc\x00def]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[ChatTitle-InvalidChatData-abc\x00]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[MessageText-InvalidMessageText-\x00]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[MessageText-InvalidMessageText-\x00abc]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[MessageText-InvalidMessageText-abc\x00def]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[MessageText-InvalidMessageText-abc\x00]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_nul_message_checks_access_without_writing[False]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_nul_message_checks_access_without_writing[True]
|
||||
19 failed, 3 passed in 0.09s
|
||||
exit: 1
|
||||
@@ -0,0 +1,127 @@
|
||||
date: 2026-11-05T23:03:07.667186+00:00 commit: 5c561eac26be15d9dca3d9f282294a351f6043e5; tests: working tree
|
||||
|
||||
$ .venv/bin/pytest -q --tb=short student-tests/unit/test_nul_inputs.py
|
||||
FFFFFFFFFFFFFFFFF...FF [100%]
|
||||
=================================== FAILURES ===================================
|
||||
____________________ test_basic_rejects_nul_username[\x00] _____________________
|
||||
student-tests/unit/test_nul_inputs.py:34: in test_basic_rejects_nul_username
|
||||
assert basic_credentials(f"Basic {raw}") is None
|
||||
E AssertionError: assert ('\x00', 'synthetic-password') is None
|
||||
E + where ('\x00', 'synthetic-password') = basic_credentials('Basic ADpzeW50aGV0aWMtcGFzc3dvcmQ=')
|
||||
___________________ test_basic_rejects_nul_username[\x00abc] ___________________
|
||||
student-tests/unit/test_nul_inputs.py:34: in test_basic_rejects_nul_username
|
||||
assert basic_credentials(f"Basic {raw}") is None
|
||||
E AssertionError: assert ('\x00abc', 'synthetic-password') is None
|
||||
E + where ('\x00abc', 'synthetic-password') = basic_credentials('Basic AGFiYzpzeW50aGV0aWMtcGFzc3dvcmQ=')
|
||||
_________________ test_basic_rejects_nul_username[abc\x00def] __________________
|
||||
student-tests/unit/test_nul_inputs.py:34: in test_basic_rejects_nul_username
|
||||
assert basic_credentials(f"Basic {raw}") is None
|
||||
E AssertionError: assert ('abc\x00def', 'synthetic-password') is None
|
||||
E + where ('abc\x00def', 'synthetic-password') = basic_credentials('Basic YWJjAGRlZjpzeW50aGV0aWMtcGFzc3dvcmQ=')
|
||||
___________________ test_basic_rejects_nul_username[abc\x00] ___________________
|
||||
student-tests/unit/test_nul_inputs.py:34: in test_basic_rejects_nul_username
|
||||
assert basic_credentials(f"Basic {raw}") is None
|
||||
E AssertionError: assert ('abc\x00', 'synthetic-password') is None
|
||||
E + where ('abc\x00', 'synthetic-password') = basic_credentials('Basic YWJjADpzeW50aGV0aWMtcGFzc3dvcmQ=')
|
||||
____________ test_nul_username_is_rejected_before_credential_lookup ____________
|
||||
student-tests/unit/test_nul_inputs.py:50: in test_nul_username_is_rejected_before_credential_lookup
|
||||
verify.assert_not_awaited()
|
||||
../../../../../.local/share/uv/python/cpython-3.14.5-macos-aarch64-none/lib/python3.14/unittest/mock.py:2471: in assert_not_awaited
|
||||
raise AssertionError(msg)
|
||||
E AssertionError: Expected mock to not have been awaited. Awaited 1 times.
|
||||
________ test_text_values_reject_nul[DisplayName-InvalidUserData-\x00] _________
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidUserData
|
||||
_______ test_text_values_reject_nul[DisplayName-InvalidUserData-\x00abc] _______
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidUserData
|
||||
_____ test_text_values_reject_nul[DisplayName-InvalidUserData-abc\x00def] ______
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidUserData
|
||||
_______ test_text_values_reject_nul[DisplayName-InvalidUserData-abc\x00] _______
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidUserData
|
||||
_________ test_text_values_reject_nul[ChatTitle-InvalidChatData-\x00] __________
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidChatData
|
||||
________ test_text_values_reject_nul[ChatTitle-InvalidChatData-\x00abc] ________
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidChatData
|
||||
______ test_text_values_reject_nul[ChatTitle-InvalidChatData-abc\x00def] _______
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidChatData
|
||||
________ test_text_values_reject_nul[ChatTitle-InvalidChatData-abc\x00] ________
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidChatData
|
||||
_______ test_text_values_reject_nul[MessageText-InvalidMessageText-\x00] _______
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidMessageText
|
||||
_____ test_text_values_reject_nul[MessageText-InvalidMessageText-\x00abc] ______
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidMessageText
|
||||
____ test_text_values_reject_nul[MessageText-InvalidMessageText-abc\x00def] ____
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidMessageText
|
||||
_____ test_text_values_reject_nul[MessageText-InvalidMessageText-abc\x00] ______
|
||||
student-tests/unit/test_nul_inputs.py:62: in test_text_values_reject_nul
|
||||
with pytest.raises(error):
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
E Failed: DID NOT RAISE InvalidMessageText
|
||||
____________ test_nul_message_checks_access_without_writing[False] _____________
|
||||
student-tests/unit/test_nul_inputs.py:86: in test_nul_message_checks_access_without_writing
|
||||
await handler(command)
|
||||
src/messenger/messaging/application/handlers.py:62: in __call__
|
||||
receipt = await self._log.post(draft, command.key, command.fingerprint, now - self._ttl)
|
||||
^^^^^^^^^^^^^^^
|
||||
E TypeError: unsupported operand type(s) for -: 'Mock' and 'datetime.timedelta'
|
||||
_____________ test_nul_message_checks_access_without_writing[True] _____________
|
||||
student-tests/unit/test_nul_inputs.py:86: in test_nul_message_checks_access_without_writing
|
||||
await handler(command)
|
||||
src/messenger/messaging/application/handlers.py:62: in __call__
|
||||
receipt = await self._log.post(draft, command.key, command.fingerprint, now - self._ttl)
|
||||
^^^^^^^^^^^^^^^
|
||||
E TypeError: unsupported operand type(s) for -: 'Mock' and 'datetime.timedelta'
|
||||
=========================== short test summary info ============================
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_basic_rejects_nul_username[\x00]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_basic_rejects_nul_username[\x00abc]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_basic_rejects_nul_username[abc\x00def]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_basic_rejects_nul_username[abc\x00]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_nul_username_is_rejected_before_credential_lookup
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[DisplayName-InvalidUserData-\x00]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[DisplayName-InvalidUserData-\x00abc]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[DisplayName-InvalidUserData-abc\x00def]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[DisplayName-InvalidUserData-abc\x00]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[ChatTitle-InvalidChatData-\x00]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[ChatTitle-InvalidChatData-\x00abc]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[ChatTitle-InvalidChatData-abc\x00def]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[ChatTitle-InvalidChatData-abc\x00]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[MessageText-InvalidMessageText-\x00]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[MessageText-InvalidMessageText-\x00abc]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[MessageText-InvalidMessageText-abc\x00def]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_text_values_reject_nul[MessageText-InvalidMessageText-abc\x00]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_nul_message_checks_access_without_writing[False]
|
||||
FAILED student-tests/unit/test_nul_inputs.py::test_nul_message_checks_access_without_writing[True]
|
||||
19 failed, 3 passed in 0.08s
|
||||
exit: 1
|
||||
@@ -0,0 +1,47 @@
|
||||
date: 2026-11-05T23:07:18.897766+00:00 commit: e66e2d7d685ef8cdef74b3104bd6b5550b01c0af; OpenSpec/evidence documentation worktree
|
||||
|
||||
$ openspec validate --all --strict
|
||||
✓ spec/lab1-event-publication
|
||||
✓ spec/lab1-messenger-chats
|
||||
✓ spec/lab1-messenger-history
|
||||
✓ spec/lab1-messenger-identity
|
||||
✓ spec/lab1-service-operability
|
||||
✓ spec/lab2-auth-sessions
|
||||
✓ spec/lab2-dependency-failures
|
||||
✓ spec/lab2-history-index
|
||||
✓ spec/lab2-persistent-storage
|
||||
✓ spec/lab2-session-cache
|
||||
✓ spec/lab3-failover-operations
|
||||
✓ spec/lab3-idempotent-messages
|
||||
✓ spec/lab3-load-balancing
|
||||
✓ spec/lab3-scaling-cost
|
||||
Totals: 14 passed, 0 failed (14 items)
|
||||
- Validating...
|
||||
exit: 0
|
||||
|
||||
$ openspec list --json
|
||||
{
|
||||
"changes": [],
|
||||
"root": {
|
||||
"path": "<repo>",
|
||||
"source": "nearest"
|
||||
}
|
||||
}
|
||||
exit: 0
|
||||
|
||||
$ git diff --check
|
||||
|
||||
exit: 0
|
||||
|
||||
$ git diff 82641cbd3d03718e49701a86198bdffb35c0310e --exit-code -- contracts tests README.md COURSE.md .pipeline pyproject.toml uv.lock alembic infra compose.yaml
|
||||
|
||||
exit: 0
|
||||
|
||||
$ make lint
|
||||
.venv/bin/ruff check src student-tests alembic scripts/probe.py scripts/limits.py scripts/scaling.py tools
|
||||
All checks passed!
|
||||
.venv/bin/ruff format --check src student-tests alembic scripts/probe.py scripts/limits.py scripts/scaling.py tools
|
||||
113 files already formatted
|
||||
.venv/bin/ty check src student-tests alembic
|
||||
All checks passed!
|
||||
exit: 0
|
||||
@@ -0,0 +1,97 @@
|
||||
date: 2026-11-05T23:05:24.813684+00:00 commit: e66e2d7d685ef8cdef74b3104bd6b5550b01c0af
|
||||
|
||||
$ make check
|
||||
python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
exit: 0
|
||||
|
||||
$ make validate
|
||||
.venv/bin/python scripts/validate_openapi.py
|
||||
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
|
||||
exit: 0
|
||||
|
||||
$ make lint
|
||||
.venv/bin/ruff check src student-tests alembic scripts/probe.py scripts/limits.py scripts/scaling.py tools
|
||||
All checks passed!
|
||||
.venv/bin/ruff format --check src student-tests alembic scripts/probe.py scripts/limits.py scripts/scaling.py tools
|
||||
113 files already formatted
|
||||
.venv/bin/ty check src student-tests alembic
|
||||
All checks passed!
|
||||
exit: 0
|
||||
|
||||
$ make student-test 'PYTEST_ARGS=-q student-tests/unit'
|
||||
.venv/bin/pytest -q student-tests/unit
|
||||
........................................................................ [ 52%]
|
||||
................................................................ [100%]
|
||||
136 passed in 0.11s
|
||||
exit: 0
|
||||
|
||||
$ .venv/bin/python -c 'import runpy
|
||||
scope = runpy.run_path('"'"'student-tests/api/test_bounded_contexts.py'"'"')
|
||||
tests = [(name, fn) for name, fn in scope.items() if name.startswith('"'"'test_'"'"')]
|
||||
for name, fn in tests:
|
||||
fn()
|
||||
print('"'"'PASS'"'"', name)
|
||||
print(len(tests), '"'"'architecture checks passed without database fixtures'"'"')'
|
||||
PASS test_identity_does_not_know_about_messaging
|
||||
PASS test_domains_do_not_import_infrastructure
|
||||
PASS test_core_layers_do_not_import_pydantic
|
||||
PASS test_shared_knows_nothing_about_zones
|
||||
PASS test_shared_core_is_free_of_transport
|
||||
PASS test_shared_core_holds_only_platform
|
||||
PASS test_shared_entrypoints_hold_only_transport
|
||||
PASS test_every_zone_owns_its_errors_events_and_commands
|
||||
PASS test_every_zone_owns_its_http_layer
|
||||
PASS test_only_main_knows_both_zones
|
||||
PASS test_application_has_no_separate_entrypoints_root
|
||||
PASS test_shared_source_mentions_no_domain_vocabulary
|
||||
PASS test_shared_declares_no_concrete_commands_or_events
|
||||
PASS test_shared_has_no_test_doubles
|
||||
PASS test_zone_errors_do_not_leak_transport_codes
|
||||
PASS test_sql_of_each_zone_reads_only_its_tables
|
||||
PASS test_messaging_does_not_import_identity_at_all
|
||||
PASS test_sqlalchemy_stays_in_infrastructure_and_asyncpg_is_only_a_driver
|
||||
18 architecture checks passed without database fixtures
|
||||
exit: 0
|
||||
|
||||
$ .venv/bin/pytest --collect-only -q student-tests/api/test_nul_validation.py
|
||||
student-tests/api/test_nul_validation.py::test_nul_basic_matches_wrong_password[\x00]
|
||||
student-tests/api/test_nul_validation.py::test_nul_basic_matches_wrong_password[\x00abc]
|
||||
student-tests/api/test_nul_validation.py::test_nul_basic_matches_wrong_password[abc\x00def]
|
||||
student-tests/api/test_nul_validation.py::test_nul_basic_matches_wrong_password[abc\x00]
|
||||
student-tests/api/test_nul_validation.py::test_nul_display_name_does_not_create_user[\x00]
|
||||
student-tests/api/test_nul_validation.py::test_nul_display_name_does_not_create_user[\x00abc]
|
||||
student-tests/api/test_nul_validation.py::test_nul_display_name_does_not_create_user[abc\x00def]
|
||||
student-tests/api/test_nul_validation.py::test_nul_display_name_does_not_create_user[abc\x00]
|
||||
student-tests/api/test_nul_validation.py::test_nul_title_does_not_create_chat[\x00]
|
||||
student-tests/api/test_nul_validation.py::test_nul_title_does_not_create_chat[\x00abc]
|
||||
student-tests/api/test_nul_validation.py::test_nul_title_does_not_create_chat[abc\x00def]
|
||||
student-tests/api/test_nul_validation.py::test_nul_title_does_not_create_chat[abc\x00]
|
||||
student-tests/api/test_nul_validation.py::test_nul_message_does_not_take_key[\x00]
|
||||
student-tests/api/test_nul_validation.py::test_nul_message_does_not_take_key[\x00abc]
|
||||
student-tests/api/test_nul_validation.py::test_nul_message_does_not_take_key[abc\x00def]
|
||||
student-tests/api/test_nul_validation.py::test_nul_message_does_not_take_key[abc\x00]
|
||||
student-tests/api/test_nul_validation.py::test_nul_message_does_not_disclose_chat
|
||||
|
||||
17 tests collected in 0.01s
|
||||
exit: 0
|
||||
|
||||
$ openspec validate --all --strict
|
||||
✓ spec/lab1-event-publication
|
||||
✓ spec/lab1-messenger-chats
|
||||
✓ spec/lab1-messenger-history
|
||||
✓ spec/lab1-messenger-identity
|
||||
✓ spec/lab1-service-operability
|
||||
✓ spec/lab2-auth-sessions
|
||||
✓ spec/lab2-dependency-failures
|
||||
✓ spec/lab2-history-index
|
||||
✓ spec/lab2-persistent-storage
|
||||
✓ spec/lab2-session-cache
|
||||
✓ spec/lab3-failover-operations
|
||||
✓ spec/lab3-idempotent-messages
|
||||
✓ spec/lab3-load-balancing
|
||||
✓ spec/lab3-scaling-cost
|
||||
✓ change/reject-nul-text-inputs
|
||||
Totals: 15 passed, 0 failed (15 items)
|
||||
- Validating...
|
||||
exit: 0
|
||||
Reference in New Issue
Block a user