Jump to content

TaxRateCollector/SPEC

From MindAttic Docs

TaxRateCollector — Product specification

The complete product, written down before it is built (owner, 2026-11-30, MAT-T360). Every epic, feature and story the finished product will have is listed here, built or not. The ticket tree mirrors this file one to one: every ID below is a ticket. Nothing gets built unless it is here, and anything taken out of here is closed wont-do in the tree. docs/RELEASE.md says which part of this the current milestone delivers.

1. Product definition

Place in the ecosystem: A product (App) in docs/ECOSYSTEM.md §2.2: evidence-backed US sales and excise tax rates. TaxRateCollector keeps a provably accurate master table of US sales and excise tax rates for every jurisdiction (Country, State, County, City and special districts), each rate bound to the hashed, timestamped government document it came from. It is a Blazor Server app with a background Worker over one engine, for the owner as an internal rate database and for paying subscribers who need evidence-backed rates for the states they bill in. The finished product covers every US jurisdiction, re-scrapes every official source on a cadence and logs every change, keeps its evidence even when a .gov page disappears, and serves its data through the UI, file exports and a read-only API with change webhooks, all on a local SQL Server database.

2. Scope boundary

2.1 In the product

  • The jurisdiction hierarchy with ZIP lookup, the SSUTA product taxonomy and per-state tax profiles.
  • A cumulative rate engine covering sales tax and every excise basis, with rate history kept, never overwritten.
  • Evidence capture and verification for every rate (TRC-LAW-1).
  • Scrapers for every state's official sources, scheduled re-scraping, change detection and alerts.
  • AI-assisted rate discovery through MindAttic.Legion, always behind a human review queue.
  • Subscriptions by state and category through PayPal, Identity roles and the view-as preview.
  • The jurisdiction workbench, calculator, exports, logs, glossary, settings in MindAttic.Vault, backup.
  • A read-only rates API with rate-change webhooks.
  • Local hosting only: SQL Server on localhost, deployed by run.ps1 to R:\MindAttic\Apps\TaxRateCollector.

2.2 Never in the product

  • Cloud hosting (Azure, Hetzner, containers, CI/CD deploys, Key Vault, Blob storage): Azure was decommissioned on 2026-11-26 and the Hetzner move was dropped (TRC-T66, T67, T68; MAT-T244).
  • A SQLite or other datastore path: SQL Server is the only datastore (TRC-LAW-8).
  • A GraphQL endpoint: the read-only REST endpoint (TRC-T202) covers the one consumer shape; a second query surface would duplicate it.
  • Bulk CSV rate import: a hand-imported rate has no source document, which TRC-LAW-1 forbids; rates enter through scrapers, discovery or an edit that carries evidence.
  • PDF export: the HTML export prints to PDF.
  • Playwright page screenshots as evidence: HTML capture with its assets (TRC-T146) already preserves the page.
  • Automatic bacpac backups on startup: backup is an explicit Setup action (TRC-T185), not a boot cost.
  • Keyboard navigation of the jurisdiction tree: polish with no user asking for it.
  • Moving logging to MindAttic.Log (TRC-T10): the EF sink behind the Logs page serves the need.
  • A settings page of its own or a Vault Dashboard tab (TRC-T25 to T28): settings live in MindAttic.Vault.Desktop (TRC-T184).
  • Generic sweeps: "run the whole suite and fix everything", open-ended bughunts, "clean up code" passes (TRC-T15, T16, T65). Work is filed as concrete tickets.

3. Users and roles

  • Owner / Administrator: runs Setup, edits rates and evidence, runs scrapes and discovery, reads logs, manages settings in Vault. Needs a trustworthy, complete table and a calm operating surface.
  • Approver: reviews AI-extracted rates. Needs a fast approve/reject queue with the evidence beside each rate.
  • Subscriber: pays per state and category; reads and exports those rates. Needs correct rates with proof, and (later) self-service changes and an API.
  • Guest: sees the product with rates redacted.
  • Enterprise consumer (later): a billing system calling the rates API and receiving change webhooks.
  • Worker host: the unattended re-scrape process; needs the same engine and database as the UI.

4. Requirements

Status is built (closed ticket, with evidence) or MS-n: the milestone in §7 that delivers it (MS-29 active, then MS-99, then MS-100). Every unbuilt story is approved and prioritised in build order; the planner splits a story into tasks when the queue reaches it. Priorities in brackets.

E1. Rate engine — TRC-T122 — built

Cumulative, evidence-bound rate calculation over the jurisdiction chain, with full excise math.

F1.1 Chain calculation — TRC-T123 — built

  • S1.1.1 Combined chain rate — TRC-T124 — built As a tax team, I get a point-of-sale rate that sums every applicable tier, so the rate is correct. Acceptance: Given a CA, Los Angeles County, Beverly Hills chain, when I calculate, then the total equals the sum of the tiers. Evidence: CombinedRate_City_SumsStatePlusCountyPlusCity; TRC-T35, TRC-T39.
  • S1.1.2 Combined-rate rows — TRC-T125 — built As a tax team, a published combined rate (CA/IL/TX) is not double-counted with its ancestors. Acceptance: Given a city row marked IsCombinedRate, when I calculate, then state and county sales tax are not added again. Evidence: IsCombinedRate migration, TRC-T39.
  • S1.1.3 Unknown jurisdiction is null — TRC-T126 — built As an integrator, an unknown jurisdiction or one with no current rates returns null instead of throwing. Acceptance: Given an unknown jurisdiction ID, when I calculate, then the result is null. Evidence: UnknownJurisdiction_ReturnsNull, NoCurrentRates_ReturnsNull.

F1.2 Rate history — TRC-T127 — built

  • S1.2.1 One current rate — TRC-T128 — built As a tax team, exactly one current rate exists per jurisdiction and category, prior rates retired not deleted. Acceptance: Given an edited rate, when I save, then the old row is IsCurrent=false and a new current row exists. Evidence: TaxRate_OnlyOneCurrentRatePerJurisdiction; TRC-T35.

F1.3 Excise math — TRC-T129 — built

  • S1.3.1 Excise bases and brackets — TRC-T130 — built As a billing system, per-unit, per-volume, per-proof-gallon, per-weight and percentage-of-wholesale rates, brackets, caps, compound tax and floors calculate correctly. Acceptance: Given a FlatCapPerUnit rate, when a percentage would exceed the cap, then the cap applies. Evidence: TaxCalculatorTests.

F1.4 Point-of-sale calculator — TRC-T131 — built

  • S1.4.1 ZIP calculator page — TRC-T132 — built As a user, I enter a ZIP and see each tier and the combined total. Acceptance: Given an imported ZIP, when I enter it on TaxCalc, then each tier and the total show. Evidence: TaxCalc.razor.

E2. Jurisdictions and taxonomy — TRC-T133 — built

The US jurisdiction hierarchy, ZIP lookup, SST product taxonomy and state profiles.

F2.1 Hierarchy and seeding — TRC-T134 — built

  • S2.1.1 Hierarchy seeding — TRC-T135 — built As a data steward, counties are parented to their state and re-seeding never duplicates. Acceptance: Given a seeded database, when the seeder runs again, then no row is duplicated. Evidence: Hierarchy_SeederDoesNotSeedIfCountryExists.
  • S2.1.2 Taxonomy and state profiles — TRC-T136 — built As an admin, the SST Appendix C taxonomy and 51 state profiles seed idempotently on startup. Acceptance: Given a fresh database, when the app starts, then two taxonomy roots and 51 profiles exist. Evidence: SeedAsync_IsIdempotent, TaxCategorySeederTests.

F2.2 Census and ZIP import — TRC-T137 — built

  • S2.2.1 Crosswalk parsing — TRC-T138 — built As an admin, ZIP crosswalk parsing picks the primary county and place by largest land-area part. Acceptance: Given a ZCTA split across two counties, when parsed, then the larger part wins. Evidence: ZipCrosswalkParserTests, ZctaCrosswalkTests.
  • S2.2.2 Setup import pipeline — TRC-T139 — built As an admin, Setup runs URL validation, SST, Census and ZIP import, source URL assignment and the scrape trigger. Acceptance: Given an empty database, when I run the Setup steps in order, then each reports its counts. Evidence: Setup.razor, ZipImport.razor.
  • S2.2.3 USPS city enrichment — TRC-T140 — built As an admin, ZIP import enriches city names through USPS CityStateLookup and marks them UspsValidated. Acceptance: Given a USPS key, when ZIPs import, then USPS-confirmed cities carry UspsValidatedAt. Evidence: ZipImportService.

E3. Evidence and provenance — TRC-T141 — built

Every rate bound to a hashed, timestamped .gov artifact (TRC-LAW-1).

F3.1 Evidence store — TRC-T142 — built

  • S3.1.1 Hashed evidence — TRC-T143 — built As an auditor, every rate's evidence is SHA-256 hashed and tamper-evident, verifiable offline. Acceptance: Given tampered content, when verified, then verification fails. Evidence: EvidenceValidationTests.
  • S3.1.2 Evidence panel — TRC-T144 — built As an admin, I attach evidence by drag and drop on a jurisdiction and the store classifies and saves it. Acceptance: Given a dropped CSV, when saved, then its type is Csv and its hash is stored. Evidence: EvidenceFileStoreTests.

F3.2 Evidence capture — TRC-T145 — built

  • S3.2.1 HTML capture with assets — TRC-T146 — built As an admin, a captured HTML source is zipped with its CSS, script and images when full-page capture is on. Acceptance: Given full-page capture on, when a page is captured, then the zip holds its linked assets. Evidence: f4ce9b7 (TRC-T62).
  • S3.2.2 Linked PDF auto-fetch — TRC-T147 — built As an admin, PDFs linked from an HTML source page are fetched and attached when auto-fetch is on. Acceptance: Given a source page linking a PDF, when scraped, then the PDF is attached as evidence. Evidence: b9c546e (TRC-T61).

E4. Scraping and change detection — TRC-T148 — built

Official sources re-scraped on a cadence with every change logged (TRC-LAW-4).

F4.1 Source scrapers — TRC-T149 — built

  • S4.1.1 Format strategies — TRC-T150 — built As the system, CA CSV, IL HTML table and TX XLSX sources parse and invalid rows are skipped. Acceptance: Given a row with an invalid rate, when scraped, then it is skipped. Evidence: StrategyScraperTests.
  • S4.1.2 State bulk scrapers — TRC-T151 — built As the system, Wisconsin sales tax and twelve state alcohol and excise scrapers load their rates in bulk. Acceptance: Given a full scrape, when two scrapers share a state, then both run without error. Evidence: BulkSalesTaxScraperTests; e86ddff (TRC-T71).
  • S4.1.3 Rate sanitizer — TRC-T152 — built As the system, rate strings such as 6.25%, 0.0625 and $0.231/pack normalise to decimals. Acceptance: Given 1.00 untagged, when sanitised, then it reads as 1%. Evidence: SanitizerTests; e2708b2 (TRC-T73).
  • S4.1.4 Fetch fallback ladder — TRC-T153 — built As the system, a failed fetch falls back through browser user agents, archives and a reader proxy. Acceptance: Given a 200 without the required content, when fetched, then the next tier is tried. Evidence: ScraperHttpHelperTests (TRC-T2).

F4.2 Change detection — TRC-T154 — built

  • S4.2.1 Change log — TRC-T155 — built As the system, a changed, removed or restructured rate writes a ChangeLogEntry and an unchanged one writes none. Acceptance: Given an unchanged re-scrape, when diffed, then no entry is written. Evidence: DiffEngineTests.
  • S4.2.2 Scrape alerts — TRC-T156 — built As an admin, scrape anomalies raise alerts I can acknowledge all at once. Acceptance: Given open alerts, when I acknowledge all, then none remain open. Evidence: AlertServiceTests.

F4.3 Scheduled re-scraping — TRC-T157 — built

  • S4.3.1 Re-scrape cadence — TRC-T158 — built As the system, every source is re-scraped each default_update_frequency_days days. Acceptance: Given a source scraped N days ago, when N reaches the setting, then a re-scrape is queued. Evidence: efc245c (TRC-T63), 621e490 (TRC-T98).
  • S4.3.2 Scrape runs with pause and resume — TRC-T159 — built As an admin, I see scrape-run history and pause or resume a run; one HTTP timeout does not stop it. Acceptance: Given a running scrape, when I pause and resume, then it continues where it stopped. Evidence: ScrapeRuns.razor; 5b84ceb (TRC-T93).
  • S4.3.3 Worker host — TRC-T160 — built As the owner, a separate Worker re-scrapes unattended without competing with the UI. Acceptance: Given a Pending run, when the Worker polls, then it claims and runs it once. Evidence: TaxRateCollector.Worker.

E5. AI discovery and review — TRC-T161 — built

LLM-assisted discovery of rate laws, always behind human review.

F5.1 AI rate discovery — TRC-T162 — built

  • S5.1.1 Legion extraction — TRC-T163 — built As the system, AI rate extraction routes through MindAttic.Legion and falls back to a stub without a key. Acceptance: Given no key, when extraction runs, then it returns no rates and does not throw. Evidence: ClaudeExtractionParserTests; eafabeb (TRC-T94).
  • S5.1.2 Recursive discovery — TRC-T164 — built As an admin, discovery walks a jurisdiction hierarchy and saves extracted rates with evidence flagged NeedsReview. Acceptance: Given a state, when discovery runs, then new rates arrive with NeedsReview=true. Evidence: RecursiveRateScraperTests.

F5.2 Review queue — TRC-T165 — built

  • S5.2.1 Approve or reject — TRC-T166 — built As an approver, I approve or reject extracted rates; approved ones become current. Acceptance: Given a pending rate, when I approve it, then it is current and the prior rate retired. Evidence: NeedsReviewFlowTests; 962bda7 (TRC-T74).

E6. Subscriptions and access — TRC-T167 — built

Paid access by state and category, roles and the view-as preview.

F6.1 Billing — TRC-T168 — built

  • S6.1.1 Per-state pricing — TRC-T169 — built As a subscriber, I pay per subscribed state and category at the configured unit price, never negative. Evidence: BillingCalculationTests; 248efce (TRC-T83).
  • S6.1.2 Subscription tax — TRC-T170 — built As a subscriber, tax on my subscription uses my billing state, and zero-tax states charge none. Evidence: BillingRecord_TaxOnSubscription_UsesSubscriberBillingState.
  • S6.1.3 PayPal checkout — TRC-T171 — built As a subscriber, I check out with PayPal and activation completes even after a retried capture. Evidence: PayPalServiceTests; 2bb78a8 (TRC-T75).

F6.2 Access control — TRC-T172 — built

  • S6.2.1 Roles and gating — TRC-T173 — built As the owner, Administrator and Approver roles gate writes, and subscribers see only their states and categories. Acceptance: Given a subscriber, when they export, then only their states are included. Evidence: 26010d6 (TRC-T77), 5f49d54 (TRC-T79).
  • S6.2.2 Account flows — TRC-T174 — built As a user, I register, sign in and manage my account. Evidence: Register.razor; aab3ad3 (TRC-T92).
  • S6.2.3 View-as preview — TRC-T175 — built As an admin, I preview the UI as Subscriber or Guest without leaving my session. Evidence: ViewAsService.

E7. Data surfaces — TRC-T176 — built

The pages and exports people use the data through.

F7.1 Jurisdiction workbench — TRC-T177 — built

  • S7.1.1 Jurisdiction tree — TRC-T178 — built As an admin, I browse a lazy-loading jurisdiction tree and edit rates inline with full precision. Evidence: Jurisdictions.razor; 6b59788 (TRC-T76).
  • S7.1.2 Sales tax exports — TRC-T179 — built As a billing system, I export current sales tax rates with evidence to CSV, XLSX, SQL and HTML. Evidence: ExportFormattingTests, ExportEvidenceSubqueryTests.
  • S7.1.3 Master rate table — TRC-T180 — built As a user, I view the master rate table and export it to CSV. Evidence: Rates.razor.

F7.2 Operations pages — TRC-T181 — built

  • S7.2.1 Application logs — TRC-T182 — built: admin-only log viewer with clear-older-than. Evidence: 5f49d54, 4349c1a.
  • S7.2.2 Glossary — TRC-T183 — built: in-app glossary of every domain term. Evidence: TRC-T81 to TRC-T88.
  • S7.2.3 Settings in Vault — TRC-T184 — built: settings and keys live in MindAttic.Vault.Desktop; the cog opens it. Evidence: 0beefef (TRC-T29).
  • S7.2.4 Database backup — TRC-T185 — built: Setup exports the database to a bacpac without hanging. Evidence: 9734231 (TRC-T80).
  • S7.2.5 Run menu — TRC-T186 — built: run.ps1 builds and deploys through the shared run menu. Evidence: 885cda3 (MAT-T306).

E8. Runs locally like every app — TRC-T101 — MS-29 (priority 900)

Runs on a dedicated localhost SQL Server database with no Azure leftovers, deployed to R: by the run menu.

F8.1 Localhost SQL database — TRC-T105 — MS-29 (990)

  • Task TRC-T58 — Development connection strings point at localhost, database TaxRateCollector.
  • Task TRC-T59 — One-shot move of existing LocalDB data to the localhost instance (bacpac, from Setup).
  • Task TRC-T114 — Remove Azure leftovers (design-time factory, testsettings, azure-deploy.yml, Key Vault comments).
  • Task TRC-T60 — TRC-LAW-8, BIBLE and docs/overview.md say the database is the localhost instance. Acceptance: Given a fresh clone and the localhost instance, when the app starts, then it migrates and seeds the TaxRateCollector database with no Azure reference anywhere in the repo.

F8.2 Run-menu deploy on R: — TRC-T106 — MS-29 (980)

  • Task TRC-T99 — Debug and Release builds deploy to R:\MindAttic\Apps\TaxRateCollector and launch. Acceptance: Given run.ps1, when I pick Deploy & Run, then the build lands under R: and starts.

E9. Data and scraper correctness — TRC-T102 — MS-29 (priority 800)

F9.1 Full jurisdiction corpus — TRC-T107 — MS-29 (890)

  • Task TRC-T115 — Import and count ~3,144 counties, 10,000+ cities and ~33,000 ZIP rows; record counts in BIBLE §6.

F9.2 Every state scraper correct — TRC-T108 — MS-29 (880)

  • Task TRC-T97 — Read the alcohol scrapers TRC-T95 left unread and fix each real bug under its own ticket.

F9.3 Excise in exports — TRC-T109 — MS-29 (870)

  • Task TRC-T116 — CSV, XLSX, SQL and HTML exports include current excise rates, with the same access limits. Acceptance: Given a state with excise rates, when exported, then excise rows appear beside sales tax rows.

F9.4 Polish and release 1.0 — TRC-T113 — MS-29 (860)

  • Task TRC-T117 — Glossary and Setup stop describing a working Wayback evidence fallback.
  • Task TRC-T118 — Retire TODO.md; this spec and docs/RELEASE.md are the backlog.
  • S9.4.1 1.0 release sign-off — TRC-T212 — MS-29 As the owner, I open the 1.0 Release build on R:, calculate a rate against the full corpus and confirm the docs describe what I see. Acceptance: Given every MS-29 task closed, when I run the Release build, then the counts, rates and docs agree. Every MS-99 story requires this one.

E10. Data pipeline proven by tests — TRC-T103 — MS-29 (priority 700)

F10.1 Importer tests — TRC-T110 — MS-29 (790)

  • Tasks TRC-T3 (Census importer), TRC-T4 (ZIP importer), TRC-T5 (SST taxonomy importer).

F10.2 Background service tests — TRC-T111 — MS-29 (780)

  • Tasks TRC-T6 (ScrapeWorkerService, ScrapeSchedulerService), TRC-T7 (ScrapeJobWorker, MonthlySchedulerService).

F10.3 Seeder and Blazor service tests — TRC-T112 — MS-29 (770)

  • Tasks TRC-T8 (DemoSubscriberSeeder), TRC-T9 (ViewAsService, EfCoreSink).

E11 (TRC-T104 "Docs match the code") was a bucket epic: closed wont-do on 2026-11-30 (MAT-T470); its feature became F9.4, the 1.0 polish-and-release feature.

E12. Coverage expansion — TRC-T187 — MS-99 (priority 500)

Rates for every US jurisdiction, not just the states with scrapers today.

F12.1 SST member states — TRC-T188 — MS-99

  • S12.1.1 Shared SST scraper — TRC-T189 — MS-99 As a maintainer, one SstSalesTaxScraper loads general sales tax for all 24 SSUTA member states from the uniform SST rate files (RFC 0001). Acceptance: Given the SST rate files, when scraped, then every member state has current rates with evidence, and Wisconsin matches the pilot scraper.

F12.2 Non-SST states — TRC-T190 — MS-99

  • S12.2.1 Non-SST state rates — TRC-T191 — MS-99 As a tax team, every non-SST state with a sales tax has a scraper for its state and local rates, each with evidence. Acceptance: Given a full scrape, when it finishes, then every taxing state has current rates.
  • S12.2.2 Home-rule local rates — TRC-T192 — MS-99 As a tax team, home-rule cities in Colorado, Alabama and Louisiana have their self-administered rates with evidence. Acceptance: Given a home-rule city, when calculated, then its own rate is included.

F12.3 Jurisdiction validation — TRC-T193 — MS-99

  • S12.3.1 USPS batch validation — TRC-T194 — MS-99 As a data steward, a background job validates every Jurisdiction row against USPS, not only rows reached through ZIP import. Acceptance: Given the job has run, then every city row has UspsValidated set or a recorded mismatch.

E13. Evidence hardening — TRC-T195 — MS-99 (priority 400)

F13.1 Archive fallback — TRC-T196 — MS-99

  • S13.1.1 Wayback evidence capture — TRC-T197 — MS-99 As an auditor, when a live .gov source 404s, the evidence is captured from a Wayback snapshot and marked Archive with its snapshot URL. Acceptance: Given a dead source URL with a snapshot, when re-scraped, then the rate keeps hashed evidence whose source type is Archive.

F13.2 Value cross-check — TRC-T198 — MS-99

  • S13.2.1 PDF OCR cross-check — TRC-T199 — MS-99 As an auditor, a rate extracted from a PDF is cross-checked against OCR of that PDF and flagged for review when they disagree. Acceptance: Given a mismatch, when extracted, then the rate is NeedsReview.

F13.3 2.0 polish and release — TRC-T208 — MS-99 (470)

  • S13.3.1 2.0 release sign-off — TRC-T209 — MS-99 As the owner, I open the 2.0 Release build on R:, calculate a rate in a newly covered state and see its evidence. Acceptance: Given the Release build, when I check a newly covered state, then its rate and evidence show; coverage counts are in BIBLE §6 and the docs are current.

E14. Public integration surface — TRC-T200 — MS-100 (priority 300)

F14.1 Rates API — TRC-T201 — MS-100

  • S14.1.1 Rates endpoint — TRC-T202 — MS-100 As an enterprise consumer, GET /api/rates?state=&county=&city= returns the combined rate, its tiers and their evidence, limited to my subscription. Acceptance: Given a subscribed state, when I call the endpoint, then I get the same total as the calculator; an unsubscribed state is refused.

F14.2 Change notifications — TRC-T203 — MS-100

  • S14.2.1 Rate-change webhooks — TRC-T204 — MS-100 As an enterprise consumer, I register a webhook and receive each ChangeLogEntry for my subscribed states. Acceptance: Given a registered webhook, when a rate changes, then one signed POST arrives.

E15. Subscriber self-service — TRC-T205 — MS-100 (priority 200)

F15.1 Subscription management — TRC-T206 — MS-100

  • S15.1.1 Manage subscription — TRC-T207 — MS-100 As a subscriber, I add or remove states and categories, see the new monthly price and cancel, with PayPal updated to match. Acceptance: Given an active subscription, when I remove a state, then the next bill and access both drop it. Requires S15.3.1 (one sign-in).

F15.3 One sign-in — TRC-T213 — MS-100 (285)

  • S15.3.1 Sign in with the shared auth — TRC-T214 — MS-100 As a subscriber, I register, sign in and recover my account through MindAttic.Authentication (MFA, lockout, breached-password checks), and the app's own Identity tables are retired. Acceptance: Given an existing subscriber, when they sign in after the switch, then their account and subscriptions carry over and no app-local password store remains. Requires M.AUTH-T68 (the proven Authentication release): sign-in is the Authentication repo's concern (docs/ECOSYSTEM.md), not this app's.

F15.2 3.0 polish and release — TRC-T210 — MS-100 (280)

  • S15.2.1 3.0 release sign-off — TRC-T211 — MS-100 As the owner, I call the rates API, receive a webhook for a rate change and manage a subscription in the Release build. Acceptance: Given the Release build on R:, when I run those three flows, then each works and the API and webhook docs match; the product is finished.

5. Non-functional requirements

  • Platform: .NET 10, Blazor Server (InteractiveServer) plus a Worker host, Windows, run locally from R:\MindAttic\Apps\TaxRateCollector.
  • Data: SQL Server on localhost via EF Core 10; migrations are the schema history; seeders and importers are idempotent (TRC-LAW-7); rates and jurisdictions are retired, never deleted (TRC-LAW-2).
  • Correctness: no rate is valid for export without hash-verified evidence (TRC-LAW-1); every change is logged (TRC-LAW-4); decimal precision everywhere money or rates are involved.
  • Resilience: one failing source or timeout never stops a scrape run; transient SQL errors retry.
  • Security: keys (Anthropic via Legion, USPS, PayPal) resolve through MindAttic.Vault, never in code (TRC-LAW-5); logs and setup are administrator-only; evidence HTML is served sandboxed.
  • Verification: dotnet build TaxRateCollector.slnx clean; NUnit suites run only when the owner asks.

6. Interfaces and dependencies

  • Platform concerns (docs/ECOSYSTEM.md §2.1): Credentials and settings: MindAttic.Vault. LLM calls: MindAttic.Legion. Shipping: the shared run menu. Sign-in: MindAttic.Authentication (adopted by TRC-T214; until then the app keeps its own ASP.NET Identity, which the ecosystem assigns to Authentication).
  • Uses: MindAttic.Legion (LLM extraction), MindAttic.Vault (settings and keys), US Census gazetteers and ZCTA crosswalks, the SSUTA Appendix C PDF, USPS CityStateLookup, state revenue sites, PayPal, the Wayback Machine (fetch fallback), the shared run menu in MindAttic.Agency.
  • Used by: the owner and subscribers through the UI and exports; later, billing systems through the rates API.
  • Contract: exports and the calculator use the same cumulative-chain rules (TRC-LAW-6); evidence travels with every exported rate.

7. Release sequence

  1. MS-29 TaxRateCollector 1.0 local rate database (active, docs/RELEASE.md): E8, E9, E10, E11.
  2. MS-99 TaxRateCollector 2.0 national coverage (planned): E12 and E13 — every taxing jurisdiction with durable, cross-checked evidence; ends with F13.3 polish and release.
  3. MS-100 TaxRateCollector 3.0 integration (planned): E14 and E15 — the API, webhooks and subscriber self-service; ends with F15.2 polish and release. When this is reached, the product is finished.

Priorities run down the sequence: MS-29 epics 900 to 600, then E12 500, E13 400, E14 300, E15 200.

8. Change log

Date Change to scope Ticket
2026-11-30 Specification written from README, BIBLE, docs, code and the ticket history. GraphQL, bulk CSV import, PDF export, page screenshots, startup backups and keyboard tree navigation moved to Never (owner may reopen). Home-rule local rates (TRC-T192) added from the BIBLE's "every US jurisdiction" promise. The rest of the product sequenced into MS-99 and MS-100, approved. MAT-T369
2026-11-30 MAT-T462 single-source pass: 4 renamed (TRC-T101, T103, T108, T113), 1 bucket dissolved (TRC-T104 "Docs match the code" into the 1.0 polish-and-release feature TRC-T113 with sign-off TRC-T212), 44 requires added (1 cross-repo: TRC-T214 requires M.AUTH-T68), 1 platform re-point (sign-in to MindAttic.Authentication, TRC-T213/T214) MAT-T470
From TaxRateCollector/docs/SPEC.md via MindAttic.Docs; synced automatically, so edit the repo, not this page.