Skip to main content

Debug Generated Code Safely

Evidence status: This procedure was applied while classifying the recorded Java generator/runtime blockers and Rust generated-workspace findings. Repeat it and retain fresh evidence for every new failure.

Problem

A compiler or runtime failure points into generated code, and you need to find the real source without creating a patch that disappears on regeneration.

Diagnostic Workflow

  1. Reproduce the failure from a clean evaluation and generation.
  2. Read the complete Markdown report if one exists.
  3. Identify the first handwritten-to-generated API boundary in the stack.
  4. Open the generated entity/request source and record exact signatures.
  5. Step through or add a debugger breakpoint without editing generated source.
  6. Classify the cause as model, generator/configuration, version alignment, handwritten caller, or runtime/provider behavior.
  7. Fix the responsible input and regenerate.
  8. Confirm the fix survives another clean regeneration.

Useful Evidence

  • model element and generated file path;
  • generator/client and runtime versions;
  • exact generated signature;
  • application call site;
  • query comment and purpose or mutation audit description;
  • provider and framework configuration;
  • first compiler/runtime error;
  • minimal reproducer.

Never Do This

  • Add a guessed method to a generated entity.
  • Remove intent or audit enforcement from generated builders.
  • Patch generated dependencies without aligning the generator/template.
  • Hide a model error with handwritten schema or mapper changes.
  • Report only the last stack-trace line when a Markdown report exists.

References