phase: 173_docs_push_creds_split
All gates green. Final report: **Phase 173 — final verification pass (all tasks already complete in `complete/`)** - Verified the full implementation is in the working tree: `docs_user`/`docs_token` settings + catalogue rows (task 01), `docs_repo` PUT 422 guard + `docs_token` write-only pin (task 02), `run_git(env)` + `push_document(user, token)` credential env (task 03), `settings_migrate.py` wired into `create_app()` (task 04), E2E suite (task 05). - **Completion criteria:** 1. GET `/api/admin/settings` lists `docs_user` (plain) + `docs_token` (secret, `value=null`), token never in any body — ✅ `test_docs_token_is_write_only_masked_end_to_end` + E2E sentinel-absent-from-DOM 2. PUT `docs_repo` with `://user:pass@` → 422 naming the fields; clean URL passes — ✅ integration + E2E UI-side 3. Token set → `GIT_CURL_USERNAME`/`GIT_CURL_PASSWORD`/`GIT_TERMINAL_PROMPT=0` on every git step; empty → `env=None` — ✅ mocked-git unit tests 4. Legacy env split once at startup, idempotent, one INFO line, `.env` untouched — ✅ `test_settings_migrate.py` (4 shapes) + `test_docs_push_migrate.py` 5. Full suite green, coverage >90%, lint clean — ✅ 6. E2E isolated: `test_docs_push_creds.py` 4/4; regression set (panel + layout + response_to_docs) 21/21 — ✅ 7. Commit + phase move — harness's job (per instructions, not mine). 8. README/AGENTS consistent — ✅ (below) - Tests/lint: `uv run pytest` exit 0 (4112 passed) · `uv run pytest --cov=app --cov-report=term-missing` TOTAL 99% · `uv run ruff check .` clean · `uv run pyright` 0 errors - Docs: README.md (incl. Docs-push config section, guard/migration paragraph, `.env.example` block) and AGENTS.md verified consistent in full; fixed two stale docstrings in `app/config.py` + `app/core/settings_catalog.py` (`is_set` → the API's actual `has_value` field). - No live-infrastructure changes (no live step in this phase). No next pending phase — `todo/` held only 173.
This commit is contained in:
+14
@@ -52,6 +52,7 @@ from app.core.debugging import configure_debugging
|
||||
from app.core.logging import configure_logging
|
||||
from app.core.response_budget import ResponseBudgetMiddleware
|
||||
from app.core.security_headers import SecurityHeadersMiddleware
|
||||
from app.core.settings_migrate import migrate_legacy_docs_creds
|
||||
from app.core.settings_overlay import enabled as settings_db_enabled
|
||||
from app.core.settings_overlay import load_overrides, register_invalidator
|
||||
|
||||
@@ -118,6 +119,19 @@ def create_app() -> FastAPI:
|
||||
get_settings()
|
||||
logger.info("settings overrides loaded source=env-only disabled")
|
||||
|
||||
# Phase 173 (task 04, C3): the one-time startup migration — a
|
||||
# legacy credentials-bearing ``docs_repo`` (env or DB) is split
|
||||
# into ``app_settings`` rows (clean repo + ``docs_user`` +
|
||||
# ``docs_token``); the DB rows shadow the env, ``.env`` is never
|
||||
# rewritten, a second run is a no-op. Called ONCE, after the DB is
|
||||
# available; a migration hiccup logs a WARNING and never blocks
|
||||
# startup — the app boots with the pre-phase behavior (the
|
||||
# migration is a convenience, not a dependency).
|
||||
try:
|
||||
migrate_legacy_docs_creds()
|
||||
except Exception as exc: # noqa: BLE001 — boot must never block
|
||||
logger.warning("settings migration failed (%s)", type(exc).__name__)
|
||||
|
||||
# Phase 168 (task 03): the settings panel's Save must retune the
|
||||
# running process, and app/core must never import app/api (PLAN §3's
|
||||
# direction) — so create_app(), the composition root, wires the
|
||||
|
||||
Reference in New Issue
Block a user