stkit 17.3.2__tar.gz → 17.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {stkit-17.3.2 → stkit-17.4.0}/CHANGELOG.md +11 -0
- {stkit-17.3.2 → stkit-17.4.0}/PKG-INFO +2 -2
- {stkit-17.3.2 → stkit-17.4.0}/examples/minimal/uv.lock +2 -2
- {stkit-17.3.2 → stkit-17.4.0}/pyproject.toml +3 -2
- {stkit-17.3.2 → stkit-17.4.0}/stk/__init__.py +3 -1
- {stkit-17.3.2 → stkit-17.4.0}/stk/cli/develop.py +32 -0
- stkit-17.4.0/stk/migrations/versions/stk_0008_stk_message.py +37 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/notification/__init__.py +16 -9
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/CLAUDE.md +1 -1
- {stkit-17.3.2 → stkit-17.4.0}/stk/websocket.py +96 -6
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_cli.py +16 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_notifications.py +58 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_production_security.py +2 -2
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_smoke_pages.py +50 -0
- {stkit-17.3.2 → stkit-17.4.0}/.gitignore +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/LICENSE +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/README.md +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/SECURITY.md +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/examples/minimal/.env-sample +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/examples/minimal/.gitignore +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/examples/minimal/README.md +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/examples/minimal/minimal/__init__.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/examples/minimal/minimal/app.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/examples/minimal/minimal/migrations/364232ae77d5_add_note.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/examples/minimal/minimal/note/__init__.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/examples/minimal/minimal/note/models.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/examples/minimal/minimal/note/templates/note/index.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/examples/minimal/minimal/note/views.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/examples/minimal/minimal/settings.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/examples/minimal/minimal/templates/layout.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/examples/minimal/pyproject.toml +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/examples/minimal/tests/__init__.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/examples/minimal/tests/test_app.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/__main__.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/agent_login.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/app.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/checks.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/cli/__init__.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/cli/agent.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/cli/base.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/cli/copy_rules.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/cli/database.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/cli/doctor.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/cli/main.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/cli/reports.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/cli/smoke.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/cli/users.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/cli/watch.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/extensions.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/files/__init__.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/files/models.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/files/store.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/files/views.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/mcp/__init__.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/mcp/models.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/mcp/server.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/mcp/views.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/migrations/__init__.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/migrations/env.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/migrations/script.py.mako +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/migrations/versions/stk_0001_initial_schema.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/migrations/versions/stk_0002_jobs.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/migrations/versions/stk_0003_files.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/migrations/versions/stk_0004_notifications.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/migrations/versions/stk_0005_mcp_tokens.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/migrations/versions/stk_0006_stk_mcp_token.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/migrations/versions/stk_0007_confirm_existing_users.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/notification/models.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/notification/views.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/portal/views.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/public/__init__.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/public/models.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/public/views.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/__init__.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/Dockerfile +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/README.md +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/__app__/__init__.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/__app__/app.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/__app__/settings.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/claude/skills/stk-api/SKILL.md +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/claude/skills/stk-blueprint/SKILL.md +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/claude/skills/stk-deploy/SKILL.md +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/claude/skills/stk-lessons/SKILL.md +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/claude/skills/stk-migrate/SKILL.md +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/docker-compose.yml +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/dockerignore +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/env-sample +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/github/workflows/checks.yml +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/gitignore +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/nginx/nginx.conf +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/nginx/stk.conf +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/postgres/init-db.sh +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/pyproject.toml +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/tests/__init__.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/app/tests/test_app.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/generator.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/scaffold/templates.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/security.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/settings.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/shell.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/VERSIONS.txt +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/css/app.css +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/css/layout.css +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/css/vuetify.min.css +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.animals.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.arrows-1.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.arrows-2.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.badges.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.brand-1.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.brand-2.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.buildings.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.charts.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.communication.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.computers.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.core.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.currencies.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.database.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.design-1.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.design-2.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.development.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.devices-1.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.devices-2.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.document.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.e-commerce.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.electrical.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.extensions.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.food.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.games.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.gender.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.gestures.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.health.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.laundry.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.letters.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.logic.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.map.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.math.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.media.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.mood.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.nature.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.numbers.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.photography.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.shapes.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.sport.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.symbols.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.system-1.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.system-2.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.system-3.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.text.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.vehicles.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.version-control.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.weather.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/fonts/tabler-icons.zodiac.woff2 +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/icons/tabler-icons.min.css +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/img/auth-bg.webp +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/img/favicon.ico +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/img/stk.svg +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/js/axios.min.js +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/js/components/NotificationDropdown.js +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/js/components/ThemeSwitcher.js +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/js/components/TransitionExpand.js +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/js/components/VerticalNavGroup.js +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/js/components/VerticalNavLink.js +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/js/components/VerticalNavSectionTitle.js +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/js/components/index.js +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/js/config.js +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/js/vue.min.js +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/js/vuetify.min.js +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/static/robots.txt +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/tasks/__init__.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/tasks/models.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/401.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/404.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/500.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/_brand.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/auth_layout.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/cms/activities.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/cms/jobs.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/cms/roles.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/cms/users.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/dashboard.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/index.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/layout.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/login-layout.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/mcp/tokens.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/_macros.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/_messages.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/change_password.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/confirm_email.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/email/change_notice.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/email/change_notice.txt +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/email/confirmation_instructions.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/email/confirmation_instructions.txt +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/email/login_instructions.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/email/login_instructions.txt +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/email/reset_instructions.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/email/reset_instructions.txt +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/email/reset_notice.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/email/reset_notice.txt +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/email/welcome.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/email/welcome.txt +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/forgot_password.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/login_user.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/mf_recovery.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/mf_recovery_codes.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/register_user.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/reset_password.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/send_confirmation.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/send_login.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/two_factor_select.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/two_factor_setup.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/two_factor_verify_code.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/wan_register.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/wan_signin.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/templates/security/wan_verify.html +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/user/__init__.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/user/forms.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/user/models.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/user/views.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/utils/email.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/utils/netguard.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/stk/utils/ratelimit.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_agent_operability.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_app_index.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_branding.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_builder_ux.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_composition.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_confirm_migration.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_copy_rules.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_csrf_exempt.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_error_handler.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_files.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_jobs.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_mcp.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_mcp_migration.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_migration_drift.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_netguard.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_revision_imports.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_route_collisions.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_scaffolder.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_security_compatibility.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_shell.py +0 -0
- {stkit-17.3.2 → stkit-17.4.0}/tests/test_static_versioning.py +0 -0
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v17.4.0 (2026-11-02)
|
|
4
|
+
|
|
5
|
+
Run `uv run stk db upgrade`: migration `stk_0008` adds the `stk_message` table.
|
|
6
|
+
|
|
7
|
+
- `broadcast` reaches a user's sockets from any process: another uvicorn worker, a durable job in `stk worker`, or `stk shell`. Messages go through `stk_message`, which each server process polls while it holds sockets, so delivery lags up to a quarter second. Every call is now a database write, so throttle rapid progress updates. `user_id` must be a numeric user id.
|
|
8
|
+
- `broadcast(..., session=)` and `notify(..., session=)` join the caller's transaction: sent at commit, dropped on rollback.
|
|
9
|
+
- `notify` from a durable job now reaches open pages instead of waiting for the next page load.
|
|
10
|
+
- `stk run` on a port that is already taken exits with the pid holding it, instead of uvicorn's easy-to-miss log line while the old server keeps serving.
|
|
11
|
+
- The dev extra requires Playwright 1.64. Older versions never reach network idle on a page that opens an EventSource, so `stk smoke` timed out there. Apps on an older lock: `uv lock --upgrade-package playwright`.
|
|
12
|
+
- `stk --version`, the MCP server info and `stk init` read the installed package version. 17.3.2 still reported 17.3.1, so apps made with it require `stkit>=17.3.1`.
|
|
13
|
+
|
|
3
14
|
## v17.3.2 (2026-11-01)
|
|
4
15
|
|
|
5
16
|
No migration required. Requires quart-security 2.2.0, which normalizes emails more fully: an account stored with a decomposed Unicode or punycode email must be rewritten with `quart_security.normalize_email` to sign in. ASCII addresses are unaffected.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: stkit
|
|
3
|
-
Version: 17.
|
|
3
|
+
Version: 17.4.0
|
|
4
4
|
Summary: An async Quart framework optimized for AI-assisted development workflows
|
|
5
5
|
Project-URL: Documentation, https://docs.stkit.dev
|
|
6
6
|
Project-URL: Source, https://github.com/level09/stk
|
|
@@ -39,7 +39,7 @@ Requires-Dist: wtforms>=3.2.1
|
|
|
39
39
|
Provides-Extra: asgi
|
|
40
40
|
Requires-Dist: hypercorn>=0.17.0; extra == 'asgi'
|
|
41
41
|
Provides-Extra: dev
|
|
42
|
-
Requires-Dist: playwright; extra == 'dev'
|
|
42
|
+
Requires-Dist: playwright>=1.64; extra == 'dev'
|
|
43
43
|
Requires-Dist: pre-commit; extra == 'dev'
|
|
44
44
|
Requires-Dist: ptpython>=3.0.30; extra == 'dev'
|
|
45
45
|
Requires-Dist: ruff; extra == 'dev'
|
|
@@ -1976,7 +1976,7 @@ asyncio = [
|
|
|
1976
1976
|
|
|
1977
1977
|
[[package]]
|
|
1978
1978
|
name = "stkit"
|
|
1979
|
-
version = "17.
|
|
1979
|
+
version = "17.4.0"
|
|
1980
1980
|
source = { editable = "../../" }
|
|
1981
1981
|
dependencies = [
|
|
1982
1982
|
{ name = "aiosmtplib" },
|
|
@@ -2041,7 +2041,7 @@ requires-dist = [
|
|
|
2041
2041
|
{ name = "libpass", specifier = ">=1.9.0" },
|
|
2042
2042
|
{ name = "orjson", specifier = ">=3.11.6" },
|
|
2043
2043
|
{ name = "pillow", specifier = ">=13.0.0" },
|
|
2044
|
-
{ name = "playwright", marker = "extra == 'dev'" },
|
|
2044
|
+
{ name = "playwright", marker = "extra == 'dev'", specifier = ">=1.64" },
|
|
2045
2045
|
{ name = "pre-commit", marker = "extra == 'dev'" },
|
|
2046
2046
|
{ name = "psycopg2-binary", specifier = ">=2.9.10" },
|
|
2047
2047
|
{ name = "ptpython", marker = "extra == 'dev'", specifier = ">=3.0.30" },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "stkit"
|
|
3
|
-
version = "17.
|
|
3
|
+
version = "17.4.0"
|
|
4
4
|
description = "An async Quart framework optimized for AI-assisted development workflows"
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "Level09", email = "hello@level09.com"}
|
|
@@ -56,7 +56,8 @@ full = [
|
|
|
56
56
|
dev = [
|
|
57
57
|
"ruff",
|
|
58
58
|
"pre-commit",
|
|
59
|
-
|
|
59
|
+
# 1.64 stops counting an open EventSource against networkidle; older versions hang smoke.
|
|
60
|
+
"playwright>=1.64",
|
|
60
61
|
"ptpython>=3.0.30",
|
|
61
62
|
]
|
|
62
63
|
asgi = [
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"""Starting an app, serving it locally, and running its durable jobs."""
|
|
2
2
|
|
|
3
|
+
import errno
|
|
4
|
+
import socket
|
|
5
|
+
import subprocess
|
|
3
6
|
from pathlib import Path
|
|
4
7
|
|
|
5
8
|
import click
|
|
@@ -47,6 +50,8 @@ def init(name, source):
|
|
|
47
50
|
def run(host, port, reload):
|
|
48
51
|
"""Run a local development server (uvicorn, as in production)."""
|
|
49
52
|
import uvicorn
|
|
53
|
+
|
|
54
|
+
_require_free_port(host, port)
|
|
50
55
|
from quart.helpers import get_debug_flag
|
|
51
56
|
|
|
52
57
|
app = cli_app()
|
|
@@ -63,6 +68,33 @@ def run(host, port, reload):
|
|
|
63
68
|
)
|
|
64
69
|
|
|
65
70
|
|
|
71
|
+
def _require_free_port(host, port):
|
|
72
|
+
# uvicorn logs EADDRINUSE and exits, easy to miss when backgrounded while
|
|
73
|
+
# the old server keeps serving stale code.
|
|
74
|
+
with socket.socket() as probe:
|
|
75
|
+
# Bind as uvicorn does, so a TIME_WAIT leftover is not a false alarm.
|
|
76
|
+
probe.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
|
77
|
+
try:
|
|
78
|
+
probe.bind((host, port))
|
|
79
|
+
except OSError as exc:
|
|
80
|
+
if exc.errno != errno.EADDRINUSE:
|
|
81
|
+
raise
|
|
82
|
+
else:
|
|
83
|
+
return
|
|
84
|
+
try:
|
|
85
|
+
pids = subprocess.run(
|
|
86
|
+
["lsof", "-nP", f"-iTCP:{port}", "-sTCP:LISTEN", "-t"],
|
|
87
|
+
capture_output=True,
|
|
88
|
+
text=True,
|
|
89
|
+
).stdout.split()
|
|
90
|
+
except FileNotFoundError: # no lsof (slim containers): report without a pid
|
|
91
|
+
pids = []
|
|
92
|
+
holder = f" by pid {', '.join(pids)}" if pids else ""
|
|
93
|
+
raise click.ClickException(
|
|
94
|
+
f"port {port} is in use{holder}. Stop it or pass --port."
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
|
|
66
98
|
@click.command("worker")
|
|
67
99
|
@click.option(
|
|
68
100
|
"--timeout",
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""stk messages: socket pushes routed through the database to every process."""
|
|
2
|
+
|
|
3
|
+
import sqlalchemy as sa
|
|
4
|
+
from alembic import op
|
|
5
|
+
|
|
6
|
+
revision = "stk_0008"
|
|
7
|
+
down_revision = "stk_0007"
|
|
8
|
+
branch_labels = None
|
|
9
|
+
depends_on = None
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def upgrade() -> None:
|
|
13
|
+
op.create_table(
|
|
14
|
+
"stk_message",
|
|
15
|
+
sa.Column("id", sa.Integer(), nullable=False),
|
|
16
|
+
sa.Column("user_id", sa.Integer(), nullable=False),
|
|
17
|
+
sa.Column("payload", sa.Text(), nullable=False),
|
|
18
|
+
sa.Column("created_at", sa.DateTime(), nullable=False),
|
|
19
|
+
sa.ForeignKeyConstraint(
|
|
20
|
+
["user_id"],
|
|
21
|
+
["user.id"],
|
|
22
|
+
name=op.f("fk_stk_message_user_id"),
|
|
23
|
+
ondelete="CASCADE",
|
|
24
|
+
),
|
|
25
|
+
sa.PrimaryKeyConstraint("id", name=op.f("pk_stk_message")),
|
|
26
|
+
)
|
|
27
|
+
with op.batch_alter_table("stk_message", schema=None) as batch_op:
|
|
28
|
+
batch_op.create_index(
|
|
29
|
+
batch_op.f("ix_stk_message_created_at"), ["created_at"], unique=False
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def downgrade() -> None:
|
|
34
|
+
with op.batch_alter_table("stk_message", schema=None) as batch_op:
|
|
35
|
+
batch_op.drop_index(batch_op.f("ix_stk_message_created_at"))
|
|
36
|
+
|
|
37
|
+
op.drop_table("stk_message")
|
|
@@ -9,11 +9,12 @@ from stk.notification.models import Notification
|
|
|
9
9
|
from stk.websocket import broadcast
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
async def notify(user_id, title, link=None, kind=None, body=None):
|
|
13
|
-
"""Store a notification for one user
|
|
12
|
+
async def notify(user_id, title, link=None, kind=None, body=None, session=None):
|
|
13
|
+
"""Store a notification for one user and push it to their sockets.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
With `session`, both join that transaction: they land at commit and vanish on
|
|
16
|
+
rollback. Without it, they commit on their own session.
|
|
17
|
+
`link` must be a same-origin path such as `/exports/3`.
|
|
17
18
|
"""
|
|
18
19
|
# The bell navigates to `link`; a `javascript:` or off-site URL would run there.
|
|
19
20
|
# Browsers strip tabs and newlines from URLs, so "/\t/evil" becomes "//evil".
|
|
@@ -23,16 +24,22 @@ async def notify(user_id, title, link=None, kind=None, body=None):
|
|
|
23
24
|
or any(c.isspace() or ord(c) < 0x20 or ord(c) == 0x7F for c in link)
|
|
24
25
|
):
|
|
25
26
|
raise ValueError(f"link must be a same-origin path, got {link!r}")
|
|
27
|
+
row = Notification(user_id=user_id, title=title, link=link, kind=kind, body=body)
|
|
28
|
+
if session is not None:
|
|
29
|
+
await _store(session, row)
|
|
30
|
+
return row
|
|
26
31
|
async with ext.async_session_factory() as db:
|
|
27
|
-
|
|
28
|
-
user_id=user_id, title=title, link=link, kind=kind, body=body
|
|
29
|
-
)
|
|
30
|
-
db.add(row)
|
|
32
|
+
await _store(db, row)
|
|
31
33
|
await db.commit()
|
|
32
|
-
await broadcast({"type": "notification", **row.to_dict()}, user_id)
|
|
33
34
|
return row
|
|
34
35
|
|
|
35
36
|
|
|
37
|
+
async def _store(db, row):
|
|
38
|
+
db.add(row)
|
|
39
|
+
await db.flush() # id and created_at for the pushed copy
|
|
40
|
+
await broadcast({"type": "notification", **row.to_dict()}, row.user_id, db)
|
|
41
|
+
|
|
42
|
+
|
|
36
43
|
def init_app(app):
|
|
37
44
|
from stk.notification.views import bp_notification
|
|
38
45
|
|
|
@@ -39,7 +39,7 @@ Backend:
|
|
|
39
39
|
- `User.from_dict()`, `Activity.register()`, `Session.create_session()` and the auth signal handlers are async.
|
|
40
40
|
- Pagination is manual: `offset().limit()` plus `select(func.count())`. List endpoints return `orjson` via `Response(json.dumps(data), content_type="application/json")`.
|
|
41
41
|
- Mutations arrive as `{item: {...}}`: read `json_data.get("item", {})`.
|
|
42
|
-
- `Activity.register()` stores audit events and does not broadcast. `broadcast()` needs an explicit recipient
|
|
42
|
+
- `Activity.register()` stores audit events and does not broadcast. `broadcast()` needs an explicit recipient; `session=` sends it at commit.
|
|
43
43
|
- SQLite migrations: DDL is not transactional; a new NOT NULL column needs `server_default` in migration and model; keep the constraint naming convention on `Base.metadata`.
|
|
44
44
|
- `stk verify` blocks drops, renames, retypes, and NOT NULL adds without a default in `upgrade()`. A rename is usually a mistaken drop + add from autogenerate; mark a deliberate one with `# destructive: <reason>`.
|
|
45
45
|
- Tests: subclass `TestingConfig` (`stk/settings.py`), never `Config`; `.env` loads at import. Pin any other env-driven switch a test depends on.
|
|
@@ -1,28 +1,67 @@
|
|
|
1
|
-
"""Bounded, same-origin WebSockets with periodic session validation.
|
|
1
|
+
"""Bounded, same-origin WebSockets with periodic session validation.
|
|
2
|
+
|
|
3
|
+
Messages travel through the `stk_message` table, so `broadcast` reaches a user's
|
|
4
|
+
sockets from any process: another uvicorn worker, `stk worker`, or `stk shell`.
|
|
5
|
+
Each server process polls the table while it holds sockets.
|
|
6
|
+
"""
|
|
2
7
|
|
|
3
8
|
import asyncio
|
|
4
9
|
import json
|
|
10
|
+
import logging
|
|
5
11
|
import time
|
|
12
|
+
from datetime import datetime, timedelta
|
|
6
13
|
|
|
7
14
|
from quart import Blueprint, current_app, g, session, websocket
|
|
8
15
|
from quart_security import SecurityState, current_user
|
|
9
|
-
from sqlalchemy import select
|
|
16
|
+
from sqlalchemy import Column, DateTime, ForeignKey, Integer, Text, delete, select
|
|
10
17
|
|
|
11
18
|
import stk.extensions as ext
|
|
19
|
+
from stk.extensions import Base
|
|
12
20
|
from stk.user.models import User
|
|
13
21
|
|
|
22
|
+
# ponytail: polling, so delivery lags up to POLL seconds; on Postgres add a
|
|
23
|
+
# LISTEN wake-up to the same loop if that lag is noticed.
|
|
24
|
+
POLL = 0.25
|
|
25
|
+
# Rows are re-read for this long, so one that commits after a later id is still
|
|
26
|
+
# delivered (Postgres ids can commit out of order); seen ids are skipped.
|
|
27
|
+
WINDOW = timedelta(seconds=10)
|
|
28
|
+
RETENTION = timedelta(minutes=1)
|
|
29
|
+
|
|
14
30
|
ws_bp = Blueprint("ws", __name__)
|
|
15
31
|
_clients: dict[str, set[asyncio.Queue]] = {}
|
|
32
|
+
_poller: asyncio.Task | None = None
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class Message(Base):
|
|
36
|
+
__tablename__ = "stk_message"
|
|
37
|
+
|
|
38
|
+
id = Column(Integer, primary_key=True)
|
|
39
|
+
user_id = Column(Integer, ForeignKey("user.id", ondelete="CASCADE"), nullable=False)
|
|
40
|
+
payload = Column(Text, nullable=False)
|
|
41
|
+
created_at = Column(DateTime, default=datetime.now, nullable=False, index=True)
|
|
16
42
|
|
|
17
43
|
|
|
18
44
|
def get_connected_users() -> list[str]:
|
|
19
45
|
return list(_clients)
|
|
20
46
|
|
|
21
47
|
|
|
22
|
-
async def broadcast(message: dict, user_id
|
|
23
|
-
"""Send only to the explicitly selected user.
|
|
24
|
-
|
|
25
|
-
|
|
48
|
+
async def broadcast(message: dict, user_id, session=None):
|
|
49
|
+
"""Send only to the explicitly selected user, from any process.
|
|
50
|
+
|
|
51
|
+
With `session`, the message joins that transaction: it goes out at commit and
|
|
52
|
+
not at all on rollback. Without it, it is committed on its own session.
|
|
53
|
+
"""
|
|
54
|
+
row = Message(user_id=int(user_id), payload=json.dumps(message))
|
|
55
|
+
if session is not None:
|
|
56
|
+
session.add(row)
|
|
57
|
+
return
|
|
58
|
+
async with ext.async_session_factory() as db:
|
|
59
|
+
db.add(row)
|
|
60
|
+
await db.commit()
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _deliver(user_id: str, payload: str):
|
|
64
|
+
for queue in _clients.get(user_id, set()):
|
|
26
65
|
try:
|
|
27
66
|
queue.put_nowait(payload)
|
|
28
67
|
except asyncio.QueueFull:
|
|
@@ -32,6 +71,54 @@ async def broadcast(message: dict, user_id: str):
|
|
|
32
71
|
queue.put_nowait(None)
|
|
33
72
|
|
|
34
73
|
|
|
74
|
+
async def _recent_ids(db):
|
|
75
|
+
since = datetime.now() - WINDOW
|
|
76
|
+
return (
|
|
77
|
+
await db.execute(
|
|
78
|
+
select(Message.id, Message.user_id).where(Message.created_at > since)
|
|
79
|
+
)
|
|
80
|
+
).all()
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
async def _poll():
|
|
84
|
+
"""Fan new rows out to this process's sockets until the last one closes."""
|
|
85
|
+
global _poller
|
|
86
|
+
try:
|
|
87
|
+
async with ext.async_session_factory() as db:
|
|
88
|
+
# Only rows sent from now on: a reconnecting tab must not replay.
|
|
89
|
+
seen = {row.id: time.monotonic() for row in await _recent_ids(db)}
|
|
90
|
+
trimmed = time.monotonic()
|
|
91
|
+
while _clients:
|
|
92
|
+
await asyncio.sleep(POLL)
|
|
93
|
+
now = time.monotonic()
|
|
94
|
+
async with ext.async_session_factory() as db:
|
|
95
|
+
# Every new row counts as seen, so a user who connects later does
|
|
96
|
+
# not receive what was sent before.
|
|
97
|
+
fresh = [row for row in await _recent_ids(db) if row.id not in seen]
|
|
98
|
+
seen.update((row.id, now) for row in fresh)
|
|
99
|
+
wanted = [row.id for row in fresh if str(row.user_id) in _clients]
|
|
100
|
+
rows = []
|
|
101
|
+
if wanted:
|
|
102
|
+
query = select(Message.user_id, Message.payload)
|
|
103
|
+
query = query.where(Message.id.in_(wanted)).order_by(Message.id)
|
|
104
|
+
rows = (await db.execute(query)).all()
|
|
105
|
+
if now - trimmed > RETENTION.total_seconds():
|
|
106
|
+
cutoff = datetime.now() - RETENTION
|
|
107
|
+
await db.execute(delete(Message).where(Message.created_at < cutoff))
|
|
108
|
+
await db.commit()
|
|
109
|
+
trimmed = now
|
|
110
|
+
for row in rows:
|
|
111
|
+
_deliver(str(row.user_id), row.payload)
|
|
112
|
+
horizon = now - 2 * WINDOW.total_seconds()
|
|
113
|
+
seen = {id: at for id, at in seen.items() if at > horizon}
|
|
114
|
+
except Exception:
|
|
115
|
+
# Open sockets stop receiving until the next one connects and restarts this.
|
|
116
|
+
logging.getLogger(__name__).exception("websocket message poller failed")
|
|
117
|
+
raise
|
|
118
|
+
finally:
|
|
119
|
+
_poller = None
|
|
120
|
+
|
|
121
|
+
|
|
35
122
|
@ws_bp.websocket("/ws")
|
|
36
123
|
async def ws_endpoint():
|
|
37
124
|
db = g.pop("db_session", None)
|
|
@@ -63,6 +150,9 @@ async def ws_endpoint():
|
|
|
63
150
|
return
|
|
64
151
|
queue = asyncio.Queue(maxsize=current_app.config.get("STK_WS_QUEUE_SIZE", 32))
|
|
65
152
|
_clients.setdefault(user_id, set()).add(queue)
|
|
153
|
+
global _poller
|
|
154
|
+
if _poller is None:
|
|
155
|
+
_poller = asyncio.create_task(_poll())
|
|
66
156
|
|
|
67
157
|
async def check_authorization():
|
|
68
158
|
async with ext.async_session_factory() as db:
|
|
@@ -86,5 +86,21 @@ class DatabaseCommandTest(unittest.TestCase):
|
|
|
86
86
|
load.assert_called()
|
|
87
87
|
|
|
88
88
|
|
|
89
|
+
class RunCommandTest(unittest.TestCase):
|
|
90
|
+
def test_run_on_a_taken_port_names_the_holder(self):
|
|
91
|
+
import os
|
|
92
|
+
import socket
|
|
93
|
+
|
|
94
|
+
with socket.socket() as held:
|
|
95
|
+
held.bind(("127.0.0.1", 0))
|
|
96
|
+
held.listen()
|
|
97
|
+
port = held.getsockname()[1]
|
|
98
|
+
result = CliRunner().invoke(main, ["run", "--port", str(port)])
|
|
99
|
+
|
|
100
|
+
self.assertNotEqual(result.exit_code, 0)
|
|
101
|
+
self.assertIn(f"port {port} is in use", result.output)
|
|
102
|
+
self.assertIn(f"pid {os.getpid()}", result.output)
|
|
103
|
+
|
|
104
|
+
|
|
89
105
|
async def _done():
|
|
90
106
|
return None
|
|
@@ -128,6 +128,64 @@ class NotificationTests(unittest.IsolatedAsyncioTestCase):
|
|
|
128
128
|
with self.assertRaises(TimeoutError):
|
|
129
129
|
await asyncio.wait_for(bob_ws.receive(), 0.2)
|
|
130
130
|
|
|
131
|
+
async def test_socket_opened_later_does_not_replay_earlier_pushes(self):
|
|
132
|
+
alice, bob = (
|
|
133
|
+
await self.client("alice@example.com"),
|
|
134
|
+
await self.client("bob@example.com"),
|
|
135
|
+
)
|
|
136
|
+
origin = {"Origin": "http://localhost"}
|
|
137
|
+
async with alice.websocket("/ws", headers=origin) as alice_ws:
|
|
138
|
+
await alice_ws.receive()
|
|
139
|
+
await notify(self.bob, "Before Bob connected")
|
|
140
|
+
await asyncio.sleep(0.5) # the running poller has passed it
|
|
141
|
+
async with bob.websocket("/ws", headers=origin) as bob_ws:
|
|
142
|
+
await bob_ws.receive()
|
|
143
|
+
with self.assertRaises(TimeoutError):
|
|
144
|
+
await asyncio.wait_for(bob_ws.receive(), 0.6)
|
|
145
|
+
|
|
146
|
+
async def test_push_from_another_process_reaches_the_socket(self):
|
|
147
|
+
"""`stk worker` and other uvicorn workers are separate processes."""
|
|
148
|
+
import sys
|
|
149
|
+
import tempfile
|
|
150
|
+
from pathlib import Path
|
|
151
|
+
|
|
152
|
+
await ext.engine.dispose()
|
|
153
|
+
folder = tempfile.TemporaryDirectory()
|
|
154
|
+
self.addCleanup(folder.cleanup)
|
|
155
|
+
uri = f"sqlite+aiosqlite:///{Path(folder.name) / 'shared.db'}"
|
|
156
|
+
config = type(
|
|
157
|
+
"SharedConfig", (TestingConfig,), {"SQLALCHEMY_DATABASE_URI": uri}
|
|
158
|
+
)
|
|
159
|
+
self.app = Stk(__name__, config=config, extensions=[stk.notification])
|
|
160
|
+
async with ext.engine.begin() as conn:
|
|
161
|
+
await conn.run_sync(Base.metadata.create_all)
|
|
162
|
+
async with ext.async_session_factory() as db:
|
|
163
|
+
user = User(
|
|
164
|
+
email="carol@example.com",
|
|
165
|
+
active=True,
|
|
166
|
+
password=hash_password("Password123!", app=self.app),
|
|
167
|
+
)
|
|
168
|
+
db.add(user)
|
|
169
|
+
await db.commit()
|
|
170
|
+
carol = await self.client("carol@example.com")
|
|
171
|
+
script = (
|
|
172
|
+
"import asyncio, sys\n"
|
|
173
|
+
"from stk.app import Stk\n"
|
|
174
|
+
"from stk.settings import TestingConfig\n"
|
|
175
|
+
"from stk.websocket import broadcast\n"
|
|
176
|
+
"C = type('C', (TestingConfig,), {'SQLALCHEMY_DATABASE_URI': sys.argv[1]})\n"
|
|
177
|
+
"Stk('other', config=C)\n"
|
|
178
|
+
"asyncio.run(broadcast({'type': 'progress', 'done': 40}, int(sys.argv[2])))\n"
|
|
179
|
+
)
|
|
180
|
+
async with carol.websocket("/ws", headers={"Origin": "http://localhost"}) as ws:
|
|
181
|
+
await ws.receive()
|
|
182
|
+
other = await asyncio.create_subprocess_exec(
|
|
183
|
+
sys.executable, "-c", script, uri, str(user.id)
|
|
184
|
+
)
|
|
185
|
+
self.assertEqual(await other.wait(), 0)
|
|
186
|
+
message = json.loads(await asyncio.wait_for(ws.receive(), 2))
|
|
187
|
+
self.assertEqual(message, {"type": "progress", "done": 40})
|
|
188
|
+
|
|
131
189
|
|
|
132
190
|
if __name__ == "__main__":
|
|
133
191
|
unittest.main()
|
|
@@ -554,14 +554,14 @@ class ProductionSecurityTests(unittest.IsolatedAsyncioTestCase):
|
|
|
554
554
|
await db.commit()
|
|
555
555
|
|
|
556
556
|
async def test_broadcast_is_targeted_and_queue_is_bounded(self):
|
|
557
|
-
from stk.websocket import _clients,
|
|
557
|
+
from stk.websocket import _clients, _deliver
|
|
558
558
|
|
|
559
559
|
target, unrelated = asyncio.Queue(maxsize=2), asyncio.Queue(maxsize=2)
|
|
560
560
|
_clients["fixture-target"] = {target}
|
|
561
561
|
_clients["fixture-other"] = {unrelated}
|
|
562
562
|
try:
|
|
563
563
|
for _ in range(3):
|
|
564
|
-
|
|
564
|
+
_deliver("fixture-target", '{"type": "notification"}')
|
|
565
565
|
self.assertTrue(unrelated.empty())
|
|
566
566
|
self.assertEqual(target.qsize(), 1)
|
|
567
567
|
self.assertIsNone(target.get_nowait())
|
|
@@ -90,3 +90,53 @@ class SmokePageErrorTests(unittest.TestCase):
|
|
|
90
90
|
|
|
91
91
|
if __name__ == "__main__":
|
|
92
92
|
unittest.main()
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class EventStreamPageTest(unittest.IsolatedAsyncioTestCase):
|
|
96
|
+
"""A page that opens an EventSource on load still reaches networkidle."""
|
|
97
|
+
|
|
98
|
+
async def test_page_with_open_event_stream_finishes(self):
|
|
99
|
+
import threading
|
|
100
|
+
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
|
101
|
+
|
|
102
|
+
from stk.cli.smoke import _visit_smoke_page
|
|
103
|
+
|
|
104
|
+
class Handler(BaseHTTPRequestHandler):
|
|
105
|
+
def log_message(self, *args):
|
|
106
|
+
pass
|
|
107
|
+
|
|
108
|
+
def do_GET(self):
|
|
109
|
+
self.send_response(200)
|
|
110
|
+
if self.path == "/events":
|
|
111
|
+
self.send_header("Content-Type", "text/event-stream")
|
|
112
|
+
self.end_headers()
|
|
113
|
+
self.wfile.write(b": open\n\n")
|
|
114
|
+
self.wfile.flush()
|
|
115
|
+
threading.Event().wait(30) # a live stream never ends
|
|
116
|
+
return
|
|
117
|
+
self.send_header("Content-Type", "text/html")
|
|
118
|
+
self.end_headers()
|
|
119
|
+
self.wfile.write(
|
|
120
|
+
b"<p>live</p><script>new EventSource('/events')</script>"
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
server = ThreadingHTTPServer(("127.0.0.1", 0), Handler)
|
|
124
|
+
server.daemon_threads = True
|
|
125
|
+
threading.Thread(target=server.serve_forever, daemon=True).start()
|
|
126
|
+
self.addCleanup(server.shutdown)
|
|
127
|
+
try:
|
|
128
|
+
from playwright.async_api import async_playwright
|
|
129
|
+
|
|
130
|
+
playwright = await async_playwright().start()
|
|
131
|
+
browser = await playwright.chromium.launch()
|
|
132
|
+
except Exception as exc: # no Playwright or no browser installed
|
|
133
|
+
self.skipTest(f"chromium unavailable: {exc}")
|
|
134
|
+
try:
|
|
135
|
+
context = await browser.new_context()
|
|
136
|
+
context.set_default_navigation_timeout(5000)
|
|
137
|
+
base_url = f"http://127.0.0.1:{server.server_port}"
|
|
138
|
+
page = await _visit_smoke_page(context, base_url, "live", "/")
|
|
139
|
+
finally:
|
|
140
|
+
await browser.close()
|
|
141
|
+
await playwright.stop()
|
|
142
|
+
self.assertEqual(page["status"], 200)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|