Skip to content

Generated FastAPI project emits placeholder endpoints and a fixed health timestamp #1257

Description

@groupthinking

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

  • /health reports a real timestamp evaluated at request time, not a literal.
  • Endpoints that cannot be genuinely implemented by a generator are either
    omitted or clearly marked as scaffolding in the generated source, so a
    consumer cannot mistake them for working behaviour.
  • A test asserts the generated /health payload is not constant across two
    calls separated in time.

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions