Problem
ProjectCodeGenerator._generate_python_api emits a FastAPI main.py whose
endpoints are placeholders rather than implementations. Raised by CodeRabbit as
🔴 Critical during review of #1251 (inline comment 3699869929).
|
|
| File |
src/youtube_extension/backend/code_generator.py |
| Symbol |
_generate_python_api, the main_py template |
| Defect |
The /health endpoint returns a hardcoded "2024-01-01T00:00:00Z" timestamp, so a generated service reports a health check that is not a health check. Database and auth endpoints return static shapes with no backing implementation. |
| Consequence |
A generated project looks deployable and passes a naive smoke test while being non-functional. The fixed timestamp in particular defeats liveness monitoring, which is the one thing a /health route exists to support. |
Reachability evidence
Reached in production through the same endpoint as #1250:
POST /api/v1/video-to-software router.py:778 (mounted main.py:192)
-> process_video_to_software video_processing_service.py:317
-> code_generator.generate_project video_processing_service.py:380
-> _generate_python_api (project_type == "api")
Why this was not fixed in #1251
#1250 is a strictly mechanical change: move filesystem calls off the event loop
while keeping generated output byte-for-byte identical, which is proven there
by differential execution. Changing template content would invalidate that proof
and mix a behavioural change into a performance change. The defect predates
#1251 and is untouched by it.
Acceptance criteria
Proposed fix
Replace the literal with datetime.now(timezone.utc).isoformat() evaluated
inside the handler, and audit the remaining template endpoints for the same
class of problem. Decide deliberately whether the generator should emit stub
endpoints at all — omitting them may be more honest than emitting convincing
fakes.
Problem
ProjectCodeGenerator._generate_python_apiemits a FastAPImain.pywhoseendpoints are placeholders rather than implementations. Raised by CodeRabbit as
🔴 Criticalduring review of #1251 (inline comment 3699869929).src/youtube_extension/backend/code_generator.py_generate_python_api, themain_pytemplate/healthendpoint returns a hardcoded"2024-01-01T00:00:00Z"timestamp, so a generated service reports a health check that is not a health check. Database and auth endpoints return static shapes with no backing implementation./healthroute exists to support.Reachability evidence
Reached in production through the same endpoint as #1250:
Why this was not fixed in #1251
#1250 is a strictly mechanical change: move filesystem calls off the event loop
while keeping generated output byte-for-byte identical, which is proven there
by differential execution. Changing template content would invalidate that proof
and mix a behavioural change into a performance change. The defect predates
#1251 and is untouched by it.
Acceptance criteria
/healthreports a real timestamp evaluated at request time, not a literal.omitted or clearly marked as scaffolding in the generated source, so a
consumer cannot mistake them for working behaviour.
/healthpayload is not constant across twocalls separated in time.
Proposed fix
Replace the literal with
datetime.now(timezone.utc).isoformat()evaluatedinside the handler, and audit the remaining template endpoints for the same
class of problem. Decide deliberately whether the generator should emit stub
endpoints at all — omitting them may be more honest than emitting convincing
fakes.