infrastructure/server_debteliminator.md

105 KiB
Raw Blame History

Debt Eliminator / CutTheCard — Personal Debt Tracking Service

Device Type: Docker application hosted on NAS16
Host: NAS16 (192.168.150.40)
VLAN: 50 --- Lab / Servers
Documentation Updated: 2026-10-11

2026-10-11 (later) update: Home Page Swap built against the v2.1.21 QA backup (debteliminator-v2_1_21-backup-2026-10-11_15-59-10) - the new "Start Here" page now lives at /; see §0e. Package home-page-swap-v2.1.22.tar.gz was delivered but its QA deployment had not been confirmed at the time of writing. v2.1.21's own contents were not itemized. §3a is a standing rule: every delivery of files must open with the SCP / cp / restart commands.

2026-10-11 update: reconciled against the QA backup debteliminator-v2_1_20-backup-2026-10-10_23-51-34.tar.gz (DevLog v2.1.20, MANIFEST "Site Version v2.1.20"). Scope note: this archive is a QA backup (project source /Kingdezignsnas16/debteliminator-qa), not the usual Production-only backup, so Production's compose file and database were not inspected this round. Features added since v2.1.7 are documented at summary level from the code's own module docstrings and DevLog task titles (§0d, §12i-12j) - not line-by-line. The sidebar navigation was regrouped (§8b).

2026-09-30 update: reconciled against the 2026-09-30 production backup debteliminator-v2.1.3-backup-2026-09-30_08-47-16.tar.gz (DevLog v2.1.3) plus the work designed/built in the following sessions (Blog Engine, blog scheduling, subscription admin tiles, unified Revenue ledger/page). See §0b for what changed. Honest scope note: the SitePay (subscriptions) and Email Campaign modules were first seen in this backup; §0b records what their source states (module docstrings, endpoints, file names) but they have not been reconciled line-by-line the way §1–§29 were for v2.0.19 — treat those two areas as summary-level until a dedicated pass is done.

Earlier source note (2026-09-15): This document was reconciled against the 2026-09-15 production backup debteliminator-v2.0.19-backup-2026-09-15_00-00-01.tar.gz, the production PostgreSQL dump contained in that archive, and the prior KingDezigns project documentation (last reconciled at DevLog v2.0.3 / app source v1.9.5 on 2026-09-03).

This update covers a large amount of new ground — the app has grown from a pure debt-tracking tool into a small public-facing product (CutTheCard.net) with donations, a support desk, SEO/educational content, and account self-service. See §0 for a fast summary of what changed since the last reconciliation.

Version distinction still applies and has drifted further: the backup filename is now v2.0.19 (latest deployed DevLog version). The application source (main.py) now reports 1.10.1. The frontend shared-asset cache marker is no longer a single consistent value — see §25 for detail. Treat these as three independent identifiers, per the existing project convention.


0. What Changed Since the Last Reconciliation (v2.0.3 → v2.0.19)

This is the highest-level summary; full detail is in the sections below.

  • Public rebrand to CutTheCard.net is now complete — confirmed, not just observed, and covers both environments. Production PUBLIC_BASE_URL is https://www.cutthecard.net; QA moved to https://debt.qa.cutthecard.net. The user has confirmed NPM on HAS and Dreamhost DNS were both updated, for both hostnames. cutthecard.org redirects to cutthecard.net at Dreamhost only (not in NPM). debt.kingdezigns.com and debt.qa.kingdezigns.com are now deprecated hostnames. See §2a and the reminder tracker in §0a — there are still stray debt.kingdezigns.com references to clean up in this doc set and in the app's own generated text.
  • Stripe donations (one-time and recurring/subscription), with full structured donation records, donor tracking on the User model, an anonymous public donate page, and an admin Donations log. (§12a)
  • Support / Contact request form, public-facing, with a 48-hour SLA, admin request queue, and automatic confirmation emails. (§12b)
  • Self-service account suspension and deletion — distinct from admin-managed disable/delete. (§17a)
  • Privacy Statement as a second, independently-versioned legal document alongside Terms of Use, plus a new Affiliate Disclosure view-only legal document (affiliate links themselves are not live yet — see §12c). (§17b)
  • Records Archive — downloadable year-end .xlsx/.docx exports, grouped by account type and paid-off/delinquent status. (§13a)
  • SEO foundation + a public "Learning Center" of six educational articles, robots.txt/sitemap.xml, and an about/contact/donate page set that's intentionally open to search crawlers while the app itself stays gated. (§12d)
  • Dark/light theme, per-user with an admin-set site default. (§8a)
  • Dev Log gained assignment/due-date/on-hold fields with a weekly overdue-item email digest, a permanent deployment history table (separate from the single-generation file backup), and a default-collapsed "last 5 releases" view. (§20)
  • Application source version bumped 1.9.5 → 1.10.1; DevLog deployed version v2.0.3 → v2.0.19 (17 releases).
  • Known issue is still open: APP_SECRET_KEY is still not set in the Production compose file. This is now more urgent — see §26.
  • New finding: live Stripe secret keys are stored in plaintext in the Production compose file, alongside the same issue. See §26.

0a. ⏰ Standing Reminders — Open Follow-Up Items

Instructions for whoever (or whichever AI) reads this file next: the two items below are open, user-acknowledged action items, not just observations. Re-surface them to the user under the stated cadence until each is marked resolved or explicitly abandoned. Once an item is resolved, delete its entry from this table (and, for the domain item, strike the now-irrelevant reference-scrubbing note from §2a/§26 — it won't be relevant any longer).

Item First flagged Remind Status
APP_SECRET_KEY unset in Production + live Stripe keys sitting in plaintext in debteliminator.yml. User has acknowledged this and said "we will circle back to this." Re-remind every ~5 days (or the next time this file is read, if more than 5 days have passed) until fixed or explicitly abandoned. See §26 for the full recommendation. 2026-09-15 Every 5 days 🔴 Open — still unset as of the v2.1.3 backup (2026-09-30); also absent from the QA compose file in the v2.1.20 backup (2026-10-10); Production not re-checked. 26 days since first flagged (2026-10-11) - overdue for a reminder
Stray debt.kingdezigns.com / debt.qa.kingdezigns.com references need to be scrubbed and replaced with cutthecard.net / debt.qa.cutthecard.net — both in this documentation set (now mostly done in this pass, see §2a) and in the application's own generated text (routers/devlog.py's two hardcoded manual-recovery strings still reference the old Production hostname). Remind until confirmed fully clean, then remove this row and the related callouts in §2a/§26. 2026-09-30 update: the v2.1.3 source no longer contains either old hostname in routers/devlog.py (verified by search; the only remaining kingdezigns.com string in app code is the legitimate Fund Tracker link in main.py). The remaining mentions in this doc set are intentional "deprecated" notes. Awaiting the user's confirmation that the doc set/NPM are clean, then delete this row. 2026-09-15 Until user confirms 🟡 Code clean — awaiting confirmation

0b. What Changed Since 2026-09-15 (→ v2.1.3, 2026-09-30)

Built in these sessions (fully documented below):

  • Blog Engine with revisions, archive, preview and scheduling — §12f.
  • Unified revenue ledger (donations.payment_kind), Subscriptions admin summary tiles + per-user monthly/yearly amounts + year selector, Sync Payments from Stripe, and a combined Admin → Revenue page — §12g.
  • Admin sidebar gained Blog and Revenue links.

Present in the v2.1.3 backup, summary-level only (not yet reconciled):

  • SitePay / subscriptions — routers/subscribe.py (real paid subscription Checkout + Stripe Customer Portal: GET /subscribe/status, POST /subscribe/create-checkout-session, POST /subscribe/portal-session), subscription_reconcile.py (daily Stripe reconciliation + trial-ending emails), User.access_status computed property, static/subscribe.html, static/billing-locked.html (lockout page), admin GET /admin/billing/subscriptions, reconciliation/migration endpoints (POST /admin/billing/reconcile-subscriptions, /send-trial-ending-soon-emails, /migrate-onetime-donors) and trial / price / launch-date / enforcement settings on Admin → Subscriptions. Plan and intent: debteliminator_subscription_model.md.
  • Email Campaigns — routers/campaigns.py (admin; throttled, per-recipient background sends, default 30 s apart, suppressed in QA, /test-send for QA), routers/email_prefs.py (per-user preferences + no-login one-click unsubscribe), email_templates.py, static/admin/campaigns.html.
  • DevLog production version is v2.1.3 (was v2.0.19).

Version identifiers (unchanged convention): DevLog deployment v2.1.3; application source string still reads 1.10.1 in main.py (not bumped despite the added modules) and the startup log line still says "Starting CutTheCard v1.9.2"; frontend cache marker has moved to ?v=1.8.5 on the pages touched in these sessions — re-verify all pages share one marker at the next shared.css/shared.js change (§4.3/§25).


0c. What Changed Since 2026-09-30 (→ v2.1.7 backup, 2026-10-01; analytics added 2026-10-02)

  • The 2026-10-01 backup (debteliminator-v2.1.7-backup-2026-10-01_16-35-01.tar.gz) reports DevLog v2.1.7. Versions v2.1.4 – v2.1.7 were deployed between 2026-09-30 and 2026-10-01; their contents are not itemized in this document (sections above were last reconciled at v2.1.3, and the DevLog task titles for 2.1.4–2.1.7 were not reviewed). Reconcile when convenient.
  • New: site-wide script loader + Umami analytics (§12h). Changes are one edit to routers/blog.py (_page() shell), two new static files, and one loader tag added to 21 static pages. No new Python dependencies, no compose changes, no new tables, no application version bump.
  • In flight (not documented here): an external demo of the Debt Reduction Plan flow was being built in QA at the same time. Any new demo pages need the loader tag if they should be tracked.

0d. What Changed Since 2026-10-02 (-> v2.1.20, 2026-10-10)

DevLog versions v2.1.8 - v2.1.20 shipped between 2026-10-02 and 2026-10-10 (titles below are from the DevLog task table in the QA database dump). Application source string in main.py is still 1.10.1 and the startup log still says "Starting CutTheCard v1.9.2" (neither bumped).

DevLog Deployed Task
2.1.4 2026-09-30 Integrated Blog Engine; HTML Builder; blog links on login/nav
2.1.5 2026-09-30 Combined donation + subscription modeling (revenue ledger, §12g)
2.1.6 2026-09-30 Role Playing - Admin Roles v2 (routers/roles.py, roles/user_roles tables)
2.1.7 2026-10-01 UI: Developer drop-down in DevLog project form
2.1.8 2026-10-01 Demo Calculator - public /debt-payoff-calculator (§12i)
2.1.9 2026-10-02 Umami analytics loader (§12h)
2.1.10 2026-10-04 Debt Reduction Plan - fine tuning #1
2.1.11 2026-10-05 Triggering Balance Transfers
2.1.12 2026-10-06 Milestones and Progress Dashboard (§12i)
2.1.13 2026-10-06 Bug: monthly interest on the Accounts page
2.1.14 2026-10-06 Windfall Allocator (§12i)
2.1.15 2026-10-10 CSV / Statement Import (§12i) (+ a no-version bug fix)
2.1.16 2026-10-09 ADA / WCAG 2.2 AA accessibility layer - see accessibility_standards.md
2.1.17 2026-10-10 Due-Date and Promo-Expiry Reminders (§12i)
2.1.18 2026-10-10 Credit Utilization Tracker (§12i)
2.1.19 2026-10-10 Budget-to-Payoff Cash Flow (§12i)
2.1.20 2026-10-11 Household Sharing (§12j)

Also in this window (not DevLog versions): blog auto-archive / rotating archive picks (blog_rotation.py, §12i) and the sidebar navigation Phase 1 regroup (§8b - front-end only, built after the v2.1.19 backup; the DevLog queue item "Nav grouping" is still pending in the QA database dump, i.e. the work had not been logged/promoted yet).

Dates caveat: the v2.1.15 / v2.1.16 deploy timestamps in the raw table are not monotonic with their version numbers (v2.1.15 shows 2026-10-10 after v2.1.16's 2026-10-09). Recorded as found.

Operational facts from the QA compose file (values never recorded): APP_SECRET_KEY is not set in the QA compose file either; the QA compose file now contains a STRIPE_SECRET_KEY entry (earlier docs said only Production had Stripe configured - see debteliminator_subscription_model.md Phase 1). Whether those are test-mode keys was not checked.


0e. Home Page Swap - "Start Here" at / (built 2026-10-11, package v2.1.22)

What changed

  • The old About page is now the site home page, titled Start Here, served at https://www.cutthecard.net/ (also answers at /index.html; canonical is /). Source: public_pages/home.html, served by new routers/home.py (same pattern as the public calculator page; __BASE_URL__ / __ROBOTS__ placeholders; Cache-Control: no-cache). QA renders noindex, nofollow; Production index, follow.
  • GET / no longer redirects to /dashboard/ (the root() redirect was removed from main.py).
  • The Accounts page is unchanged at /dashboard/index.html (/dashboard/).
  • /dashboard/about.html is a 301 -> / (query string preserved, e.g. ?suspended=1), registered before the /dashboard static mount so it wins even if a stale static/about.html remains on disk. static/about.html was deleted from QA; Production keeps an orphan copy after the file-copy deploy (harmless, the route takes precedence; clean up whenever convenient).
  • Login landing: deDoLogin() in shared.js sends the user to / after sign-in when they signed in from an entry page (/, /index.html, /dashboard/, /dashboard/index.html, no query string); on any other page (deep links) it reloads in place so the destination is kept. Logout now goes to /.
  • Nav: logo click -> /; sidebar footer link renamed About CutTheCard -> Start Here (/); onboarding-modal text updated; DE_ACCESS_ALWAYS_ALLOWED now lists / (so expired/locked users can still reach Start Here); suspended-account redirect is /?suspended=1.
  • Page layout/copy: hero cut to one heading ("Start here: your debt-free date in 3 steps") plus a one-line summary (hero logo and tagline removed; the sidebar already shows the logo); "3 Simple Steps" moved above "How CutTheCard Helps You Win" (steps + CTA are fully above the fold at 1280x720); feature headings un-numbered so they don't clash with the numbered steps; section labels are real <h2>, feature headings <h3>, emoji icons aria-hidden. CTA button: "Go to Accounts".
  • Links: every "About" link in the blog shell (routers/blog.py), Learning Center, calculator and accessibility pages now points at /.
  • SEO: sitemap.xml lists / (priority 1.0) instead of /dashboard/ and about.html; robots.txt allows /$ and /index.html instead of about.html; the Accounts page's canonical now points at / (signed-out visitors see the same login screen at both URLs).
  • Cache marker: shared.js changed, so shared.css/shared.js moved ?v=1.9.5 -> ?v=1.9.6 on every app/public static page, including household.html, which was found still on 1.9.4. blog.py and public_pages/debt-payoff-calculator.html still reference shared.css?v=1.9.2 (no sidebar; unify at the next shared.* change).
  • Files touched: new routers/home.py, public_pages/home.html; changed main.py, seo_router.py, shared.js, routers/blog.py, public_pages/debt-payoff-calculator.html, static/index.html, accessibility/learn pages and all pages carrying the cache marker; deleted static/about.html. No new dependencies, tables or compose changes -> restart-only deploy.

Verified in a headless Chromium test (not on the live QA site): / 200, /index.html 200, /dashboard/about.html?suspended=1 301 -> /?suspended=1, QA vs Production robots meta, signed-in dark/light/mobile and signed-out rendering. Not run: a11y_audit.py, the manual keyboard / screen-reader pass (see accessibility_standards.md §4).


1. Role & Purpose

Debt Eliminator (branded as CutTheCard, now primarily presented at https://www.cutthecard.net) is a self-hosted, per-user debt tracking application for credit cards, auto loans, personal loans, student loans, mortgages, medical debt, and other liabilities. It has grown beyond an internal tool into a small public product with its own donation/support/SEO surface, while remaining hosted on KingDezigns infrastructure.

The application provides:

  • Current debt balances, minimum/current payment tracking, due-day tracking
  • Per-account payment/transaction history
  • Charge-level interest rates and promotional APR tracking
  • Debt-avalanche and snowball payoff projections; estimated debt-free date
  • 0% Balance Transfer opportunity evaluation with promo balance protection
  • Encrypted account-number storage
  • User self-service account management, including self-suspend and self-delete (new — §17a)
  • Administrator account/security management
  • Versioned Terms of Use, Privacy Statement, and Affiliate Disclosure (new — §17b)
  • Security/audit logging
  • A year-at-a-glance Payment Register
  • A Records Archive downloadable year-end export (new — §13a)
  • A Debt Reduction Plan page
  • Stripe-powered donations, one-time and recurring (new — §12a)
  • A public Support/Contact request form (new — §12b)
  • A public SEO/Learning Center content section (new — §12d)
  • Dark/light theme (new — §8a)
  • A QA → Production Dev Log and automated deployment pipeline, now with assignment/due-date tracking and permanent deployment history (§20)

Debt Eliminator does not execute payments. Payments, charges, fees, refunds, and balance corrections are entered manually and become ledger transactions.


2. Deployment / Environment Architecture

Unchanged at the infrastructure level — Production and QA remain independent environments on NAS16.

Item Production QA
Public URL https://www.cutthecard.net/ https://debt.qa.cutthecard.net/
Internal URL http://192.168.150.40:8002/dashboard/ http://192.168.150.40:8003/dashboard/
API container debteliminator_api debteliminator_qa_api
PostgreSQL container debteliminator_db debteliminator_qa_db
Host port 8002 8003
App port inside container 8000 8000
App source /Kingdezignsnas16/debteliminator/api/ /Kingdezignsnas16/debteliminator-qa/api/
PostgreSQL data /opt/debteliminator/pgdata /opt/debteliminator_qa/pgdata
APP_ENV production qa
Email/scheduled behavior Enabled Suppressed
QA banner No Amber QA banner
Automated deploy pipeline Not available Available (see §20)

2a. Public domains — CONFIRMED: both Production and QA moved to cutthecard.net (2026-09-15)

As of this backup, the Production compose file sets:

PUBLIC_BASE_URL=https://www.cutthecard.net

Confirmed with the user (2026-09-15): this is a deliberate, completed rebrand covering both environments, not just an in-progress application-side change to Production.

  • Production: NPM on HAS has been updated — the proxy host for this service now serves cutthecard.net (and www.cutthecard.net) directly, not debt.kingdezigns.com.
  • QA: NPM has likewise been updated — the QA proxy host now serves debt.qa.cutthecard.net, not debt.qa.kingdezigns.com.
  • Dreamhost DNS has been updated to point both cutthecard.net and debt.qa.cutthecard.net at the KingDezigns network.
  • cutthecard.org still exists but is not configured in NPM — it 302-redirects to cutthecard.net entirely at the Dreamhost DNS/domain level, before traffic ever reaches the KingDezigns network.
  • Both debt.kingdezigns.com (Production) and debt.qa.kingdezigns.com (QA) are now deprecated old hostnames. Every remaining reference to either in this documentation set (and in the application's own generated text — see below) needs to be scrubbed and replaced with the corresponding cutthecard.net hostname.

Every outward-facing piece of the application already agrees with the new Production domain:

  • All password-reset/support/donation-confirmation email links are built from PUBLIC_BASE_URL.
  • robots.txt/sitemap.xml default to https://cutthecard.net if the env var is ever unset.
  • Canonical/Open Graph tags on about.html and other public pages hard-code cutthecard.net.
  • Support inbox and no-reply addresses are support@cutthecard.net / noreply@cutthecard.net.
  • No occurrence of kingdezigns.com remains in any static HTML page.

(QA's own PUBLIC_BASE_URL — presumably https://debt.qa.cutthecard.net — is not visible in this backup, since this archive is Production-only per §22. Worth a quick confirmation the next time QA's compose file is touched, so QA's password-reset/email links agree with the new QA hostname too.)

One inconsistency found — still needs a code fix: routers/devlog.py still generates manual-recovery/verification instructions referencing https://debt.kingdezigns.com in two places. This is cosmetic (it only affects text shown to an admin during a manual deployment fallback) but is now confirmed stale, not just possibly stale. See the reminder tracker in §0a.

Traffic path (internal architecture unchanged):

Internet
   ↓
UCG Max
   ↓
Nginx Proxy Manager on HAS (192.168.150.30)
   ├── cutthecard.net / www.cutthecard.net       → 192.168.150.40:8002 (Production)
   └── debt.qa.cutthecard.net                    → 192.168.150.40:8003 (QA)
   ↓
NAS16
   ├── :8002 → Debt Eliminator Production API
   └── :8003 → Debt Eliminator QA API

cutthecard.org → cutthecard.net redirect happens entirely at Dreamhost, upstream of NPM — it never appears in NPM's proxy host list and has no KingDezigns-side configuration to document.

Site Branding & Alternate Domains

The application is branded CutTheCard (FastAPI title and all page <title> elements). Current (2026-09-15) domain relationship: cutthecard.net (and www.cutthecard.net) is the primary, NPM-proxied Production hostname; debt.qa.cutthecard.net is the equivalent for QA. cutthecard.org 302-redirects to cutthecard.net at the Dreamhost DNS level only — not in NPM. Both debt.kingdezigns.com and debt.qa.kingdezigns.com are deprecated and should be scrubbed from documentation and from the application's own generated text (see §0a). Internal documentation continues to use "Debt Eliminator" as the service name for infrastructure purposes.


3. Deployment Policy — QA First, Then Automated Pipeline to Production

3a-0. ⚠️ STANDING RULE — every delivery starts with the deploy commands (mandatory)

Whenever Claude (or any AI) hands over files for this project — a tarball, a patch, a single file — the reply must open with the SCP / cp / restart command block, before any explanation of what changed. Not "at the end", not "on request", not only the first time. At minimum:

# 1. On KingDezigns001 (file already downloaded to ~/Downloads)
scp ~/Downloads/<package>.tar.gz rufusking@192.168.150.40:deploys/

# 2. On NAS16 - unpack, copy into QA, restart
ssh rufusking@192.168.150.40
cd ~/deploys && rm -rf <name> && mkdir <name> && tar -xzf <package>.tar.gz -C <name>
sudo cp -r ~/deploys/<name>/api/app/. /Kingdezignsnas16/debteliminator-qa/api/app/
sudo rm <any file the package deletes, full QA path>      # only if the package deletes files
sudo docker restart debteliminator_qa_api

# 3. Verify
sleep 5 && sudo docker logs debteliminator_qa_api --tail 15
curl -sI http://192.168.150.40:8003/ | head -1

Rules for the block:

  • Stage in ~/deploys/, never /tmp (NAS16: /home/rufusking/deploys/, auto-cleaned after 14 days by /etc/tmpfiles.d/deploys.conf: d /home/rufusking/deploys 0755 rufusking rufusking 14d). Never delete anything in /tmp/systemd-private-* or /tmp/bg* - they belong to running services (monit, rsyslog, OMV); removing monit's breaks omv-salt Apply with 226/NAMESPACE until sudo systemctl restart monit. Permanent backups go in ~/backups/, not ~/deploys/.
  • Use the real file name and real QA paths (project /Kingdezignsnas16/debteliminator-qa/, container debteliminator_qa_api, port 8003), never placeholders in a live reply.
  • State explicitly whether the change is restart-only or needs a rebuild (requirements.txt, Dockerfile or compose changes → docker compose build / up -d --force-recreate, never plain docker restart), and give that command when a rebuild is needed.
  • List any files the package deletes as sudo rm lines (the copy never removes anything).
  • The project directory is root-only: always sudo cp / sudo rm, never plain cp or cd into it.
  • Add curl/log checks specific to the change. After QA passes, promotion to Production is the Dev Log Deploy to Prod pipeline (below), not a manual copy, unless the pipeline is being bypassed.
  • Give the whole sequence in one block (not one command per message) — see claude_token_efficiency_tips.md.
  • Do this even when the user does not ask, even for a one-file change, and again on every follow-up revision of the package.

Unchanged in mechanism from the prior reconciliation — see the original automated pipeline description (preview → confirm → execute via deploy_engine.py, plan_token binding, orphaned_in_prod reporting, one-generation-deep backup/api/ snapshot) — all confirmed still accurate against this backup's deploy_engine.py and devlog.py.

What's new in the Dev Log itself (v2.3.0, deployed as part of the v2.0.x train — see §20):

  • Queue items can now be assigned to a developer (assigned_to, free text), given a due date, and put on hold.
  • A background thread fires a weekly overdue-item digest email (checks every 7 days regardless of APP_ENV; QA suppression is bypassed intentionally via force=True since this is an operational admin email, not a QA-suppressed feature email). An item is skipped if it's unassigned, on hold, not yet due, or was already alerted on in the last 7 days.
  • A new permanent deployment history table (deployment_records) separate from the single-generation backup/api/ file snapshot — see §20a.
  • The Dev Log page now defaults to showing only the 5 most recent releases (and the 5 most recent entries in the Deployed section), with a toggle to reveal the rest — a UI change to stop the page from scrolling indefinitely as release history grows.

Manual fallback deployment steps are unchanged from prior documentation.


4. Versioning — Three Identifiers Must Be Kept Separate

4.1 DevLog deployment version

The 2026-09-15 backup's production database reports the latest deployed DevLog version as v2.0.19. Archive filename:

debteliminator-v2.0.19-backup-2026-09-15_00-00-01.tar.gz

17 DevLog releases were deployed between the last reconciliation (v2.0.3) and this one (v2.0.19) — see §27 for the full changelog.

4.2 Application version

api/app/main.py reports:

version="1.10.1"

up from 1.9.5 at the last reconciliation.

Inconsistency found: the startup log line in main.py still reads "Starting CutTheCard v1.9.2" — a stale hardcoded string, out of sync with both the FastAPI version= field (1.10.1) and reality. Cosmetic only (log output), but worth a one-line fix.

4.3 Frontend cache-busting marker

No longer a single value. As of this backup:

Marker Pages
?v=1.8.4 about.html, donate.html, donate-public.html, payoff-strategy.html
?v=1.8.3 index.html, account.html, contact.html, donate-cancel.html, donate-success.html, help.html, records-archive.html, register.html, and all six learn/*.html pages

This is a drift from the project's own documented Cache-Busting Rule (§25), which requires every page referencing shared.css/shared.js to be bumped together. It's not currently causing a functional bug (all pages point at the same physical files, just different cache-busting query strings), but it means a browser that cached shared.css under one marker won't necessarily get a fresh copy when navigating to a page still on the other marker, if a real style change landed in between. Recommend reconciling both groups to the same marker on the next shared.css/shared.js change.

Documentation rule (unchanged)

DevLog deployment v2.0.19 — application source version 1.10.1


5. Environment Credentials

Do not treat this document as a place to record real values. The current Production compose file (debteliminator.yml) was inspected as part of this backup and confirmed to still follow the same PostgreSQL/ SMTP credential pattern documented previously (do not change without a deliberate rotation). It now also contains a live Stripe secret key, publishable key, and webhook signing secret in plaintext — see §26, which is a new and more serious version of the pre-existing "credentials sitting in an unencrypted compose file" pattern.

Production PostgreSQL / SMTP

Unchanged in structure from prior documentation — see Vaultwarden for actual values. Do not add real values here.

Stripe (new — v1.10.0)

Three new environment variables were added to the Production api service, consumed by config.py:

STRIPE_SECRET_KEY=<redacted — live secret key, see §26>
STRIPE_PUBLISHABLE_KEY=<redacted — live publishable key>
STRIPE_WEBHOOK_SECRET=<redacted — live webhook signing secret>

STRIPE_SECRET_KEY gates STRIPE_CONFIGURED; without it the donate endpoints return 503. STRIPE_WEBHOOK_SECRET gates whether /donate/webhook can verify a real Stripe request; without it, the webhook endpoint returns 503 (donations can still complete via the client-side success-page redirect, but the server-side confirmation/ audit trail is skipped).

These are live production payment credentials and must be treated with at least the same care as the database password — ideally more, given real donor card data flows through them. See §26 for the specific recommendation.

These credential categories are documented intentionally as part of the operational record (same convention as the rest of this file). Actual values are never written into Markdown documentation.


6. Application Stack

Backend/database/frontend stack is unchanged (FastAPI/Python 3.12/ Uvicorn/SQLAlchemy/PostgreSQL 16/Pydantic; vanilla HTML/JS/CSS, no build step; StaticFiles mount at /dashboard/).

New Python dependencies (in requirements.txt, confirmed present):

stripe==11.1.1
openpyxl==3.1.5
python-docx==1.1.2

stripe backs the donation flow (§12a). openpyxl and python-docx back the Records Archive .xlsx/.docx export (§13a). All three require a docker compose build (not just a restart) on first deploy if they weren't already present in a given environment's image.

Encryption — still unresolved

APP_SECRET_KEY is still not explicitly set in the Production compose file, confirmed by direct inspection of debteliminator.yml in this backup. security.py falls back to a hardcoded "fallback-dev-key-change-in-prod" string when the env var is absent. This was flagged as a critical open item at the last two reconciliations and remains open. See §26 for why this is now a higher priority than before.


7. Docker Configuration

Structurally unchanged — same Dockerfile (Docker CLI + compose plugin layer, inert in Production), same compose file locations and pgdata paths, same debt_engine-style env-var gating for the automated deployment pipeline (QA-only).

Production api service — new environment entries observed:

    environment:
      # ...existing DB/SMTP/session/proxy vars unchanged...
      - PUBLIC_BASE_URL=https://www.cutthecard.net   # changed — was debt.kingdezigns.com
      - STRIPE_SECRET_KEY=<redacted>
      - STRIPE_PUBLISHABLE_KEY=<redacted>
      - STRIPE_WEBHOOK_SECRET=<redacted>

APP_SECRET_KEY remains absent from this list — see §6 and §26.


8. Dashboard (Accounts Deck)

Unchanged in core layout (progress bars, stat banner, due-day-first ordering, overflow-menu row actions) — this section of the prior documentation remains accurate.

8a. Dark / Light Theme (new — v2.0.19)

  • Per-user theme field on User (dark / light / NULL). NULL means "use the site default."
  • Site-wide default is admin-configurable: Admin → Settings → default_theme, one of dark / light. New installs preserve the previous all-dark look by defaulting to dark.
  • A user's own explicit choice (set from My Account) always overrides the site default.
  • Logos were switched between dark/light variants alongside this (cutthecard-dark-logo.png, cutthecard-light-logo.png, cutthecard-dark-small.png, cutthecard-light-small.png/.jpg, cutthecard-black.png for the sidebar brand mark).

8b. Sidebar Navigation - Grouped (Phase 1, built 2026-10-11)

The sidebar (deRenderSidebar() in static/shared.js, styles in shared.css) changed from one flat list of ~18 links to task-based collapsible groups. This is Phase 1 of 2; Phase 2 (merging pages with similar content, e.g. Budget + Credit Utilization, Accounts + Import Transactions) is not started.

Structure as built (order as deployed - Track precedes Plan):

Top-level Contains
Accounts (standalone link) /dashboard/ - the home page
Track (group) Payment Register, Import Transactions, Budget
Plan (group) Debt Reduction Plan, Windfall Allocator, Credit Utilization, Milestones
Learn (group) Learning Center (matchPrefix), Blog (/blog, a public server-rendered page)
Help (group) Help Center, Contact / Support
Account (group) My Profile, Household, Subscription, Records Archive
Admin (label, admins only) People (User Accounts, Support Requests), Money (Revenue, Donations, Subscriptions), Content (Blog, Email Campaigns), standalone Dev Log
  • The user-facing link formerly labelled My Account is now "My Profile" (same page, account.html). "User Accounts" (admin) is unchanged and deliberately distinct from "Accounts" (a user's tracked debts).
  • Sidebar footer link is now "Start Here" (was "About CutTheCard", renamed in the home-page swap, §0e); it and the logo both go to /. Free Calculator is intentionally not in the logged-in nav - it is the public logged-out demo (§12i) and stays at /debt-payoff-calculator.
  • Each destination appears exactly once. Admin items are filtered by the existing per-page permission map (DE_PAGE_PERMS); a group left with one visible page renders as a plain link.
  • Behaviour: collapsed by default; the group containing the current page is open on load; opening a group closes the others (accordion). On a page that is in no group (e.g. donate), the last group the user opened this session (sessionStorage key de_nav_open_group) is restored. In the collapsed icon rail, clicking a group icon expands the rail and opens that group. The Milestones "new" dot also shows on the Plan header while that group is collapsed.
  • Accessibility: group headers are real <button>s with aria-expanded and aria-controls; panels are <ul>s labelled by the button; the active link carries aria-current="page"; icons are decorative (aria-hidden). Top-level items use one inline-SVG icon set; child links are text-only. Verified in headless Chromium: axe WCAG 2.x A/AA = 0 violations in dark and light themes, no horizontal scroll at 320 px, mouse + Enter + Space operate the groups. The project's a11y_audit.py and the manual screen-reader pass were not run (see accessibility_standards.md section 3).
  • To add a page to the nav: add one {href, label} entry to the right group in DE_NAV_ALL / DE_NAV_ADMIN in shared.js - nothing per page. Use also: [...] for secondary pages that should highlight the same item (e.g. blog-editor.html highlights admin Blog) and matchPrefix for multi-page sections.
  • Cache marker: this change moved shared.css / shared.js to ?v=1.9.5 on every app page (they were already on 1.9.4 for an earlier change; 1.9.4 could not be reused because browsers had cached the old CSS under it). blog.py and public_pages/debt-payoff-calculator.html still reference ?v=1.9.2 - they do not render the sidebar, so this is harmless but should be unified at the next shared.* change (§4.3/§25).
  • Deployment state: loaded into QA and confirmed visually by the owner; Production promotion not confirmed as of this update. A proposed re-order (Plan above Track) was considered and dropped by the owner - the order above stands.

9–11. Transaction Register, Charge-Level Interest, Debt Reduction Plan

Unchanged. The transaction-driven ledger, future-transaction handling, minimum-payment auto-estimation, charge-level interest/ promotional-APR engine, and the four-step Debt Reduction Plan (Avalanche/Snowball → Balance Transfer → Adjust Payments → Follow the Trail) all remain as previously documented and were re-confirmed against ledger.py, interest_engine.py, and payoff.py in this backup.


12. New Public-Facing Features (v1.10.0 – v2.0.19)

12a. Stripe Donations

Implemented in routers/donate.py, backed by a new donations table (models.Donation) — a real structured record replacing the old free-text-only audit-log entries.

Four endpoints:

Endpoint Auth
GET /donate/status Login required (sidebar poll — decides whether to show the Donate nav item)
POST /donate/create-checkout-session Login required
POST /donate/create-checkout-session-public None (anonymous donor, linked from the login screen)
POST /donate/webhook Stripe HMAC signature, no session

Behavior:

  • Supports one-time and monthly recurring (subscription-mode Stripe Checkout) donations, created inline via price_data (no pre-created Stripe Product/Price needed).
  • A pending Donation row is written at checkout-session-creation time, from the donor's own browser request — this is the only point in the flow where IP/user-agent/device fingerprint genuinely belong to the donor. The webhook is a Stripe server-to-server call and is never used as a source of donor IP/UA.
  • The webhook handles checkout.session.completed (confirms the pending row, pulls card brand/last4/country + Stripe Radar risk score/level via an expanded charge lookup), invoice.paid (records each subsequent recurring billing cycle as its own row, skipping the signup cycle to avoid a duplicate), customer.subscription.deleted (marks every Donation row tied to that subscription as cancelled), and payment- failure events.
  • consent_collection is requested on every Checkout Session, captured as Donation.marketing_consent (opt_in/opt_out/null). Do not add a donor to any email campaign unless this is opt_in.
  • On a completed donation tied to a logged-in user, User.is_donor, donor_since, last_donation_at, and total_donated_cents are updated — this is the source of truth for donor status, not the audit log.
  • Admin on/off switch: Admin → Settings → donation_enabled (off by default; cannot be turned on until STRIPE_SECRET_KEY is configured). When off, the Donate nav item disappears entirely.
  • Anonymous donation: a public donate-public.html page (linked from the login screen — "Donate anonymously →") uses the public endpoint; username_at_time is stored as "anonymous", user_id is NULL.

Admin visibility (new admin pages):

  • GET /admin/donations/summary, GET /admin/donations, GET /admin/donations/{id} back an Admin → Donations page (admin/donations.html).

12b. Support / Contact Request Form

Implemented in routers/support.py, backed by a new support_requests table. Public-facing form at static/contact.html — reachable logged in or signed out.

  • Request types: general question, site issue, enhancement request, request for account removal (extensible — see SUPPORT_REQUEST_TYPES in models.py).
  • Human-readable confirmation code (CTC-XXXXXXXX) generated per request, used in both the internal notification and the submitter's confirmation email instead of the raw row ID.
  • 48-hour SLA — due_by is fixed at created_at + 48h and not recalculated later.
  • On submit: (1) an internal notification email to support@cutthecard.net with a direct admin review link, and (2) a branded confirmation email to the submitter (if a valid email was given), both sent immediately with force=True (bypasses QA suppression — these are treated as real operational/user-facing actions even in QA).
  • Endpoints:
Endpoint Auth
POST /support/requests None (submit)
GET /support/my-requests Login required (submitter's own history)
GET /support/requests Admin only (list/search)
GET /support/requests/{request_id} Admin only
PATCH /support/requests/{request_id} Admin only (status/notes)
  • Admin review page: admin/support-requests.html.

A new Affiliate Disclosure legal document type was added alongside Terms of Use and Privacy Statement (§17b), viewable from the site footer and managed through the same Legal Documents admin flow. This is preparatory/compliance content only — a separate, still-unversioned DevLog queue item ("Affiliate links for credit card companies," update type no-version, qa_status = pending) describes the planned affiliate program (FlexOffers/CJ Affiliate, balance-transfer offer placement in the Debt Reduction Plan's Step 1, an outbound-link interstitial modal) but has not been deployed. Do not describe affiliate links as live.

12d. SEO Foundation + Learning Center

Two DevLog phases, both deployed:

  • Phase 1 (v2.0.11) — SEO foundation: robots.txt and sitemap.xml (served by the new seo_router.py), canonical URLs and OG/Twitter meta tags on public pages, and a public/private page split enforced at the crawler level (see below).
  • Phase 2 (v2.0.12–2.0.14) — Learning Center: a public educational content section at /dashboard/learn/, six articles plus an index:
Page Topic
learn/avalanche-vs-snowball.html Avalanche vs. Snowball comparison
learn/credit-card-interest.html Real cost of interest
learn/minimum-payments.html The minimum-payment trap
learn/extra-payments.html Impact of extra payments
learn/balance-transfer.html Balance transfer considerations
learn/credit-utilization.html Credit utilization

These are intentionally tied to CutTheCard's own tools (not a generic finance blog) and are linked from both the authenticated sidebar ("Learning Center") and the public login screen.

Crawler access model (robots.txt, generated by seo_router.py): public pages (about.html, donate-public.html, /dashboard/learn/, and a few static assets) are explicitly Allowed; the rest of /dashboard/ (the authenticated app) and every API prefix (/auth/, /debt/, /admin/, /legal/, /donate/, /portfolio/, /api/, /health) are Disallowed. Allow rules are listed before the blanket Disallow specifically because not every crawler/validator implements RFC 9309's "most-specific-rule-wins" resolution — some use simple first-match, top-to-bottom logic, so ordering the file this way is correct under both interpretations (confirmed via a validator that was still flagging /dashboard/learn/ as blocked under the other order).

The Phase 1 task notes also call for reviewing the CrowdSec configuration on HAS to make sure legitimate search-engine crawlers aren't being blocked — this documentation cannot confirm whether that review resulted in any actual CrowdSec allowlist change, since CrowdSec config lives on HAS and is outside this backup's scope. Worth checking server_homeassistant.md's CrowdSec section / cscli output if search indexing issues come up.

12e. Login Screen Marketing Copy + About Page

The login screen now carries value-proposition copy ("Take Control of Your Debt and Stop Wasting Money on Interest," feature bullets) aimed at converting visitors into signups, plus the site logo. A permanent About CutTheCard page (about.html) was added, reachable from the sidebar and the footer, and doubles as the onboarding-modal follow-up — see onboarding_acknowledged on User (a first-login modal that, once dismissed, never reappears; the About page remains available afterward for anyone who wants to revisit it).


12f. Blog Engine (new — 2026-09-30)

Public SEO articles, outside the paywall, crawlable. Implemented in routers/blog.py (public + admin routers), blog_sanitize.py, models BlogPost/BlogImage, admin UI static/admin/blog.html (list) and static/admin/blog-editor.html. Public pages are server-rendered HTML (not static files) so search engines receive full content.

Public routes (no auth): GET /blog (index, paginated 12/page, newest first), GET /blog/archive, GET /blog/{slug}, GET /blog/img/{id}. Reserved slugs: archive, img, feed, new, admin. QA renders noindex. Each article emits canonical URL, OG/Twitter tags, and Article JSON-LD (headline, author, datePublished, image). Header/footer reuse the Learning Center look (learn.css); the CTA block links to the planner. Published articles and /blog are added to sitemap.xml; robots.txt has Allow: /blog. Archived versions stay reachable via /blog/archive but are not listed in the sitemap.

Revision model — one row per revision, each with its own URL. Rows of the same article share series_id; revision counts up; every revision has its own unique slug (my-post, my-post-r2, …) so an older URL never becomes a dead link. The slug locks once a revision has ever been published (ever_published). Creating a revision copies the source row into a new preview row; only one Preview/Scheduled revision may exist per series at a time. Publishing a revision (manually or via schedule) automatically archives the previously published revision of that series; the public date shown on the new one is its publication (or scheduled) date, labelled "Revised" for revision ≥ 2. Old revisions keep their own image (images are referenced per row, never shared-mutable).

Statuses / Publish dropdown (models.BLOG_STATUSES):

Status Who can see it Notes
preview Admins only (renders like production, banner, noindex) Public gets 404
scheduled Admins only until scheduled_for (UTC) passes Goes live automatically; see scheduling below
published Everyone; indexed At most one per series
archived Everyone (Blog Archive page, banner links to current version) Indexable, self-canonical
unpublished Admins only; public gets HTTP 410 Removes it everywhere incl. archive

Rules: a post that has ever been published cannot return to Preview or be rescheduled (create a revision); archiving requires a prior publish; published/archived posts cannot be deleted (unpublish first); deleting a post also deletes its image row if no other post references it.

Scheduling. Admin picks a local date/time (converted to UTC in the browser); stored in blog_posts.scheduled_for; must be in the future. promote_due() publishes every due scheduled post, sets the displayed date to the scheduled time (not the moment the worker ran) and archives the superseded revision. It runs (a) lazily on every public blog request, admin list request and sitemap request, and (b) from a background thread started in main.py (blog-scheduler, every 60 s; log line Blog scheduler started (checks every 60 seconds).). It is idempotent.

Images are stored in PostgreSQL (blog_images, PNG/JPEG/WebP/GIF, ≤ 5 MB, magic-byte checked), served by /blog/img/{id} — so they are covered by the existing pg_dump backup and never enter the QA→Production file-deploy pipeline. A post may instead use an external/path image_url. Width/height rule: only one given → the other is auto (no distortion); both → both obeyed (object-fit: cover); neither → natural size capped to the column. Non-admins can only fetch images belonging to a published/archived post.

HTML safety: article HTML is stored raw and sanitized at render time (blog_sanitize.py, stdlib allow-list): scripts, styles, iframes, forms, event handlers, non-http(s)/mailto/relative URLs removed; <h1> demoted to <h2>.

Audit: admin actions are logged (blog_post_created/updated, blog_status_changed, blog_revision_created, blog_post_deleted).

Admin UI: Admin → Blog (/dashboard/admin/blog.html): table with row ✎ menu (Edit / Preview-or-View / New Revision) and a 🗑 delete icon; editor has Cancel (with unsaved-changes guard), image upload/URL + alt + width/height, summary, HTML body, status dropdown (Preview / Schedule / Publish / Archive / Unpublish) and a date-time picker when Schedule is chosen. The admin JSON API lives under /admin/blog/* (admin-gated at router level); the UI pages are under /dashboard/admin/ like every other admin page (not /admin/blog, which is the API prefix).

Operational notes: no new Python dependencies and no compose changes; new tables (blog_posts, blog_images) are created by create_all on startup, and main.py runs ALTER TABLE blog_posts ADD COLUMN IF NOT EXISTS scheduled_for. CrowdSec/Fail2Ban need no change (public paths are on the already-proxied cutthecard.net host) — but as with §12d, confirm legitimate search crawlers aren't being banned by CrowdSec on HAS if blog indexing stalls.


12g. Revenue Ledger, Subscription Admin Views, and Revenue Page (new — 2026-09-30)

Ledger change. donations gained payment_kind ("donation" default | "subscription", indexed). The donations table is now the single payment ledger for both kinds; every consumer filters on payment_kind so totals never mix. The invoice.paid webhook handler in routers/donate.py now records every paid invoice for a user's real subscription (including the first, billing_reason=subscription_create) as payment_kind="subscription" — deduped by stripe_invoice_id, $0 invoices skipped — and deliberately does not call _apply_donor_status (a subscriber is not a donor). Previously the first subscription payment was never recorded anywhere and later ones landed as plain recurring donations. A startup migration in main.py adds the column and backfills: any donations row whose stripe_subscription_id equals some user's users.stripe_subscription_id becomes subscription.

⚠️ Design departure + caveat (see §26). routers/subscribe.py's original docstring says a real subscription "writes NO Donation row — the donations table stays semantically pure." That is no longer true for the payment (invoice) records: _handle_subscription_checkout_completed still writes no Donation row, but invoice.paid now does, tagged subscription. Also, grandfathered recurring donors (Phase 2 links their existing donation subscription onto users.stripe_subscription_id) are classified by the rule above — so their historical pre-conversion donation rows are backfilled as subscription too, moving that money out of Donations totals into subscription revenue.

Donations page (/admin/donations, /admin/donations/summary) now counts payment_kind="donation" rows only (its totals can drop after this deploys — expected).

Admin → Subscriptions (static/admin/subscriptions.html) additions:

  • Overview tiles: Monthly Subscriptions (dollars collected this calendar month), Yearly Subscriptions (this calendar year), Subscribers (active + payment-issue).
  • Status pills: Completed (active), Trials, Cancelled, Failed (past_due/unpaid), plus Pending Cancel (active with cancel_at_period_end), Free Access (admin grants), Expired. Admins are excluded from all counts.
  • Users table gained Monthly (latest paid amount, else the configured price for active/past-due users) and <year> contributed (sum + payment count) columns, with a year selector listing every year that has payments (default current year).
  • Sync Payments from Stripe button (Background Jobs): backfills paid invoices for every user with a subscription id; idempotent; returns 503 where Stripe isn't configured (expected in QA).

Admin → Revenue (static/admin/revenue.html, new): all completed money in, both kinds. Tiles (all-time / selected year / this month), clickable type pills (Subscription / Recurring donation / One-time donation), a 12-month stacked bar (subscriptions vs donations), and a payments list with type + status filters, search (username/email/name), year selector and receipt links. Completed payments only count as revenue. All periods are UTC calendar months/years.


12h. Site-Wide Script Loader and Umami Analytics (new — 2026-10-02)

Goal: self-hosted, cookie-free analytics (page views, time on page, referrers, scroll depth, "did they read it") without third-party scripts. Backend service: Umami at https://stats.cutthecard.net — see server_umami.md.

Single-loader design. These are plain static HTML pages with no template engine, so instead of repeating scripts on each page, every page carries ONE tag:

<script defer src="/dashboard/site-scripts.js?v=1"></script>

static/site-scripts.js is the registry of all site-wide scripts. To add, change or remove a script, edit that file only — it has a CONFIG section, numbered script blocks with comments, a [next script goes here] marker and a change log.

What the loader does today

  1. Umami — loaded from https://stats.cutthecard.net/insights.
  2. Reading tracker (static/reading-tracker.js) — loaded after Umami, and only on pages containing an <article> (blog posts and the six Learning Center guides).

Guards in the loader

  • /dashboard/admin/ is never tracked (admin pages also don't carry the tag).
  • Hostname allow-list: only cutthecard.net and www.cutthecard.net have a website ID; debt.qa.cutthecard.net is null (QA reports nothing until a separate QA Umami website ID is pasted in).
  • Browser Do Not Track (data-do-not-track) and Global Privacy Control are honored.
  • Pages whose URL may carry tokens (donate-success.html, donate-cancel.html, subscribe.html, billing-locked.html) have query string and hash stripped before sending.
  • Everything is wrapped in try/catch; analytics can never break a page.
  • Rules: never call umami.identify(); never put user data (names, balances, account names, emails) in event properties.

Custom events (from reading-tracker.js)

Event Fires when
scroll-depth {depth} reader passes 25 / 50 / 75 / 100% of the <article> (falls back to <main>, then <body>)
engaged-time {seconds} 30 / 60 / 120 / 180 s of active time (tab visible and input within the last 15 s)
article-read ≥ 75% depth and ≥ 45 s active time (thresholds are constants at the top of the file)

CTA clicks can be tracked without code by adding data-umami-event="cta-planner" to a link.

Where the tag is present (21 static pages + blog)

  • Public: about, contact, donate, donate-public, donate-success, donate-cancel, and all learn/* pages (index + six guides).
  • Authenticated app (page-level only): index (landing/login and accounts deck), account, payoff-strategy, register, records-archive, help, subscribe, billing-locked.
  • Blog: added in routers/blog.py _page() — emitted unless the page is noindex (so Preview, Scheduled and Unpublished posts are never tracked). This was the only Python change.
  • Not tracked: everything under /dashboard/admin/.

Deployment notes

  • Applied with an idempotent patch script (apply_site_scripts.py) that only inserts the tag before </head> and edits the _page() shell, so it works on whatever version of each file is in QA (important while other changes are in flight). Needs sudo (the project directory is root-only). Extra pages can be passed as arguments.
  • Promoted as a no-version DevLog project via the normal QA → Production pipeline; blog.py makes it a restart-path deploy.
  • The loader is a static file served without explicit Cache-Control; browsers may use a cached copy for a while after edits. Bump the ?v= on the tag (touching all pages) or add a no-cache rule in NPM if immediate propagation is ever needed.
  • robots.txt already Disallows /dashboard/ generally (loader/tracker files included); this is harmless — crawlers don't need these scripts.

Status: page views confirmed recording in production (2026-10-02). Custom events (scroll-depth, engaged-time, article-read) were not yet confirmed visible in Umami → Events at time of writing; the tracker logic passed simulated testing. Verification steps are in server_umami.md (Troubleshooting).


12i. Features Added v2.1.8 - v2.1.19 (summary-level, from module docstrings)

Not reconciled line-by-line; confirm against source before relying on detail. Common design rule across the new engines: pure functions, no DB writes, and every projection reuses payoff.calculate_payoff_ladder() so numbers agree with the Debt Reduction Plan page.

Feature Files What it does
Public Demo Calculator (v2.1.8) demo_calculator.py, routers/demo.py, public_pages/debt-payoff-calculator.html Logged-out, crawlable /debt-payoff-calculator. Stateless: GET /demo/config, POST /demo/calculate (plan + optional 0% transfer what-if), POST /demo/convert (creates a real trial account through the normal auth.signup() then saves the demo accounts). No DB writes until a visitor converts.
Milestones (v2.1.12) routers/milestones.py, static/milestones.html Read-only; recomputed live from accounts/transactions (payoff per account, cumulative paid tiers, interest-avoided tiers, debt-free). "Seen" state lives in browser localStorage (no table). ?keys_only=true powers the sidebar dot.
Windfall Allocator (v2.1.14) windfall.py, static/windfall.html Splits a lump sum across debts and shows interest saved; lands money on the highest-rate lot first on mixed-rate cards.
CSV / Statement Import (v2.1.15) routers/import_statements.py, statement_import/ (csv, OFX, QIF, PDF parsers, dedupe, reconcile), import_guide.py, static/import.html, learn/import-credit-card-transactions.html parse -> duplicate check -> commit. Privacy contract: uploads are parsed in memory and discarded; no files, descriptions or text are stored or logged. Only an import_batches record (when/account/row count/adjustments) is kept 30 days so imports can be reviewed or undone.
Accessibility layer (v2.1.16) a11y.css, a11y.js, accessibility.html, blog publish gate WCAG 2.2 AA standard - see accessibility_standards.md.
Reminders (v2.1.17) reminders.py, routers/reminders.py, payment_reminder_log Daily worker emails due-date reminders (0..3 days out, none if already paid this cycle) and 0%-promo-expiry reminders (30/14/3 days). One combined email per person per day; default ON, opt-out in Email Preferences. Admin tools under /admin/reminders/* (campaigns.manage): preview, test-send (works in QA), run-now.
Credit Utilization (v2.1.18) utilization.py, static/utilization.html Balance/limit per card and blended; projects the balance at the next statement close and shows the effect of paying before it. Deliberately promises no score change (30%/10% are rules of thumb).
Budget-to-Payoff (v2.1.19) budget.py, routers/budget.py, budget_items, budget_settings, static/budget.html income - living expenses - minimum payments - cushion = money available for extra payments; optionally committed so the Debt Reduction Plan and Windfall Allocator run on it (get_committed_extra()). Estimates from user-entered numbers.
Blog auto-archive + rotation blog_rotation.py Articles older than 30 days auto-archive (unless admin "keep active"); front page has 10 slots - fresh articles first, remaining slots filled with random archived picks that rotate every 5 days (seeded by window number so all visitors/workers agree); 10+ fresh = no archived shown.
Admin Roles v2 (v2.1.6) routers/roles.py, roles, user_roles Role definitions/assignments; roles.assign (Primary Admin + Supervisor) and roles.manage (Primary Admin). Non-primary admins cannot change their own roles; nobody but the Primary Admin can change the Primary Admin's roles; Supervisor can never be removed from the Primary Admin. Pages gated by per-permission checks mirrored in DE_PAGE_PERMS.

12j. Household Sharing (v2.1.20)

Lets an owner share their accounts with one other CutTheCard user for joint management. Code: household.py (pure rules), household_deps.py (FastAPI plumbing + audit middleware), routers/household.py, models HouseholdShare / HouseholdActivity (household_shares, household_activity), page static/household.html, Help Center section #household. Nav: Account -> Household (§8b).

  • Model: owner invites a user by email as View only or Can edit. The owner's records are never copied or moved. A member "switches into" the household (sessions.acting_owner_id); from then on that browser session's data pages read/write the owner's accounts within the permission. A banner shows whose accounts are being viewed, with a switch-back button (deMaybeShowHouseholdBanner() in shared.js).
  • Mechanism: get_data_user() replaces get_current_user on the routers that hold debt records and returns the owner when an ACTIVE share exists, the owner is still allowed to share, and (for writes) the member has edit permission. Those routers already scope queries by user.id, so no query changes were needed. get_own_user() is for endpoints that must always be the real person; inside a household it refuses with household_owner_only. View-only writes are refused with household_view_only (shown as a notice).
  • Members can never: see full account numbers; change the owner's profile/password/billing; invite or manage members; delete the owner's account; read the owner's Budget.
  • Audit: every change made inside another person's household is written to an owner-visible activity log (invitations, joins, edits).
  • Invites: emailed link to /dashboard/household.html?invite=TOKEN (token stored only as a SHA-256 hash; status flow pending -> active -> revoked, or declined/expired; the accepting account's email must match the invitation). Removal takes effect immediately.
  • Billing: per the Help Center text, sharing your accounts is part of a paid plan; opening a household you were invited to is not limited. Exact enforcement was not verified against source.
  • Endpoints (/household): GET, POST /invites, DELETE /invites/{id}, PATCH /members/{id}, DELETE /members/{id}, POST /leave/{id}, GET /invite-preview, POST /accept, plus POST /household/switch {share_id|null} (used by the switch-back banner).

13. Payment Register

Unchanged from prior documentation (register.html, /debt/payment-register, Payments-Only vs. All-Transactions preference).

13a. Records Archive (new — v2.3.0 / DevLog v2.0.17)

Implemented in routers/records_archive.py. A downloadable, year-scoped export — nothing is persisted; every export is computed fresh from debt_accounts/debt_transactions at request time, same read-only philosophy as the Payment Register.

  • Page: records-archive.html. Nav label: Records Archive.
  • Groups the user's accounts by account_type, and within each type, into three sections: Paid Off Accounts, Accounts Not Paid Off, Accounts With Delinquencies.
  • Each row: account name, last-4 of account number (never the full number), beginning/ending balance for the selected year, and Jan–Dec payment totals.
  • "Delinquent" is a derived flag, not a stored one — there's no late/delinquent column on either DebtAccount or DebtTransaction. A month is flagged "missed" if the account existed that month, has a due_day_of_month on file, the month isn't in the future, and no payment-type transaction was recorded that month. Any missed month in the selected year moves the account into the Delinquencies section instead of Not Paid Off. Accounts with no due_day_of_month are never flagged. Paid-off status always wins over delinquency for a given account. This is described in the code as "a best-effort heuristic, not a statement from the creditor" — a real "marked late by lender" signal would need a new is_late_payment column, out of scope for this first version.
  • Available as .xlsx (one tab per account type, via openpyxl) or .docx (one section per account type, via python-docx).
  • Endpoints: GET /debt/records-archive/years, GET /debt/records-archive/export.xlsx?year=YYYY, GET /debt/records-archive/export.docx?year=YYYY.

14. My Account

Unchanged core sections (Profile, Change Password, Account Details), plus new controls added by v2.0.8's Suspend/Delete feature (§17a) and the theme picker (§8a).


15. Administration

Existing capabilities (account management, security settings, Terms publishing, audit log) are unchanged. New admin surface area:

  • Admin → Settings gained donation_enabled and default_theme (GET/PATCH /admin/settings, schemas.AdminSettingsOut).
  • Admin → Donations (admin/donations.html) — donation summary + full log (§12a).
  • Admin → Support Requests (admin/support-requests.html) — support queue (§12b).
  • Admin → Legal Documents now manages three doc types instead of one: Terms of Use, Privacy Statement, Affiliate Disclosure (§17b).
  • POST /admin/accounts/{username}/force-reset-privacy — parallel to the existing force-reset-terms, for the new Privacy Statement.

Primary administrator protections are unchanged (cannot be demoted, disabled, deleted, or self-suspended/self-deleted — is_primary_admin is explicitly checked in the new suspend/delete endpoints too).


16. Help Center

Unchanged page/nav label. The Help Center now also surfaces a link into the new Support/Contact form (v2.0.18, "Add Assistance form to Help Center") for users who need to reach a human rather than read documentation.


17. Authentication & Security

Core mechanism unchanged (session-cookie, HttpOnly/SameSite=Strict, bcrypt, 5-attempt/15-minute lockout, TRUSTED_PROXY_IP=192.168.150.30).

17a. Self-service suspension and deletion (new — v2.2.0)

Two new endpoints in routers/auth.py, enforced server-side via a new require_not_suspended dependency applied to the core data routers (Accounts, Transactions, Payment Register, Debt Reduction Plan, Records Archive):

  • POST /auth/suspend — sets User.is_self_suspended = true. The user can still log in (unlike admin is_disabled, which blocks login entirely), but every core app page returns 403 and the frontend redirects to the About page. Idempotent. The primary admin cannot self-suspend.
  • POST /auth/unsuspend — clears the flag, restores full access.
  • POST /auth/delete-account — two-step: requires the user's current password as a final confirmation gate (protects against a stale unattended browser tab triggering deletion). On success:
    • All DebtAccount rows deleted (cascades to DebtTransaction via ORM), all sessions invalidated (including the current one), all pending password-reset tokens cleared.
    • User PII cleared (email = NULL, password_hash replaced with a non-functional placeholder) and is_disabled = true set as a belt-and-suspenders login block; deletion_requested_at / deleted_at timestamps recorded.
    • The User row itself is soft-deleted, not hard-deleted — PII is wiped but the row (and username) persist so audit_log's actor_username/target_username string references don't dangle. A hard-delete after any applicable legal retention period is a manual/future step, not automatic.
    • Primary admin cannot self-delete.

17b. Privacy Statement + Affiliate Disclosure (new — v2.1.0 / v2.4.0-ish)

  • accepted_privacy_version on User, tracked and gated on login exactly like accepted_terms_version — publishing a new Privacy Statement version re-triggers the acceptance gate independently of Terms of Use (so publishing one doesn't force re-acceptance of both).
  • Affiliate Disclosure (§12c) is deliberately not in the login-gating map — it's view-only, reachable any time from the footer, with no acceptance tracking. (A POST /legal/affiliate_disclosure/ accept would technically work if ever called, but the frontend never calls it for this doc type.)
  • GET /legal/{doc_type} is intentionally not gated by the router-level auth dependency in main.py, specifically so a signed-out visitor on the login screen can read the current Terms/Privacy document before creating an account. Only POST /legal/{doc_type}/ accept requires login.

18. API Endpoint Reference

The existing tables (Authentication, Debt Accounts, Transactions, Payment Register, Payoff/Debt Reduction Plan, Legal, Administration, Dev Log) are still accurate and are not reproduced here in full. Additions:

Authentication — new

Method Endpoint Purpose
POST /auth/accept-privacy Accept current Privacy Statement
POST /auth/acknowledge-onboarding Dismiss the first-login onboarding modal
POST /auth/suspend Self-suspend own account
POST /auth/unsuspend Remove own self-suspension
POST /auth/delete-account Two-step self-delete (password-gated)

Donations — new

Method Endpoint Purpose
GET /donate/status Whether donations are currently enabled
POST /donate/create-checkout-session Authenticated Stripe Checkout session
POST /donate/create-checkout-session-public Anonymous Stripe Checkout session
POST /donate/webhook Stripe server-to-server confirmation
GET /admin/donations/summary Admin donation dashboard summary
GET /admin/donations Admin donation log (list)
GET /admin/donations/{donation_id} Admin donation detail

Support — new

Method Endpoint Purpose
POST /support/requests Submit a support/contact request (public)
GET /support/my-requests Submitter's own request history
GET /support/requests Admin — list/search
GET /support/requests/{request_id} Admin — detail
PATCH /support/requests/{request_id} Admin — update status/notes

Records Archive — new

Method Endpoint Purpose
GET /debt/records-archive/years Years available for export
GET /debt/records-archive/export.xlsx Excel export
GET /debt/records-archive/export.docx Word export

Admin — new

Method Endpoint Purpose
POST /admin/accounts/{username}/force-reset-privacy Force Privacy Statement re-acceptance

Dev Log — new

Method Endpoint Purpose
GET /admin/devlog/deployments Permanent deployment history (list)
GET /admin/devlog/deployments/{record_id} Deployment history detail

SEO — new (unauthenticated, not under /admin or /debt)

Method Endpoint Purpose
GET /robots.txt Crawler directives
GET /sitemap.xml XML sitemap of public pages

Blog — new (2026-09-30)

Method Endpoint Auth Purpose
GET /blog, /blog/archive, /blog/{slug} None (preview/scheduled → admin only) Server-rendered pages
GET /blog/img/{image_id} None (published/archived images only; admins any) Image bytes
GET / POST /admin/blog/posts Admin List / create
GET / PUT / DELETE /admin/blog/posts/{id} Admin Read / update / delete
POST /admin/blog/posts/{id}/status Admin Status change (body: status, scheduled_for)
POST /admin/blog/posts/{id}/revise Admin New preview revision (own slug)
POST /admin/blog/images Admin Upload image (multipart, ≤ 5 MB)

Revenue / subscription admin — new (2026-09-30)

Method Endpoint Purpose
GET /admin/billing/subscription-summary?year= Tiles, pills, per-user monthly/yearly amounts, available years
POST /admin/billing/sync-subscription-payments Backfill paid Stripe invoices as subscription revenue
GET /admin/revenue/summary?year= All-time / year / month totals, by-type, 12-month series
GET /admin/revenue/payments?year=&type=&status=&search=&limit= Unified payment list (type: subscription | recurring_donation | onetime_donation)

SitePay / email (summary-level; see §0b)

/subscribe/status, /subscribe/create-checkout-session, /subscribe/portal-session; /admin/campaigns/* (types, settings, preview, test-send, runs, start, cancel); /email-prefs/me, /email-prefs/unsubscribe.


19. Database Model (key additions)

users — new columns

  • is_self_suspended, deletion_requested_at, deleted_at (v2.2.0)
  • accepted_privacy_version (v2.1.0)
  • onboarding_acknowledged (v2.1.0)
  • is_donor, donor_since, last_donation_at, total_donated_cents, donation_modal_last_shown_at (v1.10.0-ish — donor tracking; only ever written by the Stripe webhook handler)
  • theme (v2.0.19 — nullable; NULL = use site default)

donations (new table, v1.10.0+)

One row per payment — a recurring subscription produces one row at signup and one additional row per later billing cycle, grouped by shared stripe_subscription_id/stripe_customer_id. Columns cover Stripe identifiers (checkout session/payment intent/customer/subscription/ invoice IDs), donor identity (user_id nullable for anonymous, donor_email, donor_name), amount/currency/recurrence, status (DONATION_STATUSES = pending/completed/failed/cancelled/refunded), IP/UA/device fingerprint (captured only at checkout-session-creation time), card brand/last4/country + Stripe Radar risk level/score, receipt URL, cancellation reason, marketing_consent, and the full raw Stripe event JSON for dispute/legal purposes.

support_requests (new table, v2.4.0)

request_id (human-facing CTC-XXXXXXXX code), created_at, due_by (fixed at creation + 48h), submitter identity (user_id/ username_at_time nullable for anonymous, name, email, phone), request_type (SUPPORT_REQUEST_TYPES), subject, message, status (SUPPORT_REQUEST_STATUSES = open/in_progress/resolved/closed), admin_notes, responded_at/responded_by_username, resolved_at, IP/UA/device fingerprint, and email-sent flags.

project_tasks — new columns (v2.3.0)

  • assigned_to (free-text developer name; NULL = unassigned)
  • due_date (plain Date, no timezone)
  • on_hold (suppresses overdue-alert emails; shown as an orange dot vs. green/gray in the queue)

deployment_records (new table, v2.2.0)

Permanent, append-only history of every completed QA → Production promotion (automated or legacy manual), deliberately separate from deploy_engine.py's single-generation backup/api/ file snapshot on disk (which is overwritten by the next deployment and therefore can't answer "what was v2.0.3's rollback plan?" once v2.0.4 has run). Captures: which files were copied and their backup paths, orphaned-in-prod files, whether a rebuild was performed and why, DB-migration-related file notes, the compose/container context at deploy time, the verbatim forward-direction commands, and the full step-by-step pipeline execution report. Rollback/validation instructions are generated on read (not frozen at write time) so they stay accurate as later deployments potentially overwrite the on-disk snapshot referenced by an older record.


blog_posts (new, 2026-09-30)

One row per revision: series_id, revision, unique slug, title, author, summary, content_html (raw), image_id → blog_images, image_url, image_alt, image_width, image_height, status (preview/scheduled/published/archived/unpublished), published_at (date shown publicly), scheduled_for (UTC), archived_at, ever_published (locks the slug), created_at, updated_at, created_by.

blog_images (new, 2026-09-30)

id, created_at, content_type, data (BYTEA). Images live in the DB.

donations — new column

payment_kind (donation | subscription, default donation, indexed). See §12g.


New tables since v2.1.7 (summary)

roles, user_roles (Admin Roles v2) - budget_items, budget_settings - import_batches (30-day import history, no file/text content) - payment_reminder_log (reminder dedupe) - household_shares, household_activity (plus sessions.acting_owner_id) - email_preferences. All present in the v2.1.20 QA dump.


20. Dev Log Architecture — Additions

Core lifecycle (Create → Queue → Deploy to QA → Test → automated Preview/Confirm/Execute pipeline → recorded) is unchanged from prior documentation and re-confirmed against devlog.py in this backup.

20a. Weekly overdue-item alerts (v2.3.0)

A background thread, started at API startup regardless of APP_ENV, sleeps 60 seconds (let the DB settle) then checks every 7 days for queue items where qa_status = 'pending', on_hold = false, assigned_to is set, and due_date has passed. Each qualifying item is alerted on at most once per 7 days (tracked via a SystemSetting row per task ID). The digest email is sent with force=True, so it goes out even from a QA container — this is treated as an internal operational alert, not a QA-suppressed user-facing email.

20b. Deployment history & display collapsing (v2.0.17)

  • GET /admin/devlog/deployments / GET /admin/devlog/deployments/ {record_id} back a new "Deployed" history view backed by deployment_records (§19), independent of the version/task cards above it.
  • Both the release-version list and the Deployed section now default to showing only the 5 most recent entries, with a toggle to reveal the rest — the page had grown long enough to scroll indefinitely as release history accumulated.

21. Known DevLog Sync Fix

Unchanged / already resolved — see prior documentation (missing sqlalchemy.text import, since fixed and confirmed working).


22. Backup Architecture

Unchanged in mechanism. Script (/usr/scripts/debteliminator/ debteliminator-backup.sh) still targets Production only (application files + PostgreSQL); QA is still not included. Retention still 10 most recent archives; verification still tar -tzf. Current example archive name: debteliminator-v2.1.3-backup-2026-09-30_08-47-16.tar.gz (was v2.0.19 / 2026-09-15). Blog images are in PostgreSQL and therefore included in the dump.

Restore steps are unchanged — see prior documentation.


23. Application Source Structure

Updated file tree (new files bolded via description, not markdown bold, for readability):

debteliminator/
└── api/
    ├── Dockerfile
    ├── requirements.txt          # now includes stripe, openpyxl, python-docx
    └── app/
        ├── __init__.py
        ├── main.py
        ├── models.py
        ├── schemas.py
        ├── ledger.py
        ├── payoff.py
        ├── interest_engine.py
        ├── balance_transfer.py
        ├── deploy_engine.py
        ├── config.py              # now also reads STRIPE_* env vars
        ├── database.py
        ├── deps.py
        ├── mailer.py
        ├── migrations.py
        ├── security.py            # now also has theme + donation-enabled helpers
        ├── seo_router.py          # NEW — robots.txt / sitemap.xml (now also lists published /blog articles)
        ├── blog_sanitize.py       # NEW 2026-09-30 — allow-list HTML sanitizer for blog bodies
        ├── subscription_reconcile.py  # SitePay — daily Stripe reconciliation (see §0b)
        ├── email_templates.py     # campaign email rendering (see §0b)
        ├── household.py / household_deps.py   # v2.1.20 - household sharing rules + FastAPI plumbing
        ├── budget.py, windfall.py, utilization.py   # pure engines (Budget, Windfall Allocator, Credit Utilization)
        ├── demo_calculator.py     # public logged-out calculator engine
        ├── reminders.py           # due-date / promo-expiry reminder worker
        ├── import_guide.py        # issuer download guide (single source of truth)
        ├── blog_rotation.py       # blog auto-archive + rotating archive picks
        ├── statement_import/      # csv/ofx/qif/pdf parsers, dedupe, reconcile, classify
        ├── public_pages/          # debt-payoff-calculator.html + home.html ("Start Here", served at /) - server-rendered public pages
        ├── routers/
        │   ├── __init__.py
        │   ├── auth.py            # now also suspend/unsuspend/delete-account
        │   ├── accounts.py
        │   ├── transactions.py
        │   ├── payment_register.py
        │   ├── payoff_strategy.py
        │   ├── records_archive.py # NEW
        │   ├── legal.py           # now also Privacy Statement / Affiliate Disclosure
        │   ├── donate.py          # NEW (invoice.paid now records real-subscription payments as payment_kind=subscription)
        │   ├── blog.py            # NEW 2026-09-30 — public blog + admin API + promote_due scheduler
        │   ├── subscribe.py       # SitePay — paid subscription checkout + Customer Portal (see §0b)
        │   ├── campaigns.py       # admin email campaigns (see §0b)
        │   ├── household.py, budget.py, milestones.py, import_statements.py   # v2.1.12-2.1.20
        │   ├── roles.py, reminders.py, demo.py                                # Admin Roles v2, reminders admin, public calculator
        │   ├── email_prefs.py     # email preferences + unsubscribe (see §0b)
        │   ├── support.py         # NEW
        │   ├── home.py            # NEW 2026-10-11 - / and /index.html (Start Here) + 301 for /dashboard/about.html
        │   ├── admin.py           # now also settings/donations endpoints
        │   └── devlog.py          # now also deployments history + overdue alerts
        └── static/
            ├── index.html
            ├── register.html
            ├── records-archive.html   # NEW
            ├── payoff-strategy.html
            ├── help.html
            ├── account.html
            ├── (about.html removed 2026-10-11 - /dashboard/about.html now 301s to /; see §0e)
            ├── contact.html            # NEW
            ├── donate.html             # NEW
            ├── donate-public.html      # NEW
            ├── donate-success.html     # NEW
            ├── donate-cancel.html      # NEW
            ├── shared.css
            ├── shared.js
            ├── site-scripts.js         # NEW 2026-10-02 — single site-wide script loader (Umami etc.)
            ├── reading-tracker.js      # NEW 2026-10-02 — scroll-depth / engaged-time / article-read events
            ├── household.html, budget.html, windfall.html, utilization.html, milestones.html, import.html   # NEW since 2026-10-02
            ├── a11y.css, a11y.js, accessibility.html   # NEW 2026-10-09 - see accessibility_standards.md
            ├── favicon.svg
            ├── cutthecard-*.png/.jpg   # NEW — dark/light logo variants
            ├── learn/                  # NEW — public educational content
            │   ├── index.html
            │   ├── learn.css
            │   ├── avalanche-vs-snowball.html
            │   ├── extra-payments.html
            │   ├── credit-utilization.html
            │   ├── credit-card-interest.html
            │   ├── minimum-payments.html
            │   └── balance-transfer.html
            └── admin/
                ├── accounts.html
                ├── devlog.html
                ├── donations.html          # NEW
                ├── revenue.html            # NEW 2026-09-30 — combined revenue view
                ├── blog.html               # NEW 2026-09-30 — blog post list
                ├── blog-editor.html        # NEW 2026-09-30 — blog editor
                ├── subscriptions.html      # SitePay admin (tiles/columns added 2026-09-30)
                ├── campaigns.html          # email campaigns admin
                └── support-requests.html   # NEW

The backup/api/ single-generation snapshot directory (inside the Production project root, written/overwritten by deploy_engine.py) is still present and unchanged in purpose — it now also contains the full current source tree as of the last deployment (confirmed present in this backup, same structure as api/).


24. Payoff Methodology

Unchanged. Single-account payoff (payoff.calculate_payoff()) and cascading payoff (payoff.calculate_payoff_ladder()) logic re-confirmed against this backup's payoff.py with no material differences from prior documentation.


25. Cache-Busting Rule — now inconsistently followed

Prior documentation described a single site-wide marker. As of this backup that is no longer true — see §4.3 for the actual current split (1.8.3 on 12 pages, 1.8.4 on 4 pages). The documented procedure itself is unchanged and still correct as a policy; it just wasn't fully followed on whichever change bumped the 4 pages to 1.8.4 (most likely the donation/about/payoff-strategy work, given which pages are on the newer marker):

  1. Increase the query-string version.
  2. Update all HTML pages that reference shared.css/shared.js.
  3. Deploy those files together.
  4. Test QA.
  5. Promote to Production.

Recommend a cleanup pass that bumps every page to a single new marker the next time shared.css or shared.js changes, rather than trying to retroactively figure out which of the two current values is "more correct."


26. Known Issues / Required Follow-Up

Critical — acknowledged, deferred, tracked (see §0a)

APP_SECRET_KEY is still not explicitly set in Production, and the same compose file now also contains live Stripe secret/publishable/ webhook keys in plaintext. This was first flagged when account-number encryption was the only thing riding on APP_SECRET_KEY; it's now higher-priority given the Stripe keys sitting alongside it. The user has acknowledged this (2026-09-15) and asked to circle back to it rather than fix it immediately — this is not being silently deferred. Per §0a, re-remind the user about this every ~5 days (or the next time this file is read, if more than 5 days have elapsed) until it's fixed or the user explicitly says to abandon it. Once fixed, remove this callout and the corresponding row in §0a's reminder table.

Recommended next step, updated for the current stakes:

  1. Generate a strong Production secret: openssl rand -hex 32.
  2. Move it — and the Stripe keys, which are equally sensitive — into the project's approved secret-management system (Vaultwarden, referenced the same way SMTP/DB credentials already are) rather than plaintext in debteliminator.yml.
  3. Configure APP_SECRET_KEY in Production; use a separate one in QA.
  4. Recreate the containers.
  5. Never rotate the Production APP_SECRET_KEY after encrypted account numbers have been stored.
  6. Consider whether the Stripe keys specifically warrant an env file (.env, docker compose --env-file, chmod 600, excluded from any future version-control or unencrypted-backup handling) rather than living directly in the checked-in-style compose YAML, given they're live payment-processing credentials rather than internal-service credentials.

Open — confirmed, tracked (see §0a)

  • routers/devlog.py generates two manual-recovery/verification instruction strings still hardcoded to https://debt.kingdezigns.com — confirmed stale now that cutthecard.net is the confirmed primary domain (§2a), not just possibly stale. Per §0a, keep reminding until this — and any other stray debt.kingdezigns.com reference found in code or docs — is scrubbed.
  • main.py's startup log line still says "Starting CutTheCard v1.9.2" — out of sync with the actual version="1.10.1" field a few lines above it. Cosmetic, no reminder needed, just worth a one-line fix whenever someone's next in that file.
  • Cache-busting marker inconsistency across pages (§4.3/§25).

New open items (2026-09-30)

  • Revenue classification of grandfathered recurring donors. The payment_kind backfill and the invoice.paid rule classify by users.stripe_subscription_id. Phase 2 links recurring donors' subscriptions onto that column, so their pre-conversion donation history is reclassified as subscription revenue and leaves the Donations totals. If donation history must stay intact, restrict the backfill/rule to payments on/after subscription_launch_date (not implemented — needs a decision).
  • Ledger purity vs. the original Phase 3 docstring (subscribe.py says no Donation row is written) — now only true for the checkout-completed step; revise that docstring when next in the file.
  • Revenue periods are UTC, so a charge made late on the last day of a month in US time can land in the next UTC month. Acceptable for now; note when reconciling against Stripe's dashboard.
  • Blog: archived versions are indexable and self-canonical (chosen so old URLs keep resolving); if duplicate-content dilution appears in Search Console, switch archived canonicals to the current version.
  • Doc reconciliation debt: SitePay and Email Campaigns need a full §-level write-up from source (§0b is summary only). main.py version string (1.10.1) and startup log (v1.9.2) are stale relative to DevLog v2.1.3.

New open items (2026-10-02)

  • Privacy Statement needs an analytics disclosure (first-party, cookie-free, page-level only including inside the app; no financial data, no identity). Legal review; publishing a new version triggers the re-acceptance gate for all users, so bundle with another legal change if possible.
  • Verify custom reading events in production (see §12h Status).
  • Doc reconciliation debt: DevLog v2.1.4–2.1.7 contents are not itemized (§0c); SitePay/Email Campaigns still summary-level (§0b).
  • In-flight demo pages are not documented and are untagged unless added to the loader tag set (apply_site_scripts.py <app-dir> static/<page>.html).
  • Optional: separate "CutTheCard QA" Umami website so the loader can be tested in QA; CTA click events for funnel measurement.

New open items (2026-10-11)

  • Nav Phase 2 (merge similar pages) not started; Phase 1 (§8b) is in QA, Production promotion unconfirmed. Log it in the DevLog (queue item "Nav grouping" is still pending).
  • Run a11y_audit.py and the manual screen-reader pass for the new nav and the Household page before Deploy to Prod (§8b, accessibility_standards.md).
  • Doc reconciliation debt: v2.1.4-2.1.20 features are summary-level (§0d, §12i-12j). main.py version string (1.10.1) and startup log (v1.9.2) are stale.
  • Household: confirm how "paid plan" is enforced for owners, and include Household in the Privacy Statement review (members' access to an owner's records and the activity log are personal-data processing).
  • Backups: the v2.1.20 archive is a QA backup; the standing backup script is Production-only. Note which environment each archive covers when filing it.
  • Cache markers: unify blog.py / public calculator page (?v=1.9.2) with the app pages (?v=1.9.5) at the next shared.* change.
  • APP_SECRET_KEY is also unset in the QA compose file (§0a).

New open items (2026-10-11, home page swap)

  • Confirm QA deployment of home-page-swap-v2.1.22.tar.gz, then promote via Deploy to Prod; create/attach the DevLog item (the package label v2.1.22 is an assumption - use whatever version the Dev Log assigns).
  • Run a11y_audit.py and the manual keyboard/screen-reader pass on the new Start Here page (and on the signed-out view at /) before Deploy to Prod.
  • Delete the orphan static/about.html from Production after the deploy (optional; the 301 route takes precedence).
  • Watch Search Console for the / canonical move and the retired /dashboard/about.html URL.
  • Signed-out visitors see only the login/marketing overlay at / - the Start Here copy is in the page but hidden until sign-in (same behaviour About had). Consider whether crawlers should see it.

Carried forward, still accurate

  • Automated pipeline first-use recommendations (verify docker CLI/mounts before trusting a models.py/Dockerfile-touching deployment; always review the preview diff).
  • Backup coverage: the dedicated Debt Eliminator backup still protects Production only — QA recovery still requires a separate strategy.

Needs a decision, not a bug

  • Affiliate program (§12c) — disclosure page is live, actual affiliate links are still an unversioned queue item. Don't let the two drift further apart than necessary (a disclosure page for a program that isn't running yet is fine short-term, but worth revisiting if it sits open a long time).

27. Version / Feature History

DevLog production deployment history — additions since v2.0.3

DevLog version Date deployed Production task(s)
v2.0.4 2026-09-04 New logo added to site; logo bug fix
v2.0.5 2026-09-04 Accounts Deck + Debt Reduction Plan layout/styling enhancement
v2.0.6 2026-09-05* About CutTheCard page; login screen marketing message + layout
v2.0.7 2026-09-07 Donation link text update; Stripe Donation Integration
v2.0.8 2026-09-07 Suspend & Delete My Account (self-service)
v2.0.9 2026-09-07 Recurring/subscription donation option
v2.0.10 2026-09-08 support@cutthecard.net mailbox; Privacy Statement (US-based only)
v2.0.11 2026-09-08 Phase 1 — SEO Foundation & Search Engine Accessibility
v2.0.12 2026-09-09 Phase 2 — Educational Content & SEO Growth (Learning Center)
v2.0.13 2026-09-09 Log donation data (structured donations table)
v2.0.14 2026-09-09 Learning Center links added to the login page
v2.0.15 2026-09-09 Affiliate Disclosure page (legal document)
v2.0.16 2026-09-09 Admin — View Donation Log
v2.0.17 2026-09-10 Dev Log — collapsed/last-5 release display; Records Archive (.xlsx/.docx year-end export)
v2.0.18 2026-09-10 Support/Assistance form added to Help Center
v2.0.19 2026-09-12 Dark vs. Light theme, per-user + admin default

* v2.0.2 shows a later deployed_at timestamp (2026-09-05) than v2.0.3–v2.0.6 in the raw DevLog table, which is an out-of-order artifact in the source data itself (deploy timestamps not monotonic with version numbers around that range) — noted here rather than silently "corrected," since it reflects the actual DevLog record.

Application source milestones — additions since 1.9.5

App version Features
1.9.5–1.10.0 Stripe donations (one-time + recurring), donor tracking on User
~1.10.1 (current) Self-service suspend/delete, Privacy Statement, Affiliate Disclosure, SEO foundation + Learning Center, Records Archive export, Support/Contact form, Dev Log assignment/due-date/overdue-alerts + deployment history, dark/light theme

(Exact per-version app-source mapping wasn't preserved with the same granularity as the 1.7.0–1.9.5 range in prior documentation — the DevLog production history table above is the more reliable source for "what shipped when" going forward.)


28. Current Backup Audit — 2026-09-15

The 2026-09-15 archive (debteliminator-v2.0.19-backup-2026-09-15_00-00-01.tar.gz) contains:

  • Production application files, including all new modules (seo_router.py, routers/donate.py, routers/support.py, routers/records_archive.py) alongside the previously-documented deploy_engine.py, balance_transfer.py, interest_engine.py
  • Production PostgreSQL dump
  • MANIFEST (host kingdezigns16, source /Kingdezignsnas16/ debteliminator, destination /export/kingdezignsnas-16/Public/07 - Projects/NAS16/debteliminator)
  • Docker Compose configuration (debteliminator.yml, debteliminator.env, compose.override.yml) — debteliminator.env and compose.override.yml are both currently empty templates (OMV boilerplate only); all real configuration lives in debteliminator.yml
  • A backup/api/ single-generation deploy-engine snapshot, structurally parallel to the live api/ tree
  • 20 static HTML/asset files under api/app/static/ (up from 7 previously), including the full learn/ subtree and new logo variants

The database confirms the latest deployed DevLog version is v2.0.19. The source confirms the application reports 1.10.1. The frontend cache marker is split between 1.8.3 and 1.8.4 (§4.3) rather than a single value. The backup is internally consistent once these version namespaces — and the cache-marker split — are understood.


29. Summary for AI Systems

  • Debt Eliminator / CutTheCard runs on NAS16 / VLAN 50 / 192.168.150.40. Production port 8002, QA port 8003, unchanged.
  • Public branding has moved to cutthecard.net — confirmed for both environments. Production is https://www.cutthecard.net; QA is https://debt.qa.cutthecard.net. NPM on HAS and Dreamhost DNS have both been updated for both hostnames. cutthecard.org redirects to cutthecard.net at Dreamhost only, not in NPM. debt.kingdezigns.com and debt.qa.kingdezigns.com are deprecated — stray references to either (in this doc set and in routers/devlog.py's generated text) are tracked in §0a until fully scrubbed.
  • DevLog deployed version is now v2.0.19 (was v2.0.3); application source is now 1.10.1 (was 1.9.5); the frontend cache marker is no longer a single value — split between 1.8.3 and 1.8.4 across pages.
  • Major feature additions since the last reconciliation: Stripe donations (one-time + recurring, structured donations table, admin log, anonymous public donate page), Support/Contact request form (public, 48h SLA, admin queue), self-service account suspend/delete, Privacy Statement + Affiliate Disclosure legal documents (affiliate links themselves not yet live), Records Archive (.xlsx/.docx year-end export with a derived delinquency heuristic), SEO foundation + public Learning Center (six educational articles, robots.txt/sitemap.xml), and dark/light theme.
  • Dev Log gained assignment/due-date/on-hold fields on queue items, a weekly overdue-item alert email (fires every 7 days regardless of APP_ENV), a permanent deployment-history table (deployment_records, separate from the single-generation file snapshot), and a default-collapsed "last 5 releases" view.
  • New Python dependencies: stripe, openpyxl, python-docx — require an image rebuild on first deploy to an environment that doesn't already have them.
  • APP_SECRET_KEY is still not set in Production — was already a known issue, now more urgent because live Stripe secret/publishable/webhook keys are also stored in plaintext in the same Production compose file. User has acknowledged and deferred this (2026-09-15) — see the standing reminder in §0a, and re-surface it every ~5 days until resolved.
  • Minor stale references found and worth a quick fix: devlog.py's generated manual-recovery instructions still hardcode debt.kingdezigns.com; main.py's startup log line still says v1.9.2 instead of matching the real 1.10.1 app version.
  • The dedicated Debt Eliminator backup still covers Production only (not QA) — unchanged.
  • 2026-09-30: DevLog is v2.1.3. New: Blog Engine (/blog, /blog/archive, /blog/{slug}; revisions each have their own URL/slug; Preview/Schedule/Publish/Archive/Unpublish; scheduling via promote_due() lazily + 60 s background worker; images in PostgreSQL; HTML sanitized at render; admin UI under /dashboard/admin/blog*.html), donations.payment_kind unified revenue ledger, Subscriptions admin tiles/pills/per-user amounts/year selector + Sync Payments from Stripe, and Admin → Revenue combined page. SitePay and Email Campaigns exist in the code but are documented at summary level only (§0b).
  • Open: APP_SECRET_KEY still unset in Production (overdue reminder, §0a); grandfathered-donor revenue reclassification decision (§26).
  • 2026-10-02: Production backup seen is DevLog v2.1.7 (v2.1.4–2.1.7 not itemized). New: site-wide script loader — every page carries one <script defer src="/dashboard/site-scripts.js?v=1">; scripts are added/changed only in static/site-scripts.js. It loads Umami (self-hosted at stats.cutthecard.net, see server_umami.md) and, on pages with an <article>, reading-tracker.js (scroll-depth, engaged-time, article-read). Admin pages are never tracked; only production hostnames report (QA is null); Do Not Track / Global Privacy Control honored; Stripe-return pages have query/hash stripped; tracking is page-level only with no identify(). Blog gets it via routers/blog.py _page() (skipped for noindex/preview pages). Open: Privacy Statement disclosure, confirm custom events, document the in-flight demo.
  • 2026-10-11: DevLog is v2.1.20 (from the QA backup). Since v2.1.7: Admin Roles v2, public Demo Calculator, Debt Reduction Plan tuning + balance-transfer triggers, Milestones, Windfall Allocator, CSV/Statement Import (in memory, nothing stored), WCAG 2.2 AA accessibility layer, due-date/promo-expiry reminders, Credit Utilization, Budget-to-Payoff, blog auto-archive/rotation, and Household Sharing (owner invites by email as view/edit; member "switches into" the owner's data via get_data_user(); members never see full account numbers, billing, profile, Budget or manage members; owner-visible activity log; sharing is a paid-plan feature per Help Center text). Details are summary-level (§0d, §12i-12j).
  • Sidebar nav is grouped (Phase 1, §8b): Accounts | Track (Payment Register, Import Transactions, Budget) | Plan (Debt Reduction Plan, Windfall Allocator, Credit Utilization, Milestones) | Learn (Learning Center, Blog) | Help (Help Center, Contact / Support) | Account (My Profile, Household, Subscription, Records Archive); admin groups People / Money / Content + Dev Log. Accordion, active group open, real <button>s with aria-expanded. About CutTheCard is in the sidebar footer; Free Calculator is logged-out only. Edit DE_NAV_ALL / DE_NAV_ADMIN in shared.js to add pages. Cache marker is ?v=1.9.5. Phase 2 (merge similar pages) not started.
  • 2026-10-11 Home Page Swap (§0e): the old About page is now the home page ("Start Here") at / and /index.html; / no longer redirects to /dashboard/; Accounts stays at /dashboard/index.html; /dashboard/about.html 301s to /; sign-in from an entry page lands on /; logo and sidebar footer ("Start Here") point to /; steps section moved above "How CutTheCard Helps You Win"; hero shortened. Source public_pages/home.html + routers/home.py. Cache marker now ?v=1.9.6. Restart-only deploy.
  • STANDING RULE (§3a-0): every delivery of files must OPEN with the SCP -> sudo cp -> sudo docker restart debteliminator_qa_api command block (real file names and QA paths, sudo rm for deletions, restart-vs-rebuild stated, verification lines), before any explanation. Mandatory every time, even for one-file changes and follow-up revisions.
  • Never document actual production passwords, SMTP passwords, database passwords, encryption keys, session secrets, or Stripe keys.