Skip to content

pdd generate calls its own functions with wrong arguments #199

@Serhan-Asad

Description

@Serhan-Asad

Summary

When generating a single file, pdd generate defines a function with one signature and then calls it with incompatible arguments later in the same file. This is an internal consistency failure within a single generation unit.

Evidence (from hackathon extension generation in pdd_cloud)

hackathon_compliance.py — wrong args to own function

Function definition (line 217):

def fetch_file_content(owner: str, repo: str, path: str, headers: Dict[str, str]) -> str:
    url = f"{GITHUB_API_URL}/repos/{owner}/{repo}/contents/{path}"
    response = requests.get(url, headers=headers)
    ...

Call site (line 44):

readme_content = fetch_file_content(repo_url, 'README.md', github_token)

3 arguments passed, 4 expected. And the types are wrong:

  • repo_url (full URL) passed as owner (username)
  • 'README.md' passed as repo (repo name)
  • github_token (string) passed as path (file path)
  • headers (dict) not passed at all

Other call sites in the same file (lines 178, 213, 237) call the function correctly with (owner, repo, path, headers). Only the trigger function got it wrong.

Root Cause

PDD likely generated the trigger function (on_submission_created) and the utility functions (fetch_file_content) in separate passes or contexts, and didn't cross-check the function signature when generating the call site.

Expected Behavior

PDD should verify that function calls match the function's signature within the same file. This is a basic consistency check that could catch:

  • Wrong number of arguments
  • Wrong argument order/types
  • Missing required arguments

Impact

Runtime crash: TypeError: fetch_file_content() missing 1 required positional argument: 'headers'

Labels

pdd-bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions