AOSSIE-Org / AOSSIE-Org/EduAid

[BUG]: Fix inconsistent /generate_gform response contract causing undefined form URL in web/extension clients

Offen
#616 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
JavaScript
Sterne
171
Forks
425
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### Bug Description

The `/generate_gform` endpoint currently returns a raw JSON response containing only `responderUri`, while web and extension clients expect a structured object with `form_link`.
This causes inconsistent handling and can result in undefined URL opening behavior.

## Current Behavior
- Backend returns non-uniform response shape.
- Frontend/extension tries to read `result.form_link`.
- In some flows, URL resolution is inconsistent.

## Expected Behavior
- Backend should return a consistent JSON contract:
- `form_link`
- `edit_link`
- Clients should open `form_link` reliably.
- Invalid payloads should return clear `400` errors.

## Proposed Fix
- Normalize backend response schema in `/generate_gform`.
- Add input validation for `qa_pairs` type.
- Remove server-side browser tab opening side effect.
- Add backward-compatible URL handling in clients for legacy and new response formats.

### Steps to Reproduce

1. Generate questions in EduAid web or extension.
2. Click "Generate Google Form".
3. Observe response parsing mismatch (backend vs consumer expectation).

### Logs and Screenshots

_No response_

### Environment Details

- Backend: Flask
- Clients: EduAid Web + Extension

### Impact

Medium - Feature works but has issues

### Code of Conduct

- [x] I have joined the [Discord server](https://discord.gg/hjUhu33uAn) and will post updates there
- [x] I have searched existing issues to avoid duplicates

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.