Generated spec is 542 lines including 7 sections:
- Requirements
- Event Schemas
- Checkpoint File Schema
- Resume Algorithm
- Failure handling
- Acceptance Tests
- Implementation Tasks.It inspects my existing repo, and identified existing logic, then imported my existing functions, and created a checkpoint_manager.py.
The new function adds additional functions like:
- update_started
- update_completed
- update_failed
- install_shutdown_handlers
- restore_shutdown_handlers
- persist_checkpoint
Below points are generated in Implementation Tasks:
3. Implement checkpoint model:
- typed checkpoint structure;
- schema version validation;
- bounds validation for next_url_index.
4. Implement atomic checkpoint writer: <- "atomic"
- write temporary file beside final checkpoint;
- flush and fsync;
- atomic rename;
- preserve old checkpoint on failure.
5. Implement checkpoint loader:
- handle missing file;
- reject malformed JSON;
- reject unsupported schema version;
- reject URL fingerprint mismatch.
I don't fully understand what "atomic checkpoint writer" means, but the LLM understands what it means. The functions are likely to implement "atomic checkpoint writer".
The key takeaway is that tokens generated by human usually not restrict enough. When I thought about "checkpoint", I wasn't thinking of any "atomic" shape of checkpointing. I was using my casual language model to generate first version of implementation first. Then using Spec-Driven-Development model, the generated spec has better understanding of what it is. There could be many mutated forms of real life implementation of "checkpoint", the LLM generated code is mostly restrictive one that I will never know in my whole life experience. The LLM training must have undergone very restrictive learning process that I never experienced.