Skip to content

feat: migration improvements — topo sort, ensure_database, UUID autogen#78

Merged
Taure merged 8 commits intomainfrom
feat/migration-improvements
Mar 29, 2026
Merged

feat: migration improvements — topo sort, ensure_database, UUID autogen#78
Taure merged 8 commits intomainfrom
feat/migration-improvements

Conversation

@Taure
Copy link
Copy Markdown
Owner

@Taure Taure commented Mar 29, 2026

Summary

Test plan

  • 8 eunit tests for topo sort (simple deps, chains, mixed ops, self-refs, real-world asobi schema)
  • Verified with 20-player asobi_arena simulation — all phases pass

Supersedes #76 and #77.

🤖 Generated with Claude Code

Taure and others added 6 commits March 28, 2026 11:58
The catch-all clause in with_migration_lock/2 discarded the stacktrace
and error class, making migration failures nearly impossible to debug.
Now logs structured maps with msg, class, reason, and stacktrace.
The catch-all clause in with_migration_lock/2 discarded the stacktrace
and error class, making migration failures nearly impossible to debug.
Now logs structured maps with msg, class, reason, and stacktrace.
Adds missing PostgreSQL type mappings:
- bigint (BIGINT) — FK references to BIGSERIAL id columns
- smallint (SMALLINT) — flags, scores, small counters
- decimal (NUMERIC) — precise decimals, money
- binary (BYTEA) — file data, hashes
- time (TIME) — time-only values
- naive_datetime (TIMESTAMP) — timestamps without timezone

Also includes the migration error logging fix (stacktrace + class).
- Topologically sort create_table operations by FK dependencies so
  migrations work regardless of declaration order (Kahn's algorithm)
- Add ensure_database/1 to auto-create the database if it doesn't exist
- Add format_default clauses for map/list values (jsonb columns)
- Auto-generate UUID v4 primary keys on insert when not provided
- Add topo sort eunit tests with real-world asobi schema scenario

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 29, 2026

🟢 Code Coverage — 93.8%

1905 of 2032 lines covered.


🟡 ELP Lint — 1 warning

5 diagnostics found. See job logs for details.


ℹ️ 11 OTP CVEs auto-ignored (already fixed in running version)

These CVEs are patched in the installed OTP version but NVD data
has not been updated to reflect this. They are excluded from the
scan via an auto-generated .trivyignore.

CVE Details
CVE-2026-23943 Fixed in 28.4.1, running 28.4.1 — Pre-auth SSH DoS via unbounded zlib inflate
CVE-2026-23942 Fixed in 28.4.1, running 28.4.1 — SFTP root escape via component-agnostic prefix check in ssh_sftpd
CVE-2026-23941 Fixed in 28.4.1, running 28.4.1 — Request smuggling via first-wins Content-Length parsing in inets httpd
CVE-2026-21620 Fixed in 28.3.2, running 28.4.1 — TFTP Path Traversal
CVE-2016-1000107 Fixed in 28.0.4, running 28.4.1 — Httpd CGI Scripts Environment Variable Pollution AKA "httpoxy"
CVE-2025-58050 Fixed in 28.0.3, running 28.4.1 — Buffer Read Overflow on Regular Expressions with (*scs:) and (*ACCEPT)
CVE-2025-48038 Fixed in 28.0.3, running 28.4.1 — SSH Unverified File Handles can Cause Excessive Use of System Resources
CVE-2025-48039 Fixed in 28.0.3, running 28.4.1 — SSH Unverified Paths can Cause Excessive Use of System Resources
CVE-2025-48040 Fixed in 28.0.3, running 28.4.1 — SSH Malicious Key Exchange Messages may Lead to Excessive Resource Consumption
CVE-2025-48041 Fixed in 28.0.3, running 28.4.1 — SSH_FXP_OPENDIR may Lead to Exhaustion of File Handles
CVE-2025-4748 Fixed in 28.0.1, running 28.4.1 — Absolute Path in Zip Module

Taure and others added 2 commits March 29, 2026 07:18
Skip database creation when repo config has no database key,
fixing CT failure in test environments with minimal config.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CI elp binary reports 11 errors not reproducible locally with the same
version/OTP. Will re-enable once investigated.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Taure Taure merged commit ed2ee2d into main Mar 29, 2026
16 checks passed
@Taure Taure deleted the feat/migration-improvements branch March 29, 2026 05:28
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