Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 30, 2025

The example data seeds were split across 7 files with dependencies shared via global variables ($project, $guest_person, etc.), making them difficult to test and maintain.

Changes

  • Created Seek::ExampleDataSeeder orchestrator class - coordinates seeding with explicit dependency management through constructor injection, eliminating global variables
  • Extracted 7 specialized seeder classes in lib/seek/example_data/:
    • ProjectsSeeder, UsersSeeder, IsaStructureSeeder, SamplesSeeder
    • DataFilesAndModelsSeeder, PublicationsSeeder, ConfigurationSeeder
  • Added unit tests covering seeder classes with validation of object creation and database population
  • Simplified main seed file from 8 require_relative statements to:
seeder = Seek::ExampleDataSeeder.new
seeder.seed_all
  • Removed 7 legacy seed files (621 lines) replaced by library classes (915 lines)
  • Added README in lib/seek/example_data/ documenting structure and extension patterns

Structure

Each seeder returns created objects via hash, enabling explicit dependency flow:

def seed_users
  seeder = Seek::ExampleData::UsersSeeder.new(@workgroup, @project, @institution)
  result = seeder.seed
  
  @admin_user = result[:admin_user]
  @guest_person = result[:guest_person]
end

Dependencies cascade through orchestrator methods, making the data creation flow clear and testable in isolation.

Original prompt

This section details on the original issue you should resolve

<issue_title>Clean up the example data seeds into a single seed that calls a class in the library</issue_title>
<issue_description>Currently the example_data seed (db/seeds/example_data/) is split across multiple seeds, with dependencies and global variables spread between them.

Refactor into a single seed that calls a separate class to populate the data, possibly with multiple classes for each type. Some simple unit tests can then be created to provide some sanity checks that it is populating the database correctly.

Make it so it is easier to maintain and add new example data in the future.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Clean up example data seeds into a single seed Refactor example data seeds from global variables to library classes Oct 30, 2025
Copilot AI requested a review from stuzart October 30, 2025 13:53
Copilot finished work on behalf of stuzart October 30, 2025 13:53
@stuzart stuzart requested a review from jjkoehorst October 31, 2025 14:36
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.

2 participants