Skip to content

fix(client): lock CampaignStatusTag to escrow and derive in-production (Closes #146) - #219

Open
shinzoxD wants to merge 1 commit into
Cylo-Traders:masterfrom
shinzoxD:fix/146-inproduction-status-drift
Open

fix(client): lock CampaignStatusTag to escrow and derive in-production (Closes #146)#219
shinzoxD wants to merge 1 commit into
Cylo-Traders:masterfrom
shinzoxD:fix/146-inproduction-status-drift

Conversation

@shinzoxD

@shinzoxD shinzoxD commented Aug 24, 2026

Copy link
Copy Markdown

Summary

Aligns the client's on-chain CampaignStatusTag with contracts/production_escrow/src/types.rs and treats in production as a presentational state for a Funded campaign that has already released a tranche.

Issue #146 was written against a snapshot where escrow had no InProduction variant. Master already emits InProduction on first release_tranche (PR #104). This PR:

  • Keeps CampaignStatusTag as the on-chain union only (ON_CHAIN_CAMPAIGN_STATUS_TAGS), documented as distinct from UI-only derived states
  • Derives the stepper / badge "In Production" presentation from status === 'Funded' && (tranches.some(t => t.released) || released > 0) so a mid-production Funded campaign is not stuck on the Funded step
  • Limits ACTIONABLE_STATUSES to real on-chain tags (Active, Funding, Funded, InProduction, Harvested, Disputed)
  • Adds a regression test that parses pub enum CampaignStatus from types.rs and fails if the client union drifts

No registry contract changes (those belong to #69 / PR #132). No overlap with #183.

Closes #146

Changes

  • client/src/lib/soroban/types.tsON_CHAIN_CAMPAIGN_STATUS_TAGS is the source of CampaignStatusTag
  • client/src/lib/campaignStatus.tsisDerivedInProduction / presentationalCampaignStatus / lifecycleStepIndex(status, progress); ACTIONABLE_STATUSES moved here
  • client/src/hooks/useAdminCampaigns.ts — uses the shared on-chain actionable list
  • LifecycleStepper + CampaignAdminPanel — Funded + released amount advances to In Production

Tests

cd client
npx vitest run src/lib/__tests__/campaignStatus.test.ts src/components/campaign/__tests__/LifecycleStepper.test.tsx src/components/admin/__tests__/CampaignAdminPanel.test.tsx src/pages/__tests__/AdminDashboardPage.test.tsx

15 passed (7 parity/derivation + 4 stepper + 2 admin panel + 2 dashboard)

npx eslint src/lib/soroban/types.ts src/lib/campaignStatus.ts src/hooks/useAdminCampaigns.ts src/components/campaign/LifecycleStepper.tsx src/components/admin/CampaignAdminPanel.tsx src/lib/__tests__/campaignStatus.test.ts src/components/campaign/__tests__/LifecycleStepper.test.tsx

Scoped lint clean.

Payout wallet

GBVHELLD2JE235Y2NGTDT3MWI3T65ON6SY4N6FBHYVDAQ5FZC2CP5QXH

Keep CampaignStatusTag in lockstep with production_escrow CampaignStatus
and treat Funded + released-tranche progress as a UI-only in-production
state for the lifecycle stepper and status badge.

Closes Cylo-Traders#146
Copilot AI lite review requested due to automatic review settings August 24, 2026 17:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

Frontend's CampaignStatusTag includes an 'InProduction' status the real contract never emits

3 participants