bug(trade): restore advanced trading entry instead of redirecting /trade to Swap #1497
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/cl8y-dex-terraclassic#1497
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem and why this change is needed
Entering Trade should open the advanced trading workspace (pair selector, chart, order book, and Market/Limit ticket). Currently, bare
/tradeautomatically replaces the route with the Swap entry. The desktop, compact-header, and mobile Trade links all target/trade, so the primary entry to advanced trading sends visitors to a different product surface.Restore a dependable Trade entry and its navigation/history behavior. Keep the native USTC → configured CL8Y default on Swap. Do not implement this correction by inventing a native factory pair, relabeling cUSTC, weakening execution checks, or changing quote economics.
Bundle the entry fix, its route/default documentation, and regression coverage in this issue. This is a focused follow-up to #1473 and PR #1474; it supersedes the permission to redirect bare
/tradein TQ1473-8/P534-5/P562-4. Other quote/default protections remain applicable.Investigation and current codebase
Source reviewed:
efb5fba29d3dc401d0d026d8b683db8054458920, 2026-10-14 UTC, clean tracked source.frontend-dapp/src/App.tsxalready maps/tradeand/trade/:pairAddrto lazy-loadedTradePage. Swap is/;/swapis an alias. This report is not caused by a missing Trade route registration.components/common/navItems.tsdefines Trade as/tradein both primary navigation and the mobile bottom bar; compact desktop navigation uses the same item.AppShellNavLink.tsxnavigates to that path.pages/TradePage.tsx:218–275runs an entry-selection effect after eligible pairs become available. It first honors a unique factory pair from query parameters. Otherwise it builds the Swap token catalog, selectsdefaultRetailSwapTokenPair(tokens)whenlocation.searchis empty, and callsnavigate('/?' + search, { replace: true }). Explicit native query links can also use this branch. The bare-entry redirect is confirmed by code and was introduced in commitbf13b04e2on 2026-10-11.utils/pairCatalogRank.tscontains separate concepts:defaultRetailSwapTokenPair()for nativeuusd→ exact configured CL8Y identity, and the still-existingfirstCatalogPairAddress()for a retail-filtered, catalog-sorted genuine factory market.utils/tradePairRoute.tsprotects valid deep links, pending resolution, and invalid/unknown notices from default selection.tradeQueryResolve.tsresolves unique genuine factory identities and bounded ticket prefills. Preserve those protections.pages/TradePage.test.tsxexplicitly asserts that a fresh bare/traderenders thenative-swap-entryand has pathname/. That test encodes the reported defect under the earlier default contract; changing only production code will leave the contract inconsistent.skills/AGENTS_TRADING_QUOTE_OUTCOMES.mdTQ1473-8,docs/frontend.mdP534-5/P562-4 and the #1473 section, anddocs/qa/issue-1473/README.mdAC4 currently permit or require the bare Trade redirect. Other Trade documentation still describes factory auto-selection. Reconcile these statements in the fix.Read-only production evidence
On 2026-10-14 UTC, a fresh disconnected desktop Chromium session requested
https://dex.cl8y.com/tradeand settled athttps://dex.cl8y.com/?from=uusd&to=terra16wtml2q66g82fdkx66tap0qjkahqwp4lwq3ngtygacg5q0kzycgqvhpax3. Two Trade links still targeted/trade. This confirms the redirect even before acknowledging the first-visit risk dialog; it does not claim the ticket's execution readiness.The
/tradedocument returned HTTP 200, rather than an HTTP redirect. Its served entry asset was/assets/index-DpQNfH3h.js; the served Trade asset was/assets/TradePage-CKwev5eT.js, SHA-25670fe3aced7796a3e1c0bc704699ea337bf98bddfee83cf1954266a4f2822c22d. That asset contains the same empty-search default andreplace:truenavigation to/?.... Served-asset evidence establishes the deployed branch; it does not independently attest the entire deployment's source revision.An initial browser navigation waiting for
domcontentloadedtimed out. A separate bounded retry waiting for document commit completed and reproduced the redirect. Keep these observations distinct; the timeout is not the inferred cause of the redirect.Relevant files
Paths below are relative to the repository root:
frontend-dapp/src/pages/TradePage.tsx,TradePage.test.tsx, andSwapPage.tsx.frontend-dapp/src/utils/pairCatalogRank.ts,__tests__/pairCatalogRank.test.ts,__tests__/pairCatalogRank.issue562.test.ts.frontend-dapp/src/utils/tradePairRoute.ts,tradeQueryResolve.ts, and their tests underutils/__tests__/.frontend-dapp/src/App.tsx;components/common/navItems.ts,AppShellNavLink.tsx,Layout.tsx,LazyRoute.tsx,ErrorBoundary.tsx; relevant tests undercomponents/common/__tests__/.frontend-dapp/e2e/trade-page-initial-load.spec.ts,trade-page-responsive.spec.ts,trade-indexer-outage.spec.ts; add a dedicated Trade-entry/navigation regression suite if useful.skills/AGENTS_TRADING_QUOTE_OUTCOMES.md,skills/AGENTS_FRONTEND_SWAP_URL_SYNC.md,docs/frontend.md,docs/qa/issue-1473/README.md,AGENTS.md,scripts/verify-issue-1473.sh,scripts/qa/browser-trading-quotes-1473.cjs,scripts/qa/verify-issue-713.sh, andMakefile.Recommended direction
/trade→ Swap branch. Prefer reusingfirstCatalogPairAddress()with existing retail filtering and deep-link guards to select a deterministic genuine factory market and replace only to/trade/<pairAddr>. If no eligible market exists, retain the Trade heading and an actionable pair selector/empty state at/trade./trade/:pairAddridentity and uniquely resolvable factory query links, including amount/side prefills. Never overwrite a deliberate pair selection or a link while its catalog is still resolving. Invalid, unknown, ambiguous, or unresolved links need truthful Trade-local states without a surprise fallback into Swap or an unrelated market./tradedefault assertions to check advanced trading rather than expecting Swap inputs; keep its Swap quote matrix intact. Avoid broad router, backend, economic-ranking, or contract rewrites.Constraints and guardrails
uusd→ exact configured CL8Y. Genuine native USTC and cUSTC remain distinct execution identities; display symbols do not admit assets or select a default.Acceptance criteria
/tradeor/trade/<genuine eligible pair>, never an automatic Swap redirect.from/tolinks preserve pair identity, ticket direction, and bounded amount/side prefills. Pending, invalid, unknown, ambiguous, and disconnected states cannot select a surprise market or bounce into Swap.Test plan: functional paths
/trade,/trade/, valid pair routes, valid unique query links in both directions, prefills with bid/ask and exact-input/output intent, explicit native queries, and malformed/unknown/ambiguous queries. Assert final pathname and rendered advanced workspace together, not just a skeleton or heading.make verify-issue-713,make verify-issue-1473, focused navigation/lazy/chunk tests, frontend type/build/lint checks appropriate to changed files, and affected Trade browser suites. Use owned disposable DB/LocalTerra fixtures for any funded checks; navigation verification itself requires no real wallet or transaction.Test plan: attack, hack, and abuse vectors
javascript:/data:/external/protocol-relative destinations, repeated query keys, HTML/script payloads, unsupported side/exact-field values, negative/huge/precision-invalid amounts, and forged router state. Expect bounded parsing, escaped display, same-origin canonical navigation, and no unintended RPC/signing.showGems/mode/protection flags. Preserve identity/retail filtering and all execution restrictions.Verification criteria and investigation results
Record exact final source SHA, UTC, dirty-patch status, test commands, first/retest results, and explicit unavailable scopes. Publish only sanitized findings. Tests of the old redirect passing are reproduction evidence, not acceptance of the corrected behavior. Keep pre-existing failures visible and resolve their cause or document their separate scope without weakening assertions.
Investigation verification on the reviewed source:
make verify-issue-713: executable source checks passed (8 verifier steps; 137 tests passed across the selected suites). Its LocalTerra browser step was unavailable. That script labels the skipped step as PASS internally; it is recorded here as unavailable, not deployed/funded acceptance.AppShellNavLink,LazyRoute,SwapAliasRedirect, andchunkLoadErrortests: 4 files, 27 tests passed.make verify-issue-1473: first and retest indexer library checks each passed 824 tests, with 1 ignored. Shared safety harness (16 tests) and browser-helper DOM/verdict checks (11 tests) passed on both runs. The frontend suite passed 480 tests but failed 2pairCatalogRank.issue562.test.tsdefault assertions on both runs: they expected native USTC/configured CL8Y and receivedundefined. These are baseline failures, not evidence that the proposed fix is accepted; a separate rerun with the fixture's publicVITE_CL8Y_TOKEN_ADDRESSexplicitly pinned passed all 16 tests in that file, confirming configuration/fixture isolation affects those expectations. Retain the missing-identity fail-closed behavior and make test inputs explicit rather than weakening it. Disposable socket checks could not run because the dedicated QA database capability was absent. The verifier records that unavailable prerequisite as a failed step; do not relabel its aggregate as PASS. Its broad controlled quote-economics browser matrix was stopped outside the entry-navigation investigation scope. The incomplete receipt contains 1,335 scenarios and 9 failures, including interruption-related browser closure; it is not a full-matrix or latency acceptance pass. The independently completed production entry reproduction above is the live evidence for this defect. Final aggregate: 12 PASS / 5 FAIL / 2 SKIP, overall FAIL. Frontend types, Rust formatting, shell syntax, invariant crosslinks, whitespace, and stable-source checks passed. The failures comprise both database-prerequisite steps, both frontend runs, and the incomplete controlled browser step. The public-identity-pinned catalog rerun is a separate successful diagnostic, not a rewrite of these verdicts. Live post-fix acceptance must separately identify served frontend artifacts; backend health and issue closure do not prove frontend deployment. No conversations or user identifiers are included in this issue.Implementation merged in PR #1501, main revision
9dfa373f989ca9684c00ce40bc0525265243dfe9(2026-10-14 UTC). Woodpecker PR pipeline #456 passed, including secrets, contracts, full frontend, indexer library/Postgres and required functional checks.Completed source/local scope:
Individual acceptance criteria are not closed by this shared source summary. Evidence, retained failures and remaining scope and the individual QA checklists are included in main. The initial documentation/owned-fixture failures were corrected and retested; prior failures remain recorded. Final issue-specific live results will follow; this issue remains open until all body/comment criteria pass.
Producer follow-up PR #1502 is merged into main
14055610ebe86fd3640ff85e8adc15e16785c6dd; required CI #458 passed all eight steps. Main and the feature worktree are synchronized.See release results and invariant links. This is source/CI completion, not a claim that every issue criterion passed. Final issue-specific live results will follow; the issues remain open.
Final QA/evidence PR #1503 merged into main
4bd3e8d31485613d6c3ddca62abbac1a1f6e6469; required CI #460 passed all eight steps. Main and the worktree are clean and synchronized with origin/main. Application runtime inputs did not change in this QA-only merge; the actual deployed revision remains the attested14055610…below.Fixes merged in PR #1501 and PR #1502. Both Coolify applications finished at independently attested release
14055610ebe86fd3640ff85e8adc15e16785c6dd; required CI pipelines 456/458 each passed all eight steps. Later helper/evidence changes do not claim a newer application deployment.No wallet connection/sign/broadcast was performed by these navigation checks.
Results, retained failed runs and invariant links. All issue bodies and current comments were reviewed. No complete acceptance claim: this issue stays open for the unchecked scope.
PlasticDigits referenced this issue2026-10-15 05:32:59 +00:00
Closed at the user's request as part of consolidating issues #1449–#1500.
Advanced Trade entry and stable selection/history are implemented and deployed; live navigation first/retest each passed 15/15. No separate Trade implementation task remains. Shared native recovery is tracked by #1504.
Replacement: #1504
Wallet/device chores and verification-only holds are intentionally excluded. Historical failed receipts remain unchanged; this closure does not claim every old acceptance checkbox passed.