Skip to content

Map pricing categories via slugs, read specs from includes - #87

Open
thomhug wants to merge 3 commits into
renuo:developfrom
ninech:feature/pricing-category-slugs
Open

thomhug wants to merge 3 commits into
renuo:developfrom
ninech:feature/pricing-category-slugs

Conversation

@thomhug

@thomhug thomhug commented Nov 17, 2026 •

Copy link
Copy Markdown

Why

The pricing calculator finds its products by a substring of the category path from calculator.nineapis.ch (e.g. Deploio / 1) Resources). The product data is about to change those paths (ninech/odoo-connector#162):

  • the N) ordering prefixes are removed (1) Resources → Resources, 6) Search → Search, …)
  • Deploio becomes Deploio (PaaS)

Without this change, almost every slot would lose its product (app sizes, KVS, search, static egress, IPv4, block storage, Grafana) and show –.

What

  • _data/pricing.yml gets a categories map: slug → list of full category paths. Slots refer to a slug (category: deploio_resources) instead of a path fragment.
  • A product belongs to a slug when its categ_id path equals one of the listed paths, so a short name can no longer match the wrong category by accident.
  • Each slug lists both the current and the renamed path, so the calculator works before, during and after the rename. Once the rename is live, the old paths can be removed. Future renames work the same way: add the new path first.

Also: specs from includes (second commit)

The calculator API will also drop the Odoo product id, display_name and all sh_* bundle fields (bundle_products, sh_product_id, sh_qty, …). Products list what they include as includes: [{product_id, quantity}], and the included products are part of the same response.

  • productSpecs reads includes and looks up each included product's name in the response, so the existing patterns (RAM, (GB), vCPU, Block Storage, OpenSearch) keep working unchanged.
  • The display_name fallback for slot names is gone (it always equalled name).
  • The fixture is converted to that shape and lists the included products.
  • New tests: KVS specs; an included product missing from the response adds no spec.
  • Checked against the live product list: the old and the new code build identical catalogs (de and en, specs included) when the new code gets the response without id, display_name and sh_*.

Tests

  • New: every slug used by a slot is defined in categories
  • New: with the fixture's categories renamed (no prefixes, Deploio (PaaS)), every slot still resolves to the same catalog
  • New: an unmapped path matches nothing, so the slot shows up in missingSlots
  • Checked against the live product list from calculator.nineapis.ch: no missing slots, before or after the rename, same catalog either way

Note: the page starts with the default preset and one app with a small database matches the design estimate already fail on develop. Since cd5c73e (Change Locales) the label reads Economy instead of Single database. This PR does not touch that.

🤖 Generated with Claude Code

The calculator matched products by a substring of their category path
("Deploio / 1) Resources"). The product data is about to drop the "N) "
ordering prefixes and rename "Deploio" to "Deploio (PaaS)"
(ninech/odoo-connector#162), which would leave nearly every slot
without a price.

Slots now reference a category slug, and `categories` in
_data/pricing.yml maps each slug to every full category path it stands
for. Listing old and new paths side by side lets a rename be prepared
ahead of time; the old path can be dropped once the rename is live.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thomhug
thomhug requested a review from a team as a code owner November 17, 2026 11:01

@raphaelknecht raphaelknecht left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the mapping against the live product list from calculator.nineapis.ch: every current category path (Deploio, all On-Demand Services, Object Storage) is listed exactly as it appears there, and the renamed paths are prepared next to them. Ran the tests on the branch: 18 pass, the 2 failures are the known Economy vs. Single database ones from develop. Looks good from our side.

Two small follow-ups, neither blocking:

  1. Once the rename in odoo-connector#162 is live, the old paths should be removed. The comment in pricing.yml says so, but a follow-up issue would make sure it actually happens.
  2. No checks run on this repo, which is probably why the 2 failing tests on develop went unnoticed. Worth fixing them in a separate PR, and maybe running node --test in CI.

One thing I couldn't verify: I don't have access to odoo-connector#162. If the rename also touches On-Demand Services or Object Storage (not only the N) prefixes and Deploio), those paths would be missing here.

@raphaelknecht

Copy link
Copy Markdown
Contributor

I've passed this PR on to @snitzelbread (Julian from Renuo) for review.

The calculator API is dropping the Odoo product id, display_name and all
sh_* bundle fields (bundle_products, sh_product_id, sh_qty). Specs (RAM,
vCPU, storage, nodes) now come from `includes` ({product_id, quantity});
the included product's name is looked up in the same API response, so the
existing name patterns keep working. The display_name fallback is gone
(it always equalled name).

The fixture is converted to that shape and lists the included products.
Against the live API, old and new code build identical catalogs (de/en).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thomhug thomhug changed the title Map pricing categories via slugs Map pricing categories via slugs, read specs from includes Nov 17, 2026
@sislr
sislr requested review from snitzelbread and removed request for a team November 18, 2026 08:53
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.

3 participants