Skip to content

Correct request, session, relation and database runtime contracts - #428

Merged
kodiakhq[bot] merged 5 commits into
sbdchd:mainfrom
SafeIntelligence:codex/request-session-relation-contracts
Oct 29, 2026
Merged

kodiakhq[bot] merged 5 commits into
sbdchd:mainfrom
SafeIntelligence:codex/request-session-relation-contracts

Conversation

@mikz

@mikz mikz commented Oct 28, 2026

Copy link
Copy Markdown

Several public declarations reject supported Django calls: assigning a custom AbstractBaseUser to a request, setting session expiry with a timedelta, using integer primary keys with many-to-many managers, and executing generated flush SQL.

Use AbstractBaseUser as the shared configured-user bound; add timedelta expiry, async expiry and key_salt; accept target instances and integer primary keys in the six relation mutation methods; and correct quote_name, execute_sql_flush and sequence_reset_sql declarations. Through-model instances and bare querysets are not individual target arguments. Integer-key support is intentionally bounded: the manager's model/through parameters do not encode an arbitrary custom primary-key type.

The configured-user correction means consumers must narrow to their configured user before assuming AbstractUser-specific profile or permission attributes. No such attributes are invented on AbstractBaseUser.

Validation: two Pyright-driven regression tests pass, covering supported synchronous/asynchronous calls and rejection of through instances and arbitrary request-user objects. Ruff passes for changed stubs. Full mypy over tests and django-stubs reports the same 14 errors in two untouched files on both this branch and upstream main 20905e2, with no added errors. Tests ran with pytest 9.0.3 on Python 3.14 because the older runner cannot rewrite Python 3.14 assertions.

@sbdchd sbdchd left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@sbdchd

sbdchd commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Oh CI looks angry, can you check it?

@kodiakhq
kodiakhq Bot merged commit 25e39e1 into sbdchd:main Oct 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants