From c300c09495286133b6538c45fdf66ac8560e804b Mon Sep 17 00:00:00 2001 From: Andy <119136210+AndyMik90@users.noreply.github.com> Date: Wed, 7 Jan 2026 10:56:39 +0100 Subject: [PATCH] Revert "Fix Windows UTF-8 encoding errors in spec file reading (#744)" (#770) This reverts commit a01634d54809e9f4f1d6507d5bcbf55fdff68981. --- apps/backend/spec/compaction.py | 2 +- apps/backend/spec/pipeline/agent_runner.py | 2 +- .../validate_pkg/validators/spec_document_validator.py | 7 +------ apps/backend/spec/validation_strategy.py | 10 ++-------- 4 files changed, 5 insertions(+), 16 deletions(-) diff --git a/apps/backend/spec/compaction.py b/apps/backend/spec/compaction.py index 65365d34..d74b377c 100644 --- a/apps/backend/spec/compaction.py +++ b/apps/backend/spec/compaction.py @@ -141,7 +141,7 @@ def gather_phase_outputs(spec_dir: Path, phase_name: str) -> str: file_path = spec_dir / filename if file_path.exists(): try: - content = file_path.read_text(encoding="utf-8") + content = file_path.read_text() # Limit individual file size if len(content) > 10000: content = content[:10000] + "\n\n[... file truncated ...]" diff --git a/apps/backend/spec/pipeline/agent_runner.py b/apps/backend/spec/pipeline/agent_runner.py index b981a150..d1ee2a78 100644 --- a/apps/backend/spec/pipeline/agent_runner.py +++ b/apps/backend/spec/pipeline/agent_runner.py @@ -82,7 +82,7 @@ class AgentRunner: return False, f"Prompt not found: {prompt_path}" # Load prompt - prompt = prompt_path.read_text(encoding="utf-8") + prompt = prompt_path.read_text() debug_detailed( "agent_runner", "Loaded prompt file", diff --git a/apps/backend/spec/validate_pkg/validators/spec_document_validator.py b/apps/backend/spec/validate_pkg/validators/spec_document_validator.py index 92a5f8ad..edf4a991 100644 --- a/apps/backend/spec/validate_pkg/validators/spec_document_validator.py +++ b/apps/backend/spec/validate_pkg/validators/spec_document_validator.py @@ -40,12 +40,7 @@ class SpecDocumentValidator: fixes.append("Create spec.md with required sections") return ValidationResult(False, "spec", errors, warnings, fixes) - try: - content = spec_file.read_text(encoding="utf-8") - except (OSError, UnicodeDecodeError) as e: - errors.append(f"Failed to read spec.md: {e}") - fixes.append("Ensure spec.md is a valid UTF-8 encoded file") - return ValidationResult(False, "spec", errors, warnings, fixes) + content = spec_file.read_text() # Check for required sections for section in SPEC_REQUIRED_SECTIONS: diff --git a/apps/backend/spec/validation_strategy.py b/apps/backend/spec/validation_strategy.py index fe71f8f1..cad467e2 100644 --- a/apps/backend/spec/validation_strategy.py +++ b/apps/backend/spec/validation_strategy.py @@ -171,15 +171,9 @@ def detect_project_type(project_dir: Path) -> str: # Try to detect API framework deps_text = "" if requirements.exists(): - try: - deps_text = requirements.read_text(encoding="utf-8").lower() - except (OSError, UnicodeDecodeError): - pass # Skip if file is unreadable + deps_text = requirements.read_text().lower() if pyproject.exists(): - try: - deps_text += pyproject.read_text(encoding="utf-8").lower() - except (OSError, UnicodeDecodeError): - pass # Skip if file is unreadable + deps_text += pyproject.read_text().lower() if "fastapi" in deps_text or "flask" in deps_text or "django" in deps_text: return "python_api"