Skip to content

feat(protocol): the price answer names the VAT rate it taxed at - #116

Open
frahlg wants to merge 1 commit into
mainfrom
price-vat
Open

frahlg wants to merge 1 commit into
mainfrom
price-vat

Conversation

@frahlg

@frahlg frahlg commented Nov 1, 2026

Copy link
Copy Markdown
Member

Pair: srcfl/ftw#1949 (Core sends the field, and FTW Cloud's tile carries it). Merge the two together.

price.get's answer gains vatPermille: the VAT rate the box taxed totalMinor at, in permille (250 is 25 %). With it a client can show spot with VAT, spotMinor × (1 + vatPermille / 1000), at the box's own rate instead of a guess.

  • docs/protocol.md: the field, what 0 and absent mean, and that a total stored before a rate change keeps the old rate for a while.
  • src/lib/protocol/messages.ts: vatPermille?: number on Prices. Optional, because an older box leaves it out, and absent means unknown, never zero.
  • src/lib/sim/box.ts: the simulated box sends the rate its own totals use (25 % as 250). SIM_VAT_PCT is now exported from the sim planner for that.
  • tests/price-e2e.test.ts: the sim names 250, and taking each total back out at that rate leaves the same tariff in every hour. A wrong rate would leave a tariff that follows the market.

No UI change. No registry change: price message keys are not in registry.yaml.

Permille rather than a float percent because every ratio on the wire is an integer in permille, and the price answer keeps floats off the wire.

Tests, run on this machine:

  • npm run verify: pass (svelte-check 0 errors, 1190 tests, build)
  • npm run check:contract against the paired FTW branch: registry and push catalogue match byte for byte

🤖 Generated with Claude Code

Prices gains an optional vatPermille: the VAT rate the box taxed
totalMinor at, in permille (250 is 25 %). Absent means an older box
and an unknown rate; 0 means no VAT. The protocol doc says so, and the
simulated box sends the rate its own totals use. No UI change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T14:18:00.286243Z 2157f9c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ftw-webapp 2157f9c Commit Preview URL

Branch Preview URL
Nov 01 2026, 02:17 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant