diff --git a/server/app/git_adapter.py b/server/app/git_adapter.py index 3c433b7..3e4f323 100644 --- a/server/app/git_adapter.py +++ b/server/app/git_adapter.py @@ -54,6 +54,11 @@ return {"diff": result.stdout} def commit(self, request: CommitRequest) -> dict[str, Any]: + if self.settings.storage_backend == "db": + raise GitAdapterError( + "Write path is not available in database mode yet; use the file backend " + "until Phase 2 of the PostgreSQL migration" + ) validation = validate_repository(self.settings) if validation["status"] != "ok": raise GitAdapterError("Repository validation failed; commit blocked") diff --git a/server/app/pending_changes.py b/server/app/pending_changes.py index 8150398..e52c75a 100644 --- a/server/app/pending_changes.py +++ b/server/app/pending_changes.py @@ -58,6 +58,7 @@ return self._read_file(path) def create(self, request: ProposedChangeRequest) -> dict[str, Any]: + self._require_file_backend() now = datetime.now(UTC).replace(microsecond=0).isoformat().replace("+00:00", "Z") change = PendingChange( id=self._new_id(), @@ -78,6 +79,7 @@ return change.model_dump() def apply(self, change_id: str) -> dict[str, Any]: + self._require_file_backend() change = self.get(change_id) if change["status"] != "pending": raise PendingChangeError("Only pending changes can be applied") @@ -157,6 +159,13 @@ self._write_change(change) return change + def _require_file_backend(self) -> None: + if self.settings.storage_backend == "db": + raise PendingChangeError( + "Write path is not available in database mode yet; use the file backend " + "until Phase 2 of the PostgreSQL migration" + ) + def _new_id(self) -> str: return datetime.now(UTC).strftime("%Y%m%d%H%M%S") + "-" + uuid4().hex[:8]