Skip to content

Drop forge launch status airdrop cap#2170

Merged
prxt6529 merged 9 commits intomainfrom
drop-forge-launch-status-airdrop-cap
Mar 26, 2026
Merged

Drop forge launch status airdrop cap#2170
prxt6529 merged 9 commits intomainfrom
drop-forge-launch-status-airdrop-cap

Conversation

@prxt6529
Copy link
Copy Markdown
Collaborator

@prxt6529 prxt6529 commented Mar 26, 2026

Summary by CodeRabbit

  • New Features

    • Added a "Checking Onchain" status to indicate active on-chain verification.
    • Enforced and surfaced limits for research target edition sizes (default cap applied; inputs clamped/truncated).
  • Improvements

    • Expanded loading indicators to show during on-chain verification.
    • Standardized publishing pill text to remove ellipses.
    • Numeric target input now respects a max constraint when a limit is present.
  • Tests

    • Added unit tests covering status outcomes and edition-size helper behavior.

…tion size.

Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 26, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds on-chain fetching awareness with a new "checking_onchain" primary status, refactors status derivation, introduces helpers and state for computing/clamping research target edition sizes (default 310), threads fetching and size limits through launch client/view, and adds tests covering these behaviors.

Changes

Cohort / File(s) Summary
Tests
__tests__/components/drop-forge/drop-forge-status.helpers.test.ts, __tests__/components/drop-forge/launch/drop-forge-launch-claim-page-client.helpers.test.ts
New/expanded tests for the "checking_onchain" status and comprehensive unit coverage for research target edition-size helpers (limits, defaults, clamping, truncation, edge cases).
Status helpers
components/drop-forge/drop-forge-status.helpers.ts
Added checking_onchain to ClaimPrimaryStatusKey; getClaimPrimaryStatus signature extended with isManifoldClaimFetching?: boolean; refactored into pre/post-init helpers and adjusted "Publishing" label and early-return for on-chain fetching.
Launch helpers
components/drop-forge/launch/drop-forge-launch-claim-page-client.helpers.ts
Added DEFAULT_RESEARCH_TARGET_EDITION_SIZE (310) and exported helpers: getResearchTargetEditionSizeLimit, getDefaultResearchTargetEditionSize, clampResearchTargetEditionSize for normalization, limits, and truncation.
Launch client logic
components/drop-forge/launch/DropForgeLaunchClaimPageClient.tsx
Replaced fixed default with getDefaultResearchTargetEditionSize, added per-claim sync/ref effect, derived researchTargetEditionSizeLimit and cappedResearchTargetEditionSize, enforced max on input with toast, and passed isManifoldClaimFetching into getClaimPrimaryStatus.
Launch view
components/drop-forge/launch/DropForgeLaunchClaimPageClient.view.tsx
Added researchTargetEditionSizeMax prop, applied HTML max on numeric input when provided, and expanded DropForgeStatusPill loader to also show for "checking_onchain".
Claims list
components/drop-forge/DropForgeClaimsListPageClient.tsx
Wired isFetching from useDropForgeManifoldClaim into getClaimPrimaryStatus for launch claims and adjusted pill loader behavior accordingly.

Sequence Diagram(s)

sequenceDiagram
  participant UI as "DropForge UI"
  participant Hook as "useDropForgeManifoldClaim"
  participant Onchain as "Manifold / Onchain API"
  participant Helper as "getClaimPrimaryStatus"
  participant Pill as "StatusPill"

  UI->>Hook: request manifold claim (claimId)
  Hook->>Onchain: fetch on-chain claim state
  Onchain-->>Hook: returns { manifoldClaim, isFetching }
  UI->>Helper: compute primary status (claim, manifoldClaim, isManifoldClaimFetching)
  Helper-->>UI: returns primaryStatus (checking_onchain / publishing / published / ...)
  UI->>Pill: render status (showLoader when primaryStatus.key == "publishing" or "checking_onchain")
  Pill-->>UI: display pill with tone/label and loader state
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • ragnep
  • simo6529

Poem

🐰 I nibble at limits, trim numbers neat,
I hop to onchain to check what we meet,
A checking light glows, then publishing sings,
I clamp and sync edition-size things,
Hop! Launch ready — soft code on quick feet.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly reflects the main changes: adding onchain status checking for drop forge launches and capping airdrop edition sizes with proper validation and limits.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch drop-forge-launch-status-airdrop-cap

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@components/drop-forge/launch/DropForgeLaunchClaimPageClient.tsx`:
- Around line 974-981: The code computes researchAirdropCount from
cappedResearchTargetEditionSize which only clamps against claim.edition_size via
clampResearchTargetEditionSize, so if the DB edition_size is raised before the
on‑chain manifoldClaim.totalMax is updated we may attempt to airdrop past the
on‑chain ceiling and revert; update the clamp logic and any places using
claim.edition_size (including cappedResearchTargetEditionSize, the new target
change handler, the computation of researchAirdropCount, and calls like
runResearchAirdropWrite()/airdrop) to also respect manifoldClaim.totalMax (use
the minimum of claim.edition_size and manifoldClaim.totalMax when computing
target/ceilings) so that all airdrop counts and validations are bounded by the
live on‑chain ceiling.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6d4fc65a-91d7-43d3-a92c-a2f3446c7c29

📥 Commits

Reviewing files that changed from the base of the PR and between 65c4c30 and 22281a7.

📒 Files selected for processing (7)
  • __tests__/components/drop-forge/drop-forge-status.helpers.test.ts
  • __tests__/components/drop-forge/launch/drop-forge-launch-claim-page-client.helpers.test.ts
  • components/drop-forge/DropForgeClaimsListPageClient.tsx
  • components/drop-forge/drop-forge-status.helpers.ts
  • components/drop-forge/launch/DropForgeLaunchClaimPageClient.tsx
  • components/drop-forge/launch/DropForgeLaunchClaimPageClient.view.tsx
  • components/drop-forge/launch/drop-forge-launch-claim-page-client.helpers.ts

Comment thread components/drop-forge/launch/DropForgeLaunchClaimPageClient.tsx
Signed-off-by: prxt6529 <prxt@6529.io>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
components/drop-forge/launch/DropForgeLaunchClaimPageClient.tsx (1)

349-352: ⚠️ Potential issue | 🟠 Major

Clamp the research target to the lower of the DB and on-chain caps.

getResearchTargetEditionSizeLimit() still treats manifoldClaim.totalMax as an override instead of a cap (components/drop-forge/launch/drop-forge-launch-claim-page-client.helpers.ts:179-194). Across these call sites, that means the rendered value, input max, and researchAirdropCount can exceed claim.edition_size whenever the on-chain ceiling is higher than the DB cap. Please bound this with the minimum of the two limits so research airdrops stay inside both ceilings.

Also applies to: 986-994, 1488-1517, 1681-1682

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/drop-forge/launch/DropForgeLaunchClaimPageClient.tsx` around lines
349 - 352, getResearchTargetEditionSizeLimit is treating manifoldClaim.totalMax
as an override instead of a cap, allowing researchTargetEditionSizeLimit (and
downstream uses like researchAirdropCount, input max, and rendered value) to
exceed claim.edition_size when on-chain ceiling is higher; update the logic
where researchTargetEditionSizeLimit is computed (and inside
getResearchTargetEditionSizeLimit) to use the minimum of claim?.edition_size and
manifoldClaim?.totalMax as the effective cap, ensuring all call sites (e.g.,
variables named researchTargetEditionSizeLimit, researchAirdropCount and related
input max handling) clamp values to Math.min(claim.edition_size,
manifoldClaim.totalMax) before rendering or computing counts.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@components/drop-forge/launch/DropForgeLaunchClaimPageClient.tsx`:
- Around line 371-394: Collapse the reset and sync into one useEffect and only
update syncedResearchTargetClaimIdRef/current and call
setResearchTargetEditionSize from that effect when the claim data is known to
belong to the current claimId (e.g. check claim?.id === claimId or maintain a
loadedClaimId and verify it matches). Specifically, replace the two separate
effects with a single effect watching [claimId, claim, manifoldClaim?.totalMax]
that first clears state when claimId changes (set
syncedResearchTargetClaimIdRef.current = null and
setResearchTargetEditionSize(getDefaultResearchTargetEditionSize(null))) and
then, only if claim is non-null and its id matches claimId, set
syncedResearchTargetClaimIdRef.current = claimId and compute the default via
getDefaultResearchTargetEditionSize(claim.edition_size,
manifoldClaim?.totalMax); otherwise avoid marking synced for the new id so
subsequent real claim data can initialize or clamp via
clampResearchTargetEditionSize safely.

---

Duplicate comments:
In `@components/drop-forge/launch/DropForgeLaunchClaimPageClient.tsx`:
- Around line 349-352: getResearchTargetEditionSizeLimit is treating
manifoldClaim.totalMax as an override instead of a cap, allowing
researchTargetEditionSizeLimit (and downstream uses like researchAirdropCount,
input max, and rendered value) to exceed claim.edition_size when on-chain
ceiling is higher; update the logic where researchTargetEditionSizeLimit is
computed (and inside getResearchTargetEditionSizeLimit) to use the minimum of
claim?.edition_size and manifoldClaim?.totalMax as the effective cap, ensuring
all call sites (e.g., variables named researchTargetEditionSizeLimit,
researchAirdropCount and related input max handling) clamp values to
Math.min(claim.edition_size, manifoldClaim.totalMax) before rendering or
computing counts.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 74d1ef10-d605-4dfe-a6f9-fa9c02ea7494

📥 Commits

Reviewing files that changed from the base of the PR and between 22281a7 and fe7a06e.

📒 Files selected for processing (3)
  • __tests__/components/drop-forge/launch/drop-forge-launch-claim-page-client.helpers.test.ts
  • components/drop-forge/launch/DropForgeLaunchClaimPageClient.tsx
  • components/drop-forge/launch/drop-forge-launch-claim-page-client.helpers.ts
✅ Files skipped from review due to trivial changes (1)
  • tests/components/drop-forge/launch/drop-forge-launch-claim-page-client.helpers.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/drop-forge/launch/drop-forge-launch-claim-page-client.helpers.ts

Comment thread components/drop-forge/launch/DropForgeLaunchClaimPageClient.tsx
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
components/drop-forge/drop-forge-status.helpers.ts (1)

93-117: ⚠️ Potential issue | 🟠 Major

Add !isCraftContext guard to the launch-only missing-info state.

The craft published branch (lines 94–109) only runs when missingLaunchInfo is false, but lines 111–117 do not check isCraftContext. Since isMissingRequiredLaunchInfo checks for launch-specific fields like edition_size and season, craft claims lacking these fields will return true and hit the unguarded branch, emitting pending_initialization_missing_info—a state not expected in the craft flow (DropForgeCraftClaimPageClient lines 1668–1725 only handles "draft", "publishing", and "published").

Suggested fix
-  if (!initializedOnchain && missingLaunchInfo) {
+  if (!isCraftContext && !initializedOnchain && missingLaunchInfo) {
     return {
       key: "pending_initialization_missing_info",
       label: "Pending Initialization — Missing Info",
       tone: "pending",
       reason: "Not onchain yet. Required launch fields are missing",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/drop-forge/drop-forge-status.helpers.ts` around lines 93 - 117,
The branch that returns the "pending_initialization_missing_info" status should
be guarded so it does not run for craft claims; modify the condition that
currently reads if (!initializedOnchain && missingLaunchInfo) to also require
!isCraftContext (i.e., if (!initializedOnchain && missingLaunchInfo &&
!isCraftContext)), so craft flow (handled by DropForgeCraftClaimPageClient) will
continue to use its "published"/craft-only branches and won't receive the
launch-only missing-info state.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@components/drop-forge/drop-forge-status.helpers.ts`:
- Around line 93-117: The branch that returns the
"pending_initialization_missing_info" status should be guarded so it does not
run for craft claims; modify the condition that currently reads if
(!initializedOnchain && missingLaunchInfo) to also require !isCraftContext
(i.e., if (!initializedOnchain && missingLaunchInfo && !isCraftContext)), so
craft flow (handled by DropForgeCraftClaimPageClient) will continue to use its
"published"/craft-only branches and won't receive the launch-only missing-info
state.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ccf687b5-bee9-499f-bfe1-05e2be2d9d50

📥 Commits

Reviewing files that changed from the base of the PR and between fc9c85f and dcdd67e.

📒 Files selected for processing (2)
  • __tests__/components/drop-forge/drop-forge-status.helpers.test.ts
  • components/drop-forge/drop-forge-status.helpers.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/components/drop-forge/drop-forge-status.helpers.test.ts

Signed-off-by: prxt6529 <prxt@6529.io>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
components/drop-forge/drop-forge-status.helpers.ts (1)

158-163: The API design conflates two distinct states using undefined: "craft context" and "query loading."

Currently, all non-craft callers (DropForgeClaimsListPageClient and DropForgeLaunchClaimPageClient) properly normalize undefined to null with the manifoldClaim ?? null pattern. However, this normalization is implicit and not enforced by the API contract. Line 170's const isCraftContext = manifoldClaim === undefined; depends on caller discipline—if a non-craft caller omits normalization, the helper would misclassify loading state as craft context, causing the logic at lines 79–91 to skip checking_onchain and fall back to the craft path instead.

While this isn't currently a problem in practice, making context explicit through a dedicated parameter or normalizing the loading state consistently (e.g., always using null for non-craft, never undefined) would eliminate this fragility and prevent future regressions when the API is used elsewhere.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/drop-forge/drop-forge-status.helpers.ts` around lines 158 - 163,
The helper currently treats manifoldClaim === undefined as "craft context",
which is fragile; change the API to accept an explicit boolean (e.g., add
parameter isCraftContext?: boolean to the function signature) and compute
isCraftContext from that parameter instead of checking manifoldClaim for
undefined; update all callers (notably DropForgeClaimsListPageClient and
DropForgeLaunchClaimPageClient) to pass false (they already normalize
manifoldClaim to null) and any craft caller to pass true so the helper no longer
conflates loading (undefined) with craft context.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@components/drop-forge/drop-forge-status.helpers.ts`:
- Line 164: The initialization check uses truthiness which treats instanceId ===
0 as false; update the check used to set initializedOnchain (currently "const
initializedOnchain = !!manifoldClaim?.instanceId") to a nullish check like
"manifoldClaim?.instanceId != null" so zero is treated as a valid initialized
value, and apply the same fix where Boolean(manifoldClaim?.instanceId) is used
(e.g., the DropForgeLaunchClaimPageClient usage) to use a nullish comparison
instead.

---

Nitpick comments:
In `@components/drop-forge/drop-forge-status.helpers.ts`:
- Around line 158-163: The helper currently treats manifoldClaim === undefined
as "craft context", which is fragile; change the API to accept an explicit
boolean (e.g., add parameter isCraftContext?: boolean to the function signature)
and compute isCraftContext from that parameter instead of checking manifoldClaim
for undefined; update all callers (notably DropForgeClaimsListPageClient and
DropForgeLaunchClaimPageClient) to pass false (they already normalize
manifoldClaim to null) and any craft caller to pass true so the helper no longer
conflates loading (undefined) with craft context.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 00b02ded-3e1b-4e1b-8be7-e800298057e5

📥 Commits

Reviewing files that changed from the base of the PR and between dcdd67e and 4610210.

📒 Files selected for processing (2)
  • __tests__/components/drop-forge/drop-forge-status.helpers.test.ts
  • components/drop-forge/drop-forge-status.helpers.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/components/drop-forge/drop-forge-status.helpers.test.ts

Comment thread components/drop-forge/drop-forge-status.helpers.ts Outdated
Signed-off-by: prxt6529 <prxt@6529.io>
simo6529
simo6529 previously approved these changes Mar 26, 2026
Signed-off-by: prxt6529 <prxt@6529.io>
@sonarqubecloud
Copy link
Copy Markdown

@prxt6529 prxt6529 merged commit 4c9b671 into main Mar 26, 2026
8 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Apr 20, 2026
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