Skip to content

Filter migrations to only run numbered files, skip bootstrap helpers#17

Merged
techbuzzz merged 3 commits into
developfrom
copilot/sub-pr-11-please-work
Jan 27, 2026
Merged

Filter migrations to only run numbered files, skip bootstrap helpers#17
techbuzzz merged 3 commits into
developfrom
copilot/sub-pr-11-please-work

Conversation

Copilot AI commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

The runMigrations function was executing all .sql files in migrations/, including bootstrap_existing_db.sql which is intended as a one-time manual operation for existing databases.

Changes

  • Added regex filter ^\d{3}_.*\.sql$ to match only numbered migrations (001_init.sql, 002_sample_data.sql, etc.)
  • Skip non-numbered files with log message
  • Compile pattern once at function start to avoid repeated overhead

Implementation

func runMigrations(db *database.DB) error {
    // Compile regex pattern once for efficiency
    migrationPattern := regexp.MustCompile(`^\d{3}_.*\.sql$`)
    
    // ... existing setup code ...
    
    for _, entry := range entries {
        if entry.IsDir() || !strings.HasSuffix(entry.Name(), ".sql") {
            continue
        }
        
        // Skip non-numbered migration files (e.g., bootstrap scripts)
        if !migrationPattern.MatchString(entry.Name()) {
            log.Printf("Skipping non-numbered migration file: %s", entry.Name())
            continue
        }
        
        // ... execute migration ...
    }
}

Bootstrap scripts like bootstrap_existing_db.sql now stay manual-only as documented.


💡 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 and others added 2 commits January 27, 2026 16:53
… scripts

Add regex pattern to only execute numbered migrations (e.g., 001_init.sql, 002_sample_data.sql)
and skip helper scripts like bootstrap_existing_db.sql. This prevents the bootstrap script
from being run automatically during the migration process, maintaining the intended
"run once for existing DBs" bootstrap flow.

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>
Move migration pattern compilation to the beginning of runMigrations function
to avoid repeated compilation overhead on each function call.

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on Release v0.3.5 changes Filter migrations to only run numbered files, skip bootstrap helpers Jan 27, 2026
Copilot AI requested a review from techbuzzz January 27, 2026 16:55
@techbuzzz techbuzzz marked this pull request as ready for review January 27, 2026 17:45
Copilot AI review requested due to automatic review settings January 27, 2026 17:45
@techbuzzz techbuzzz merged commit cd83b5b into develop Jan 27, 2026

Copilot AI left a comment

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.

Pull request overview

This PR enhances the database migration system to filter and execute only numbered migration files while skipping helper scripts that are intended for manual execution.

Changes:

  • Added regex pattern ^\d{3}_.*\.sql$ to match only numbered migrations (001_init.sql, 002_sample_data.sql, etc.)
  • Implemented filtering logic to skip non-numbered migration files with logging
  • Compiled regex pattern once at function start for efficiency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/server/main.go
Comment on lines +298 to +302
// Skip non-numbered migration files (e.g., bootstrap scripts)
if !migrationPattern.MatchString(entry.Name()) {
log.Printf("Skipping non-numbered migration file: %s", entry.Name())
continue
}

Copilot AI Jan 27, 2026

Copy link

Choose a reason for hiding this comment

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

The new filtering logic that skips non-numbered migration files lacks test coverage. Consider adding tests to verify that:

  1. Numbered migration files (e.g., 001_init.sql) are processed correctly
  2. Non-numbered files (e.g., bootstrap_existing_db.sql) are skipped with appropriate logging
  3. Edge cases like files with partial number patterns are handled correctly

Other functions in the codebase have comprehensive test coverage (see tests/a2a/, internal/models/models_test.go, internal/validator/validator_test.go), suggesting that adding tests for this migration filtering logic would be consistent with project practices.

Copilot uses AI. Check for mistakes.
techbuzzz added a commit that referenced this pull request Jan 28, 2026
* chore(gitignore): 🗃️ add `postgres_data/` to .gitignore

* Ensures that the `postgres_data/` directory and its contents are excluded from version control.
* Prevents accidental commits of local PostgreSQL data files.

* feat(tasks): add task reassignment functionality with new API endpoint and UI modal

* feat(mcp): enhance MCPHandler to broadcast agent updates via WebSocket
feat(TaskCard): display task ID in the TaskCard component

* fix(TaskCard): adjust layout to properly display task ID and due date

* fix(TaskCard): remove due date display from task card

* Release v0.3.5 – Daily Standup Management & Production Migrations (#10)

* feat: add daily standup and agent heartbeat models, migrations, and Vue components

- Implemented DailyStandup and AgentHeartbeat models in Go with necessary fields.
- Created SQL migrations for daily_standups and agent_heartbeats tables with indexes.
- Developed StandupModal component for submitting and editing daily standups with form validation.
- Added standupStore for managing standup data, including fetching, creating, updating, and deleting standups.
- Created Standups view to display a list of daily standups with filtering options and modal integration.
- Enhanced UI with loading states, error handling, and markdown rendering for standup details.

* fix(go.mod): remove 'indirect' comments from dependency requirements

* feat(migrations): implement automatic migration system with tracking and bootstrap scripts

* feat: add release notes for v0.3.5 including daily standup management and migration system

* Initial plan

* Initial plan

* Initial plan

* Add application verification report for v0.3.5

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

* Update internal/handlers/standups.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update scripts/bootstrap-migrations.ps1

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Initial plan (#20)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

* Refactor task reassignment to use shared API client (#18)

* Initial plan

* Refactor task reassignment to use shared API client

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Fix migration race condition in concurrent container startups (#19)

* Initial plan

* Make migration loop safe for concurrent startups using INSERT ON CONFLICT

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Add concurrency safety test and documentation for migrations

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Address code review feedback: improve error handling and add sql import

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Filter migrations to only run numbered files, skip bootstrap helpers (#17)

* Initial plan

* feat(migrations): filter to only run numbered migrations, skip helper scripts

Add regex pattern to only execute numbered migrations (e.g., 001_init.sql, 002_sample_data.sql)
and skip helper scripts like bootstrap_existing_db.sql. This prevents the bootstrap script
from being run automatically during the migration process, maintaining the intended
"run once for existing DBs" bootstrap flow.

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* refactor: move regex compilation outside loop for efficiency

Move migration pattern compilation to the beginning of runMigrations function
to avoid repeated compilation overhead on each function call.

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Add aria-label to icon-only buttons in Standups view (#16)

* Initial plan

* feat(a11y): add aria-label to edit/delete buttons in Standups view

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Fix async state management in ReassignModal (#15)

* Initial plan

* Fix isSubmitting state management in ReassignModal

- Move isSubmitting state to parent (ProjectDetail)
- Pass isSubmitting as prop to ReassignModal
- Properly manage async state throughout reassignment lifecycle
- Button stays disabled until API request completes

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* fix(standups): return 404 on non-existent update and broadcast changes (#14)

* Initial plan

* fix(standups): improve UpdateStandup to check rows affected and return updated object

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* fix(standups): handle error from RowsAffected in UpdateStandup

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Fix metadata loss in AgentCard legacy capability unmarshaling (#13)

* Initial plan

* fix: preserve legacy capabilities in metadata after struct assignment

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* style: remove extra blank line for consistency

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Address PR #11 review comments: preserve metadata, add 404 checks, improve concurrency safety and accessibility (#12)

* Initial plan

* fix: preserve legacy capabilities in metadata and add 404 checks for standup updates/deletes

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* fix(ui): improve accessibility, state management, and date handling in frontend components

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* fix(migrations): skip bootstrap files and add advisory lock for concurrency safety

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* fix(api): use API service for task reassignment and sanitize database URL in logs

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* refactor: improve code quality based on review feedback

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>
Co-authored-by: Victor Buzin <buzin.victor@gmail.com>

* Update web/src/services/api.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update internal/handlers/standups.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Initial plan (#21)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

* Initial plan (#22)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

* Initial plan (#23)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

* Restore transactional migration execution with automatic rollback (#24)

* Initial plan

* Restore transactional migration execution with rollback safety

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Improve transaction handling with defer cleanup and race condition handling

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Extract migration application into separate function for proper defer scoping

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Add missing database/sql import (#25)

* Initial plan

* Add missing database/sql import to fix compile error

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Make database migrations transactional (#26)

* Initial plan

* refactor: make migrations transactional and safe

- Execute migration DDL within a transaction
- Record migration in schema_migrations only after DDL succeeds
- Commit both DDL and tracking record atomically
- Proper rollback on any failure
- Now matches "Automatic, transactional, safe" claim in verification report

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* refactor: simplify migration transaction logic per code review

- Remove complex ON CONFLICT detection with RETURNING
- Use simple ON CONFLICT DO NOTHING for defense-in-depth
- Remove unused database/sql import
- Improve comments explaining PostgreSQL transactional DDL support
- Simplify error handling paths

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>
Co-authored-by: Victor Buzin <buzin.victor@gmail.com>

* Sort migration files to ensure deterministic execution order (#27)

* Initial plan

* Sort migration files to ensure deterministic execution order

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Fix readonly prop mutation in ReassignModal (#28)

* Initial plan

* Fix isSubmitting prop mutation in ReassignModal

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Fix isReassigningTask state not resetting after reassignment (#29)

* Initial plan

* Fix isReassigningTask state management by adding finally block

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>
Co-authored-by: Victor Buzin <buzin.victor@gmail.com>

* Fix migration race: execute DDL before recording completion (#30)

* Initial plan

* Fix migration safety: execute DDL before recording success

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Remove server binary and add to gitignore

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Address code review: check rollback errors and simplify ON CONFLICT

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>
Co-authored-by: Victor Buzin <buzin.victor@gmail.com>

* Enhance sample data migration: add idempotent comments and ensure conflict handling for inserts

* Refactor standup model and handlers: rename references to reference_links for consistency

* Add MCP Setup Documentation and Verification Files

- Created MCP_SETUP_QUICK_REFERENCE.md for quick setup and command usage.
- Added MCP_SETUP_REVIEW.md detailing component verification and functionality.
- Introduced MCP_SETUP_VERIFICATION_SUMMARY.md summarizing the verification process and results.

* Add comprehensive documentation for Visual Studio 2026 MCP integration

- Created VS2026_DOCUMENTATION_INDEX.md for quick navigation and role-based reading guide.
- Added VS2026_FEATURE_SUMMARY.md detailing key features, deployment options, and generated files.
- Introduced VS2026_IMPLEMENTATION_GUIDE.md with step-by-step setup instructions and UI integration examples.
- Developed VS2026_MCP_SETUP.md outlining configuration files, usage examples, and troubleshooting tips.
- Enhanced composable with new functions and improved error handling.

* Refactor MCP setup: enhance error handling, add support for Blob downloads, and update event handlers for better user feedback

* Refactor code structure for improved readability and maintainability

* [WIP] WIP Address feedback on Release v0.3.5 changes (#31)

* Initial plan

* Fix mcpApiUrl to use hostname instead of host to avoid double port issue

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Remove unused isRef import from useMcpSetup composable (#32)

* Initial plan

* Remove unused isRef import from useMcpSetup.js

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Update cmd/server/main.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update internal/handlers/standups.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fix advisory lock session scope in database migrations (#33)

* Initial plan

* Fix advisory lock to use dedicated connection for session scope

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Remove UTF-8 BOM from migration file (#34)

* Initial plan

* Remove UTF-8 BOM from migrations/003_daily_standups.sql

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Fix backward compatibility: restore `references` JSON field for standup models (#35)

* Initial plan

* Fix backward compatibility: change JSON tag from reference_links to references

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Harden formatDate validation to prevent RangeError on invalid inputs (#36)

* Initial plan

* Add validation for formatDate to prevent RangeError with invalid dates

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Improve date validation: add rollover check and error handling

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Refactor formatDate: extract fallback parsing to eliminate duplication

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Remove shadowing imports in ProjectDetail.vue (#37)

* Initial plan

* Remove unused downloadFile and downloadAllMcpFiles imports

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Fix .mcp download to use VS2026 config instead of VSCode config (#38)

* Initial plan

* Fix .mcp download to use VS2026 config instead of VSCode config

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

* Align VS2026 MCP documentation with minimal config implementation (#39)

* Initial plan

* Update VS2026 docs to match actual minimal config implementation

Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: techbuzzz <6938100+techbuzzz@users.noreply.github.com>
@techbuzzz techbuzzz deleted the copilot/sub-pr-11-please-work branch January 28, 2026 13:43
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.

3 participants