Skip to content

test: add migration and schema integrity tests#12

Merged
govindkavaturi-art merged 1 commit into
mainfrom
test/migration-test
Apr 4, 2026
Merged

test: add migration and schema integrity tests#12
govindkavaturi-art merged 1 commit into
mainfrom
test/migration-test

Conversation

@govindkavaturi-art
Copy link
Copy Markdown
Member

Summary

4 new tests verifying database schema integrity:

  • All expected tables exist after create_all
  • Alembic migration head is valid
  • Cues table has required columns (id, user_id, name, status, etc.)
  • Executions table has outcome fields (outcome_success, outcome_result, outcome_error)

All pass locally (4/4, 0.53s).

🤖 Generated with Claude Code

4 tests verifying database schema:
- All expected tables exist (users, cues, executions, etc.)
- Alembic migration head is valid
- Cues table has required columns
- Executions table has outcome tracking fields

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@govindkavaturi-art govindkavaturi-art enabled auto-merge (squash) April 4, 2026 18:58
@govindkavaturi-art govindkavaturi-art merged commit da9ea86 into main Apr 4, 2026
4 checks passed
mikemolinet added a commit that referenced this pull request May 11, 2026
…parity port of cueapi/cueapi#623) (#77)

Re-port of closed [PR #46](#46) which was on a stale base ~8900 deletions behind main. Fresh against current main HEAD.

Closes §13 / Phase 12.1.7 — messages-side complement to the cue-fire send_at shipped in PR #618 (which still needs its own re-port).

## What lands

- **alembic/versions/030_message_send_at.py** (renumbered from private's 047)
  Adds `messages.send_at TIMESTAMPTZ NULL` + partial index
  `ix_messages_send_at` (WHERE send_at IS NOT NULL) built CONCURRENTLY
  so the index creation doesn't take an ACCESS EXCLUSIVE lock on
  the messages table during deploy. Existing rows default to NULL =
  "send now".
- **app/models/message.py** — adds `send_at` Column.
- **app/schemas/message.py** — `send_at: Optional[datetime]` on
  MessageCreate + MessageResponse.
- **app/routers/messages.py** — passes `send_at=body.send_at` into
  `create_message`.
- **app/services/inbox_service.py** — gates inbox query AND
  queued→delivered transition UPDATE with
  `send_at IS NULL OR send_at <= now()`. Scheduled messages are
  invisible until their time; the atomic poll-fetch transition
  skips them too.
- **app/services/message_service.py** — `create_message` plumbs
  `send_at` into both `Message.send_at` and
  `DispatchOutbox.scheduled_at`. Past timestamps are forgiving
  fallback (treated as send-now). `to_response_dict` surfaces the
  persisted value.
- **tests/test_message_send_at.py** — 7 new tests verbatim from
  private cueapi covering all 7 semantic paths (omitted,
  future-invisible, outbox-scheduled, past-fallback, becomes-visible-
  after-pass, sender-view-shows-it, invalid-timestamp).
- **parity-manifest.json** — new entry for migration 030 under
  `message-send-at-port (private #623)`.

## Wire format

`send_at` flows in the BODY of `POST /v1/messages` (server contract:
`MessageCreate.send_at`). Same shape as cue-fire `send_at` (PR #618).
NULL = send now (default). Future timestamp = inbox-gate +
DispatchOutbox.scheduled_at. Past timestamp = forgiving send-now.

## Tests

7/7 new tests pass locally. Full local suite: 836 passed + 18
xfailed (pre-existing) + 3 skipped. Zero regressions.

## Sibling ports

- cli, mcp, python, action sides shipped via session 2 (2026-05-10):
  cueapi-cli #48, cueapi-mcp #33, cueapi-python (private), cueapi-action #12.
  This is the cueapi-core (OSS server) side that was still missing.

## Re-port note

Re-port of closed PR #46. That branch was ~8900 deletions behind main;
fresh port against current main HEAD (after PR #74 + #75 merged earlier
in this session).
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