Add WTO trade policy intelligence service with tariffs, flows, and barriers#364
Merged
Add WTO trade policy intelligence service with tariffs, flows, and barriers#364
Conversation
…cyPanel Adds a new `trade` RPC domain backed by the WTO API (apiportal.wto.org) for trade policy intelligence: quantitative restrictions, tariff timeseries, bilateral trade flows, and SPS/TBT barrier notifications. New files: 6 protos, generated server/client, 4 server handlers + shared WTO fetch utility, client service with circuit breakers, TradePolicyPanel (4 tabs), and full API key infrastructure (Rust keychain, sidecar, runtime config). Panel registered for FULL and FINANCE variants with data loader integration, command palette entry, status panel tracking, data freshness monitoring, and i18n across all 17 locale files. https://claude.ai/code/session_01HZXyoQp6xK3TX8obDzv6Ye
The delegated click handler was added inside render(), which runs on every data update (4× per load cycle). Since the listener targets this.content (a persistent container), each call stacked a duplicate handler. Moving it to the constructor binds it exactly once. https://claude.ai/code/session_01HZXyoQp6xK3TX8obDzv6Ye
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
koala73
added a commit
that referenced
this pull request
Feb 25, 2026
The WTO trade handlers used fabricated indicator codes (QR, SPS, TBT, HS_M_0010) that don't exist in the WTO Timeseries API, causing all four RPCs to silently return empty data. Fixes: - Tariffs: HS_M_0010 → TP_A_0010; remove partner param (tariff indicators lack partner dimension, caused 400 error) - Trade flows: split comma-separated indicators into parallel requests (API truncates combined i= values) - Restrictions: rewrite to use tariff overview across 15 major economies (QR API is a separate subscription product) - Barriers: rewrite to use agricultural vs non-agricultural tariff gap analysis (ePing SPS/TBT API is separate subscription) - Handle 204 No Content (valid query, no data) instead of treating as error Also: disable Global Giving panel by default for non-happy variants, update README for BIS + WTO features (PR #363, #364).
3 tasks
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds comprehensive trade policy intelligence from WTO data sources, including trade restrictions, tariff trends, bilateral trade flows, and SPS/TBT barrier notifications. Implements a new
TradeServicewith four RPC endpoints backed by the WTO Timeseries API, includes a newTradePolicyPanelUI component for visualizing trade data, and adds multilingual support across 16 languages.Type of change
/api/*)Affected areas
/api/*)Changes
Backend
proto/worldmonitor/trade/v1/): Service definition and message types for trade restrictions, tariff trends, trade flows, and trade barrierssrc/generated/server/worldmonitor/trade/v1/service_server.ts): Auto-generated TypeScript server interfaces and route handlersserver/worldmonitor/trade/v1/):get-trade-restrictions.ts: Fetches WTO quantitative restrictions and export controlsget-tariff-trends.ts: Fetches applied tariff rates over timeget-trade-flows.ts: Fetches bilateral export/import values with YoY changesget-trade-barriers.ts: Fetches SPS/TBT barrier notifications_shared.ts: WTO API integration, member code mappings, and shared utilitiesserver/worldmonitor/trade/v1/handler.ts): Aggregates RPC implementationsFrontend
src/generated/client/worldmonitor/trade/v1/service_client.ts): Auto-generated TypeScript client with circuit breaker supportsrc/services/trade/index.ts): Client-side service with circuit breakers, caching, and error handlingsrc/components/TradePolicyPanel.ts): Tabbed panel displaying restrictions, tariffs, flows, and barriers with source attributionConfiguration
src/services/runtime-config.ts): AddedWTO_API_KEYsecret key supportsrc/app/panel-layout.ts,src/config/panels.ts): RegisteredTradePolicyPanelin layout and configsrc/app/data-loader.ts): Integrated trade data fetching into app initializationvite.config.ts): Added trade service module to API pluginapi/[domain]/v1/[rpc].ts): Registered trade service routessrc-tauri/sidecar/local-api-server.mjs,src-tauri/src/main.rs): AddedWTO_API_KEYto allowed environment variablessrc/services/data-freshness.ts): Added 'wto' data source trackingsrc/components/StatusPanel.ts): Added WTO to API listsrc/services/analytics.ts): Added WTO API key trackingsrc/config/commands.ts): Added trade policy panel commandTesting