Skip to content

[#1] Fix forms callback delivery and action feedback - #533

Merged
DVidal1205 merged 6 commits into
KnightHacks:mainfrom
ChrisH0125:codex/forms-delivery-feedback
Sep 6, 2026
Merged

[#1] Fix forms callback delivery and action feedback#533
DVidal1205 merged 6 commits into
KnightHacks:mainfrom
ChrisH0125:codex/forms-delivery-feedback

Conversation

@ChrisH0125

@ChrisH0125 ChrisH0125 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Closes #1.

Why

Form submission side effects need to survive transient Discord failures, and admins need a clear way to connect form data to registered callback inputs without editing application code for every form.

What changed

  • Persists callback execution snapshots, delivery status, retry history, Discord response identifiers, and a stable nonce for idempotent retries.
  • Discovers callback-only tRPC mutations through formCallback metadata and exposes their input descriptions to the admin mapper.
  • Lets admins map each callback input from one form question, a respondent field, or a manual value. A question cannot be reused for another input in the same callback.
  • Exposes Member ID, respondent name, respondent email, Auth User ID, and linked Discord User ID as respondent sources.
  • Restores the recruiting workflow with separate name, email, major, gradTerm, gradYear, and team inputs, plus the legacy structured embed, configured director mention, and role-derived team color.
  • Configures Discord role assignment with a mapped Discord User ID and manual role ID while preserving the server-side role allowlist.
  • Shows callback configuration, delivery receipts, failures, retries, and deletion feedback in Blade.
  • Prevents direct HTTP callers from invoking callback-only procedures.

The latest desktop and mobile callback-mapper screenshots are attached to the implementation update.

Verification

  • API forms suite: 73 tests passed
  • Blade forms suite: 132 tests passed
  • Forms validators: 12 tests passed
  • Discord configuration: 13 tests passed
  • Root format, lint, and typecheck passed
  • Changed React analysis passed with 0 failures
  • Blade production build passed
  • Headed Chrome desktop and mobile checks passed with no console errors or horizontal overflow

Deployment

  1. Deploy the matching Blade, API, and cron worker revisions.
  2. Configure each form's callback and input mappings in Blade.
  3. Retry one retained failed execution to confirm Discord delivery in the target environment.
  4. Do not bulk-replay historical failures unless their saved snapshots are still intended for delivery.

No database migration, dependency, or environment-variable change is required by this update.

@ChrisH0125
ChrisH0125 marked this pull request as ready for review September 5, 2026 23:37
@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Approval pending

CodeRabbit has no unresolved comments, but it has not reviewed the latest commit.

Use the checkbox below to review the latest commit. CodeRabbit will approve the changes if it finds no blocking issues.

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR updates callback delivery with typed mappings, router-based procedure dispatch, respondent data, and Discord-compliant nonces. It updates the callback editor with metadata-driven inputs, validation, responsive controls, and operation feedback. It adds persistent submission receipts and multiple-response navigation. It adds deletion and retry feedback in the responses dashboard. API, component, browser, and end-to-end tests cover these flows.

Merge Risk: 🟡 Moderate · up to f5124

Callback delivery can omit required recruiting content, role assignments can diverge between Discord and the platform, and older callback settings may not be remapped before use. These should be resolved before merge.

🚥 Pre-merge checks | ✅ 7 | ❌ 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 53 functions across 28 files. (4 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (7 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes address all coding objectives in issue [#1], including deterministic nonce encoding, responsive callback settings, submission confirmation, deletion feedback, delivery status clarity, retr…
Out of Scope Changes check ✅ Passed The code and test changes remain within issue [#1]. No schema, migration, dependency, environment-variable, authorization, deployment-setting, historical replay, or callback backfill changes are inclu…
No Hardcoded Secrets ✅ Passed No changed file contains a hardcoded API key, password, token, or secret literal. Provider-token scans found no GitHub, OpenAI, Slack, Google, bearer, or private-key patterns. The changed `JUDGING_ACC…
Validated Env Access ✅ Passed No direct process.env usage was introduced by this pull request. The exact diff from base f4436df1 contains no added or removed process.env lines, and no changed file contains that access. The r…
No Typescript Escape Hatches ✅ Passed No changed TypeScript code introduces any, @ts-ignore, @ts-expect-error, or a non-null assertion. Diff searches and AST checks across the full PR range found only ordinary logical negation and p…
Title check ✅ Passed The title starts with the required issue number format, summarizes the forms callback and action feedback changes, and is 52 characters long.
Description check ✅ Passed The description directly explains the callback delivery, form feedback, configuration, verification, and deployment changes in the changeset.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 53 functions across 28 files. (4 skipped: 4 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

ChrisH0125 and others added 3 commits September 5, 2026 22:13
@DVidal1205
DVidal1205 force-pushed the codex/forms-delivery-feedback branch from 6cd145a to f512430 Compare September 6, 2026 02:33
@DVidal1205

Copy link
Copy Markdown
Contributor

Implemented the callback mapping refinement and rebased this PR onto current main (ec5e26ec).

What changed:

  • Form callbacks are now tRPC mutations opted in through formCallback metadata. The metadata supplies the procedure label and optional labels, descriptions, placeholders, allowed sources, and compatible question types for each input.
  • Admins map every input independently from a form question, respondent field, or manual value. A question can fill only one input.
  • Respondent sources include Member ID, name, email, Auth User ID, and the linked Discord User ID.
  • Recruiting maps name, email, major, gradTerm, gradYear, and team. Team can be fixed per form; delivery restores the legacy structured embed, configured director mention, and role-derived team color.
  • Discord role assignment now takes the respondent's Discord User ID and a manual Discord role ID, with the server allowlist still enforced.
  • Existing durable execution snapshots, retries, status history, and Delivery UI remain intact. Direct HTTP callers cannot invoke callback-only procedures.

Verification:

  • API forms: 73 tests passed
  • Blade forms: 132 tests passed
  • Root format, lint, and typecheck passed
  • Changed React analysis: 0 failures
  • Blade production build passed
  • Headed Chrome: desktop and mobile, with no console errors or horizontal overflow

The screenshots below use the authenticated Blade admin route with synthetic local data. The fixture was removed after capture.

Desktop

Desktop callback input mapper

Mobile

Mobile callback input mapper

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

🟡 Other comments (1)
.forge/features/forms-delivery-feedback/status.md-51-52 (1)

51-52: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Reconcile the publication status.

Mark the pre-publication entries in lines 20–21 and 46–47 as historical with dates, or remove them. The current status states that the branch and pull request were published.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: QUIET

Plan: Team

Run ID: 4cf05fda-7cbb-4335-bc4f-94b784bc0d29

📥 Commits

Reviewing files that changed from the base of the PR and between 6cd145a and f512430.

📒 Files selected for processing (23)
  • .forge/features/forms-delivery-feedback/spec.md
  • .forge/features/forms-delivery-feedback/srd.md
  • .forge/features/forms-delivery-feedback/status.md
  • .forge/features/forms-delivery-feedback/test-cases.md
  • apps/blade/src/app/_components/admin/forms/admin-form-builder.tsx
  • apps/blade/src/app/_components/admin/forms/form-builder-types.ts
  • apps/blade/src/app/_components/admin/forms/form-callback-mappings.ts
  • apps/blade/src/app/_components/admin/forms/form-callbacks-dialog.tsx
  • apps/blade/src/tests/forms/admin-form-builder-dialogs.test.tsx
  • apps/blade/src/tests/forms/form-callback-delivery.test.tsx
  • apps/blade/src/tests/forms/form-callback-mappings.test.ts
  • packages/api/src/routers/forms.ts
  • packages/api/src/tests/config/discord-config.test.ts
  • packages/api/src/tests/forms/callbacks.test.ts
  • packages/api/src/tests/forms/database-callbacks.test.ts
  • packages/api/src/trpc.ts
  • packages/api/src/utils/forms/callbacks.ts
  • packages/api/src/utils/forms/database-callbacks.ts
  • packages/api/src/utils/forms/procedures.ts
  • packages/api/src/utils/forms/registry.ts
  • packages/consts/src/discord.ts
  • packages/validators/src/forms-platform.ts
  • packages/validators/src/tests/forms-platform.test.ts
💤 Files with no reviewable changes (1)
  • packages/api/src/utils/forms/registry.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

Comment thread apps/blade/src/app/_components/admin/forms/form-callback-mappings.ts Outdated
Comment thread packages/api/src/utils/forms/procedures.ts
Comment thread packages/api/src/utils/forms/procedures.ts
@DVidal1205

Copy link
Copy Markdown
Contributor

@coderabbitai resolve

@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown
✅ Action performed

Comments resolved and changes approved.

@DVidal1205
DVidal1205 added this pull request to the merge queue Sep 6, 2026
Merged via the queue into KnightHacks:main with commit bd97fcc Sep 6, 2026
11 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