Address review feedback: Design world chunk data format and persistence schema #11
Reference in New Issue
Block a user
Delete Branch "agent/c92c939b819c"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Auto-opened by architect for task
c92c939b819c.Dashboard: http://cloudbison:7070/task/c92c939b819c
Reviewer requested changes on PR #3 for this task.
Feedback:
Review: Design world chunk data format and persistence schema
This is a well-structured, comprehensive spec document. The chunk format, SQLite schema, and API are clearly specified with good design rationale. Here are the issues I found:
Issues requiring changes:
revisionstable claims rollback support but doesn't store payload (§4.7): The doc says revisions "Enables rollback, auditing, and replication of changes," but the table only storeschecksum, not the actual chunk payload. To actually roll back a chunk, you need the previous payload bytes. Either:payload BLOBcolumn (orpayload_refpointing to a separate payload table), orcontent_flagsNULL uniqueness gap (§4.6): The table usesPRIMARY KEY (chunk_key, object_id)withobject_id TEXT(nullable for chunk-level flags). In SQLite, composite PK columns allow NULL, but NULL values aren't unique-constrained — meaning you could accidentally insert multiple rows with the samechunk_keyandobject_id = NULL. Consider using a sentinel value like''(empty string) instead of NULL for chunk-level flags, or add a UNIQUE constraint onchunk_keyfor chunk-level rows.Minor observations (not blocking):
dirtycolumn recovery path undocumented (§4.4, §5.5): The write-behind model describes an in-memory dirty set, but thedirtycolumn in the DB is only useful for recovery after an unclean shutdown. The doc doesn't explain the recovery path (e.g., on startup, scan fordirty=1chunks and re-flush them).revisionsON DELETE CASCADE loses audit trail (§4.7): For an audit log, cascading deletes on chunk deletion means you lose historical data when a chunk is deleted. ConsiderON DELETE SET NULLor making revisions independent of chunk lifecycle.chunk_objectssync mechanism unspecified: The doc says this derived index is "kept in sync by the write path" but doesn't specify how (trigger? explicit write path? periodic rebuild?). Minor implementation detail.Example checksum is SHA-256 of "test": The JSON example shows
9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08which is the SHA-256 of the string "test", not of the example JSON. Cosmetic.Positive notes:
chunk_objectsindex for queryabilityPlease address issues 1 and 2, then I'll approve.
PR: daddy/agp-game#3
Branch: agent/a6930697b17d
Original task description:
Define the chunk data format (JSON/binary), the SQLite schema for persistent world state, and the API for reading/writing chunks. Write spec to docs/architecture/world.md.