Skip to content

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

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

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

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 a standalone Rails backend implementation for VA Form 22-1990n (Application for VA Education Benefits by a National Call to Service Participant). The implementation follows the standalone controller/model/serializer/job pattern across 10+ files:

  • Controller (app/controllers/v0/form22_1990n_controller.rb): Defines a V0::Form22_1990nController with before_action :authenticate and before_action :require_loa3 guards. The create action instantiates a Form22_1990nSubmission record scoped to the authenticated user, persists it, and enqueues the async Sidekiq job for Lighthouse submission. Returns a serialized response on success or structured error messages on failure.

  • Model (app/models/form22_1990n_submission.rb): Form22_1990nSubmission ActiveRecord model backed by the form22_1990n_submissions table. Includes presence validations on required fields (e.g., form_data, user_uuid), a status enum tracking lifecycle states (pending, submitted, failed), and serialized storage of the form payload.

  • Serializer (app/serializers/form22_1990n_serializer.rb): Form22_1990nSerializer using ActiveModel::Serializer, exposing attributes such as id, status, created_at, and updated_at for API responses.

  • Sidekiq Job (app/sidekiq/lighthouse/submit_form22_1990n_job.rb): Lighthouse::SubmitForm22_1990nJob worker configured with retry logic, responsible for submitting the form payload to the Lighthouse Benefits Intake API and updating the submission status accordingly. Includes structured logging on success and failure paths.

  • Routes (config/routes/form22_1990n.rb): Registers the POST /v0/form22_1990n route scoped under the v0 namespace, mapped to form22_1990n#create.

  • Migration (db/migrate/20260426223952_create_form22_1990n_submissions.rb): Creates the form22_1990n_submissions table with columns for user_uuid, form_data (jsonb), status (integer with default), and standard timestamps.

  • Specs: Full RSpec coverage across controller, model, serializer, Sidekiq job, and FactoryBot factory, including authenticated/unauthenticated request scenarios, model validation cases, serializer attribute assertions, and job enqueue/execution behavior.

  • Team: Optimus / Aquia.

Files

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