Remove manual tagging
A tag could come from two places: rules.toml, or the TUI's t key, which wrote manual_tag with COALESCE(manual_tag, rule_tag) deciding the winner. That split paid for itself in the first invariant of the codebase, in ClearOverrides and the c key, in the * marker on the tag column, and in the one exception to a disposable index -- a tag set by hand was the only thing in index.db that the statements could not reproduce. Now rules.toml decides every tag. The index is derived entirely from the statements plus that file, so deleting it and re-importing gets back exactly what was there, and retag has nothing to be careful of. Tagging a one-off means writing a narrow rule on screen 4, which previews what the glob catches before it is saved. A manual tag in an existing index is dropped along with the column the first time this build opens it, and those rows read as whatever the rules say, or as untagged. TestManualTagSurvivesRetag guarded the invariant that has just been removed; TestRetagRewritesEveryTag replaces it with the one that took its place, and keeps Retag itself covered. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+3
-10
@@ -39,16 +39,9 @@ type Transaction struct {
|
||||
// transaction, when it reports one. Used to verify the balance chain.
|
||||
BalanceMinor *int64
|
||||
|
||||
RuleTag string
|
||||
ManualTag string
|
||||
}
|
||||
|
||||
// Tag is the effective category: a manual tag always beats a rule tag.
|
||||
func (t Transaction) Tag() string {
|
||||
if t.ManualTag != "" {
|
||||
return t.ManualTag
|
||||
}
|
||||
return t.RuleTag
|
||||
// RuleTag is the category, decided entirely by rules.toml. It is derived
|
||||
// state: `money retag` rewrites it wholesale.
|
||||
RuleTag string
|
||||
}
|
||||
|
||||
// FormatAmount renders the amount using the account's minor-unit scale.
|
||||
|
||||
Reference in New Issue
Block a user