Skip to content

Conversation

@dimitri-yatsenko
Copy link
Member

Summary

  • Add Phase 2 migration functions for column type and blob markers in migrate.py
  • Fix flaky job tests by using delay=-1 for immediate job scheduling

Migration utilities added:

  • analyze_columns(): Identify columns needing type labels in comments
  • migrate_columns(): Add core type markers (:int32:, :<blob>:, etc.) to column comments
  • NATIVE_TO_CORE_TYPE mapping for MySQL native → DataJoint core type conversion
  • Support for bool/datetime special cases with interactive user prompts
  • Dry-run mode for previewing all changes before applying

Also adds placeholder stubs for Phase 3-4 migration functions:

  • migrate_external(): For external storage migration (blob, attach)
  • migrate_filepath(): For filepath attribute migration
  • finalize_migration(): For Phase 4 finalization

Flaky test fix:

The tests test_sigint, test_sigterm, test_suppress_dj_errors, and test_populate_exclude_error_and_ignore_jobs were flaky due to a race condition: jobs created with scheduled_time=NOW(3) might not pass the scheduled_time <= NOW(3) check if checked in the same millisecond.

Fixed by using delay=-1 in auto-refresh during populate(), ensuring jobs are scheduled 1 second in the past and immediately schedulable.

Test plan

  • Pre-commit hooks pass
  • Full test suite passes (638 passed, 7 skipped, 0 failures)
  • Previously flaky tests now consistently pass

🤖 Generated with Claude Code

dimitri-yatsenko and others added 2 commits January 13, 2026 19:08
Add migrate_columns() and supporting functions for Phase 2 of the
0.14.6 → 2.0 migration:

- analyze_columns(): Identify columns needing type labels
- migrate_columns(): Add core type markers to column comments
- NATIVE_TO_CORE_TYPE mapping for type conversion
- Support for bool/datetime special cases
- Dry-run mode for previewing changes

Also adds placeholder stubs for Phase 3-4 migration functions:
- migrate_external(): For external storage migration
- migrate_filepath(): For filepath attribute migration
- finalize_migration(): For Phase 4 finalization

These functions implement the migration guide documented in
datajoint-docs/src/how-to/migrate-from-0x.md.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The tests test_sigint, test_sigterm, test_suppress_dj_errors, and
test_populate_exclude_error_and_ignore_jobs were flaky due to a race
condition: jobs created with scheduled_time=NOW(3) might not pass the
scheduled_time <= NOW(3) check if checked in the same millisecond.

Fix by using delay=-1 in auto-refresh during populate(), ensuring jobs
are scheduled 1 second in the past and immediately schedulable.

Also update test_populate_exclude_error_and_ignore_jobs to use delay=-1
in its explicit refresh() call.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions github-actions bot added the enhancement Indicates new improvements label Jan 14, 2026
- Replace bare except: with except ImportError: in diagram.py
- Replace assert statements with explicit raises in blob.py
- Replace assert False with explicit raises in expression.py and declare.py
- Implement hash verification in objectref.py

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dimitri-yatsenko dimitri-yatsenko mentioned this pull request Jan 14, 2026
5 tasks
dimitri-yatsenko and others added 6 commits January 13, 2026 19:57
dj.key was removed in 2.0 but was still listed in __all__ without
being imported or defined.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove `schema` alias for `Schema` (use `dj.Schema` instead of `dj.schema`)
- Remove `Di` alias for `Diagram` (use `dj.Diagram` or `dj.ERD`)
- Update all examples, tests, and docstrings

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update outdated docs.datajoint.com URLs to new paths:
- diagram.py: /how-to/installation/
- heading.py: /how-to/migrate-from-0x/
- expression.py: /how-to/migrate-from-0x/

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove key_hash function (legacy job table debugging)
- Remove hash.py module
- Fix test_erd.py to use dj.Diagram instead of dj.Di
- Bump version to 2.0.0a20

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove ERD alias (use dj.Diagram)
- Rename test_erd_algebra to test_diagram_algebra
- Remove test_diagram_aliases test
- Bump version to 2.0.0a21

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dimitri-yatsenko dimitri-yatsenko merged commit 3218cd1 into pre/v2.0 Jan 14, 2026
7 of 8 checks passed
@dimitri-yatsenko dimitri-yatsenko deleted the migration_script branch January 14, 2026 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Indicates new improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants