Skip to content

Promote to prod: M-Wallet rename + MCP deploy/index/search fixes#118

Merged
jab3z merged 16 commits into
mainfrom
dev
Jun 26, 2026
Merged

Promote to prod: M-Wallet rename + MCP deploy/index/search fixes#118
jab3z merged 16 commits into
mainfrom
dev

Conversation

@jab3z

@jab3z jab3z commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Promotes the staging work on dev to main (production / docs.ottu.com). Everything below is already merged to dev and verified live on docs.ottu.dev.

What's included

Docs

  • Wallet → M-Wallet rename (#112) — disambiguates the Ottu merchant wallet from digital/loyalty wallets. Scoped to the feature name; common-noun "wallet" and all code/API values (payment_services:["wallet"], destination:"wallet", etc.) preserved; original section anchors preserved so no bookmarks break.
  • (already on dev) expose /business/ routes in the MCP server (#110).

MCP service / deploy reliability (these are why prod needs this — its next deploy would otherwise fail the same way dev did)

  • Readiness hardening + fetch timeout (#113).
  • Oversized-index guard (#114) — the mcp skips an index over 50 MB instead of OOM-crashing the deploy. Permanent safety net.
  • Shrink the search index 293 MB → 2.8 MB (#115) — patch-package the plugin's createSearchIndex() (tokenize: strict, resolution: 3, drop context), applied on postinstall in both the root and mcp-server installs.
  • /refresh reloads the in-memory index + auto-refresh after deploy (#116, #117) — both deploy-dev.yml and deploy.yml poll the deployment to ACTIVE then ping /mcp/refresh, so search reflects the just-published docs.

Prod deploy behaviour on merge

Merging triggers deploy.yml (prod). The guard means the deploy promotes even though prod's current live index is still ~293 MB; the new build publishes the 2.8 MB index; the new refresh step then pings https://docs.ottu.com/mcp/refresh so prod MCP search works on this same deploy. Prod's bare DO health-check is fine now that the index loads fast (matches the pre-bloat state).

Verified on dev

  • docs.ottu.dev shows M-Wallet; old anchors (e.g. …/operations#refund-to-wallet) still resolve.
  • _mcp-data/search-index.json = 2.8 MB; /mcp/health 200; docs_search returns relevant hits.
  • Deploy workflow polled to ACTIVE and logged MCP index refreshed.

🤖 Generated with Claude Code

ankitottu and others added 16 commits June 24, 2026 19:48
Removes /business/* from the docusaurus-plugin-mcp-server excludeRoutes
so business pages are indexed and served by the MCP server.

Fixes: docs_fetch returning "Page not found" for /business/ URLs
Ref: #156237
docs(mcp): expose /business/ routes in MCP server
Rename the Ottu merchant wallet (stored-balance feature) to "M-Wallet"
(merchant wallet) so it can't be confused with digital wallets (Apple Pay,
Google Pay, Samsung Wallet, STC Pay) or stacked loyalty wallets (e.g. Qitaf).

Semantic rename, not a global find/replace:
- Renamed every reference to *this* wallet → M-Wallet across the two main
  pages (developer + business), the four Checkout SDK platform sections, and
  the operations / payment-methods / payments-index / transaction-states pages.
- Updated sidebar labels and the section-anchor hrefs whose headings changed;
  cross-page links and the regenerated API references follow the new anchors
  (e.g. operations#refund-to-m-wallet).
- Renamed user-facing strings in the wallet demo + flow diagram (WalletDemo
  copy, scenario captions, SVG title/desc/labels).

Deliberately left literal:
- Product-UI-quoted strings (SDK "Wallet (X.XXX CCC)" chip, dashboard
  "Refund to Wallet" button, "Wallet → Accounts/Operations" menus,
  "Generated Reports → Wallet Exports") — the product UI is not renamed.
- API contract values / code identifiers: payment_services ["wallet"],
  formsOfPayment ["wallet"], destination "wallet", provider_code "wallet_ottu",
  customer_wallet_transactions, component names, routes, image paths.
- Generic / other-provider wallet language: "wallet provider", "one wallet
  per provider", multi-wallet stacking, loyalty wallets — M-Wallet is one
  wallet among these.
- API reference titles (per request) — only fixed the operations anchor in the
  enrichment overlays for link integrity, then regenerated.

Verified: typecheck passes, production build succeeds, no new broken
links/anchors, no stale "Ottu Wallet" or old wallet anchors in shipped content.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Address PR review: "anchors follow new names" broke any existing external
deep-link to the renamed sections. Keep the M-Wallet display text everywhere,
but pin every renamed heading back to its original slug with an explicit
`{#…}` id, and point every internal anchor reference at the original slug.

Net effect: the rename is now display-only at the URL level — every
previously-valid anchor (and the operations refund tab's queryString value)
keeps resolving, so no bookmark or inbound link breaks.

- Pinned original ids on renamed headings (e.g. `## M-Wallet at Checkout
  {#wallet-at-checkout}`, `## Refund to M-Wallet {#refund-to-wallet}`,
  `### M-Wallet {#ottu-wallet}`, `### M-Wallet (Stored Balance)
  {#wallet-stored-balance}`, plus the deep H3/H4 sub-headings).
- Reverted internal anchor refs to original slugs: dev-page cross-links,
  business self-links, transaction-states, sidebar hrefs, and the operations
  `<TabItem value>` (label stays "Refund to M-Wallet").
- Reverted the enrichment overlays' anchor and regenerated — the 3 generated
  API pages link to operations#refund-to-wallet again.

Verified: typecheck passes; production build's broken-anchor list is identical
to the pre-existing baseline (no new broken anchors); no residual `m-wallet`
slug anywhere; all M-Wallet display text intact.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…"wallet")

Per review feedback: the goal is to *name* the feature distinctly so merchants
don't confuse it with STC Pay / Apple Pay / other wallet services — not to brand
"M-Wallet" as a repeated proper noun. The previous pass over-applied it, turning
the common noun "wallet" into "M-Wallet" everywhere.

Reset the touched files to their pre-rename original (restoring all natural
common-noun "wallet" prose), then re-applied "M-Wallet" only where it *names*
the feature:

- Page titles, sidebar_label, sidebar nav labels, H1, and the one-time intro
  definition ("M-Wallet (merchant wallet) ...").
- Feature-naming section headings: "M-Wallet at Checkout", "M-Wallet Reporting",
  "Why use M-Wallet", "Refund to M-Wallet", the SDK "### M-Wallet",
  "M-Wallet (Stored Balance)", and the "M-Wallet as a payment method" tip.
- Disambiguation-vs-other-wallets references: "Ottu Wallet/credit + Qitaf"
  -> "M-Wallet + Qitaf"; "The Ottu Wallet payment method" -> "The M-Wallet ...".
- Nav-style cross-links / What's Next labels that name the feature.
- Demo card title and the flow-diagram title.

Everything else stays the common noun "wallet" — "wallet balance/credit/account/
ledger/rail/leg", "refund to the wallet", "wallet-capable", "wallet service", etc.
Net change drops from ~263 to ~47 lines.

Anchors unchanged: the few headings that became M-Wallet keep their original
slug via explicit `{#…}` ids, so no URL breaks. transaction-states.md and
wallet-scenarios.tsx are byte-identical to the original (pure common-noun).

Verified: typecheck passes; build's broken-anchor list matches the pre-existing
baseline (no new broken anchors); no residual "Ottu Wallet" or "m-wallet" slug.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
docs(wallet): rename the Ottu Wallet feature to "M-Wallet"
The docs-dev DO app deploys the `docs` static site and the `mcp` Node service
atomically. The mcp service was failing its readiness probe during cold start
(starts, then terminated exit 128), which failed the whole deployment and rolled
back — leaving docs.ottu.dev serving the previous build (e.g. PR #112's M-Wallet
rename never went live).

Root cause was a too-tight readiness window, not the service itself (the live
instance is healthy). Two changes:

- server.mjs: bound the startup artifact fetch with AbortSignal.timeout(20000) so
  a stalled docs origin (mid-deploy) can't hang the "ready" transition; the retry
  loop then advances instead of waiting forever.
- app-spec-dev.yaml: replace the bare health_check (which used DO defaults: 1s
  timeout, 0s initial delay) with 30s initial delay, 5s timeout, 9 retries. Also
  add the SANDBOX_KEYCLOAK_CLIENT_SECRET env key to match the live app spec (the
  WalletDemo seed reads it; the repo spec had drifted).

mcp-server tests pass (8/8). Dev only; prod has the same config and should get
the same fix before its next main deploy.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fix(mcp): harden staging deploy readiness probe
The docusaurus-plugin-mcp-server flexsearch index has ballooned to ~293 MB
(contextual indexing over full page content). The mcp service runs on a 512 MB
instance and imports the index at startup, so it OOMs/stalls during deploy,
fails the readiness probe, and — because DO deploys the docs static site and the
mcp service atomically — takes the entire docs.ottu.dev deployment down with it.
That's why the M-Wallet rename never went live.

Guard it: stream the index body and bail past a 50 MB cap (Content-Length is
unreliable — the origin gzips, so the header is the compressed size while the
body decompresses far larger). Over the cap we write an empty "{}" index and keep
serving, so the service stays healthy and the deploy promotes. Doc lookups and
the webhook relay are unaffected; only MCP keyword search is degraded until the
index itself is shrunk (separate follow-up: patch the plugin's index config).

Verified locally against the live 293 MB index: server logs the skip, writes a
2-byte index, /health is 200, "MCP server ready." mcp-server tests: 8/8 pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fix(mcp): cap search-index load so a bloated index can't fail the deploy
The docusaurus-plugin-mcp-server flexsearch index ballooned to 293 MB and the
mcp service had to skip loading it (guard in PR #114) to keep deploys alive,
leaving MCP keyword search degraded. The bloat is the plugin's hardcoded
createSearchIndex(): tokenize "forward" (prefix-expands every word of full page
content) plus resolution 9 and a context:{depth:2,bidirectional} proximity index.

patch-package the plugin (no config knob is exposed): tokenize "strict",
resolution 3, drop the context block — full-text fields stay indexed. Index drops
to ~2.8 MB (under the 50 MB guard). Applied automatically on every build via a
postinstall hook, in both the root install (build-time index generation) and the
mcp-server copy (runtime import) so their FlexSearch configs match.

Verified locally: npm run build emits a 2.8 MB index; the mcp runtime loads it
(no cap skip), "MCP server ready"; docs_search "refund wallet" returns 14
relevant hits (top: the M-Wallet page). mcp-server tests 8/8.

The 50 MB guard stays as a permanent safety net against future bloat.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fix(mcp): shrink search index 293MB → 2.8MB to restore MCP search
…ploy

POST /mcp/refresh re-downloaded the artifact files but never rebuilt the
in-memory McpDocsServer, so search kept serving the index imported at startup —
the endpoint was effectively a no-op. Factor the startup construction into a
buildMcpServer() closure and call it from /refresh after fetchArtifacts(), so a
refresh actually reloads the index. A failed fetch still returns 500 and keeps
the existing server (buildMcpServer isn't reached).

Also: the mcp loads the index from the public URL at startup, which during a
deploy is still the previous build — so MCP search lagged one deploy. The dev
deploy workflow now captures the deployment id, polls the DO API until ACTIVE,
then POSTs /mcp/refresh so search reflects the just-published docs. Best-effort:
the step never fails the workflow (skips on ERROR/CANCELED/SUPERSEDED/timeout).

Verified: served a built site locally, search returned 16 hits; swapped the
served index to {} and POSTed /refresh; the same query then returned no results
— proving the in-memory rebuild. mcp-server tests 8/8.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fix(mcp): make /refresh reload the index + auto-refresh after deploy
Mirror the dev workflow's post-deploy refresh into deploy.yml: capture the DO
deployment id, poll until ACTIVE, then POST https://docs.ottu.com/mcp/refresh so
production MCP search reflects the just-published docs (the mcp loads the index
from the public URL at startup, which during a deploy is still the previous
build). Best-effort — never fails the workflow. Uses DO_APP_ID_PROD.

Needed so the dev->main promotion (guard + shrink + /refresh fix) leaves prod
MCP search working on the first deploy rather than one deploy behind.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ci(prod): refresh MCP index after production deploy
@jab3z jab3z merged commit abc83a4 into main Jun 26, 2026
2 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.

2 participants