Repository navigation
Enforce production architecture: src/ layout, AI test markers, type safety - #5
Merged
Merged
Conversation
Co-authored-by: AndrewMichael2020 <63167427+AndrewMichael2020@users.noreply.github.com>
…ints and logging Co-authored-by: AndrewMichael2020 <63167427+AndrewMichael2020@users.noreply.github.com>
Co-authored-by: AndrewMichael2020 <63167427+AndrewMichael2020@users.noreply.github.com>
Co-authored-by: AndrewMichael2020 <63167427+AndrewMichael2020@users.noreply.github.com>
Co-authored-by: AndrewMichael2020 <63167427+AndrewMichael2020@users.noreply.github.com>
Co-authored-by: AndrewMichael2020 <63167427+AndrewMichael2020@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor codebase for production readiness and GCP deployment
Enforce production architecture: src/ layout, AI test markers, type safety
Feb 1, 2026
AndrewMichael2020
marked this pull request as ready for review
February 1, 2026 22:15
AndrewMichael2020
deleted the
copilot/refactor-codebase-for-production
branch
February 2, 2026 05:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Educational code prototype lacks production rigor: flat namespace, no dependency locking, print-based debugging, untested AI paths blocking CI.
Architecture
Enforced src/ layout to prevent import collisions and treat codebase as installable package rather than script collection:
Config decoupling via
src/config.py- environment variables loaded once, no hardcoded values scattered across files.Eliminated code duplication -
inject_corruptionimported from single source instead of 70-line duplicate inapp.py.Testing Strategy
pytest.ini with AI markers separates fast deterministic tests from slow LLM-dependent tests:
CI runs in ~2s (7 tests), local verification runs full suite (8 tests). Expanded coverage: 4→8 tests including
apply_plan,summarize_quality, edge cases.Makefile standardizes operations:
make test(CI-safe),make test-all(includes AI),make setup,make run.Defensive Coding
Type hints on all function signatures -
Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame],Dict[str, Any],Optional[str]throughout.Structured logging replaces print statements:
Error handling with context around all external API calls (OpenAI, Gemma):
Fixed OpenAI SDK calls - corrected to
chat.completions.create()withmessagesandresponse_format(was incorrectly using non-existentresponses.create()withinputandtext).Reproducibility
Pinned dependencies -
duckdb==1.4.4,pandas==2.2.3, etc. (wasduckdb>=1.1.0,openai>=1.0.0).Dockerfile updated to copy
src/directory for Cloud Run deployment compatibility..env.example documents required environment variables (OPENAI_API_KEY, GCP configs).
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.