Skip to content

fix: throw an error when export to terra runs without a configured exporttoterraurl (#1107) - #1141

Closed
frano-m wants to merge 2 commits into
mainfrom
frano-m/1107-terra-url-error
Closed

frano-m wants to merge 2 commits into
mainfrom
frano-m/1107-terra-url-error

Conversation

@frano-m

@frano-m frano-m commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Closes #1107

What changed

  • useExportToTerraResponseURL now throws Export to Terra requires exportToTerraUrl to be set in the site config. once the manifest location and request params are available and exportToTerraUrl is not configured. Before that point it still returns undefined, so the form renders as before.
  • ExportToTerra JSDoc updated to describe the throw instead of "the form stays".
  • New tests/useExportToTerraResponseURL.test.ts covering the missing-config throw, the pending state, the configured URL, and missing request params.

Why

Without exportToTerraUrl, clicking "Request Link" fired the analytics event and the manifest request succeeded, but the user never left the form and nothing reported the misconfiguration. The error now reaches the nearest React error boundary, so the problem is visible.

Assumptions I made

  • Throw after the manifest returns, not on render. An app that renders the export view without Terra configured still loads; it only fails when a user requests the link. Side effect: the export-requested analytics event still fires before the error.
  • Error boundary only. No inline error UI; the nearest React error boundary handles it.
  • Scope limited to the export link step. AcceptTerraTOS and CreateTerraAccount still silently no-op on "Go to Terra" when exportToTerraUrl is unset.
  • Shipped as fix:, not a breaking change. Apps that configure exportToTerraUrl are unaffected. Apps that render export to Terra without exportToTerraUrl will now see their error boundary after "Request Link" instead of a silently stuck form — set exportToTerraUrl in the site config if you use export to Terra.

How to verify

In a consuming app (e.g. data-browser) linked with scripts/link.sh:

  1. With exportToTerraUrl set in the site config, go to the export to Terra page, choose a format, and click "Request Link". You should get the Terra link view as before.
  2. Remove exportToTerraUrl from the site config and restart. The export to Terra form should still render. Click "Request Link": once the manifest returns, the app's error boundary should show, and the console should log Export to Terra requires exportToTerraUrl to be set in the site config.
  3. Run npm test -- tests/useExportToTerraResponseURL.test.ts in findable-ui; all four tests pass.

Definition of done:

  • With no exportToTerraUrl configured, the export to Terra flow throws an error with a message naming the missing config. → step 2
  • With exportToTerraUrl configured, export to Terra behaves as before. → step 1
  • A test covers the missing-config case. → step 3

🤖 Generated with Claude Code
🐦 Built with cc-claude-tools

Copilot AI balanced review requested due to automatic review settings October 21, 2026 09:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused change preserves existing configured behavior and has regression coverage; no blockers were found, though tests were not executed.

No open issues 🎉

What changed in this PR

Addresses #1107 by surfacing missing Terra export configuration instead of silently leaving users on the form.

Changes:

  • Throws a descriptive error once the manifest location and request parameters are available.
  • Preserves pending and configured behavior.
  • Updates documentation and adds four focused tests.
File Description
tests/​useExportToTerraResponseURL.test.ts Tests missing configuration, pending states, and configured exports.
src/​hooks/​useExportToTerraResponseURL.ts Throws when a completed request lacks Terra configuration.
src/​components/​Export/​components/​ExportToTerra/​exportToTerra.tsx Updates JSDoc to describe the error behavior.

Review effort: Balanced

@frano-m
frano-m marked this pull request as ready for review October 22, 2026 04:25
Copilot AI balanced review requested due to automatic review settings October 22, 2026 04:29
frano-m and others added 2 commits October 22, 2026 14:30
…porttoterraurl (#1107)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: cc-claude-tools <cc-claude-tools@clevercanary.com>
…porttoterraurl (#1107)

use it() in useexporttoterraresponseurl tests and fix terra casing in the hook jsdoc.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@frano-m
frano-m force-pushed the frano-m/1107-terra-url-error branch from de5fb8f to 4f46fee Compare October 22, 2026 04:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The narrowly scoped change satisfies the issue requirements with no identified blocking issues; tests were inspected but not executed.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 22, 2026 04:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused guard change meets the issue requirements, preserves configured exports, and has regression coverage; tests were not executed during this review.

No open issues 🎉

Review effort: Balanced

@NoopDog

NoopDog commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Thanks Fran, this is cleanly done. But every app that uses export to Terra sets exportToTerraUrl, so nothing can reach this case today. Let's not add code and tests for it. I'll close this and #1107 as not planned.

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.

Throw an error when export to Terra runs without a configured exportToTerraUrl

3 participants