Repository navigation
v0.10.0
A restored database now catches up with Stripe before Hardcount serves it (hardcount restore). A test clock's advance runs as a background job on one replica, and work on a test clock is dated at the event it belongs to. Each API route states who may call it, and a request that was refused no longer holds its Idempotency-Key. Draft subscriptions and the X-API-Key header are removed. Claude Fable 5.2 and Mythos 5.2 have prices.
Before upgrading:
This upgrade cannot be done one copy at a time: several of its migrations need every copy of the earlier version stopped first. In order:
- Activate the draft subscriptions that should bill, and list the draft invoices that carry a discount (both below).
- Keep the earlier version running until no charge is in progress (migration 00225, below).
- Stop every copy of the earlier version, then take a backup.
- Start v0.10.0. Its migrations run on start.
Before you start v0.10.0:
- The upgrade cancels every draft subscription. Activate the ones that should bill before you upgrade, or create them again afterwards. Migration
00235_no_draft_subscriptionsalso removessubscription.activatedfrom webhook endpoints' event lists and deletes an endpoint that listened to nothing else (Upgrade Hardcount, #1837). - Working out a draft's tax again, on a tax retry or the finalize of a one-off invoice, now drops its
discount_cents. A draft's discount came from a tax-inclusive rounding or refresh error. A subscription's draft then charges the sum of its line totals, so its total rises by the discount. A one-off draft charges the prices entered. List these drafts before you upgrade:SET app.bypass_rls = 'on'; SELECT tenant_id, livemode, invoice_number, billing_reason, discount_cents, total_amount_cents FROM invoices WHERE status = 'draft' AND discount_cents <> 0;On Stripe Tax, check each subscription's draft as Invoices an earlier version under-billed says (#1698). - One migration runs on start:
00225_charge_hold_token. It refuses to run while an open or written-off invoice has a charge in progress or a parked charge from the previous version. Keep the previous version running until none is left (about an hour; a parked charge about 25 hours), then stop it, take the backup, and start the new one, one version at a time (Upgrade Hardcount). A backup made before that needs one more step when it is restored (Restore Hardcount).
Migrations: fifteen run on start, 00223 to 00237 (00225 and 00235 are described above; 00236 makes the database hold 00235's rule):
- One migration runs on start:
00223_restore_catchupadds therestore_catchuptable, which marks a restored database. - One migration runs on start:
00224_mark_credit_notes_owing_tax_reversalmarks the credit notes the earlier version's hourly run would still have reversed (issued in the last 24 hours, no reversal stored, on an invoice with tax and a Stripe tax transaction). The hourly run then files a reversal at Stripe Tax for each. Stop every replica of the earlier version before you start this one: its hourly run clears the mark on a note whose invoice has no tax transaction yet. - One migration runs on start:
00226_testclock_catchup_roleadds a sixth leader role,testclock_catchup, which now runs every test-clock advance (ADR-140). Stop every replica of the earlier version before you start this one, as 00224 and 00225 already require: an earlier replica runs advances from its own queue, outside the role. A test clock leftadvancingby the earlier version is picked up by the new leader; itslast_advance_summary.advanced_frommay then be wrong, since the earlier version did not store it. The role shows inleader_statusand can be paused withleader_pause('testclock_catchup', …)like the others. - Two migrations run on start.
00227_invoice_tax_inclusiveaddsinvoices.tax_inclusive, whether an invoice's prices include tax, which decides the terms a draft's tax is worked out in at its finalize and at a tax retry.00228_invoice_tax_inclusive_backfillsets it on the invoices of tenants whose prices include tax today, which is how they are read now. The start takes longer in proportion to those invoices. Stop every replica of the earlier version first, as 00224 to 00226 already require (#1717). - One migration runs on start:
00229_delete_kept_show_once_answersdeletes the answers kept for requests whose answer carries a secret shown only once: creating or rotating an API key, creating a webhook endpoint or rotating its signing secret, rotating a customer's cost dashboard token, and creating a card setup session. Those requests now ignore theIdempotency-Keyheader, so sending the same request again runs it again; what to do for each when an answer is lost is in Routes that ignore the header. If you lose the answer to a signing-secret rotation, rotate again and deploy the new secret right away: from the second rotation the secret your receiver uses no longer verifies, and deliveries that fail in between are retried on the delivery schedule. During a rolling upgrade, a replica still on the earlier version keeps these answers until it is replaced; they expire within 24 hours (#1732). - Two migrations run on start:
00230_api_key_shapeand00231_api_key_shape_validatemake the database state an API key's shape and make its prefix unique. Every key Hardcount wrote has that shape. A key written by hand that does not stops the upgrade, with the fix in the runbook (#1739). - Four migrations run on start.
00232_activity_lines_effective_atto00234_activity_lines_effective_at_validateaddeffective_attoemail_outboxandinvoice_charge_attemptsand fill it on every row, and00237_activity_lines_drop_sim_effective_atdrops theirsim_effective_at, whicheffective_atreplaces. The start waits while every row ofemail_outbox, which keeps each email ever queued, is rewritten once. Once these have run, a copy of the previous release cannot queue an email or record a charge attempt, and shows no emails or charge attempts in an invoice's activity or a customer's sent emails: stop every old copy before you migrate (#1824, #1841).
Start-up now stops on:
HARDCOUNT_ENCRYPTION_KEYset to a value that is not 64 hex characters now stops start-up in every environment, naming the setting. Outside production it logged an error and stored that data in plain text. Set a valid key (openssl rand -hex 32), or unset it outside production (settings, #1874).CORS_ALLOWED_ORIGINSset to only spaces or commas now stops start-up, naming the setting. It allowed no origin, without a word. Unset it for the local dashboard origins, or list the origins (settings, #1871).- Hardcount now refuses to start on a database
scripts/restore.shrestored, orhardcount restore beginmarked, and the restore pauses billing and dunning. A script that does this must change:- A restore that replaces your live database runs
hardcount restore catch-upbefore it starts Hardcount. After a snapshot or point-in-time restore, it runshardcount restore beginfirst (Restore Hardcount). - A copy, such as a staging database refreshed from a live dump, must never run the catch-up: it writes to your live Stripe account. Remove the mark with
DELETE FROM restore_catchup;instead, and follow the rules for starting a copy (Back up Hardcount).
- A restore that replaces your live database runs
After the upgrade, check these and run what applies once:
- Invoices from before this version record whether their prices include tax from the account's setting at the upgrade. If the account switched to tax-included prices while a period billed before the switch is still running, check those invoices: a cancel or an item change credits them too little until their flag is set right (Tax calculation).
- Older credit notes that still owe a reversal are not marked: one whose reversal and mark were both lost more than 24 hours ago, one issued while its invoice's tax was not yet recorded at Stripe, or one on an invoice Stripe Tax calculated with no tax whose reversal at issue failed or never ran. The earlier version did not reverse those either. To mark them, run this once, after the last replica of the earlier version has stopped; the hourly run then files a reversal at Stripe Tax for each marked note:
SET app.bypass_rls = 'on'; UPDATE credit_notes cn SET tax_reversal_pending = true WHERE cn.status = 'issued' AND cn.total_cents > 0 AND COALESCE(cn.tax_transaction_id, '') = '' AND NOT cn.tax_reversal_pending AND EXISTS (SELECT 1 FROM invoices i WHERE i.id = cn.invoice_id AND i.tenant_id = cn.tenant_id AND i.tax_provider = 'stripe_tax' AND (COALESCE(i.tax_calculation_id, '') <> '' OR COALESCE(i.tax_transaction_id, '') <> '')); - On the first run after the upgrade, Hardcount records at Stripe the tax of every finalized invoice whose calculation is under 90 days old and has no tax transaction, including invoices the earlier version stopped retrying weeks ago. A tax commit made late is posted in Stripe's reporting period of the commit, not of the invoice. A credit note an earlier version issued on such an invoice then owes a tax reversal and carries no mark: run the one-time
UPDATEin the credit-note entry above, which marks it, and the hourly run makes the reversal. - A subscription whose cycle close kept failing on a long Stripe Tax error, until billing parked it, stays parked after the upgrade. Its log line
bill subscription failedreadsinvalid byte sequence for encoding "UTF8"(SQLSTATE 22021). CallPOST /v1/subscriptions/{id}/retry-billingfor each one. - A webhook delivery still pending 50 hours 36 minutes after it was created is now marked failed without another attempt. A delivery already that old is marked failed when Hardcount next picks it up after the upgrade, and
hardcount_webhook_deliveries_total{status="failed"}counts it. Resend the ones your receivers still need (Send a delivery again).
API answers and fields that changed:
POST /v1/auth/moderequireslivemode. A body without it answered200and switched to test mode; it now answers422(param: livemode) (#1816).POST /v1/api-keysrefuses a name over 100 characters (422,param: name). An unknown key onPOST /v1/api-keys/{id}/rotatenow answersapi key not found, the wordingDELETEalready used. A key whose name is already longer keeps it when rotated (#1742).POST /v1/api-keys/{id}/rotateon an expired key now answers409invalid_state, as for a revoked key, instead of422validation_erroronexpires_at, a field the request did not send. Create a new key instead (#1733).- API callers: an unknown value for
statusorpayment_statusonGET /v1/invoices,statusorrefund_statusonGET /v1/credit-notes,statusonGET /v1/customers, orentry_typeonGET /v1/credits/ledger/{customer_id}now answers422 validation_error, withparamnaming the filter. It answered200with an empty list. Values match exactly, in lower case (#1705). POST /v1/test-clocks/{id}/advanceand/retry-advanceno longer answer503 catchup_queue_full: there is no queue to fill. A client that handled that code can drop it.- An invoice's
payment_statusis nowunknownfor the moment every card charge takes, so a client or a webhook consumer seesunknownon each charge, not only after an unclear answer. Treat it as "not known yet", and wait forsucceededorfailed. tax_reversal_pendingon a credit note for an invoice Stripe Tax taxed is now true from the moment the note is issued until its tax reversal is recorded at Stripe Tax, which is normally within the same request. Before, it was true only after a failed attempt. If the invoice's own tax is never recorded at Stripe, the flag stays true and no reversal is made. The gaugehardcount_creditnote_pending_tax_reversalscounts only notes whose invoice has a recorded tax transaction.tax_next_retry_aton a finalized invoice can now be set: it holds the time of the next try while a tax commit or tax reversal waits to be retried. Before, only a draft waiting for a tax calculation had it. A client that reads it as "the tax calculation is pending" should readtax_statusinstead.- A draft whose Stripe Tax calculation is older than 23 hours and was not recorded at Stripe now finalizes on that calculation, until it expires 90 days after it was made. Before, finalize answered
tax_calculation_expiredand the operator refreshed the tax with Retry tax.POST /v1/invoices/{id}/retry-taxon such a draft is now refused until the calculation expires; the dashboard still offers Retry tax on it. An address or tax ID changed after the draft was built is therefore not picked up. - If a webhook endpoint listens for only one of
payment_method.attachedandpayment_method.updated, subscribe it to both. A Stripe event that changes nothing on a saved card now sends no webhook. One Stripe Checkout setup session sends two Stripe events for its card, so the card can arrive as either webhook (Payment methods).
Billing, monitoring and scripts:
- A spend-threshold invoice now bills usage up to one
INVOICE_GRACE_PERIODbefore it is built (1 hour unless you set it), and itsbilling_period_endis that instant, not the time it was built. A threshold is therefore seen, and its invoice built, up to one grace later than before. Set a shorter grace for an earlier invoice; that shortens the wait before a period's own invoice too. A credit grant that expires within that grace before the invoice is built does not pay it. A crossing within the last grace of a period does not make an invoice: the period's own invoice bills it. Subscriptions on a test clock are unchanged. - Shutdown now takes at most
SHUTDOWN_DRAIN_DELAYplus 60 seconds, in two stages, down from plus 90 seconds in three: a test-clock advance in progress stops with the other background jobs. A grace period set for the old budget still works. - Prometheus alerts:
hardcount_leader_status_scrape_errors_totalis nowhardcount_leader_status_scrape_failed, andhardcount_usage_unpriced_quantity_totalhas nometer_idlabel. An alert on the old name, or one that filters or groups bymeter_id, matches nothing after the upgrade and never fires. Rename the first (== 1stays). Dropmeter_idfrom the second; the WARNusage matched no price of its plan — not billednames the meter's id and event name (#1858). scripts/backup.shnow writes each dump so that only the user who runs it can read it, and creates a missing backup folder that only that user can open. A job that copies the dumps as another user can no longer read them: run that job as the user that runsbackup.sh.
Compose and quick-start installs:
- Quick-start installs: the quick start now listens only on 127.0.0.1, and
./quickstart.sh destroyasks you to type the project name first. Scripts pass--yes. It takes its settings only from its.env, not from your shell. It refuses to run while a quick start in another folder has its Compose project: run./quickstart.sh destroyin that folder first. An.envthat an earlierquickstart.shwrote still listens on every network interface: put127.0.0.1:before the port on itsNGINX_HTTP_PORTline, as inNGINX_HTTP_PORT=127.0.0.1:8080, then run./quickstart.sh. - Compose installs:
deploy/compose/nginx.confnow includesnginx-log-redact.conf, whichdocker-compose.ymlmounts. Check out the release, as for any upgrade, so all three arrive together. If you runnginx.confoutside this Compose file, copynginx-log-redact.conftoo, or nginx will not start (#1651). - The dashboard's pages, the hosted invoice page among them, now refuse to be shown in a frame, on any site. If your site frames one, link to it instead (#1651).
Added
- Claude Fable 5.2 and Mythos 5.2 arrive under their own names,
claude-fable-5.2andclaude-mythos-5.2. Until now their usage kept its raw name and was not billed. Theanthropic_stylerecipe (now 11.0.0) has their prices: $8 input and $40 output per million tokens. An account that installed an earlier version does not get them: add a price for each model to your plan. If you pricedclaude-fable-5-2orclaude-mythos-5-2under its raw name inmodel, rename that price'smodelto the new name, or it stops matching. - Each API key says its status. Every key the API returns has
status:active,expiredorrevoked, decided by the one rule that also decides whether the key works. A client no longer works it out fromexpires_atandrevoked_at(#1741). - An invoice shows whether its prices include tax.
tax_inclusiveis on the invoice in the API and in theinvoice.*andpayment.*webhooks, read-only, in the terms fixed when the invoice was created. The invoice page shows "Prices include tax" or "Prices exclude tax" on a draft, in Add line item, and on an invoice that carries tax (#1730). - A restored database catches up with Stripe before Hardcount serves it. Started on a restored database, Hardcount could charge or refund again money Stripe moved after the backup. Now the restore pauses billing and dunning, and Hardcount refuses to start until
hardcount restore catch-uphas applied Stripe's events since the backup. What it must not apply is listed for you to handle. That is a payment whose invoice the restore lost, a refund whose credit note it lost or whose tax the old server may have reversed, and an event it could not apply. Restore Hardcount is much shorter. (#1633) - CI runs ShellCheck on every shell script. For contributors: a ShellCheck warning in any tracked script now fails the
lintjob. Runscripts/ci/shellcheck.shlocally. The warnings the scripts had are fixed, andscripts/restore.shandscripts/backup.shquote the tool name they look up. (#1645) - Database pool metrics.
/metricsnow exportsgo_sql_wait_count_total,go_sql_wait_duration_seconds_totaland the othergo_sql_*series for the connection pool that serves requests and background jobs (db_name="app"). A wait count that keeps rising means requests wait for a connection (alert). (#1662)
Changed
-
A caller without a route's permission gets
403before the rate limit, Idempotency and the clock door run. It could get one of their answers first: a429, Idempotency's400,409,422or503, a413, or in test mode a503. A path or method no route serves under a mount such as/v1/customersanswers404or405right after authentication, where a caller without the mount's permission got403. These answers carry noX-RateLimit-*headers and spend no rate-limit tokens. An ingest key onPUT /v1/settingsis told it needs a dashboard session, and a405on/v1/invoices/create_previewlists onlyPOSTinAllow(#1875). -
A recipe installed from a dashboard session records who installed it. A recipe instance's
created_byis the user's id (hc_usr_…), as it is the API key's (hc_key_…) for an install with a key. It was left out. Instances installed from a session before keep none (#1871). -
Request-path log lines name each fact once. The audit detector's and the deadlock and lock-timeout lines call the route
path, as the access log does, notroute; Idempotency's lines write the route's pattern underpath, not the raw path. No line writestenant_idorrequest_idtwice. The rate limiter's Redis-outage lines and Idempotency's finalize and release lines now carryrequest_id(#1865). -
The start-up line for a missing or invalid
HARDCOUNT_EMAIL_BIDX_KEYsays what happens: bounces are not recorded against customers, and bounced addresses are still sent to. It said bounce reporting and suppression "fail closed", which they never did (settings, #1869). -
Metrics, access and panic logs, and traces name a request answered before its handler ran by its route's pattern, not
/v1/*or its mount's…/*; the LiteLLM route's 503 count now includes the key check's 503s. A request matching no route isunmatched. CORS preflights are now logged and counted (#1863). -
The bundled Grafana dashboard's audit alert is two alerts. "Audit rows lost" pages when a change committed without its audit row; "Writes failing: audit row could not be written" alerts when changes are being refused. Import the dashboard again. The monitoring guide now lists every exported metric (#1858).
-
A cross-site write (any method but
GET,HEAD,OPTIONSorTRACE, from another site, unless it carries only an API key) answers403on/v1/webhook_events/streamand/v1/exports/*, as on every other signed-in/v1route. It answered401,404,405or429there. A signed-in request to a/v1path no route matches (such as/v1/foo, or a method/v1/whoamidoes not take) gets its404or405with no rate limit (noX-RateLimit-*headers, never a429) and no idempotency: itsIdempotency-Keyis not reserved, stored or replayed (#1859). -
On an invoice with no card on file, the activity card lists "Payment recovery started" before the email that asks for a card, on real time as on a test clock. It listed the email first (#1844).
-
Off a test clock, an email in an invoice's activity and in a customer's sent emails is dated at the time of the action that queued it, not when the mail server took it. Emails no longer sort out of order when the database's and the server's clocks differ (#1824).
-
A test clock's advance fails when a card charge could not be made. When credits could not be applied first, Stripe could not take the charge, Stripe refused the account's key, or the attempt's result was unclear, the advance ended
readywith the invoice uncharged. Now the clock stops atinternal_failure, and the reason names the invoice and what to do: Retry advance, after fixing the Stripe key if it was refused. Collection outside a clock is unchanged (#1751). -
A test clock's advance no longer skips an invoice whose earlier charge attempt has not finished. The advance passed over it and could end
readywith it uncharged. Now the clock stops atinternal_failurenaming the invoice; Retry advance once that attempt is done. An invoice on the hosted page, paused, or settled meanwhile is still left alone (#1756). -
The dashboard's API keys page shows the status the server decides, and says what happens to a rotated key. Expired and revoked keys sit behind a toggle and have no actions; a rotated key's reveal says when the old key stops working; Copy in a shown-once dialog says when the browser refuses the clipboard instead of "Copied"; revoking asks for the typed word for every live key (#1746).
-
An invoice's tax is worked out in the terms it was priced in. A one-off draft created before a tenant switched tax-inclusive pricing, and finalized after, used to be taxed in the new terms, and so did a subscription invoice whose pending tax was retried after the switch. Both now keep the terms they were priced in. Issued invoices are never taxed again; to price a draft in the new terms, delete it and create it again (#1722).
-
An item change, or an item added mid-period, is refused with
503proration_unavailableand aRetry-Afterwhen the tax settings or the customer's billing profile cannot be read, or the tax calculation cannot be saved. It used to write a draft proration invoice. Nothing is changed, so send it again. A tax provider that fails or does not answer still leaves a draft whose tax is pending (#1719). -
Test clocks: usage for a customer whose test clock cannot be read is refused with
503test_clock_unavailable, and nothing is recorded; send it again. It used to be recorded at real time instead. A batch answers one503instead of422with per-event errors; a LiteLLM batch answers503, and nothing is recorded for that call. The customer usage and margin reads and the public cost dashboard answer503the same way (#1780). -
A test clock's advance no longer ends
readywith dunning work it left undone. A payment retry with no definite answer from Stripe, a final action that failed, a dunning run still due after 50 rounds, or one that stopped moving used to end the advancereadywith that work undone. Each now stops it atinternal_failure, saying what is left; Retry advance goes on (#1760). -
Test clocks: a Stripe payment or card event for a record whose test clock cannot be read is answered
500, so Stripe sends it again. Before, the payment was recorded at the machine's time. A card event whose customer's clock was deleted meanwhile goes on at real time, and a payment whose every delivery is refused is still recorded by the reconciler's sweep (#1773). -
Test clocks: a refund's status change on a credit note for a clock invoice is dated at the clock's time, where it took the machine's. A Stripe refund event whose clock cannot be read is answered
500, so Stripe sends it again, where a refund made in Stripe was recorded at the machine's time (#1775). -
A credit note PDF made for a customer on a test clock shows the machine's date in its "Generated on" footer, where it showed the clock's. The credit note's own dates stay the clock's (#1755).
-
Test clocks: creating a subscription for a customer whose test clock cannot be read is refused with
503test_clock_unavailable, and nothing is created; send the request again. It used to be created at real time (#1782). -
An invoice PDF made for a customer on a test clock shows the machine's date in its "Generated on" footer, where it showed the clock's. The invoice's own dates stay the clock's (#1754).
-
POST /v1/subscriptions/{id}/cancelcan answer409concurrent_changewhen the subscription changes while the cancel prices it. The cancel prices once more on its own. If the subscription changes again, it is not canceled. A period that had already ended and was billed first stays billed. Send the request again; the sameIdempotency-Keyworks (ADR-139, #1685). -
Test clocks: creating an invoice whose test clock cannot be read is refused with
503test_clock_unavailable, and nothing is created; send the request again. It used to be created at real time (#1785). -
Test clocks: after a Stripe connect, each stuck invoice's tax is retried on its own clock, and its finalize and charge follow on that clock. An invoice whose clock cannot be read is not retried and stays marked Needs attention: click Retry tax on it, or it is retried on the next connect (#1785).
-
Test clocks: the hosted invoice page works at the invoice's clock time, so a checkout started there is recorded at that time. If the clock cannot be read, the page answers
503and nothing is started (#1777). -
A card refusal with no decline code is a decline. A card error from Stripe that carries no decline code failed a test clock's advance and counted as an error of the billing run, though the invoice was already marked failed and in dunning. It is now logged as a warning and left to dunning, on a clock and outside one. An invalid request is still an error (#1761).
-
A test clock's advance no longer ends
readywhile a payment retry waits for an earlier payment of its invoice. The advance now fails, naming each invoice that is waiting; retry the advance once that payment is done, or void or write off the invoice. A retry whose customer may be paying on the hosted page does not stop it (#1774). -
An open event stream ends when the caller that opened it stops authenticating. A stream opened with a dashboard session and an API key on the same request kept running after logout, on the key, which could belong to another account. It now closes unless its re-check, every 15 seconds, names the same account and the same session user or key (#1749).
-
Test clocks: a credit note on an invoice whose test clock cannot be read is refused with
503test_clock_unavailable, and nothing is created; send the request again. It used to be created at real time. A note created withauto_issueand its issue carry the same clock time, and a commit relief uses its own invoice's clock (#1786). -
Test clocks: an invoice preview (
POST /v1/invoices/create_preview) for a subscription on a test clock reportsgenerated_atat the clock's time. It was real time; the amounts are the same. A clock that cannot be read answers503test_clock_unavailable; try again (#1789). -
A rotation's audit row says what happened to the old key. Its metadata gains
old_key_outcome(revokedorexpires) andold_key_stops_at. A rotation also keeps the old key's name exactly as stored; it used to trim it (#1749). -
Test clocks: the payment reconciler records a clock invoice's payment or failure at the clock's time, and an invoice whose clock cannot be read is checked again on its next run, with no payment lost. When Stripe's record of a failed charge does not say when the charge was made, payment retries count from the clock's time, so the first retry is not already due (#1776).
-
Test clocks: one replica at a time runs every advance, and a deploy no longer leaves one waiting. The holder of the new
testclock_catchupleader role runs each advancing clock; an advance waits behind any catch-up already running, up to 10 minutes each.last_advance_summary.advanced_fromis now always the clock's time before the advance (ADR-140, #1689). -
A test clock's advance fails when a trial's free cancel could not be read. When a trial's activation found its cancel schedule had come due, a failed re-read of the subscription ended the advance
readywith the trial neither cancelled nor activated. Now the clock stops atinternal_failurewith the reason, and Retry advance tries the trial again. Outside a clock the error is logged and the next run tries again (#1752). -
Test clocks: a request on a record on a test clock runs at the clock's time. For example, a clock customer's live credit balance reports
computed_atat the clock's time, and a request whose clock cannot be read answers503test_clock_unavailablewith nothing done (#1772). -
API callers: five more routes answer
409concurrent_change, and the code also covers a lock wait that Postgres ended. Create a subscription, add or remove an item, update a customer and write a billing profile answer it, beside the six routes that already did. A409is not stored, so the sameIdempotency-Keyworks again. Postgres ends a lock wait only if alock_timeoutis set, for example onhardcount_app(Errors). (#1677)- Every other route still answers a deadlock or an ended lock wait with a
500, which its key replays for 24 hours. Among them: schedule-cancel, pause collection, end or extend a trial, retry billing, billing thresholds, plan and meter writes, credit-note create, refunds and manual invoices.
- Every other route still answers a deadlock or an ended lock wait with a
-
A charge saves its Stripe payment before any money can move. Each charge creates the PaymentIntent unconfirmed, puts it on the invoice, then confirms it. While it runs, the invoice's payment is
unknown. An unclear answer from the confirm names the payment and is settled within about an hour. No invoice is parked for 24 hours (ADR-137). What else you see (#1666):POST /v1/invoices/{id}/mark-uncollectiblenow succeeds on any invoice whose payment isunknown, once the charge is no longer being sent. Before, it answered 409 unless the invoice was parked. A payment found later still marks the invoice paid.- A decline whose answer was lost is now recorded as a decline: the customer gets the payment-failed email and dunning starts. Before, the invoice was charged again a day later.
- A confirm request that Stripe refuses outright (not a card decline) marks the invoice
failedand starts dunning, with no email to the customer. - A payment that succeeded and was refunded in Stripe before Hardcount recorded it is recorded as paid, with the refund shown as a refund made in Stripe. Before, the invoice could be charged again.
- If Stripe refuses your API key while a payment is being confirmed, Collect payment says the outcome is not known yet, and the invoice is
unknownuntil Hardcount has read the payment with a working key.
-
Hardcount warns at start-up when the limited database user has no idle-transaction timeout. The warning
the app database role has no idle-transaction timeoutmeansidle_in_transaction_session_timeoutis0for that user. Hardcount still starts. Set it as Postgres requirements says, then restart. (#1680) -
Outside pull requests are not accepted at this time. On GitHub, only collaborators can open a pull request. Report a bug or propose a fix in an issue, with a patch or a link to your fork; a commit that uses your code names you as co-author, and the entry here names you. The
good first issuelabel is no longer used. #1720, #1729 -
The money-path playbook has four rules the last week of fixes needed. Contributors: no page limit on a question about every row; a job reads its list to the end or stamps what it looked at; compare an amount change with today and make no case worse; walk a paged list in a test. #1710
-
The contributor rules are half as long (2026-11-13). Contributors: CONTRIBUTING, the engineering principles, the code standard, the testing guide and the money-path playbook were rewritten in plain words, with each rule in one place. No rule about money changed. #1692
-
A
503is no longer stored under itsIdempotency-Key. A retry with the same key runs the request again, instead of getting the stored503back. Hardcount answers503only when nothing the request did would be done twice. Aftercurrency_unavailable, send the same request with the same key, not a new one. (#1646) -
Hardcount builds with Go 1.27.4 (2026-11-13). To build from source, you need Go 1.27.4 or newer. The go command downloads it, unless
GOTOOLCHAIN=localis set, as in thegolangimages: then it stops withgo.mod requires go >= 1.27.4. An install that runs the published images has nothing to do. Contributors:make lintneeds golangci-lint v2.14.0 built with Go 1.27.4:GOTOOLCHAIN=go1.27.4 go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.14.0. (#1708) -
A LiteLLM spend body cut short inside its JSON array gets a
400naming the line it ends on. The message isinvalid JSON body at line N (record M), where M is the record that would have come next. Before, it named no line, or the wrong one. Nothing is saved, as before (#1708).
Removed
- Draft subscriptions and
POST /v1/subscriptions/{id}/activate. A subscription starts, or starts its trial, when it is created. API callers:statusonPOST /v1/subscriptionsanswers422,draftis no longer a status or astatusfilter value, andsubscription.activatedis no longer sent. To start billing later, create the subscription then, or give it a trial (#1837). POST /v1/dunning/runs/{id}/resolve. It now answers404. Close a run on its invoice instead: recording a payment, voiding or writing off an open invoice (POST /v1/invoices/{id}/record-payment,/void,/mark-uncollectible) closes its run, an escalated one too, and sendsdunning.resolved. The route could also relabel the escalated run of an invoice already written off; nothing does that now, and it needs nothing. The dashboard has not used the route since #1470.GET /v1/test-clocks/{id}/subscriptionsand the clock page's subscription list. They listed the same subscriptions the clock's customers have. Open a customer from the clock's customer list (GET /v1/test-clocks/{id}/customers) to see its subscriptions. The clock page's advance and delete dialogs count customers (#1769).- The
HARDCOUNT_TEST_CLOCK_INJECT_FAILUREsetting. It made the next test-clock advance fail, for manual tests, and a server that had it set by mistake failed every advance. It now does nothing; remove it from your environment (#1694). - The
X-API-Keyheader. A key is sent inAuthorization: Beareronly; theX-API-Keyheader is no longer read. A request that sent its key there now gets401with the missing-credentials message: send it asAuthorization: Bearer <key>(#1766). - The metric
hardcount_webhook_outbox_enqueue_failures_total(#1639). It counted webhook events lost because they could not be queued after their change was saved. Every event is now saved with its change, and a change whose event cannot be saved fails, so no event is lost this way. Remove any alert on the metric. had_errorson a test clock'slast_advance_summary. It was true exactly when the clock'sstatusisinternal_failure; read the status instead. A summary stored before this release may still carry the field; it is ignored. On the dashboard, the failure banner now says the work it finished is kept, and the last-advance card names its counts in plain words (#1768).
Fixed
- Test mode: on a test clock's advance, a cancel at the end of payment recovery dates its final invoice at the escalation, and a trial's first invoice is collected at the trial's end. The final invoice was issued, and collected, at the advance's target date, and the trial's first invoice was collected there (#1888).
- The bootstrap output names your dashboard's address.
hardcount-bootstraptold you to sign in athttp://localhost:5173/loginwherever the dashboard ran. It now usesDASHBOARD_BASE_URLwhen that is set. - Start-up with no database setting says where the server looks. The message now says the setting must be in the environment and that the server does not read a
.envfile (make devloads one). It named the settings only, so starting the binary beside a.envlooked like a fault. - The start-up check on the limited database user no longer asks for the migration tool's sequence. On a database without default privileges, the grants it listed included
goose_db_version_id_seq, which Hardcount never uses as that user. The docs now say the limited user must be namedhardcount_app; they said "usually". - An error's status no longer depends on its wording. A server fault whose message read like a validation message, such as "… is required", answered
422with that internal text. It now answers500internal_error, and the details go to the server log. Client mistakes keep their422(#1854). - A replayed answer carries
Hardcount-Version, and a browser on another origin can readIdempotent-Replayed. An answer replayed for a repeatedIdempotency-Keyleft out the version header every other answer has, and CORS did not expose the replay header to a page on another origin (#1850). - The API keys page tells two keys with one name apart on a phone, and says what to do about a key that is about to expire. After a rotation the old and the new key looked the same on a narrow screen, and the expiry warning offered no action that helps. A key in its last week also shows the hour it stops, and the revoke dialog says what the docs say: the key is refused from the next request (#1846).
- Switching the dashboard to the mode it is already in writes no audit row.
POST /v1/auth/modewith the session's current mode wrote amode_changedrow though nothing changed. It still answers200(#1840). - A subscription on a trial keeps its last item.
DELETE /v1/subscriptions/{id}/items/{item_id}removed the last item of a trialing subscription, which then became active with nothing to bill. It now answers409 invalid_state, as for an active subscription, and so does removing an item from a canceled subscription (#1838). - Accepting an invitation for an address that already belongs to another workspace is refused. The page said "You've joined", but sign-in then always opened the first workspace. An address can belong to one workspace on a server, and the accept page now says so (#1839).
- The "Remove member" dialog says that API keys are not changed. It said the person loses access immediately; a key they copied keeps working until it is rotated. The dialog, the API keys guide and the data page now say to rotate it (#1836).
- Rotating an API key with "Now" warns that the old key stops at once. The dialog said nothing more for "Now" than for a grace period; it now says that anything still using the old key fails until it has the new one (#1830).
- The API keys page says when a rotated key's old key stops, which mode a new key works in, and each key's type on a phone. The rotate dialog promised the time you picked even when the old key expires sooner (#1827).
- The Team tab shows the day each member joined the workspace, and lists only invitations that are pending or expired. It showed the day the person's account was created, and kept revoked invitations in the list. The invitation email tells someone who already has an account to sign in, not to set one up (#1828).
GET /v1/whoamianswers an error when the signed-in user cannot be read. It answered200withoutemail. Three API key validation messages are plainer (#1825).- The "Billing cycles per minute" dashboard panel is titled for what it counts: billing passes.
hardcount_billing_cycles_totalcounts one pass per mode, two per cycle; its help text, the monitoring page and the panel now say so. The help text ofhardcount_webhook_outbox_dead_lettered_totalnames itscauselabel (#1831). - An expired invitation no longer blocks a new one to the same address. Inviting someone whose earlier invitation expired answered
409and the dashboard offered no way to clear it; the new invitation now replaces the expired one (#1817). - An invoice finalized through the API and paid at once from credits has
paid_atequal toissued_at. The timestamps one API request writes now share one time;paid_atwas read a moment later before (#1815). - A person who has been removed from a workspace can no longer remove a member or revoke an invitation there. A request they made at the moment of their removal could still go through; it now answers
403(#1834). - A card payment's
paid_atis the time Stripe's answer arrived, in the same call or by its event; a declined card's payment recovery starts at that time too. Neither is dated before its charge. On a test clock both stay on the clock's time (#1819). - In an invoice's activity, 'Invoice paid' is listed after the credit note that paid it. It was listed before it (#1824).
- A card payment Stripe is still processing is stamped
processingat the time its answer arrived, and an invoice'supdated_atno longer steps back after a charge's result. A charge made when an invoice was finalized or its period closed setupdated_atback to the time the finalize or the period close was dated, after the payment had been recorded at the time Stripe answered. A client that syncs invoices byupdated_atcould miss the payment. On a test clock both stay on the clock's time (#1842). - A credit note created with
auto_issuehascreated_atequal toissued_at. They differed by a few milliseconds before. A refund made in Stripe is likewise recorded with one time on its credit note, the note's line and its issue date (#1812). - A usage backfill or a LiteLLM spend call with an invalid event answers
422even when the customer's test clock cannot be read. It answered503, asking for a retry that could not help. The event is now checked before the clock is read, as a single ingest and a batch already did (#1808). - Each access log line names the caller, the account and the client address. A request made with an API key or a dashboard session logs
actor_type(api_keyoruser),actor_id,tenant_idandip; any other logsanonymousandip. Before, every line saidsystem, with no account and no address. The log now holds client IPs: Logs (#1805). - A request body over the 1 MB limit is answered
413payload_too_large, with or without anIdempotency-Key. It was answered400:invalid JSON bodywithout a key andfailed to read bodywith one. The usage batch and the LiteLLM callback keep their413batch_too_large(#1802). - Test clocks: a credit grant or adjustment for a customer whose test clock cannot be read is refused with
503test_clock_unavailable, and nothing is changed; send the request again. It used to be written at real time (#1787). - Rotating an API key with a grace period never keeps the old key working past its own expiry. A key set to expire in an hour, rotated with 7 days of grace, used to keep working for 7 days. It now stops at its own time, and a key with no expiry stops when the grace ends, as before (#1733).
- An API key's last-used time is written during the request that used it. It was written after the answer, by a task the server did not wait for, so it could lag, be lost at shutdown, and fail without a log line. It is still written at most once a minute per key, and a failed write is now logged (#1735).
- Unused prepaid time on tax-inclusive prices is credited once, not grossed up for tax a second time. A cancel or plan swap with half of a 120.00 month (20% tax included) unused credited 72.00, not 60.00; a quantity decrease, downgrade or item removal was over-credited by the tax rate the same way. Each invoice is now credited in the terms it was priced in. To find credits already issued too high, and invoices billed before a switch to tax-included prices, see Tax calculation (#1731).
- Editing a customer no longer clears its tax data at Stripe. When the customer had no billing profile, or the profile could not be read, an edit set the Stripe customer's tax status to none and deleted its tax IDs. Look for
customer.tax_id.deletedevents in Stripe. If the customer has a billing profile, save it again. Otherwise re-enter the data in Stripe (#1721). - A draft manual invoice no longer shows a due date an hour off after a failed settings read. Its provisional due date was counted in UTC when a second read of the account's settings failed, an hour early or late across a daylight-saving change; finalizing set the right one. Finalizing a draft created before invoices carried their own time zone now answers
503settings_unavailablewhen the account's settings cannot be read, instead of setting a due date counted in UTC: send the same request again (#1727). - Relative dates on a test-clock record appear once its clock has loaded. "Past due", "Due in", "Trial ends in" and a cycle's day count no longer flash values counted from today's date while the clock loads. If the clock list fails to load, the page says so, with Retry, and shows only stored dates and statuses. The Test clocks list no longer reads "Advancing" after an advance has finished, and the credit note's "Choose invoice" list counts Past due from a test-clock invoice's clock, not today's date (#1718).
- After you advance a test clock, the dashboard shows its new time on every page. A page opened within 30 seconds of its last read of the clock kept the old time, and counted "Due in", "Trial ends" and a payment retry's "Next step" from it. Every clock change now refreshes the clock everywhere (#1713).
- A test-clock change whose audit row cannot be written is no longer saved. Before, a create, advance, retry advance or delete was saved with no row in the audit log; now the request answers
500and nothing changes. An advance's row now always names the time it advanced from (#1711). - The audit log now records a change to the low-balance alert threshold from one amount to another, such as $50 to $70. The save's row left the threshold out, and a save that changed only the threshold wrote no row. A change that turned the alert on or off was recorded (#1707).
- A Settings save no longer puts back a change someone else saved, such as the tax rate. The dashboard sent every field, so a page opened before another person's save restored their old values, and later invoices used the old rate. It now sends only the fields you change, and two saves at once each keep the other's fields (#1707).
- A billing-profile currency change is checked against every live subscription of the customer. The check read the 100 newest of each status. It could save a currency an older subscription does not bill in, and that subscription's invoices then showed its prices in the new currency without conversion. This needed two currencies on one customer (only in rows written before #1659) or newer subscriptions with no items (#1705).
- A list filter with an unknown value answers
422, not an empty list.GET /v1/invoices?status=openanswered200with no rows, which read as "no open invoices". The invoice, credit-note, customer and credit-ledger lists now refuse it, as the subscription and dunning-run lists already did (#1705). - An
Idempotency-Keymore than 24 hours old is free at once. A request with it got409conflict_idempotencyuntil the cleanup at the next scheduled billing run deleted the key. It now runs as a new request. Before you retry a request that old, read the resource to see whether it happened (#1702). - A
400invalid JSON bodyno longer traps itsIdempotency-Key. It answers a body that is not JSON, is empty, or has a field of the wrong type. The fixed request with the same key got422idempotency_errorfor 24 hours, and now runs. Any other400is still stored (#1702). - With tax-inclusive prices on the manual tax provider, an invoice with several lines now charges the sum of its prices. Before, its total could be a few cents off, or show a discount nobody gave. A one-off draft is fixed at its next finalize. A subscription's draft built before the upgrade keeps its total unless its tax is worked out again (see Before upgrading). Issued invoices are unchanged (#1698).
- A prorated base fee is divided by one billing cycle in every place that prorates one. The largest case: on a subscription billed on the 1st, in the period during which the organization changed its time zone, a cancel, plan swap or seat decrease refunded the whole invoice, and a plan or seat change charged or credited the whole month's difference. Rarer cases were over-billed (a period cut short by a plan swap, a subscription with no stored billing day), under-billed (a trial end after a time-zone change) or under-refunded (a calendar month that kept a yearly billing day). Invoices already issued are unchanged; #1709 lists every case with a query that finds the credit notes and invoices affected.
- A quantity change, a change to a plan on the same billing interval, or a cancel, in a period that starts on a shortened month end is no longer over-billed. It affects subscriptions billed on the 29th to 31st on plans billed in arrears: Feb 28 to Mar 31 was prorated over 28 days, not 31. A change to a plan with a different billing interval there is still prorated over the shorter month until a later release. Invoices already issued are unchanged; #1697 has a query that finds the lines billed before this release.
- A test-clock advance now ends every due trial and resumes every due collection pause, however many, in the order they fell due. It did the first 100 of each and said
ready, and it skipped a trial, pause or period close whose subscription another request held at that moment. Advance again to finish what an earlier advance left (#1696). - A trial extended while its trial-end job runs is no longer activated and billed at its old end. The job now checks the trial's end when it flips it, in real time and on a test clock, and leaves an extended trial running (#1696).
- A test-clock advance stops at the first job that fails, and the clock's reason names that job. Before, the jobs after it ran too: a relief credit note that failed to issue let the card charge take the full amount. Retry advance runs the advance again from the top (#1695).
- A test-clock advance now retries tax on every invoice waiting for it, once each. It retried the first 100 and said
readywith the rest still waiting for tax (#1699). - A test-clock advance now issues every relief credit note held for its invoices. It issued the first 100 and said
readywith the rest still held, so the relief they carry was not applied (#1701). - A test-clock advance no longer skips a payment retry whose invoice another request is changing at that moment. The retry's charge claim waits for that request and charges only if the invoice is still unpaid (#1704).
- An offline payment or a credit note now closes the invoice's open Checkout page at Stripe, and an offline payment always closes the invoice's dunning run. If the expire fails or the server stops first, the page stays payable until its hour ends, and a payment through it raises the duplicate-charge or amount-mismatch alarm (#1690).
- A cancel no longer keeps the subscription locked while it waits for Stripe Tax. An immediate cancel, a scheduled mid-period cancel and dunning's cancel priced their final invoice inside their transaction. A slow Stripe Tax call held the subscription for its whole length, and about 20 cancels at once (
DB_MAX_OPEN_CONNS) used every database connection until they timed out. They now price first, then write (ADR-139, #1685). POST /v1/invoicesanswers409concurrent_changewhen Postgres stops it because of another change (a deadlock, or a lock wait that reached the database'slock_timeout), instead of a500that anIdempotency-Keyreplayed for 24 hours. Nothing is created, so sending the same request again, with the same key, creates the invoice once. (#1686)- A refund whose client disconnects, or whose request times out, still issues its credit note, or voids the draft if the issue fails. This covers
POST /v1/invoices/{id}/refundandPOST /v1/credit-noteswithauto_issue. Before, the draft could stay, count toward the invoice's refunded total, and make the next full refund answer "invoice has already been fully refunded". If the issue fails after the refund was made, the call now answers with the issued note instead of an error. Behaviour change: a refund now waits for Stripe's answer instead of being cut at the 30-second request limit: with a slow Stripe that can take about 90 seconds, longer than the server's 35-second write limit, so the connection can drop before the answer arrives. Send anIdempotency-Keyand send it again to get the result. Still possible: a server stop between the note's creation and its issue leaves a draft and logs nothing; it shows as a draft in the credit notes list and holds the refund until you void it. A void that fails for another reason is logged (credit note created but its issue failed, and voiding the draft failed too). (#1684) - Invoices finalized after you connect Stripe are now recorded in the audit log under the person who connected it, not "system". The retry of invoices stuck on Stripe settings ran without the request's identity. A panic in that retry no longer stops the server. (#1683)
- A manual invoice whose create fails no longer uses up an invoice number. A create from New invoice or
POST /v1/invoicestook its number before it saved the invoice. When the save then failed, that number was gone, and your invoice numbers had a gap. The number is now taken in the same write that saves the invoice. (#1681) - An immediate plan change to another billing interval is refused at the exact time a spend-threshold invoice ends, for plans billed in arrears. Before, the change went through and the period it cut short closed with no invoice, so its base fee was never billed. In practice this needs a frozen test clock: advance the clock, then retry. (#1682)
- The billing run no longer closes a period with no invoice when the invoice's number or period is already taken. The bill fails and is retried (runbook). A spend-threshold scan whose invoice number is taken now logs an error instead of skipping. Known cause: a counter or period set back in the database. Periods already closed this way stay uninvoiced. After upgrading: a test-clock subscription whose plan was changed at the exact time a spend-threshold invoice ends, and whose period has not closed yet, now fails its close until you void that threshold invoice (if it is unpaid) or delete the clock. (#1682)
- A tax retry that works out the tax now finalizes the invoice in the same transaction. Before, a stop between the two writes (a restart, a lost leader lease, a cut-off request) left a draft with its tax worked out that no background job finalized. If the finalize fails, the tax is not saved, the invoice keeps its tax notice, and the try is counted (toward the 8 automatic retries, for an error Hardcount retries);
POST /v1/invoices/{id}/retry-taxanswers an error that names the finalize, and writes itsretry_taxaudit row only on success. Such an invoice holds its subscription's cancel, plan change and quantity decrease until a retry finalizes it or you void it: if the finalize keeps failing, fix the cause the server log names and retry, or void the draft. The finalize audit row is now saved with the finalize, so a finalize whose row cannot be written does not happen. After upgrading: look at your draft invoices. A draft billing made, with its tax worked out and no paused subscription, may be one an earlier version left: finalize it or void it. A draft kept by a pause you later ended looks the same. (#1679) hardcount doctornow also flags an invoice Stripe Tax calculated with no tax whose sale was never recorded at Stripe. The checkinvoice_tax_calculated_never_committedskipped zero-tax invoices, but such an invoice still records the sale in your Stripe Tax reports. (#1678)- Usage in flight when a spend threshold fires is no longer left off every invoice. A spend-threshold invoice billed usage up to the moment it was built, and the period's own invoice billed only from that moment on. Usage stamped before the fire and stored after it was on neither invoice. The spend-threshold invoice now reads usage one grace late, so usage that arrives within one grace of its timestamp is billed by the period's own invoice. (#1673)
- A cancel, or a plan change to a different billing interval, no longer charges the card in full in the same call when its relief credit note fails to issue. The final invoice is left to the next billing run (or the next Advance on a test clock), which retries the credit note before it collects queued invoices. (#1676)
- A credit note on an invoice Stripe Tax calculated with no tax now has its tax reversal retried. Such an invoice, for example in a place you are not registered, still records the sale in your Stripe Tax reports. A failed reversal was never retried. Customers marked exempt or reverse charge are not sent to Stripe and owe nothing. (#1675)
- An email whose send panics is retried, not given up at once. It was marked failed on its first try, so it was never sent, and the runbook's requeue of failed emails skipped it. It now waits for its next try like any other error, as a webhook event already did. Both outboxes now log a panic with its stack. (#1674)
- An invoice is no longer blocked for about an hour after a late decline. When a charge got no answer from Stripe and the decline then arrived by webhook, the invoice was marked failed and the customer emailed, but the charge hold stayed until the next scheduled run cleared it. Until then the payment page said a payment was in progress, and Collect payment, void and offline payment were refused. The write that records the result now frees the hold. (#1671)
- A tax commit that kept failing for more than a day is now recorded at Stripe after the cause is fixed. Before, Hardcount stopped retrying after 24 hours, and the invoice's tax was never reported to Stripe Tax. It now retries until the Stripe Tax calculation expires, 90 days after it is made. Allow about a day after the fix: Stripe repeats its saved answer to a request for 24 hours. A failing tax commit, or a failing tax reversal of a voided invoice, now waits between tries: at least 1 hour and at most 12 hours. One account's failing invoices no longer hold up the rest. (#1669)
- Voiding or crediting an invoice Stripe Tax taxed now reverses its tax at Stripe after you switch tax provider. After a switch to manual or none, a voided invoice was marked reversed with nothing reversed, and the sale stayed on your Stripe Tax report. The reversal now goes to Stripe Tax, which recorded the tax. Keep Stripe connected until those invoices are settled: with it disconnected, the reversal fails and is tried again. Invoices voided while another provider was selected are not corrected; reverse them in Stripe by hand. (#1668)
- Collect payment no longer ends dunning while Stripe is still processing the payment. When Stripe answered a Collect card payment with
processing, the invoice's dunning run was closed as recovered anddunning.resolvedwas sent, with the invoice unpaid. If the payment then failed, nothing retried the invoice. The run now ends only when the invoice is paid. The Collect audit entry now carriespayment_status. (#1665) - A retry stopped by a shutdown no longer uses up one of the customer's attempts. When Hardcount stopped while Stripe was being asked, the attempt it had counted was not taken back, because the write that takes it back ran on the stopping pass's cancelled context. (#1664)
- A dunning retry interrupted after the charge no longer charges the card again an hour later. The retry counted its attempt before charging the card but saved the wait before the next retry only afterwards. A deploy, a lost leader lease or a failed write between the two left the run due, so the next hourly run charged the card again where the policy said to wait days, and the customer reached the final action early. The wait is now saved with the attempt, before the charge. A retry interrupted before its charge is now skipped until the next scheduled retry. (#1664)
- A credit note issued just before Hardcount stopped no longer keeps its tax on the Stripe Tax report. The note's tax reversal is a Stripe call made after the note is issued. A deploy or crash between the two left a note that was found again only for 24 hours, and a reversal that was still owed could age out for good. Issuing the note now records that the reversal is owed, in the same write, and the hourly run makes it however late. (#1667)
- Two edits to one customer at once no longer undo each other. An edit wrote back every field as it had read them, so a rename could un-archive the customer or reset its dunning policy. The second edit now waits and applies to the saved customer. (#1659)
- Archiving a customer no longer leaves a subscription billing. An archive that ran while a subscription was being created, or while a trial was ending, could miss that subscription and succeed. The archive now sees it and gets
409. A create that waited for an archive gets409too. (#1659) - A subscription create no longer races a second currency onto its customer. Two creates in different currencies could both succeed, and a billing-profile currency saved during a create relabeled that subscription's amounts without conversion. The second request now waits, then gets
409. (#1659) - Two subscription writes for one customer at once no longer both bill one meter. Two such writes, for example two creates or a create and an item add, could both pass the meter check, so the meter's usage was invoiced twice every period. The second request now waits, then gets
409. (#1659) - hardcount-doctor reads every account's rows, whatever database user runs it. Run as a user that is neither a superuser nor
BYPASSRLS, such as the tables' owner on managed Postgres, it read no rows and printedOK. It now also exits 2 when accounts exist but it reads no customers and no invoices. (#1660) - Two changes to the default dunning policy at once no longer answer
500. This was two Set as default calls, or one beside a new policy that takes the default. Both now finish, and one policy is the default. (#1656) - Changes to a customer's default card no longer collide. Two Set as default clicks at once, or one beside a card saved through a setup link, could answer
500. Two cards removed at once could leave the rest with no default, so auto-charge found no card and dunning started. (#1656) - A void by billing, dunning or a test clock now cancels the invoice's PaymentIntent at Stripe. When a scheduled cancel or dunning's final cancel voided an unused prebill, the declined PaymentIntent recorded on it stayed open at Stripe (status
requires_payment_method). No money moved: the customer could not pay through it. Voids from the dashboard or API already canceled it. (#1657) - A sent email or webhook is no longer left marked failed or skipped when two replicas end up handling it at once. Before, requeuing failed rows as the runbooks say could send it again, and a webhook could be written twice with different ids. Multi-replica installs only. (#1661)
- A panic while sending a webhook no longer stops the server. It ended the whole process, with the API and every background job on that replica, and happened again each time the delivery was claimed. It is now logged with its stack and counted as one failed attempt. (#1663)
- A webhook your endpoint accepted is no longer sent again after a shutdown. If Hardcount shut down, or lost its leader lease, between a retry's
2xxand saving that result, the delivery stayed pending and was sent again. The result is now saved. (#1663) - A webhook delivery that cannot record a result is given up once it is 50 hours 36 minutes old. A delivery whose endpoint or event Hardcount could not read was claimed again every few minutes, for good. It is now marked failed with an error that says so, the next time Hardcount picks it up. A new
hardcount-doctorcheck flags one left pending. (#1663) - A cancel, item change, record payment, collect or credit-note issue that loses a database deadlock no longer replays a stored
500. It answers409concurrent_change, which is not stored, so the same request with the sameIdempotency-Keyruns again and finishes. Before, that key replayed the500for 24 hours. Collect answers this way only when it charges no card, and credit-note create only in itsauto_issuestep (Errors). (#1652) - Two members removing each other at once no longer leave the account with no members. Both removals could pass the last-member check, and then nobody could sign in without a database fix. Now the second removal waits for the first, and gets the "cannot remove the last member" refusal. (#1658)
- An invite accept that fails part-way leaves the invitation usable. The accept used up the invitation, then created the account and the membership in separate steps. A failure in between left a used link, and sometimes an account in no workspace. Now all three are saved together or not at all. (#1658)
- A team invite is saved with its email. The email was queued after the invitation was saved, so a crash in between left a pending invitation whose link was never sent. Now both are saved together, and a failed queue leaves no invitation. (#1658)
- Collect pays an invoice that credit already covers. An unpaid invoice with nothing due, left when the settle after a credit apply failed, answered
422"invoice has no amount due", and only dunning or the automatic charge settled it. Collect now marks it paid with no card charge, unless a charge on it is still in flight. (#1652) - A plan change that voids an unused invoice no longer deadlocks with a credit note on it. This was a change of billing interval on a period's first day, while that period's invoice was unpaid. Either side could fail. Both now finish. No amounts were affected. (#1649)
- A cancel and a credit note on the invoice that prepaid the period no longer deadlock. An immediate or scheduled cancel that bills a final invoice could stop, or be stopped by, a credit note or a recorded Stripe refund on that invoice at the same moment. Both now finish. No amounts were affected. (#1649)
- A cut to fit no longer splits a character. A long error or webhook answer cut inside an accented letter or emoji, or an answer that is not text, made Postgres refuse the write. A cycle close then failed on every retry, a failed email or webhook was retried without end, a test clock stayed advancing, and a delivered webhook was sent again. (#1644)
- An item change whose invoice read fails is refused, not left uncharged. Adding an item, or a quantity or plan increase that takes effect now, reads the current period's invoice to check it is paid. A database error there was taken as "no invoice yet": the change went through, and nothing ever charged it. Now it answers
503proration_unavailableand changes nothing. Send it again. (#1646) - An error toast that names the failed action, such as "Failed to void", says "Result unknown" after a bare server error. A 502 or 504 from the proxy, or a 500 with no reason, read as a failure with "Try again", though the action may have gone through. Now the warning says to refresh and check before trying again. An error shown inside a dialog is unchanged, except in Issue credit note. (#1640)
- Issue credit note no longer makes a second note after a lost answer. The dialog showed raw text such as "Failed to fetch". Closed and opened again, it still offered the old amounts and sent a new request key, so a second try made a second note, and with it a second card refund. Now it says the result is unknown, counts a note that landed, and keeps the key until an answer settles the try. (#1640)
quickstart.shtakes its settings only from its.env. Compose took a setting exported in the shell over the.env, so afterset -a; . ./.envfor a server install, the quick start ran with that server's port,APP_ENVand encryption key. From a clean shell it then could not open its own data. (#1635)quickstart.shrefuses to act on a server install, or on a quick start in another folder.destroydeleted the database and the.env, which holds the encryption key, of a server install set up in its folder. In a second quick-start folder, it deleted the first one's database, because every quick start uses the same Compose project. Now it refuses an.envit did not write, and a project whose containers another folder started.destroyasks first. (#1635)- New invoice starts at your payment terms, and a click after a lost answer makes one invoice. It started at Net 30 whatever Settings said. After a lost answer, a second click could make, and send, a second invoice, and Add line item a second line. Both now show what landed, and New invoice says the result is unknown. (#1637)
- Dates you pick on the dashboard are sent in your account's time zone, never a guessed UTC. Picked while the account settings were loading, a credit expiry, invoice period, resume date, trial end, test-clock time or API key expiry was sent in UTC. Pages now wait for the settings. The date picker's first day and Today follow your account's zone and the customer's test clock, not your browser. (#1641)
- A refund of another account's payment, on a Stripe account two Hardcount accounts share, is acknowledged. Its webhook failed, and Stripe sent it again for three days. (#1633)
- Webhook events are no longer lost to a crash, a deploy or a dropped request. Ten event types, among them
dunning.resolved,customer.email_bounced,payment.duplicate_chargeandpayment_method.attached, were queued just after their change was saved, and a crash or a cancelled request in between dropped them. Each is now saved with its change, as every other webhook event already is. Each payment anomaly is sent once per charge, not once per report. A bounce from your SMTP server that cannot be saved is logged at ERROR, because nothing sends it again. (#1636, #1638, #1639) - When retries run out under a policy that writes the invoice off, the write-off and the escalation are now saved together. Before, a crash, a deploy or a dropped connection just after the write-off closed the run as if someone had written the invoice off by hand. No
dunning.escalatedwas sent, the customer got no final email, and the invoice timeline did not say the payment retries had run out. The final email, when the customer has an email address, is now queued in that same transaction. A write-off also no longer lands on an invoice whose recovery run another path closed a moment before, for example when Stripe refused the amount as below its minimum. The invoice stays open. (#1642) - Fewer ERROR lines from closed browser tabs. A request whose client went away logged
context canceledat ERROR. It now logs at WARN on theunhandled errorline, the authentication check, Settings, the dashboard overview and the invoice list. The 30-second request limit still logs at ERROR, as does every other failure. (#1650) scripts/restore.shrestores a backup that ends with the privileges on a table. That is a backup of a database whose roles have no default privileges (ALTER DEFAULT PRIVILEGES). The restore stopped at\unrestrict: not currently in restricted mode, and nothing changed. Compose installs were not affected. (#1654)
Security
- Accepting an invitation saves the membership, the new account's session and the audit row together. If the session or the audit row cannot be saved the accept answers
500, nothing changes and the invitation can be accepted again. An invitation can be created only by someone who is still a member of the workspace (#1821). - An invitation, and the revoking of one, are saved together with their audit row. If the row cannot be written the request answers
500and nothing changes (#1817). - A sign-out and a test/live mode switch are saved together with their audit row. If the row cannot be written the request answers
500and nothing changes: the session stays signed in, or keeps its mode (#1816). - A sign-in creates its session and writes its audit row in one transaction, and ends the session the browser held before. If the audit row cannot be written the sign-in answers
500and no session exists. A sign-in whose password changed while it was running is refused as a wrong password (#1813). - Removing a member signs them out of that workspace and ends the invitations they sent that were not yet accepted, with the audit row, in one transaction. Before, it signed them out of every workspace. If any step fails the removal answers
500and nothing changes (#1810). - A password reset signs out every session of the user, in both modes, in one transaction with the password change and its audit row. If any step fails the reset answers
500and nothing changes. A user who belongs to no workspace gets the expired-link answer (#1806). - A request that matched no route or mount is logged with only the first segment of its path, such as
/v2/…. This holds for the access log, the panic log and traces. A mistyped address under/v1still logs/v1/*, the mount's pattern. Before, only four known link addresses had their token replaced by[redacted], and any other path was logged as sent (#1801). - The log line for a request that crashed names the route, not the path the client sent. On a hosted invoice, card update, cost dashboard or invite link, it shows the route with
{token}in place of the link token, as the access log and traces already did (#1799). - A stored
Idempotency-Keyanswer is returned only to the caller that made the request: the same API key or the same dashboard user. A retry from another API key or user of the account, or with another query string, gets422idempotency_error, also while the first request still runs. Answers stored before the upgrade were stored without the caller, so a retry of one answers422for up to 24 hours. (#1796) - An
Idempotency-Keyis held only by a request that can run. A request its route refuses (401,403), and one to a path or method no route serves (404,405), no longer keeps the key: the next request with it runs (idempotency, #1873). - Release images carry build provenance, and a release carries its SBOM. From the next release, each image has a signed record of the workflow run and commit that built it (
gh attestation verify oci://ghcr.io/gethardcount/hardcount:<tag> --repo gethardcount/hardcount), CI checks the Cosign signatures it makes, and the API image's SBOM is attached to the GitHub release. CI's own GitHub Actions are pinned to exact commits. The checks are on Verify a release (#1758). - CodeQL scans the code. Every pull request, and
mainevery week, is scanned for unsafe code patterns in Go, TypeScript, Python and the CI workflows (#1781). - The keys the setup command creates are minted like every other key. They are stored with a salted SHA-256 hash, and the test key's audit row is in the test-mode log. Setup keys created in v0.9.3 or earlier have no salt and still work; rotating one replaces it with a salted key (#1740).
- An API key is refused unless it has Hardcount's exact shape. A key is
hc_secret_orhc_ingest_, thenlive_ortest_, then 64 lowercase hex characters; any other string is refused before it is looked up. The database now refuses a stored key of another shape, and two keys with one prefix (#1739). - The webhook event stream closes when its credential stops working.
GET /v1/webhook_events/streamchecks its API key or session again every 15 seconds. Once the key is revoked or expires, or the session ends, it closes with no final frame, and a reconnect with that credential answers401. A credential-store failure does not close it (#1736). - Creating, revoking or rotating an API key is saved only with its audit row. The change and the row commit in one transaction: if the row cannot be written, the request answers
500and the key is unchanged. A rotation is one transaction too, so a failure no longer leaves an unused replacement key behind (#1738). - An answer that carries a secret shown only once is not kept for a replay. A new API key, a webhook signing secret, a cost dashboard token or a card setup link appears in that one answer and nowhere else, and the upgrade deletes the answers kept before (#1732).
- Go 1.26.11 (2026-11-12). Clears GO-2026-6859 (CVE-2026-97054) in
net/http: an HTTP/1 server whose handler writes a response header while it reads a body past aMaxBytesReaderlimit can crash. Hardcount's API caps request bodies withMaxBytesReader, andgovulncheckreaches the advisory from Hardcount code; CI lint failed on every branch until this lands. No application code change. - The dev Postgres, Redis and Mailpit, and the restore drill, listen only on 127.0.0.1. Another machine on your network could reach them with a known password or none. Dumps from
scripts/backup.share now readable only by their owner. The restore drill also removes its copy of the restored data when it ends; before, each run left one in a Docker volume. With Docker Engine on Linux, a container can no longer reach the dev Mailpit (Mailpit). (#1653) - The Compose stack's nginx logs
[redacted]in place of a link's token, and the dashboard's pages refuse to be framed. A hosted invoice, card update, invite or password-reset link holds a token that works like a password. Both nginx access logs wrote it, in the URL and in the Referer. The dashboard's pages now also sendX-Frame-Options, aframe-ancestorspolicy,nosniffandReferrer-Policy. (#1651) - The quick start listens only on this computer. It served the dashboard and API on every network interface, over plain HTTP, with a live key already made. A new quick-start
.envsetsNGINX_HTTP_PORT=127.0.0.1:8080. From another machine, use an SSH tunnel (quick start). (#1635) - Postgres now also keeps each account's Stripe keys apart when they are saved, listed or removed. Settings → Payments and
/v1/settings/striperun these under row-level security, as the caller's account and mode. Hardcount's code already refused another account's or mode's keys. Now the database refuses them too. Nothing changes for a caller managing its own keys. (#1655) - Two new pages say what data Hardcount stores and what it defends against. What data Hardcount stores lists each kind of personal and secret data, where it is kept, how it is protected, what leaves your server and how long it stays, with the fields that are not encrypted today. The threat model lists the attacks Hardcount is built to stop, the control for each, and what is the operator's job (#1763).
Not checked live for this release: two charge-interruption checks that need a proxy holding one Stripe request ("confirm never arrived", "interrupted charge"), the two checks with a real LiteLLM proxy, and the checks that need a Stripe account registered in India. Everything else on the release checklist passed, in Stripe test mode.
Try it:
git clone --branch v0.10.0 https://github.com/gethardcount/hardcount.git
cd hardcount/deploy/compose
./quickstart.sh
./quickstart.sh demoImages (signed with cosign, keyless; with build provenance and an SBOM):
ghcr.io/gethardcount/hardcount:v0.10.0ghcr.io/gethardcount/hardcount-dashboard:v0.10.0
Full changes: v0.9.3...v0.10.0