Hygiene sweep: dead code, role-assignment race, cached user lookup, stale files #60
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "chore/hygiene"
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?
Sixth PR of the refactor series (stacked on #59 → #58 → #57 → #56 → #55; merge in order).
Sweeps the LOW-tier review items + two folded issues:
validate_journal_entrydeleted (validated the pre-Fava, pre-string-amount model; never called) with exports, unused crud imports, and its tests.m006adds a UNIQUE index onuser_roles(user_id, role_id)after deduping;assign_user_roleinserts withON CONFLICT DO NOTHINGand returns the existing row — two concurrent logins can no longer double-assign the default role._get_username_from_user_id(fresh LNbitsDatabaseper call in per-row hot paths) moves touser_lookup.pywith one shared core-DB handle, a 60s TTL cache and a batchget_usernamesAPI.*flagformat_receivable_entryactually writes. (Income/expense genuinely are pending; only receivable misreported.)account_utils.ACCOUNT_TYPE_ROOTS(the last hardcoded tuple in fava_client); the no-op per-test rate-limit reset removed from conftest.print()→loggerin tasks.py; stale files deleted (migrations_old.py.bak,MIGRATION_SQUASH_SUMMARY.md,docs/PHASE*_COMPLETE.md, rendered.html);data/gitignored (holds the runtime.lnbits_auth_key);docs/CODE-REVIEW-2026-06.mdnow tracked with statuses updated for this series; CLAUDE.md notes LNbits pins Pydantic v1 (keep.dict()).Non-fix:
format_payment_entry'sis_payabledocstring, flagged in the review follow-up as inverted, is actually consistent with the body — left alone.Still open from the review's LOW tier:
parse_legacy_account_namefragility (internal input only, documented) and theis_active/is_virtualfilter inconsistency.Tests: 177 passed, 3 skipped (5 tests removed with the dead validator).
🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.