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:
@@ -297,6 +297,36 @@ def test_run_git_captures_and_returns_stdout(
|
||||
assert len(calls) == 1
|
||||
|
||||
|
||||
def test_run_git_default_env_is_none_and_reaches_subprocess(
|
||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""Phase 173 (C5 byte-identity pin): the default ``env=None`` is
|
||||
passed through verbatim to ``subprocess.run`` — the pre-phase call
|
||||
shape, so every sync-path invocation is unchanged."""
|
||||
calls = _fake_run(monkeypatch, stdout="ok")
|
||||
|
||||
assert git_sync.run_git(["git", "version"], cwd=tmp_path) == "ok"
|
||||
assert len(calls) == 1
|
||||
assert "env" in calls[0]
|
||||
assert calls[0]["env"] is None
|
||||
|
||||
|
||||
def test_run_git_explicit_env_reaches_subprocess_verbatim(
|
||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""Phase 173 (C2): an explicit env dict reaches ``subprocess.run``
|
||||
verbatim — ``run_git`` neither merges over nor mutates the parent
|
||||
environment (the env-replacement trap is the caller's contract;
|
||||
the docs-push sequence does its own ``os.environ`` merge)."""
|
||||
calls = _fake_run(monkeypatch, stdout="ok")
|
||||
env = {"A": "b"}
|
||||
|
||||
assert git_sync.run_git(["git", "version"], cwd=tmp_path, env=env) == "ok"
|
||||
assert len(calls) == 1
|
||||
assert calls[0]["env"] is env # the SAME object — passed through verbatim
|
||||
assert calls[0]["env"] == {"A": "b"}
|
||||
|
||||
|
||||
# --- phase 135: the branch pin (the argv matrix) ----------------------------
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user