feat(forms): derive key fields from per-field isKeyField flag#991
Merged
Conversation
Key fields (shown in the response/program offer list) were stored as a hardcoded list of slugs in Survey.key_fields. Rename that column to Survey.cached_key_fields and denormalize it from a new per-field isKeyField flag on Form.fields, editable via a checkbox in the form field editor. When form fields are saved, cached_key_fields is recomputed from the language version being edited and the isKeyField flag is synced to the other language versions. Program offer forms mark the title field as a key field by default. The GraphQL API field stays named keyFields; the cached/denormalized nature is a backend implementation detail. fixes #570 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
japsu
force-pushed
the
feature/key-fields-from-form-fields
branch
from
July 7, 2026 19:45
bb15cce to
77a36d9
Compare
Replace remaining manual cached_key_fields writes with refresh-based derivation and persist key-field intent in event form YAML via isKeyField flags. Co-authored-by: GitHub Copilot <copilot@github.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
japsu
force-pushed
the
feature/key-fields-from-form-fields
branch
from
July 7, 2026 20:26
da48795 to
03055ab
Compare
Update Survey.refresh_cached_key_fields to refresh cached fields for existing current responses when cached_key_fields changes, and add regression coverage.
Wrap create_survey_language and update_form_fields mutations in transaction.atomic so response cache refresh can safely use select_for_update.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Key fields (shown in the response/program offer list) were stored as a
hardcoded list of slugs in Survey.key_fields. Rename that column to
Survey.cached_key_fields and denormalize it from a new per-field
isKeyField flag on Form.fields, editable via a checkbox in the form
field editor.
When form fields are saved, cached_key_fields is recomputed from the
language version being edited and the isKeyField flag is synced to the
other language versions. Program offer forms mark the title field as a
key field by default.
The GraphQL API field stays named keyFields; the cached/denormalized
nature is a backend implementation detail.
fixes #570
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com