Skip to content

feat(22-1990n): Add Rails backend — generated by Optimus#1

Draft
voidspooks wants to merge 1 commit into
masterfrom
optimus/22-1990n-api-20260426T220042Z-1fa8
Draft

feat(22-1990n): Add Rails backend — generated by Optimus#1
voidspooks wants to merge 1 commit into
masterfrom
optimus/22-1990n-api-20260426T220042Z-1fa8

Conversation

@voidspooks
Copy link
Copy Markdown
Owner

⚠️ AI-Generated PR — This pull request was automatically generated by Optimus. All code requires human review and testing before merging.

Summary

  • This work is behind a feature toggle (flipper): NO

This PR introduces the Rails backend implementation for VA Form 22-1990n (Application for VA Education Benefits by a Spouse or Child — Transfer of Entitlement). The implementation follows the canonical simple_forms_api module pattern while satisfying all required file output specifications:

  • Controller (app/controllers/v0/form22_1990n_controller.rb): Exposes a create action that accepts a form submission payload, validates presence of required fields, and delegates processing to the Sidekiq job. Returns a serialized response on success or a structured error on failure.

  • Model (app/models/form22_1990n_submission.rb): Defines the Form22_1990nSubmission ActiveRecord model backed by the new form22_1990n_submissions table. Includes validations for required fields (e.g., veteran_full_name, benefit_type, relationship_to_veteran) and enum definitions for submission status (pending, submitted, failed).

  • Serializer (app/serializers/form22_1990n_serializer.rb): ActiveModel::Serializer implementation exposing id, status, created_at, updated_at, and confirmation_number attributes for API responses.

  • Sidekiq Job (app/sidekiq/lighthouse/submit_form22_1990n_job.rb): Asynchronous worker in the Lighthouse namespace that submits the form payload to the Lighthouse Benefits Intake API, updates submission status on the model record, and logs success/failure events via Rails.logger and StatsD metrics.

  • Routes (config/routes/form22_1990n.rb): Registers POST /v0/form22_1990n under the V0 namespace, scoped to authenticated users.

  • Migration (db/migrate/20260426215806_create_form22_1990n_submissions.rb): Creates the form22_1990n_submissions table with columns for veteran_full_name, benefit_type, relationship_to_veteran, status, confirmation_number, form_data (jsonb), and standard timestamps, including appropriate indexes on status and created_at.

  • Factory (spec/factories/form22_1990n_submissions.rb): FactoryBot factory with default trait for pending status and a submitted trait for use across specs.

  • Team: Optimus / Aquia.

Files

  • app/controllers/v0/form22_1990n_controller.rb
  • spec/controllers/v0/form22_1990n_controller_spec.rb
  • app/models/form22_1990n_submission.rb
  • spec/models/form22_1990n_submission_spec.rb
  • app/serializers/form22_1990n_serializer.rb
  • spec/serializers/form22_1990n_serializer_spec.rb
  • app/sidekiq/lighthouse/submit_form22_1990n_job.rb
  • spec/sidekiq/lighthouse/submit_form22_1990n_job_spec.rb
  • config/routes/form22_1990n.rb
  • db/migrate/20260426215806_create_form22_1990n_submissions.rb
  • spec/factories/form22_1990n_submissions.rb

Related issue(s)

  • department-of-veterans-affairs/va.gov-team#0000

Testing done

  • New code is covered by unit tests
  • Code generated by Optimus AI — engineer must run RSpec locally before merging.

Acceptance criteria

  • Unit and integration tests added for controller and model
  • No PII/credentials/internal URLs hardcoded
  • No errors or warnings in console
  • Events sent to appropriate logging solution
  • No sensitive information captured in logging or specs

Generated by Optimus (https://github.com/aquia-inc/optimus).
All files require human review before merging.

Files:
- app/controllers/v0/form22_1990n_controller.rb
- spec/controllers/v0/form22_1990n_controller_spec.rb
- app/models/form22_1990n_submission.rb
- spec/models/form22_1990n_submission_spec.rb
- app/serializers/form22_1990n_serializer.rb
- spec/serializers/form22_1990n_serializer_spec.rb
- app/sidekiq/lighthouse/submit_form22_1990n_job.rb
- spec/sidekiq/lighthouse/submit_form22_1990n_job_spec.rb
- config/routes/form22_1990n.rb
- db/migrate/20260426215806_create_form22_1990n_submissions.rb
- spec/factories/form22_1990n_submissions.rb
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.

1 participant