Skip to content

Release: promote develop to main (one place decides what a dish costs) - #886

Merged
sridharkalaibala merged 4 commits into
mainfrom
develop
Sep 18, 2026
Merged

sridharkalaibala merged 4 commits into
mainfrom
develop

Conversation

@sridharkalaibala

Copy link
Copy Markdown
Contributor

What

Promotes the pricing unification to main. Nothing here needs the cloud - it is all till-side renderer code - but main should not sit behind develop, and the installer is built from this.

Commits

  • The token test checks who signed it, not how it was typed
  • One place decides what a dish costs

Verified on develop by content

kot.js: one copy of the pricing sum remains (_priceFrom), reached through
_priceOf (catalogue, untyped tax inclusive) and _priceOfOrderLine (order
line, untyped tax exclusive). The two defaults still disagree on purpose.

Merge with a merge commit, never squash.

kot.js carried THREE copies of the same discount-and-tax arithmetic: the
search results, and the two paths that re-read an order already sitting on a
table. Three copies of a price calculation is how a dish ends up costing two
different amounts on two screens, and nobody notices until a customer is
charged differently for the same thing twice.

They had already drifted, which is the part worth knowing:

  the search path   reads `selling_price`, and an item carrying tax with no
                    tax_type is treated as INCLUSIVE
  the order paths   read `selling_price || item_price`, and the same item is
                    treated as EXCLUSIVE

On a taxed item with no tax_type those two return different money. So the sum
is shared in _priceFrom and THE DIFFERENCES ARE KEPT, passed in by each
caller through _priceOf and _priceOfOrderLine. Folding the defaults together
would quietly reprice every untyped item on one screen or the other, and that
is a decision about money for the owner to make on purpose rather than
something to slip into a refactor.

Proven rather than eyeballed: the tests run the real functions against the
numbers the old copies produced, on ten combinations of tax, tax type and the
two kinds of discount. The catalogue path was also compared against the
committed version of the file directly - identical on every case. One test
asserts the two defaults still DISAGREE, so that if somebody makes them
agree it fails and asks them to mean it.

The count of copies is asserted too. A fourth will say so before it can
drift.
…-costs

One place decides what a dish costs
develop was carrying a failing suite, and the failure was the test's fault
twice over. A handset was given its own, longer token lifetime - reasonable,
since a phone on a floor all day should not expire like a till - and two
assertions pinned to exact source text went red for it:

  signLegacyToken(recordsFiltered, req)        became
  signLegacyToken(recordsFiltered, req, undefined, handsetSeconds)

  expiresIn: jwtLifetimeSeconds()              became
  expiresIn: handsetSeconds

Neither weakened anything. The credential is still signed from the user who
signed in, and the client is still told when it expires. But a suite that
fails when its subject improves is a suite people stop reading, and this one
had already gone quiet on develop.

So both now assert the rule. The first checks that the user and the request
are what the token is signed FROM, whatever else follows them. The second
reads the lifetime argument out of the call and requires expiresIn to report
THAT identifier - which is the property that matters, because a client told a
different figure refreshes too often or, worse, too late. Proven by making
the handler report a lifetime the token does not carry: it fails and names
the one that was signed.

Not my area - this is the handset login - and nothing in the controller is
touched. A red develop is everybody's problem, so the assertions are fixed
rather than left for whoever wrote them to find.
…ned-it

The token test checks who signed it, not how it was typed
@sridharkalaibala
sridharkalaibala merged commit 32b6b05 into main Sep 18, 2026
19 checks passed
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