Skip to content

Refactor: Drop extensions model+table#493

Draft
cycomachead with Copilot wants to merge 6 commits into
mainfrom
copilot/drop-extensions-model-table
Draft

Refactor: Drop extensions model+table#493
cycomachead with Copilot wants to merge 6 commits into
mainfrom
copilot/drop-extensions-model-table

Conversation

Copilot AI commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

General Info

Changes

The extensions table and model were legacy code predating the Request model, never used in the current app. This removes all traces of it.

  • Migration (20260704000002_drop_extensions_table.rb): drops the extensions table; reversible down restores it if needed
  • Schema: removes extensions table definition and its foreign keys to assignments and users
  • Model (app/models/extension.rb): deleted
  • User model: removed has_many :extensions association
  • CoursesController#delete: removed Extension.where(...).destroy_all (table gone)
  • API::V1::RequestsController#create: removed Extension.new/save block; returns Canvas override data (id, new_due_date) directly
  • Routes: removed unused resources :extensions, only: [:create] nested under courses
  • Specs/factories: deleted spec/models/extension_spec.rb, spec/factories/extension.rb; removed Extension references from controller specs

Testing

Updated existing controller specs to remove Extension.create! setup, change(Extension, :count) assertions, and Extension.destroy_all teardown calls. No new tests needed — the code being deleted had no active callers.

Documentation

No documentation changes required.

Checklist

  • Name of branch corresponds to story

@superconductor-for-github

Copy link
Copy Markdown

Superconductor is workingView implementation | App Preview


I'll get back to you soon!

Copilot AI linked an issue Jul 4, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Refactor: Drop 'extensions' model and table Refactor: Drop extensions model+table Jul 4, 2026
Copilot AI requested a review from cycomachead July 4, 2026 03:41
render json: { message: 'not yet implemented' }, status: :not_implemented
end

def create

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot This method should create a request object which is the right replacement for the Extension model. (This API endpoint isn't in public use but should be kept in sync)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in commit 3a2e8e4. After provisioning the Canvas override, the action now:

  1. Looks up the student by canvas_uid before Canvas provisioning (to avoid a Canvas-provisioned-but-no-local-record inconsistency)
  2. Creates a Request record with status: 'approved', external_extension_id from the override, and reason from params (defaulting to 'API request')
  3. Returns the saved Request as JSON, with validation errors included in any save-failure response

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No @copilot this behavior assumes too much.

Please just create a Request and don't do anything other than validating that it exists. This should behave the same as requests#create route -- though for now, we can assume that all write tokens are from instructors, but we should should still validate. Status should always start as pending.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in the latest commit. The create action now just builds and saves a Request (status defaults to pending), validates that the Authorization header is present, and returns the saved record or a joined error string. All Canvas provisioning has been removed.

@cycomachead

Copy link
Copy Markdown
Contributor

@copilot sync with main and resolve conflicts

Copilot AI commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

@copilot sync with main and resolve conflicts

Done — merged origin/main and resolved the single conflict in db/schema.rb (schema version + faultline tables from main, without the dropped extensions table/foreign keys).

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.

Refactor: Drop 'extensions' model+table

2 participants