Repository navigation
Add form snapshots scheduled task to forms-admin - #2370
Merged
Merged
Conversation
theseanything
force-pushed
the
form-snapshots-scheduled-task
branch
from
October 30, 2026 10:47
3ac84b6 to
dc83826
Compare
Runs rake analytics:snapshot_forms at 22:00 UTC, after the working day in both GMT and BST, so the UTC and UK dates of a snapshot are always the same. It runs in every environment. Unlike the Mailchimp and organisations syncs it only writes to the environment's own analytics table, so there is no reason to limit it to production, and running it in dev and staging lets us check the data before it matters. There is no failure alert: a missed day shows up as a gap in the data and the task can be rerun by hand. The stream ARN is built from its name so the forms-admin root doesn't need the health root's state. Each environment has its own AWS account, and the log group is already per environment, so unlike the other scheduled tasks the names don't include the environment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
theseanything
force-pushed
the
form-snapshots-scheduled-task
branch
from
October 30, 2026 10:54
dc83826 to
2b63037
Compare
theseanything
marked this pull request as ready for review
October 30, 2026 11:05
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The scheduled-task deployment updater does not select the application container, so normal forms-admin deployments register new task revisions without updating the image.
1 open issue
What changed in this PR
Adds a daily forms-admin task to send form snapshots to the environment-specific analytics Firehose stream introduced in #2359.
Changes:
- Schedules
rake analytics:snapshot_formsat 22:00 UTC in every environment, without a failure alert. - Grants the shared task role
firehose:PutRecordBatchaccess to the snapshots stream. - Supplies the stream name through an environment variable inherited by scheduled tasks.
| File | Description |
|---|---|
infra/modules/forms-admin/scheduled-tasks.tf |
Defines the daily form snapshots task and schedule. |
infra/modules/forms-admin/main.tf |
Adds the stream name, write permission, and application configuration. |
Review effort: Balanced
SamJamCul
approved these changes
Oct 30, 2026
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.

What problem does this pull request solve?
Adds a daily forms-admin scheduled task that runs
rake analytics:snapshot_forms(added in govuk-forms/forms-admin#3262) at 22:00 UTC. The task puts a row for every form to theform-snapshots-<env>Firehose stream added in #2359.The forms-admin task role, which the scheduled tasks share with the service, can now call
firehose:PutRecordBatchon that stream. The service also getsSETTINGS__ANALYTICS__FORM_SNAPSHOTS_STREAM_NAME, and the scheduled task inherits it. The stream ARN is built from its name, so the forms-admin root doesn't need to read the health root's state.The task runs in every environment, with no setting to turn it off. It only writes to that environment's own analytics table, so it doesn't need to be limited to production the way the Mailchimp and organisations syncs are. There's no failure alert: a missed day shows up as a gap in the data, and the task can be rerun by hand.
Things to consider when reviewing
forms/healthmust be applied in each environment before this, so the stream exists before the first run.