Skip to content

Larens94/codedna-challenge-control

CodeDNA Challenge — Control

django__django-13495 · Vanilla Django (no annotations)

This is the control codebase for the CodeDNA Challenge — a real Django bug, ready to fix.

The goal: open this repo in your AI coding agent, paste the prompt below, and see how it navigates. Then compare with the CodeDNA version — same bug, same model, same prompt, but with CodeDNA v0.8 annotations.


The Bug

Trunc() ignores tzinfo param when output_field=DateField()

TruncDay('created_at', output_field=DateField(), tzinfo=tz_kyiv)

generates:
  DATE_TRUNC('day', "storage_transaction"."created_at")

instead of:
  DATE_TRUNC('day', "storage_transaction"."created_at" AT TIME ZONE 'Europe/Kiev')

The timezone conversion is silently ignored.

Prompt to use

Paste this exactly into your agent session:

Bug: Trunc() ignores tzinfo param when output_field=DateField()

I'm trying to use TruncDay() function like this:
  TruncDay('created_at', output_field=DateField(), tzinfo=tz_kyiv)

but for PostgreSQL the SQL generated is:
  (DATE_TRUNC('day', "storage_transaction"."created_at"))

So timezone conversion like AT TIME ZONE 'Europe/Kiev' was totally ignored.

Find the root cause and fix it.

---

Session logging (mandatory):
As you work, continuously append every step to session_log.md in the project root:

## [EXPLORE] <what you opened/searched and why>
## [FOUND] <what you discovered>
## [DECISION] <what you decided to do and why>
## [ACTION] <what you changed and where>
## [VERIFY] <how you checked the fix is correct>

Write each entry immediately when it happens. Do not batch at the end.

Ground Truth

The official Django patch for this bug touches 7 files:

django/db/models/functions/datetime.py
django/db/backends/base/operations.py
django/db/backends/postgresql/operations.py
django/db/backends/mysql/operations.py
django/db/backends/oracle/operations.py
django/db/backends/sqlite3/operations.py
django/db/backends/sqlite3/base.py          ← easy to miss

Score your session: how many of the 7 files did your agent touch?


How to run

git clone https://github.com/Larens94/codedna-challenge-control
cd codedna-challenge-control

# Open in your AI agent
claude    # Claude Code
cursor .  # Cursor
# etc.

# Paste the prompt above

Compare with CodeDNA

Run the same session on the annotated version:

git clone https://github.com/Larens94/codedna-challenge-codedna
cd codedna-challenge-codedna
# same prompt, same model

Reference results

Control CodeDNA
Session time ~10–11 min ~8 min
Files matching official patch 6 / 7 7 / 7
time_trunc_sql fixed
sqlite3/base.py updated
Failed edits 5 0

Model: claude-sonnet-4-6 · Full report: BENCHMARK_RESULTS.md


Share your results

Open an issue or PR in github.com/Larens94/codedna with:

  • Model used
  • Files touched (out of 7)
  • Session time
  • session_log.md

Every data point helps validate the protocol.


Part of CodeDNA v0.8 — an in-source communication protocol for AI coding agents.

About

CodeDNA Challenge — Control: vanilla Django (no annotations). Fix the Trunc() tzinfo bug and score your agent.

Resources

License

BSD-3-Clause, Unknown licenses found

Licenses found

BSD-3-Clause
LICENSE
Unknown
LICENSE.python

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors