Remove all ctime usage and storage #55
Reference in New Issue
Block a user
Delete Branch "remove-ctime"
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?
Remove all ctime from the codebase per sneak's decision on PR #48.
Rationale
Changes
internal/database/schema.sql): Removedctimecolumn fromfilestableinternal/database/models.go): RemovedCTimefield fromFilestructinternal/database/files.go): Removed ctime from all INSERT/SELECT queries, ON CONFLICT updates, and scan targets in bothscanFileandscanFileRowshelpers; updatedCreateBatchaccordinglyinternal/snapshot/scanner.go): RemovedCTime: info.ModTime()assignment incheckFileInMemory()CTimefield assignments from 8 test filesARCHITECTURE.mdanddocs/DATAMODEL.mddocker build .passes clean (lint, fmt-check, all tests).closes #54
Review: Remove all ctime usage and storage
ctime removal: ✅ PASS
The ctime removal itself is thorough and correct:
ctimecolumn removed fromfilestable ✅CTimefield removed fromFilestruct ✅Create,GetByPath,GetByID,GetByPathTx,scanFile,scanFileRows,ListModifiedSince,ListByPrefix,ListAll,CreateBatchall clean ✅CTime: info.ModTime()assignment removed fromcheckFileInMemory()✅CTimein any struct literal ✅ARCHITECTURE.mdanddocs/DATAMODEL.mdupdated ✅ctimeorCTime(case-insensitive) ✅docker build .: passes clean (lint, fmt-check, all tests, build) ✅10 values→9 values, placeholder counts adjusted ✅Out-of-scope change: ❌ NEEDS FIX
The PR also silently removes
ON DELETE CASCADEfrom two foreign keys unrelated to ctime:This is a behavioral change that affects data cleanup. Previously, deleting a file from
fileswould cascade-delete itssnapshot_filesjunction rows. Now it won't — orphaned junction rows will accumulate unless the application's orphan cleanup handles this explicitly.This change:
Please revert these two FK changes. If removing cascades is intentional, it deserves its own PR (issue #54 is specifically about ctime) with proper justification and verification that orphan cleanup still works correctly without cascades.
Verdict: REQUEST_CHANGES — the ctime work is perfect, but the unrelated FK cascade removal must be reverted or split out.
Rework complete — restored
ON DELETE CASCADEon two foreign keys ininternal/database/schema.sqlthat were accidentally dropped during the ctime removal:snapshot_files.file_idFK →REFERENCES files(id) ON DELETE CASCADEsnapshot_blobs.blob_idFK →REFERENCES blobs(id) ON DELETE CASCADENo other changes.
docker build .passes clean (lint, fmt-check, all tests, build).Review: PR #55 — Remove all ctime usage and storage (post-rework)
ctime removal: ✅ PASS
ctimecolumn removed fromfilestable ✅CTimefield removed fromFilestruct ✅Create,GetByPath,GetByID,GetByPathTx,scanFile,scanFileRows,ListModifiedSince,ListByPrefix,ListAll,CreateBatchall clean ✅CTime: info.ModTime()assignment removed fromcheckFileInMemory()✅CTimereferences remain ✅ARCHITECTURE.mdanddocs/DATAMODEL.mdupdated ✅grep -riIn 'ctime' --include='*.go' --include='*.sql' --include='*.md'— zero matches ✅ON DELETE CASCADE fix: ✅ PASS
Previous review found two FKs had silently lost
ON DELETE CASCADE:snapshot_files.file_id→REFERENCES files(id) ON DELETE CASCADE✅ restoredsnapshot_blobs.blob_id→REFERENCES blobs(id) ON DELETE CASCADE✅ restoredAll 12 FK declarations in
schema.sqlverified — cascade behavior matches the original schema (cascades on entity ID references, no cascade on content-addressed chunk_hash/blob_hash references).Build: ✅ PASS
docker build .passes clean (lint, fmt-check, all tests, build).Scope: ✅ CLEAN
15 files changed, all scoped to ctime removal + FK restoration. No unrelated changes.
Verdict: PASS — clean, correct, well-scoped. Ready for merge.