Skip to content

Backtest intake lacks operations outbox runtime privileges #245

Description

@hjcud

INT03 Development observation

After backend #243 and root #445 were deployed successfully, fresh automatic backtest run 4071b877-1aaf-36b7-b473-df559881a45c remains QUEUED with attempt_count=0.

The BASIC request queue receives the message and the backtest ASG/worker is healthy, but the worker retries the same intake message. The deployed worker log shows:

psycopg.errors.InsufficientPrivilege: permission denied for schema operations
FROM operations.outbox_messages
...
backtest request intake poll failed; retrying

Cause

PostgresRequestReceiptStore in backtest_request_intake.py reads operations.outbox_messages and writes operations.outbox_consumer_receipts during request claiming.

The generated R__database_runtime_grants.sql revokes all operations access from idea2strategy_backtest and grants that role schema usage only for backtest, market_data, storage, and strategy. Its source of truth, DatabaseAccessPolicy.allowsBacktest, likewise has no operations-table exception.

This is separate from #243: the corrected transport envelope reaches the worker, but intake cannot validate/claim it.

Expected fix / acceptance

  • Grant idea2strategy_backtest the least privileges actually needed by intake:
    • SELECT on operations.outbox_messages
    • SELECT, INSERT, UPDATE on operations.outbox_consumer_receipts (or the exact smaller set proven by tests)
    • USAGE on schema operations
  • Add/adjust DB access policy tests for those exact privileges and for no broader operations access.
  • Refresh and test the root Flyway CI bundle, update the backend/root pointers, and deploy Development.
  • Verify a fresh BASIC automatic backtest leaves QUEUED, records an attempt, and completes without a permission error.

Do not redrive or delete the current poison/in-flight messages as evidence; use a fresh release after deployment.

This blocks root INT03 automatic-backtest completion. Database policy, Flyway bundle, and root pointers are kcrmin-owned per the launch readiness plan.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions