3.2 KiB
TODO
Note: These todos can wait until all the subcommands have been ported.
HIGH
-
table.odin:74-89 — Hand-rolled JSON output doesn't escape
",\, newlines. Reimplementsjson.marshalwhich is already imported incmd_list.odin. Replace withjson.marshal. -
db.odin:380-383, 405, 446 —
sqlite.bind_textreturn values overwritten but never checked. A failed bind meanssqlite.stepoperates on unbound params. -
config.odin:52-54 —
os.user_home_direrror silently ignored. If it fails,homeis""and all paths become relative (".envr"instead of"~/.envr").
MEDIUM
-
db.odin:29-35 —
make_temp_pathnever callsstrings.builder_destroy. Leaks builder buffer every call. -
db.odin:324-327 — Map iteration (
remote_set) is non-deterministic. Same file can produce different JSON on each backup, causing spurious DB diffs. Sort remotes before storing. -
db.odin:470-473 —
string_to_cstringallocates viastrings.clone_to_cstringand never frees. Called dozens of times across db operations. -
db.odin:470, 462 — Both
string_to_cstringandcstring_to_stringignore allocation errors. A nil cstring gets passed to SQLite (UB). -
db.odin:135, 250 — String interpolation into SQL (
VACUUM INTO '%s',ATTACH DATABASE '%s'). Currently safe because input is controlled, but fragile. -
features.odin:30-41 —
find_binaryusesstrings.joininstead offilepath.join, usesos.statinstead of checking executability, hardcodes:as PATH separator (wrong on Windows). -
cmd_restore.odin:20-30 & cmd_remove.odin:19-29 — Identical path-resolution block copy-pasted.
is_absguard is redundant sincefilepath.absis a no-op on absolute paths. Extract a helper. -
cmd_restore.odin:44 —
os.mkdir_allerror silently discarded. Subsequent write failure will be confusing. -
cmd_edit_config.odin:27 —
$EDITORused as single binary name. Breaks for multi-word values like"code -w". Needsstrings.fields(). -
cmd_list.odin:31-35, 58-61 — Uses a
strings.Builder(never destroyed) for what is justrow.Dir + "/". Alsofilepath.relused wherefilepath.basewould suffice since dir is always the parent.
LOW
-
db.odin:338-341 — Unnecessary
strings.clonebeforefilepath.dir(which already returns a slice into the input). -
db.odin:115 —
json.unmarshal_stringerror not checked. Malformed JSON silently produces empty/partial data. -
db.odin:352-353 —
hex.encodeerror ignored.string(hex_bytes)aliases the byte slice. -
config.odin:51-60 —
envr_dirrecomputes home dir on every call. Could cache. -
main.odin:42-46 — Dynamic array in
fallback_to_gonever deleted. Harmless since process exits.
REFACTOR
-
cmd_list.odin — Non-TTY branch builds
ListEntrystructs and marshals JSON separately. Now thatrender_json_rows(issue 1) accepts anio.Writerand usesjson.marshal, unify both branches to use it. Note: will change JSON keys from"directory"/"path"to"Directory"/"Path". -
Check for prealloc opportunities. i.e.
make([dynamic]string)->make([dynamic]string, 5).