docs: document scaffold status and make local doc checks reproducible
This commit is contained in:
1 parent
70f96adf26
commit
0f206bfc29
7 files changed
+214
-7
No files matched your search
+1
-1
@@ -15,7 +15,7 @@ The backend build context is `backend/`, so Docker applies `backend/.dockerignor
|
||||
|
||||
The current `postgres:alpine` volume mounts at `/var/lib/postgresql`; the image stores data in a subdirectory for its major version. When the tag advances to a new major version, migrate an existing database with `pg_upgrade` or backup/restore. Updating the image alone does not convert the data.
|
||||
|
||||
Open http://127.0.0.1:8080. The host port binds to loopback. Nginx handles /healthz, proxies /api/ to Go, and uses the SPA fallback for other paths. The Go health endpoint is /api/v1/healthz; the internal Go /readyz checks PostgreSQL with SELECT 1, Redis with PING, and the SeaweedFS bucket with HeadBucket; any dependency being unavailable produces 503. The internal backend port 9090 serves /metrics.
|
||||
Open http://127.0.0.1:8080. The host port binds to loopback. Nginx handles /healthz, proxies /api/ to Go, and uses the SPA fallback for other paths. The public API health route is /api/v1/healthz through Nginx /api/. On the internal port 8080, Go also serves /healthz for the process and /readyz, which checks PostgreSQL with SELECT 1, Redis with PING, and the SeaweedFS bucket with HeadBucket; any dependency being unavailable produces 503. The internal backend port 9090 serves /metrics.
|
||||
|
||||
This Nginx configuration has no production TLS. The current bind does not expose the app directly to the public network. Remote access needs a selected TLS reverse proxy, firewall rules, and environment-specific configuration.
|
||||
|
||||
|
||||
@@ -13,6 +13,49 @@ This guide describes the current technical scaffold and the commands declared in
|
||||
|
||||
Select current stable frontend dependency releases and keep pnpm-lock.yaml committed for repeatable installs. ML dependencies are locked in uv.lock; Go dependencies are in backend/go.mod. An update must change its lock/configuration and pass checks for that service. Container images use the requested moving `latest` or `alpine` tags; inspect their current Compose/Dockerfile references instead of treating the tag as a fixed version.
|
||||
|
||||
## Scaffold status
|
||||
|
||||
The repository contains a verifiable technical scaffold, not a product. Values below are read from the named files; when updating a dependency, change its source and lockfile and update this table in both languages.
|
||||
|
||||
| Component | Pinned version | Source |
|
||||
| --- | --- | --- |
|
||||
| Go | 1.26.8 (`go` directive; no separate `toolchain` line) | backend/go.mod; build image `golang:1.26.8-alpine` in backend/Dockerfile |
|
||||
| Node.js | 26.10.0 | frontend/.node-version |
|
||||
| pnpm | 12.9.1 | `packageManager` in frontend/package.json, frontend/pnpm-lock.yaml |
|
||||
| React, React DOM | 19.3.0 | frontend/package.json, frontend/pnpm-lock.yaml |
|
||||
| React Router (`react-router-dom`) | 7.18.4 | frontend/package.json, frontend/pnpm-lock.yaml |
|
||||
| TanStack Query (`@tanstack/react-query`) | 5.104.1 | frontend/package.json, frontend/pnpm-lock.yaml |
|
||||
| Zod | 4.6.5 | frontend/package.json, frontend/pnpm-lock.yaml |
|
||||
| Vite | 8.3.2 | frontend/package.json, frontend/pnpm-lock.yaml |
|
||||
| TypeScript | 7.0.2 (`@typescript/native`, `tsc`); 6.0.2 API (`typescript` alias of `@typescript/typescript6`) for ESLint | frontend/package.json, frontend/pnpm-lock.yaml |
|
||||
| Vitest | 5.0.3 | frontend/package.json, frontend/pnpm-lock.yaml |
|
||||
| Orval | 8.40.0 | frontend/package.json, frontend/pnpm-lock.yaml |
|
||||
| Python | 3.14.8 (`requires-python >=3.14,<3.15`) | ml/.python-version, ml/pyproject.toml |
|
||||
| uv | 0.12.22 | `[tool.uv] required-version` in ml/pyproject.toml; `setup-uv` in .github/workflows/ci.yml |
|
||||
| FastAPI | 0.142.2 | ml/pyproject.toml, ml/uv.lock |
|
||||
| Pydantic | 2.13.5 | ml/pyproject.toml, ml/uv.lock |
|
||||
| uvicorn | 0.54.0 | ml/pyproject.toml, ml/uv.lock |
|
||||
| ogen | v1.24.0 | backend/go.mod (`require` and `tool`) |
|
||||
| sqlc | v1.31.1 | backend/go.mod (`tool`) |
|
||||
| wire (`github.com/goforj/wire`) | v1.2.0 | backend/go.mod (`require` and `tool`) |
|
||||
| mockery | v3.8.0 | backend/go.mod (`tool`) |
|
||||
| golangci-lint | v2.14.0 | backend/go.mod (`tool`) |
|
||||
| goose | v3.28.0 | backend/go.mod (`tool`) |
|
||||
| chi | v5.3.2 | backend/go.mod |
|
||||
| pgx | v5.11.0 | backend/go.mod |
|
||||
| testcontainers-go | v0.44.0, including modules/postgres | backend/go.mod |
|
||||
|
||||
What exists now:
|
||||
|
||||
- Health and readiness routes. Nginx answers `GET /healthz` itself and proxies only `/api/` to Go (deploy/nginx/conf.d/app.conf). Go serves `GET /healthz` (`ok`) and `GET /readyz` (`ready` or 503 `not_ready` after checking PostgreSQL, Redis, and SeaweedFS) on its internal port 8080 outside the OpenAPI contract, plus `GET /api/v1/healthz` from api/core/routes/healthz.yml through the ogen handler (backend/internal/adapter/primary/http). The Go metrics listener uses port 9090 (`METRICS_ADDR`) and Prometheus scrapes `/metrics`. ML serves `GET /healthz`, `GET /readyz` (always 503 `not_ready` because no model is connected), and `/metrics` (ml/src/lincodex_ml, api/ml/routes). deploy/scripts/smoke.sh checks Nginx `/healthz`, `/api/v1/healthz`, Go `/readyz` from inside the Compose network, and a 404 for an unknown API route; it does not start ML.
|
||||
- Adapters: PostgreSQL through pgxpool with a generated `SELECT 1` query, Redis through go-cachekit, and SeaweedFS through the S3 API. A generated Go client for the ML contract exists but is not wired into bootstrap.
|
||||
- OpenAPI contracts api/core/ and api/ml/ with schema merge, bundles, lint, and generation for Go (ogen), TypeScript (Orval), and Python (datamodel-code-generator). The SPA has a home page, a generated API client, and MSW handlers.
|
||||
- Compose projects: core (`deploy/docker/docker-compose.yml`: PostgreSQL, Redis, SeaweedFS, backend, frontend), ML (`docker-compose.ml.yml`), and monitoring (`docker-compose.monitoring.yml`).
|
||||
- CI jobs in .github/workflows/ci.yml: `api`, `backend`, `integration` (matrix of two shards), `frontend`, `ml`, `codegen`, `infrastructure`, `security`, `security-images`, `smoke`, and the required `aggregate` result. See [TESTING.md](TESTING.md) for sharding.
|
||||
- Observability: Prometheus, Loki, Alloy, Grafana with provisioned datasources and dashboards, and PostgreSQL, Redis, and node exporters. The React app does not send telemetry yet.
|
||||
|
||||
Not implemented yet: registration and login, consents, profiles, the questionnaire and assessment, the company cabinet, needs and matching, invitations and contacts, mail delivery, Kafka/outbox, notifications, support, and an end-to-end business suite. backend/db/migrations/ has no business schema, product usecase and adapter directories contain only placeholders, and `make -C deploy test-e2e` is a deferred placeholder that exits with an error. The target design is in [ARCHITECTURE.md](ARCHITECTURE.md).
|
||||
|
||||
## Install and work loop
|
||||
|
||||
The frontend uses TypeScript 7.0.2 (`tsc`) for type checking. The `@typescript/native` npm alias points to that compiler, while `typescript` points to the compatible `@typescript/typescript6` API for ESLint. This follows [Microsoft's side-by-side setup](https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/#running-side-by-side-with-typescript-6.0): current typescript-eslint does not support the TS7 API yet. Type checking covers source files, Vite configuration, and `codegen/orval.config.ts`.
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
|
||||
Для текущего `postgres:alpine` volume монтируется в `/var/lib/postgresql`; образ размещает данные в подкаталоге своей major-версии. При переходе тега на новую major-версию существующую базу нужно мигрировать через `pg_upgrade` или backup/restore. Обновление образа само по себе не преобразует данные.
|
||||
|
||||
Откройте http://127.0.0.1:8080. Порт привязан к loopback. Nginx отвечает на /healthz, перенаправляет /api/ в Go и использует SPA fallback для остальных путей. Go health endpoint находится на /api/v1/healthz; внутренний Go /readyz проверяет PostgreSQL через SELECT 1, Redis через PING и bucket SeaweedFS через HeadBucket; недоступность любого из них дает 503. Служебный /metrics слушает на внутреннем порту backend 9090.
|
||||
Откройте http://127.0.0.1:8080. Порт привязан к loopback. Nginx отвечает на /healthz, перенаправляет /api/ в Go и использует SPA fallback для остальных путей. Публичный health-маршрут API - /api/v1/healthz через Nginx /api/. На внутреннем порту 8080 Go также обслуживает /healthz для проверки процесса и /readyz, который проверяет PostgreSQL через SELECT 1, Redis через PING и bucket SeaweedFS через HeadBucket; недоступность любого из них дает 503. Служебный /metrics слушает на внутреннем порту backend 9090.
|
||||
|
||||
Этот Nginx конфиг не настраивает production TLS. Текущий bind не открывает приложение напрямую во внешнюю сеть. Для удаленного доступа требуется отдельно выбранный TLS reverse proxy, firewall и конфигурация целевого окружения.
|
||||
|
||||
|
||||
@@ -13,6 +13,49 @@
|
||||
|
||||
Frontend зависимости выбираются из актуальных stable releases; сохраняйте pnpm-lock.yaml для повторяемой установки. ML зависимости фиксируются в uv.lock, Go dependencies - в backend/go.mod. При обновлении меняйте соответствующий lock/config и запускайте checks области. Образы используют заданные moving `latest` или `alpine` tags; сверяйте ссылки в Compose/Dockerfiles и не считайте их стабильными номерами версии.
|
||||
|
||||
## Состояние каркаса
|
||||
|
||||
В репозитории есть проверяемый технический каркас, а не готовый продукт. Значения ниже взяты из указанных файлов; при обновлении зависимости меняйте ее источник и lockfile, затем обновляйте эту таблицу на обоих языках.
|
||||
|
||||
| Компонент | Закрепленная версия | Источник |
|
||||
| --- | --- | --- |
|
||||
| Go | 1.26.8 (директива `go`; отдельной строки `toolchain` нет) | backend/go.mod; build image `golang:1.26.8-alpine` в backend/Dockerfile |
|
||||
| Node.js | 26.10.0 | frontend/.node-version |
|
||||
| pnpm | 12.9.1 | `packageManager` в frontend/package.json, frontend/pnpm-lock.yaml |
|
||||
| React, React DOM | 19.3.0 | frontend/package.json, frontend/pnpm-lock.yaml |
|
||||
| React Router (`react-router-dom`) | 7.18.4 | frontend/package.json, frontend/pnpm-lock.yaml |
|
||||
| TanStack Query (`@tanstack/react-query`) | 5.104.1 | frontend/package.json, frontend/pnpm-lock.yaml |
|
||||
| Zod | 4.6.5 | frontend/package.json, frontend/pnpm-lock.yaml |
|
||||
| Vite | 8.3.2 | frontend/package.json, frontend/pnpm-lock.yaml |
|
||||
| TypeScript | 7.0.2 (`@typescript/native`, `tsc`); API 6.0.2 (`typescript` как alias `@typescript/typescript6`) для ESLint | frontend/package.json, frontend/pnpm-lock.yaml |
|
||||
| Vitest | 5.0.3 | frontend/package.json, frontend/pnpm-lock.yaml |
|
||||
| Orval | 8.40.0 | frontend/package.json, frontend/pnpm-lock.yaml |
|
||||
| Python | 3.14.8 (`requires-python >=3.14,<3.15`) | ml/.python-version, ml/pyproject.toml |
|
||||
| uv | 0.12.22 | `[tool.uv] required-version` в ml/pyproject.toml; `setup-uv` в .github/workflows/ci.yml |
|
||||
| FastAPI | 0.142.2 | ml/pyproject.toml, ml/uv.lock |
|
||||
| Pydantic | 2.13.5 | ml/pyproject.toml, ml/uv.lock |
|
||||
| uvicorn | 0.54.0 | ml/pyproject.toml, ml/uv.lock |
|
||||
| ogen | v1.24.0 | backend/go.mod (`require` и `tool`) |
|
||||
| sqlc | v1.31.1 | backend/go.mod (`tool`) |
|
||||
| wire (`github.com/goforj/wire`) | v1.2.0 | backend/go.mod (`require` и `tool`) |
|
||||
| mockery | v3.8.0 | backend/go.mod (`tool`) |
|
||||
| golangci-lint | v2.14.0 | backend/go.mod (`tool`) |
|
||||
| goose | v3.28.0 | backend/go.mod (`tool`) |
|
||||
| chi | v5.3.2 | backend/go.mod |
|
||||
| pgx | v5.11.0 | backend/go.mod |
|
||||
| testcontainers-go | v0.44.0, включая modules/postgres | backend/go.mod |
|
||||
|
||||
Что есть сейчас:
|
||||
|
||||
- Маршруты health и readiness. Nginx сам отвечает на `GET /healthz` и проксирует в Go только `/api/` (deploy/nginx/conf.d/app.conf). Go обслуживает `GET /healthz` (`ok`) и `GET /readyz` (`ready` или 503 `not_ready` после проверки PostgreSQL, Redis и SeaweedFS) на внутреннем порту 8080 вне OpenAPI контракта, а также `GET /api/v1/healthz` из api/core/routes/healthz.yml через ogen handler (backend/internal/adapter/primary/http). Метрики Go отдаются на порту 9090 (`METRICS_ADDR`), Prometheus читает `/metrics`. ML обслуживает `GET /healthz`, `GET /readyz` (всегда 503 `not_ready`, потому что модель не подключена) и `/metrics` (ml/src/lincodex_ml, api/ml/routes). deploy/scripts/smoke.sh проверяет `/healthz` Nginx, `/api/v1/healthz`, `/readyz` Go изнутри сети Compose и 404 для неизвестного API маршрута; ML он не запускает.
|
||||
- Адаптеры: PostgreSQL через pgxpool и generated запрос `SELECT 1`, Redis через go-cachekit, SeaweedFS через S3 API. Generated Go client для ML контракта есть, но в bootstrap не подключен.
|
||||
- OpenAPI контракты api/core/ и api/ml/ с объединением схем, bundles, lint и генерацией для Go (ogen), TypeScript (Orval) и Python (datamodel-code-generator). В SPA есть домашняя страница, generated API client и MSW handlers.
|
||||
- Compose проекты: core (`deploy/docker/docker-compose.yml`: PostgreSQL, Redis, SeaweedFS, backend, frontend), ML (`docker-compose.ml.yml`) и monitoring (`docker-compose.monitoring.yml`).
|
||||
- CI jobs в .github/workflows/ci.yml: `api`, `backend`, `integration` (matrix из двух шардов), `frontend`, `ml`, `codegen`, `infrastructure`, `security`, `security-images`, `smoke` и обязательный итог `aggregate`. Шардирование описано в [TESTING.md](TESTING.md).
|
||||
- Observability: Prometheus, Loki, Alloy, Grafana с provisioned datasources и dashboards, exporters для PostgreSQL, Redis и node. React-приложение пока не отправляет телеметрию.
|
||||
|
||||
Еще не реализованы: регистрация и вход, согласия, профили, анкета и тестирование, кабинет компании, потребности и подбор, приглашения и контакты, отправка почты, Kafka/outbox, уведомления, поддержка и бизнес-E2E suite. В backend/db/migrations/ нет бизнес-схемы, каталоги продуктовых usecase и адаптеров содержат только заглушки, а `make -C deploy test-e2e` остается отложенной заглушкой и завершается ошибкой. Целевая архитектура описана в [ARCHITECTURE.md](ARCHITECTURE.md).
|
||||
|
||||
## Установка и цикл работы
|
||||
|
||||
Frontend проверяется компилятором TypeScript 7.0.2 (`tsc`). Пакет `@typescript/native` ссылается на него через npm alias, а `typescript` ссылается на совместимый API `@typescript/typescript6` для ESLint. Это [рекомендованная Microsoft схема совместного использования](https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/#running-side-by-side-with-typescript-6.0): текущий typescript-eslint еще не работает с API TS7. В проверку типов входят исходники, Vite config и `codegen/orval.config.ts`.
|
||||
|
||||
+57
-3
@@ -1,11 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Check project-owned Markdown links, language docs, routes, and imports."""
|
||||
"""Check project-owned Markdown links, language docs, routes, and imports.
|
||||
|
||||
Inside a git work tree, Markdown files that git ignores (for example through
|
||||
.gitignore or .git/info/exclude) are local material and are not checked.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from urllib.parse import unquote, urlsplit
|
||||
@@ -45,7 +50,52 @@ HEADING = re.compile(r"^\s{0,3}#{1,6}\s+(.+?)\s*#*\s*$")
|
||||
HTML_ID = re.compile(r"\bid\s*=\s*['\"]([^'\"]+)['\"]", re.IGNORECASE)
|
||||
|
||||
|
||||
class GitIgnoreError(RuntimeError):
|
||||
"""Raised when git reports a work tree but cannot evaluate ignore rules."""
|
||||
|
||||
|
||||
def inside_git_work_tree(root: Path) -> bool:
|
||||
"""Return True only when git is available and root belongs to a work tree."""
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["git", "-C", str(root), "rev-parse", "--is-inside-work-tree"],
|
||||
capture_output=True,
|
||||
check=False,
|
||||
)
|
||||
except OSError:
|
||||
return False
|
||||
return result.returncode == 0 and result.stdout.strip() == b"true"
|
||||
|
||||
|
||||
def git_ignored(root: Path, paths: list[Path]) -> set[Path]:
|
||||
"""Return the paths that git ignores, using one check-ignore call.
|
||||
|
||||
Tracked files are never reported because check-ignore runs without
|
||||
--no-index, so only local files that git would not track are skipped.
|
||||
"""
|
||||
if not paths or not inside_git_work_tree(root):
|
||||
return set()
|
||||
by_name = {path.relative_to(root).as_posix(): path for path in paths}
|
||||
payload = b"".join(os.fsencode(name) + b"\0" for name in by_name)
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["git", "check-ignore", "--stdin", "-z"],
|
||||
cwd=root,
|
||||
input=payload,
|
||||
capture_output=True,
|
||||
check=False,
|
||||
)
|
||||
except OSError as error:
|
||||
raise GitIgnoreError(f"git check-ignore could not run: {error}") from error
|
||||
# Exit status 1 means that no path is ignored; anything else is a failure.
|
||||
if result.returncode not in (0, 1):
|
||||
message = result.stderr.decode("utf-8", errors="replace").strip()
|
||||
raise GitIgnoreError(f"git check-ignore failed with status {result.returncode}: {message}")
|
||||
return {by_name[os.fsdecode(name)] for name in result.stdout.split(b"\0") if name}
|
||||
|
||||
|
||||
def markdown_files(root: Path) -> list[Path]:
|
||||
root = root.resolve()
|
||||
found: list[Path] = []
|
||||
for current, directories, filenames in os.walk(root):
|
||||
directories[:] = sorted(
|
||||
@@ -57,7 +107,8 @@ def markdown_files(root: Path) -> list[Path]:
|
||||
path = Path(current) / filename
|
||||
if path.suffix.lower() == ".md" and not path.is_symlink():
|
||||
found.append(path.resolve())
|
||||
return sorted(found)
|
||||
ignored = git_ignored(root, found)
|
||||
return sorted(path for path in found if path not in ignored)
|
||||
|
||||
|
||||
def visible_lines(markdown: str) -> list[tuple[int, str]]:
|
||||
@@ -294,7 +345,10 @@ def main() -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--root", type=Path, default=Path(__file__).resolve().parents[1])
|
||||
args = parser.parse_args()
|
||||
errors = validate_repository(args.root)
|
||||
try:
|
||||
errors = validate_repository(args.root)
|
||||
except GitIgnoreError as error:
|
||||
errors = [str(error)]
|
||||
if errors:
|
||||
for error in errors:
|
||||
print(f"ERROR: {error}", file=sys.stderr)
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
|
||||
MODULE_PATH = Path(__file__).with_name("docs-check.py")
|
||||
@@ -13,7 +17,9 @@ DOCS_CHECK = importlib.util.module_from_spec(SPEC)
|
||||
SPEC.loader.exec_module(DOCS_CHECK)
|
||||
|
||||
|
||||
class DocsCheckTests(unittest.TestCase):
|
||||
class RepositoryTestCase(unittest.TestCase):
|
||||
"""Create a minimal valid repository layout in a temporary directory."""
|
||||
|
||||
def setUp(self) -> None:
|
||||
self.temporary = tempfile.TemporaryDirectory()
|
||||
self.root = Path(self.temporary.name)
|
||||
@@ -40,6 +46,8 @@ class DocsCheckTests(unittest.TestCase):
|
||||
path.write_text(content, encoding="utf-8")
|
||||
return path
|
||||
|
||||
|
||||
class DocsCheckTests(RepositoryTestCase):
|
||||
def test_accepts_angle_bracket_path_with_spaces(self) -> None:
|
||||
self.write("README.md", "# Root\n\n[Guide](<guides/guide with spaces.md>)\n")
|
||||
self.write("guides/guide with spaces.md", "# Guide\n")
|
||||
@@ -119,5 +127,62 @@ class DocsCheckTests(unittest.TestCase):
|
||||
self.assertTrue(any("instruction import cycle" in error for error in errors), errors)
|
||||
|
||||
|
||||
@unittest.skipUnless(shutil.which("git"), "git is required for ignore-rule tests")
|
||||
class DocsCheckGitIgnoreTests(RepositoryTestCase):
|
||||
LOCAL_README = "docs/other/notes/README.md"
|
||||
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
# Isolate git from user and system configuration and from any parent repository.
|
||||
environment = mock.patch.dict(
|
||||
os.environ,
|
||||
{
|
||||
"GIT_CONFIG_GLOBAL": os.devnull,
|
||||
"GIT_CONFIG_NOSYSTEM": "1",
|
||||
"GIT_CEILING_DIRECTORIES": str(self.root.resolve().parent),
|
||||
},
|
||||
)
|
||||
environment.start()
|
||||
self.addCleanup(environment.stop)
|
||||
self.write(self.LOCAL_README, "[Missing](missing.md)\n")
|
||||
|
||||
def git(self, *arguments: str) -> None:
|
||||
subprocess.run(["git", *arguments], cwd=self.root, check=True, capture_output=True)
|
||||
|
||||
def local_errors(self) -> list[str]:
|
||||
errors = DOCS_CHECK.validate_repository(self.root)
|
||||
return [error for error in errors if self.LOCAL_README in error]
|
||||
|
||||
def test_skips_markdown_excluded_through_info_exclude(self) -> None:
|
||||
self.git("init", "--quiet")
|
||||
with (self.root / ".git" / "info" / "exclude").open("a", encoding="utf-8") as exclude:
|
||||
exclude.write("/docs/other/\n")
|
||||
self.assertEqual([], DOCS_CHECK.validate_repository(self.root))
|
||||
|
||||
def test_skips_markdown_ignored_through_gitignore(self) -> None:
|
||||
self.git("init", "--quiet")
|
||||
self.write(".gitignore", "/docs/other/\n")
|
||||
self.assertEqual([], DOCS_CHECK.validate_repository(self.root))
|
||||
|
||||
def test_reports_untracked_markdown_that_is_not_ignored(self) -> None:
|
||||
self.git("init", "--quiet")
|
||||
errors = self.local_errors()
|
||||
self.assertTrue(any("broken local link" in error for error in errors), errors)
|
||||
self.assertTrue(any("README is below a top-level directory" in error for error in errors), errors)
|
||||
|
||||
def test_reports_tracked_markdown_that_matches_ignore_rules(self) -> None:
|
||||
self.git("init", "--quiet")
|
||||
self.write(".gitignore", "/docs/other/\n")
|
||||
self.git("add", "--force", self.LOCAL_README)
|
||||
errors = self.local_errors()
|
||||
self.assertTrue(any("broken local link" in error for error in errors), errors)
|
||||
|
||||
def test_reports_markdown_outside_git_work_tree(self) -> None:
|
||||
self.write(".gitignore", "/docs/other/\n")
|
||||
errors = self.local_errors()
|
||||
self.assertTrue(any("broken local link" in error for error in errors), errors)
|
||||
self.assertTrue(any("README is below a top-level directory" in error for error in errors), errors)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -23,7 +23,9 @@ class MergeSchemasTest(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.temporary = tempfile.TemporaryDirectory()
|
||||
self.addCleanup(self.temporary.cleanup)
|
||||
self.contract_root = Path(self.temporary.name) / "api"
|
||||
# merge_contract returns resolved paths; resolve the temporary root too because it
|
||||
# may sit behind a symlink (for example /var -> /private/var on macOS).
|
||||
self.contract_root = Path(self.temporary.name).resolve() / "api"
|
||||
(self.contract_root / "components" / "schemas").mkdir(parents=True)
|
||||
(self.contract_root / "routes").mkdir()
|
||||
|
||||
|
||||
Reference in new issue
Block a user