Skip to content

Add df.status_by_label() and clarify df.status() requires instance_id#181

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/clarify-df-status-instance-id
Draft

Add df.status_by_label() and clarify df.status() requires instance_id#181
Copilot wants to merge 4 commits into
mainfrom
copilot/clarify-df-status-instance-id

Conversation

Copy link
Copy Markdown

Copilot AI commented May 27, 2026

df.status() accepts an instance_id, not a label — passing a label silently returns NULL, making it easy for callers who use df.start(..., 'my-label') to unknowingly query the wrong identifier.

New function: df.status_by_label(label TEXT)

Returns the status of the most recently started instance matching the given label. Respects RLS (queries via SPI). Returns NULL when no visible instance matches.

SELECT df.start('SELECT 1', 'my-workflow');

-- Before: callers would mistakenly do this (always returns NULL)
SELECT df.status('my-workflow');

-- Now: correct label-based lookup
SELECT df.status_by_label('my-workflow');  -- 'Running', 'Completed', etc.

Labels are not unique — if multiple instances share a label, the most recently created one wins. Save the instance_id from df.start() when you need to track a specific run.

Changes

  • src/monitoring.rsstatus_by_label implementation; documents NULL-on-error behaviour (consistent with df.status())
  • sql/pg_durable--0.1.1.sql — C wrapper registration for fresh installs
  • sql/pg_durable--0.2.1--0.2.2.sqlCREATE OR REPLACE FUNCTION for the upgrade path
  • docs/api-reference.md — warning note on df.status() clarifying it needs an instance_id; full entry for df.status_by_label()
  • USER_GUIDE.md — updated Quick Status Check section with label-based example and tip
  • docs/upgrade-testing.md — added df.status_by_label() to the monitoring functions table
  • tests/e2e/sql/05_monitoring_and_explain.sql — tests correct status for a known label and NULL for an unknown one

Copilot AI and others added 3 commits May 27, 2026 14:11
… not label

- Add `df.status_by_label(label TEXT)` Rust function in src/monitoring.rs that
  returns the status of the most recently started instance with the given label,
  returning NULL when no match exists (respects RLS)
- Register the function in sql/pg_durable--0.1.1.sql
- Update docs/api-reference.md: add note on df.status() warning about label vs
  instance_id confusion, and add full df.status_by_label() documentation entry
- Update USER_GUIDE.md Quick Status Check section with df.status_by_label()
  example and a tip explaining the label vs instance_id distinction
- Update .github/skills/pg-durable-sql/SKILL.md with status_by_label reference
- Extend tests/e2e/sql/05_monitoring_and_explain.sql to exercise status_by_label
  for both a known label and an unknown label

Co-authored-by: pinodeca <32303022+pinodeca@users.noreply.github.com>
- Add CREATE OR REPLACE FUNCTION df.status_by_label to the 0.2.1→0.2.2
  upgrade script so users upgrading from 0.2.1 also receive the new function
- Update docs/upgrade-testing.md to include df.status_by_label() in the
  monitoring functions table for upgrade scenario tests

Co-authored-by: pinodeca <32303022+pinodeca@users.noreply.github.com>
…error handling note

- docs/api-reference.md: remove 'eight-character hex' from df.status() note;
  use 'unique identifier returned by df.start()' instead
- tests/e2e/sql/05_monitoring_and_explain.sql: add comment clarifying
  status_by_label test uses the same label as the df.start() call above it
- src/monitoring.rs: document the NULL-on-error behaviour of status_by_label
  and note its intentional consistency with df.status()

Co-authored-by: pinodeca <32303022+pinodeca@users.noreply.github.com>
Copilot AI changed the title [WIP] Clarify that df.status() accepts instance_id, not label Add df.status_by_label() and clarify df.status() requires instance_id May 27, 2026
Copilot AI requested a review from pinodeca May 27, 2026 14:18
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.

Clarify that df.status() accepts instance_id, not label

2 participants