Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab31d828d4 | ||
|
|
21338337a1 | ||
|
|
8fb16f4a4a |
No files matched your search
@@ -0,0 +1,14 @@
|
||||
.venv
|
||||
**/__pycache__
|
||||
**/*.pyc
|
||||
.git
|
||||
.task
|
||||
web/node_modules
|
||||
**/node_modules
|
||||
docs/evidence
|
||||
local-data
|
||||
.env.local
|
||||
*.log
|
||||
.pytest_cache
|
||||
.mypy_cache
|
||||
.ruff_cache
|
||||
@@ -0,0 +1,39 @@
|
||||
# Copy to .env.dev / .env.local and replace placeholders.
|
||||
# .env.local is never committed.
|
||||
|
||||
# Bootstrap only (local superuser). Prefer system env or .env.local.
|
||||
WATCHMAN_BOOTSTRAP_DATABASE_URL=postgresql+psycopg://postgres:CHANGE-ME@127.0.0.1:5432/postgres
|
||||
|
||||
# App and migrator roles (not the bootstrap superuser)
|
||||
WATCHMAN_MIGRATOR_PASSWORD=CHANGE-ME
|
||||
WATCHMAN_APP_PASSWORD=CHANGE-ME
|
||||
|
||||
DATABASE_URL=postgresql+psycopg://watchman_app:CHANGE-ME@127.0.0.1:5432/watchman
|
||||
DATABASE_MIGRATOR_URL=postgresql+psycopg://watchman_migrator:CHANGE-ME@127.0.0.1:5432/watchman
|
||||
|
||||
# Server-injected tenant for M01; keep out of committed shared env.
|
||||
WATCHMAN_TENANT_ID=dev-tenant
|
||||
|
||||
# Queue (host processes talk to published RabbitMQ port).
|
||||
# DEV ONLY: RabbitMQ image default guest/guest — never reuse in non-local brokers.
|
||||
CELERY_BROKER_URL=amqp://guest:guest@127.0.0.1:56729//
|
||||
|
||||
# Compose app profile overrides (gitignored .env.local only)
|
||||
# DEV ONLY guest/guest for the local compose RabbitMQ service.
|
||||
CELERY_BROKER_URL_DOCKER=amqp://guest:guest@rabbitmq:5672//
|
||||
DATABASE_URL_DOCKER=postgresql+psycopg://watchman_app:CHANGE-ME@host.docker.internal:5432/watchman
|
||||
DATABASE_MIGRATOR_URL_DOCKER=postgresql+psycopg://watchman_migrator:CHANGE-ME@host.docker.internal:5432/watchman
|
||||
COMPOSE_POSTGRES_PASSWORD=CHANGE-ME
|
||||
|
||||
# 4. Security, identity. Real values belong in gitignored .env.local only.
|
||||
CASDOOR_ENDPOINT=http://CHANGE-ME
|
||||
CASDOOR_CLIENT_ID=CHANGE-ME
|
||||
CASDOOR_CLIENT_SECRET=CHANGE-ME
|
||||
CASDOOR_ORGANIZATION=CHANGE-ME
|
||||
CASDOOR_APPLICATION=CHANGE-ME
|
||||
CASDOOR_CERTIFICATE=CHANGE-ME
|
||||
CASDOOR_ISSUER=http://CHANGE-ME
|
||||
CASDOOR_AUDIENCE=CHANGE-ME
|
||||
HXOPS_SSO_ISSUER=https://CHANGE-ME
|
||||
HXOPS_SSO_AUDIENCE=CHANGE-ME
|
||||
HXOPS_SSO_PUBLIC_KEY=CHANGE-ME
|
||||
@@ -0,0 +1,19 @@
|
||||
# Shared non-secret defaults for all environments.
|
||||
# Do not put production secrets in this file.
|
||||
|
||||
# 1. Environment and service identity
|
||||
APP_NAME=watchman
|
||||
ENV_NAME=dev
|
||||
|
||||
# 2. Application runtime
|
||||
API_HOST=127.0.0.1
|
||||
API_PORT=8000
|
||||
|
||||
# 3. Public addresses / network (dev-only ports; never publish to 0.0.0.0)
|
||||
CONSOLE_HOST=127.0.0.1
|
||||
CONSOLE_PORT=5173
|
||||
|
||||
# 4. Database names / role names (passwords and tenant id stay in .env.local)
|
||||
WATCHMAN_DATABASE_NAME=watchman
|
||||
WATCHMAN_MIGRATOR_USER=watchman_migrator
|
||||
WATCHMAN_APP_USER=watchman_app
|
||||
@@ -2,7 +2,9 @@
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
!.env.shared
|
||||
secrets/
|
||||
|
||||
*.pem
|
||||
*.key
|
||||
*.p12
|
||||
@@ -30,6 +32,8 @@ Thumbs.db
|
||||
playwright/.auth/
|
||||
test-results/
|
||||
playwright-report/
|
||||
web/apps/console/playwright-report/
|
||||
docs/evidence/M01/ui/test-results/
|
||||
|
||||
# Raw local artifacts can contain internal data; keep only reviewed summaries
|
||||
docs/evidence/**/raw/
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
3.12
|
||||
@@ -0,0 +1,150 @@
|
||||
# Task Context Pack
|
||||
|
||||
## Task Goal
|
||||
|
||||
完成 Watchman M01 基础框架:实现 S1–S7、补齐 critic/review 必改与建议顺带项,并留下可回查证据。
|
||||
|
||||
## Knowledge Posture
|
||||
|
||||
- Mode: standard
|
||||
- Maturity: L1
|
||||
|
||||
## Current Slice Or Group
|
||||
|
||||
当前:review 修复收尾已完成;等待复审结果与用户最终确认。不再扩大 M01 范围。
|
||||
|
||||
## Gate Policy
|
||||
|
||||
- Recommended: strict
|
||||
- Selected: autonomous(任务局部)
|
||||
- finalApprovalRequired: true
|
||||
- Policy Notes: 分析→编码门禁已过。仓库 `gatePolicy.defaultMode` 保持 balanced(D17)。最终批准仍需用户确认。
|
||||
|
||||
## Bugfix Context
|
||||
|
||||
不适用(本轮为 review 修复)。
|
||||
|
||||
## Requirement Source
|
||||
|
||||
`.task/2026-11-17/m01-foundation/requirement.md`
|
||||
|
||||
## Implementation Source
|
||||
|
||||
`.task/2026-11-17/m01-foundation/implementation-plan.md`
|
||||
|
||||
## Involved Modules Or Areas
|
||||
|
||||
`services/watchman`、`web/`、`deploy/`、`docs/evidence/M01/`。
|
||||
|
||||
## Loaded Context
|
||||
|
||||
### Global Rules
|
||||
|
||||
AGENTS.md 托管段门禁;sy-standards;密钥不入库。
|
||||
|
||||
### Knowledge Map Matches
|
||||
|
||||
M01 基础框架。
|
||||
|
||||
### Path-Proximity Rules
|
||||
|
||||
无模块级 MODULE_RULES。
|
||||
|
||||
### Excluded Context
|
||||
|
||||
syops 业务代码、M02+、生产部署。
|
||||
|
||||
## Loaded Rules
|
||||
|
||||
- `standards://api/api-envelope?version=1.1.0`
|
||||
- `standards://api/error-handling?version=1.1.1`
|
||||
- `standards://engineering/code-layout?version=1.0.1`
|
||||
- `standards://engineering/code-comments?version=1.1.1`
|
||||
- `standards://security/red-line?version=1.1.0`
|
||||
- `standards://security/env-secrets?version=1.1.1`
|
||||
- `standards://frontend/frontend-stack?version=2.1.0`
|
||||
- `standards://frontend/element-plus?version=1.0.2`
|
||||
- D01、D04、D12–D18
|
||||
|
||||
## Loaded Docs
|
||||
|
||||
- `docs/tasks/M01.md`
|
||||
- `docs/decisions.md`
|
||||
- `docs/runbook.md`
|
||||
- `docs/evidence/M01/*`
|
||||
|
||||
## Execution Mode
|
||||
|
||||
- Mode: sequential
|
||||
- Current Slice Or Group: review-fixup(已实现)
|
||||
- Parallel Members: 无
|
||||
- Fallback Order: N/A
|
||||
- Shared Files: N/A
|
||||
- Merge Owner: 主 Agent
|
||||
- Conflict Resolution Rule: 信封与 RLS 语义冻结
|
||||
- Validation Level: module
|
||||
|
||||
## Execution Chain
|
||||
|
||||
实现 → 独立 review → 必改/建议修复 → Playwright/pytest → 复审 → 用户最终确认。
|
||||
|
||||
## Allowed Modification Scope
|
||||
|
||||
- `services/watchman/**`
|
||||
- `web/**`
|
||||
- `deploy/**`
|
||||
- `.env.example`、`.env.shared`
|
||||
- `docs/tasks/M01.md`、`docs/progress.md`、`docs/runbook.md`、`docs/decisions.md`、`docs/evidence/M01/**`、`docs/handoffs/**`
|
||||
- `.task/2026-11-17/m01-foundation/**`
|
||||
- `.gitignore`
|
||||
|
||||
## Forbidden Modification Scope
|
||||
|
||||
- 提交真实密码
|
||||
- 写入 `D:\PROJECT\syops`
|
||||
- 业务模块、Casdoor、vben5、Redis、生产部署
|
||||
- 未经确认的门禁姿态放宽
|
||||
- DONE_LOCAL/git commit(除非用户明确要求)
|
||||
|
||||
## Key Existing Classes Or Entrypoints
|
||||
|
||||
- `python -m watchman api|worker|beat`
|
||||
- `web/apps/console` Vite 5173
|
||||
- `/health`、`/platform/*`
|
||||
|
||||
## Required Behavior
|
||||
|
||||
- 数值信封无额外顶层字段;`/health` 不泄漏机密
|
||||
- env 分层;启动缺键失败;probe/docs 非生产收口
|
||||
- FORCE RLS;幂等;调用方不可传租户;commit 后租户重绑
|
||||
- 前端三态 + 截图证据
|
||||
|
||||
## Non-goals
|
||||
|
||||
M02 登录、业务规则、真实企微、生产 Compose。
|
||||
|
||||
## Implementation Steps
|
||||
|
||||
1. (已完成)必改与建议修复。
|
||||
2. (进行中)独立复审。
|
||||
3. 用户最终确认后关 M01。
|
||||
|
||||
## Validation Commands
|
||||
|
||||
- `uv run pytest services/watchman/tests -q`
|
||||
- `cd web/apps/console && pnpm test:unit && pnpm typecheck && pnpm test:e2e`
|
||||
|
||||
## Assumptions
|
||||
|
||||
- 本机 Postgres + RabbitMQ Compose 可用。
|
||||
- `.env.local` 已配置且不入库。
|
||||
|
||||
## Risks
|
||||
|
||||
- 复审可能再发现残余项。
|
||||
- 无 commit hash,证据与工作区绑定需靠文件路径与命令输出。
|
||||
|
||||
## Stop Conditions
|
||||
|
||||
- 复审 FAIL 或用户要求改口径时停止。
|
||||
- 不自动 DONE_LOCAL/不自动 commit。
|
||||
@@ -0,0 +1,497 @@
|
||||
# M01 基础框架 Implementation Plan
|
||||
|
||||
## Requirement Source
|
||||
|
||||
`.task/2026-11-17/m01-foundation/requirement.md`
|
||||
|
||||
## Scope Summary
|
||||
|
||||
按已冻结的 M01 需求,顺序建立 uv 与 `web/` 工作区、环境分层、API 信封、带强制 RLS 的两张平台表、Celery 探测进程、管理台薄壳,以及只绑定本机的开发 Compose。不进入业务模块。
|
||||
|
||||
## Involved Modules Or Areas
|
||||
|
||||
Watchman M01。一个 Python 服务包,API / worker / beat 三个进程。前端是 `web/apps/console` 薄壳。
|
||||
|
||||
## Loaded Rules
|
||||
|
||||
- Marionettist:本任务 `gatePolicy.selected=autonomous`,`finalApprovalRequired=true`。分析到编码仍须用户确认。`risk_score >= 4` 和 `high-risk` 切片完成后必须停。
|
||||
- `standards://engineering/code-layout?version=1.0.1`
|
||||
- `standards://api/api-envelope?version=1.1.0`
|
||||
- `standards://api/error-handling?version=1.1.1`
|
||||
- `standards://frontend/frontend-stack?version=2.1.0`
|
||||
- `standards://frontend/element-plus?version=1.0.2`
|
||||
- `standards://security/red-line?version=1.1.0`
|
||||
- `standards://security/env-secrets?version=1.1.1`
|
||||
- `standards://engineering/code-comments?version=1.1.1`
|
||||
- `standards://workflow/git-commit?version=1.1.0`
|
||||
- Watchman D01、D04、D12–D15。
|
||||
|
||||
## Loaded Docs
|
||||
|
||||
- `docs/tasks/INDEX.md` M01
|
||||
- `docs/development-plan.md` 技术栈;目录以 D12 为准
|
||||
- `docs/decisions.md`
|
||||
- syops 只用于对照,不复制 Flask、Redis worker 或字符串错误码
|
||||
|
||||
## Global Forbidden Scope
|
||||
|
||||
- `D:\PROJECT\syops` 内的任何写入。
|
||||
- 业务包:数据源、查询、规则、报警、通知、场景、AI。
|
||||
- Casdoor 真接入、权限点编码、vben5、Redis。
|
||||
- 把 API、worker 拆成独立服务或独立数据库。
|
||||
- 监听 `0.0.0.0`,或把开发端口写进任何非开发配置。
|
||||
- 真实密钥、生产连接串、修改已合入迁移。
|
||||
- 为列表分页做协议选择。
|
||||
|
||||
## Execution Strategy
|
||||
|
||||
- Complexity: complex
|
||||
- Default Execution: sequential
|
||||
- Parallel Execution: not-needed
|
||||
- Fallback Execution: sequential
|
||||
- Merge Owner: 主 Agent
|
||||
- Conflict Resolution Rule: 工作区根、锁文件、env 样例和迁移目录由当前切片独占。后一切片不得改前一切片已经冻结的信封字段和 RLS 策略语义。
|
||||
|
||||
选择顺序执行,因为根工作区、环境样例和数据库会话会被多个切片碰到。
|
||||
|
||||
## Slice Dependency Graph
|
||||
|
||||
| Slice | Depends On | Can Run In Parallel With | Fallback Order | Shared Files | Merge Owner | Conflict Risk |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| S1 工作区 | 无 | 无 | 1 | 根 `pyproject.toml`、`web/`、`.gitignore` | 主 Agent | high |
|
||||
| S2 环境分层 | S1 | 无 | 2 | env 样例、`.gitignore` | 主 Agent | high |
|
||||
| S3 信封 | S1 | 无 | 3 | `services/watchman` | 主 Agent | medium |
|
||||
| S4 RLS | S2、S3 | 无 | 4 | 迁移、数据库会话 | 主 Agent | high |
|
||||
| S5 队列 | S2、S4 | 无 | 5 | 同一 Python 包、Compose | 主 Agent | medium |
|
||||
| S6 薄壳 | S3 | 无 | 6 | `web/` | 主 Agent | medium |
|
||||
| S7 手册与总验 | S5、S6 | 无 | 7 | `deploy/`、`docs/runbook.md` | 主 Agent | medium |
|
||||
|
||||
S6 依赖 S3 的信封,不依赖 S4 的表。仍按上表顺序做,避免和 S5 同时改 Compose。
|
||||
|
||||
## Implementation Slices
|
||||
|
||||
### Slice 1: 工作区与工具链
|
||||
|
||||
#### Goal
|
||||
|
||||
建立可安装的 uv 工作区和 pnpm `web/` 工作区,锁定 Python 3.12 候选上的最小依赖。不写业务行为。
|
||||
|
||||
#### Allowed Modification Scope
|
||||
|
||||
- 根 `pyproject.toml`、`uv.lock`
|
||||
- `services/watchman/pyproject.toml`
|
||||
- `services/watchman/src/watchman/` 的空包和进程入口文件
|
||||
- `web/package.json`、`web/pnpm-workspace.yaml`、`web/pnpm-lock.yaml`
|
||||
- `web/apps/console` 的空 Vite 应用
|
||||
- `web/packages/api`、`web/packages/ui-components`、`web/design` 的空包
|
||||
- `.gitignore` 中与虚拟环境和前端依赖相关的条目
|
||||
|
||||
#### Forbidden Scope
|
||||
|
||||
- 业务模块、迁移、Compose、页面视觉、密钥文件。
|
||||
|
||||
#### Execution
|
||||
|
||||
- Mode: sequential
|
||||
- Depends On: 无
|
||||
- Can Run With: 无
|
||||
- Must Not Run With: S2–S7
|
||||
- Fallback Order: 1
|
||||
- Shared Files: 根工作区
|
||||
- Merge Owner: 主 Agent
|
||||
- Conflict Risk: high
|
||||
- Gate Class: standard
|
||||
- Risk Score: 3
|
||||
- Gate Reasons: new-dependencies
|
||||
- Validation Level: slice
|
||||
- Recommended Agent Strategy: 编码模型实现;审查用另一个模型系列
|
||||
|
||||
#### Steps
|
||||
|
||||
1. 核对 FastAPI、Pydantic v2、SQLAlchemy 2、Alembic、Celery、pytest 与 Python 3.12 的当前兼容版本,把结果写进切片记录。AGPL 依赖不引入。
|
||||
2. 创建 uv 工作区。只建一个成员:`services/watchman`。入口预留 API、worker、beat,不拆服务。
|
||||
3. 创建 pnpm 工作区:`web/apps/console`、`web/packages/api`、`web/packages/ui-components`、`web/design`。
|
||||
4. 生成锁文件。
|
||||
|
||||
#### Validation
|
||||
|
||||
- `uv lock` 成功。
|
||||
- `uv run --package watchman python -c "import watchman"` 成功。
|
||||
- `pnpm install` 在 `web/` 成功,`pnpm -r list` 能看到 console 和两个包。
|
||||
|
||||
#### Done Criteria
|
||||
|
||||
- 锁文件入库所需的依赖已经固定。
|
||||
- 还没有健康检查、表和页面行为。
|
||||
|
||||
#### Rollback Notes
|
||||
|
||||
删除新建的工作区文件和锁文件即可。没有数据库可回滚。
|
||||
|
||||
### Slice 2: 环境分层
|
||||
|
||||
#### Goal
|
||||
|
||||
按公司环境规范提供可提交的无密样例,并让进程从分层 env 读取配置。
|
||||
|
||||
#### Allowed Modification Scope
|
||||
|
||||
- `.env.shared`
|
||||
- `.env.example`
|
||||
- `.gitignore` 的 env 例外
|
||||
- `services/watchman` 的配置读取模块
|
||||
- 配置测试
|
||||
|
||||
#### Forbidden Scope
|
||||
|
||||
- `.env.local`、真实 `.env.dev`、真实密码。
|
||||
- 监听地址改到非回环。
|
||||
|
||||
#### Execution
|
||||
|
||||
- Mode: sequential
|
||||
- Depends On: S1
|
||||
- Can Run With: 无
|
||||
- Must Not Run With: S3–S7
|
||||
- Fallback Order: 2
|
||||
- Shared Files: `.gitignore`
|
||||
- Merge Owner: 主 Agent
|
||||
- Conflict Risk: high
|
||||
- Gate Class: standard
|
||||
- Risk Score: 3
|
||||
- Gate Reasons: secrets-config
|
||||
- Validation Level: slice
|
||||
- Recommended Agent Strategy: 编码模型实现
|
||||
|
||||
#### Steps
|
||||
|
||||
1. `.env.shared` 只放三环境相同且非机密的值,包括开发绑定地址说明。
|
||||
2. `.env.example` 列出 `.env.dev` 与 `.env.local` 要填的键,值用占位符。
|
||||
3. 调整忽略规则:提交 `.env.shared` 和 `.env.example`;忽略 `.env.local`、`.env.dev`、`.env.test`、`.env.prod`。
|
||||
4. 加载顺序实现为:系统环境、`.env.local`、`.env.dev`、`.env.shared`。
|
||||
5. 开发端口写死为仅开发:API `127.0.0.1:8000`,控制台 `127.0.0.1:5173`,Postgres `127.0.0.1:54329`,RabbitMQ `127.0.0.1:56729`,管理端口 `127.0.0.1:15679`。
|
||||
|
||||
#### Validation
|
||||
|
||||
- 测试证明 `.env.local` 覆盖 `.env.dev`,`.env.dev` 覆盖 `.env.shared`。
|
||||
- 仓库检索确认样例不含真实口令、token 或内网账号。
|
||||
|
||||
#### Done Criteria
|
||||
|
||||
- 缺配置时进程失败并给出键名,不打印其他配置值。
|
||||
- 开发端口只出现在开发样例和开发 Compose 计划中。
|
||||
|
||||
#### Rollback Notes
|
||||
|
||||
恢复 `.gitignore` 并删除新的 env 样例和配置模块。
|
||||
|
||||
### Slice 3: API 信封与错误
|
||||
|
||||
#### Goal
|
||||
|
||||
提供健康检查和全局失败信封。路由不手写错误 JSON。
|
||||
|
||||
#### Allowed Modification Scope
|
||||
|
||||
- `services/watchman/src/watchman/api/`
|
||||
- `services/watchman/src/watchman/services/` 中的健康服务
|
||||
- 错误类型、响应构造、请求号中间件
|
||||
- 对应 pytest
|
||||
|
||||
#### Forbidden Scope
|
||||
|
||||
- 数据库表、RLS、前端页面、队列任务。
|
||||
|
||||
#### Execution
|
||||
|
||||
- Mode: sequential
|
||||
- Depends On: S1
|
||||
- Can Run With: 无
|
||||
- Must Not Run With: S4–S7
|
||||
- Fallback Order: 3
|
||||
- Shared Files: `services/watchman`
|
||||
- Merge Owner: 主 Agent
|
||||
- Conflict Risk: medium
|
||||
- Gate Class: standard
|
||||
- Risk Score: 3
|
||||
- Gate Reasons: public-api-contract
|
||||
- Validation Level: slice
|
||||
- Recommended Agent Strategy: 编码模型实现
|
||||
|
||||
#### Steps
|
||||
|
||||
1. 成功体使用 `success`、`data`、`request_id`。失败体使用 `success=false`、`error`、`request_id`。
|
||||
2. 错误码只用五段位整数。内部错误对外为 50000。
|
||||
3. 尊重传入的 `X-Request-Id`;没有则生成。响应头回写同一个值。
|
||||
4. `GET /health` 返回进程存活,不访问数据库,不返回租户、主机或连接串。
|
||||
5. 增加一个只用于测试的参数错误路径,确认 40000 由全局处理生成。
|
||||
|
||||
#### Validation
|
||||
|
||||
- `uv run pytest services/watchman/tests/test_envelope.py`
|
||||
- 断言成功与 40000、50000 的形状,并断言响应不含 traceback。
|
||||
|
||||
#### Done Criteria
|
||||
|
||||
- 健康检查和两类失败响应有测试。
|
||||
- 没有信封例外出口。
|
||||
|
||||
#### Rollback Notes
|
||||
|
||||
移除 API 包中本切片新增的模块和测试。
|
||||
|
||||
### Slice 4: 平台表、租户会话与 RLS
|
||||
|
||||
#### Goal
|
||||
|
||||
在 PostgreSQL 建立审计事件和运行记录,应用角色被强制 RLS 限制在服务端租户内。
|
||||
|
||||
#### Allowed Modification Scope
|
||||
|
||||
- `services/watchman/migrations/`
|
||||
- 数据库会话和租户上下文
|
||||
- 审计、运行记录的最小写入服务
|
||||
- RLS 与幂等测试
|
||||
- 开发 Compose 中仅数据库服务的部分可以在本切片先写出,完整应用服务留到 S7
|
||||
|
||||
#### Forbidden Scope
|
||||
|
||||
- 报警、查询、场景等业务表。
|
||||
- 从请求体、查询串或请求头读取租户。
|
||||
- 用超级用户作为应用连接。
|
||||
- 修改已经写好的迁移文件;纠正用新迁移。
|
||||
|
||||
#### Execution
|
||||
|
||||
- Mode: sequential
|
||||
- Depends On: S2、S3
|
||||
- Can Run With: 无
|
||||
- Must Not Run With: S5–S7
|
||||
- Fallback Order: 4
|
||||
- Shared Files: 迁移目录、数据库会话
|
||||
- Merge Owner: 主 Agent
|
||||
- Conflict Risk: high
|
||||
- Gate Class: high-risk
|
||||
- Risk Score: 5
|
||||
- Gate Reasons: schema, security, rls
|
||||
- Validation Level: slice
|
||||
- Recommended Agent Strategy: 独立实现与不同系列审查。本切片结束必须停,即使用户选择了 autonomous。
|
||||
|
||||
#### Steps
|
||||
|
||||
1. Compose 只启动 PostgreSQL,发布在 `127.0.0.1:54329`。创建迁移角色和应用角色。应用角色不是超级用户,也不是表所有者。
|
||||
2. 迁移创建审计事件和运行记录。两表都有服务端写入的租户列和幂等键唯一约束。
|
||||
3. 启用并强制 RLS。策略比较租户列和 `current_setting('app.tenant_id', true)`。
|
||||
4. 每个应用事务在本地设置 `app.tenant_id`,值只来自服务端配置。
|
||||
5. 写接口要求 `x-idempotency-key`。重复键返回第一次的结果,不插入第二行。
|
||||
6. 测试覆盖:未设置租户不可读不可写;其他租户不可见;正确租户可读写;重复键不新增。
|
||||
|
||||
#### Validation
|
||||
|
||||
- 启动开发 Postgres 后执行迁移。
|
||||
- `uv run pytest services/watchman/tests/test_rls.py services/watchman/tests/test_idempotency.py`
|
||||
- 用应用角色手工查询确认没有租户设置时结果为空。
|
||||
|
||||
#### Done Criteria
|
||||
|
||||
- 空库迁移成功。
|
||||
- RLS 正反用例通过。
|
||||
- 健康检查仍然不访问这两张表。
|
||||
|
||||
#### Rollback Notes
|
||||
|
||||
停掉开发库卷并删除本切片迁移文件。若迁移已被共享环境应用,只能再写一条逆向迁移,不改原文件。
|
||||
|
||||
### Slice 5: 队列进程
|
||||
|
||||
#### Goal
|
||||
|
||||
API 之外的 worker 能连接 RabbitMQ,并注册一个不写业务事实的探测任务。
|
||||
|
||||
#### Allowed Modification Scope
|
||||
|
||||
- 同一 `services/watchman` 包内的 Celery 入口
|
||||
- Compose 中的 RabbitMQ 服务,只绑定 `127.0.0.1:56729` 和 `127.0.0.1:15679`
|
||||
- worker 启动测试
|
||||
|
||||
#### Forbidden Scope
|
||||
|
||||
- Redis result backend。
|
||||
- 业务周期任务、报警计数、真实外发。
|
||||
- 第二个调度框架。
|
||||
|
||||
#### Execution
|
||||
|
||||
- Mode: sequential
|
||||
- Depends On: S2、S4
|
||||
- Can Run With: 无
|
||||
- Must Not Run With: S6、S7
|
||||
- Fallback Order: 5
|
||||
- Shared Files: Python 包、Compose
|
||||
- Merge Owner: 主 Agent
|
||||
- Conflict Risk: medium
|
||||
- Gate Class: standard
|
||||
- Risk Score: 3
|
||||
- Gate Reasons: new-infrastructure
|
||||
- Validation Level: slice
|
||||
- Recommended Agent Strategy: 编码模型实现
|
||||
|
||||
#### Steps
|
||||
|
||||
1. Celery broker 指向开发 RabbitMQ。不配置 Redis。
|
||||
2. 注册一个探测任务,返回静态状态,不写审计表,不增加任何业务次数。
|
||||
3. beat 进程可以启动,但 M01 不注册业务日程。
|
||||
|
||||
#### Validation
|
||||
|
||||
- RabbitMQ 容器健康。
|
||||
- worker 进程启动后能列出探测任务。
|
||||
- 执行一次探测任务,确认审计表行数不变。
|
||||
|
||||
#### Done Criteria
|
||||
|
||||
- 三个进程入口都存在,仍然是同一个包。
|
||||
- 探测任务没有业务副作用。
|
||||
|
||||
#### Rollback Notes
|
||||
|
||||
停止 RabbitMQ 容器并移除 Celery 入口。不删除 S4 的表。
|
||||
|
||||
### Slice 6: 管理台薄壳
|
||||
|
||||
#### Goal
|
||||
|
||||
本机控制台显示健康检查的加载、成功和失败。四语言目录齐全。不引入后台框架。
|
||||
|
||||
#### Allowed Modification Scope
|
||||
|
||||
- `web/apps/console`
|
||||
- `web/packages/api` 的唯一 JSON 客户端
|
||||
- `web/design/tokens.css` 的最小令牌
|
||||
- `web/packages/ui-components` 保持空包或只放说明,不放 ProTable
|
||||
|
||||
#### Forbidden Scope
|
||||
|
||||
- vben5、业务菜单、列表页、第二套组件库。
|
||||
- 页面内直接 `fetch`。
|
||||
- 全局 `app.use(ElementPlus)`。
|
||||
|
||||
#### Execution
|
||||
|
||||
- Mode: sequential
|
||||
- Depends On: S3
|
||||
- Can Run With: 无
|
||||
- Must Not Run With: S7
|
||||
- Fallback Order: 6
|
||||
- Shared Files: `web/`
|
||||
- Merge Owner: 主 Agent
|
||||
- Conflict Risk: medium
|
||||
- Gate Class: standard
|
||||
- Risk Score: 2
|
||||
- Gate Reasons: none
|
||||
- Validation Level: slice
|
||||
- Recommended Agent Strategy: 编码模型实现,并用浏览器核对健康三态
|
||||
|
||||
#### Steps
|
||||
|
||||
1. 唯一客户端解析信封,失败抛带 `code`、`requestId` 的错误对象。
|
||||
2. App 根注入一次 Element Plus 语言。页面按需引入用到的组件。
|
||||
3. 建立 `locales/zh-CN`、`zh-TW`、`en`、`th`。健康文案四份都写上。
|
||||
4. 页面请求 `/health`,分别呈现加载、成功和失败。
|
||||
5. 开发服务器只绑 `127.0.0.1:5173`。
|
||||
|
||||
#### Validation
|
||||
|
||||
- `pnpm --filter console exec vue-tsc --noEmit`
|
||||
- 浏览器打开本机控制台:API 可用时看到成功;API 停掉时看到失败;请求未完成时看到加载。
|
||||
- 抽查一种非默认语言,健康文案不是硬编码中文。
|
||||
|
||||
#### Done Criteria
|
||||
|
||||
- 三态都实际看过,不只看截图。
|
||||
- 四语言目录和 `errors.json` 骨架存在。
|
||||
|
||||
#### Rollback Notes
|
||||
|
||||
恢复 `web/apps/console` 到 S1 的空应用,保留工作区结构。
|
||||
|
||||
### Slice 7: 开发手册与总验
|
||||
|
||||
#### Goal
|
||||
|
||||
把 API、worker、beat、前端和两个基础设施服务收成一条开发手册,并跑本模块测试。
|
||||
|
||||
#### Allowed Modification Scope
|
||||
|
||||
- `deploy/compose.dev.yml`
|
||||
- `docs/runbook.md`
|
||||
- 根 README 里指向手册的短节
|
||||
- `docs/tasks/M01.md` 的证据栏
|
||||
- `docs/progress.md`
|
||||
|
||||
#### Forbidden Scope
|
||||
|
||||
- 生产 Compose、域名 443 配置、业务服务。
|
||||
- 把 `0.0.0.0` 写进 Compose。
|
||||
|
||||
#### Execution
|
||||
|
||||
- Mode: sequential
|
||||
- Depends On: S5、S6
|
||||
- Can Run With: 无
|
||||
- Must Not Run With: 无
|
||||
- Fallback Order: 7
|
||||
- Shared Files: `deploy/`、文档
|
||||
- Merge Owner: 主 Agent
|
||||
- Conflict Risk: medium
|
||||
- Gate Class: standard
|
||||
- Risk Score: 3
|
||||
- Gate Reasons: dev-runtime
|
||||
- Validation Level: final
|
||||
- Recommended Agent Strategy: 主 Agent 汇总证据;测试由独立执行完成
|
||||
|
||||
#### Steps
|
||||
|
||||
1. Compose 包含 Postgres、RabbitMQ、API、worker、beat。端口只发布到 127.0.0.1,并在文件头标明仅开发。
|
||||
2. 手册写明启动、迁移、测试和停止命令。
|
||||
3. 跑后端测试、前端类型检查,并按 S6 再看一次健康三态。
|
||||
|
||||
#### Validation
|
||||
|
||||
- `docker compose -f deploy/compose.dev.yml config`
|
||||
- 手册中的测试命令实际执行并记录退出码。
|
||||
- 容器未启动时记录未运行,不记通过。
|
||||
|
||||
#### Done Criteria
|
||||
|
||||
- 手册命令和实际命令一致。
|
||||
- M01 仍不声称业务模块或真实登录已经完成。
|
||||
|
||||
#### Rollback Notes
|
||||
|
||||
停止 Compose 并删除开发卷。文档可以回退到本切片之前。
|
||||
|
||||
## Parallel Slice Groups
|
||||
|
||||
没有并行组。
|
||||
|
||||
## Final Validation
|
||||
|
||||
- 信封测试、RLS 测试、幂等测试、worker 探测测试通过。
|
||||
- `vue-tsc` 通过。
|
||||
- 浏览器确认健康三态。
|
||||
- `docker compose config` 通过,发布地址都是 127.0.0.1。
|
||||
|
||||
## Documentation Update Requirement
|
||||
|
||||
- 已在分析阶段记录 D12–D15。
|
||||
- S1 记录实际锁定的版本,替换 O09 里本模块已经核实的部分。
|
||||
- S7 更新 `docs/runbook.md`、`docs/progress.md` 和 `docs/tasks/M01.md`。
|
||||
- 不把实现文件清单写进架构文档。
|
||||
|
||||
## Risks
|
||||
|
||||
- S4 是高风险切片。autonomous 不能越过它。
|
||||
- 版本号要在 S1 查官方资料后锁定。计划里故意不预写。
|
||||
- 分页协议和 vben5 仍延后。
|
||||
- O08 的模型授权仍未确认。编码开始前要记下实际子 Agent 模型;不能把未执行的审查写成通过。
|
||||
@@ -0,0 +1,43 @@
|
||||
# Task Intake Result
|
||||
|
||||
## Task Type
|
||||
|
||||
feature. Watchman M01,搭建基础框架和开发环境。Tier M:一个已有任务边界的模块,含 API、壳层 UI 和本模块迁移。不是跨模块权限模型或真实外发。
|
||||
|
||||
## Current Understanding
|
||||
|
||||
用户要求先规划、不编码。范围以 `docs/tasks/INDEX.md` 的 M01 为准:后端/前端骨架、平台库迁移、任务队列与测试环境、错误/审计/运行记录基础和契约。不实现登录、业务模块或真实外发。
|
||||
|
||||
已确认技术方向见 `docs/decisions.md` D01:FastAPI、SQLAlchemy/Alembic、PostgreSQL、Celery/RabbitMQ、Vue 3/TS/Vite/Element Plus、Pinia/Router、pytest/Playwright、Docker Compose。不建微服务,不引入 Redis 作为任务结果库。
|
||||
|
||||
`D:\PROJECT\syops` 是 Flask + 自建 worker + Redis 的既有项目,Python 3.12,字符串错误码 `DOMAIN.SUBTYPE`,前端为 Vue 3.5、Element Plus、Pinia、vue-i18n、Tailwind 3。可借鉴环境文件分层、请求号和分层异常,不能把 Flask 应用或业务模块搬过来。公司现行信封已改为数值错误码。
|
||||
|
||||
## Gate Policy
|
||||
|
||||
- config/default: autonomous
|
||||
- allowTaskOverride: true
|
||||
- recommended: strict
|
||||
- selected: autonomous
|
||||
- reason or override reason: 用户于 2026-11-17 明确选择 autonomous。建议 strict 仍只作参考。
|
||||
- effective: autonomous
|
||||
- finalApprovalRequired: true
|
||||
|
||||
## Blocking Questions
|
||||
|
||||
无。2026-11-17 用户已选:autonomous、公司目录、薄壳、M01 实施 RLS、Compose 只绑本机。
|
||||
|
||||
## Non-blocking Assumptions
|
||||
|
||||
- 错误码按 `standards://api/api-envelope?version=1.1.0` 使用 40000/41000/42000/43000/50000。不沿用 syops 字符串码。`error-handling?version=1.1.1` 里残留的 `SYSTEM.INTERNAL_ERROR` 与信封冲突,内部错误拟用 50000。
|
||||
- 四语言目录按 `frontend-stack?version=2.1.0` 建齐。M01 不交付业务列表,因此不锁定「cursor 分页」和 Element Plus 页码分页的冲突。
|
||||
- 按钮图标按 `element-plus?version=1.0.2` 使用 `@element-plus/icons-vue`。
|
||||
- 密钥只进 env。样例不含真实值。迁移只新增。
|
||||
- 正式 Casdoor、业务表和真实发送不在 M01。
|
||||
|
||||
## Recommended Next Step
|
||||
|
||||
用户回答阻塞问题后,写 M01 实现切片。编码仍须单独确认。
|
||||
|
||||
## Suggested Prompt For Next Step
|
||||
|
||||
按已选门禁和目录,为 M01 写 implementation slices。只覆盖骨架、契约、迁移、队列和壳层。
|
||||
@@ -0,0 +1,147 @@
|
||||
# M01 基础框架 Requirement
|
||||
|
||||
## Goal
|
||||
|
||||
在隔离的本机开发环境里跑起 Watchman 的模块化单体骨架:统一 API 信封、平台库迁移、租户行级隔离、任务队列进程、空的管理台壳和可重复的测试命令。不交付业务预警功能。
|
||||
|
||||
## Background
|
||||
|
||||
范围来自 `docs/tasks/INDEX.md` 的 M01,技术方向来自 `docs/decisions.md` D01、D04。2026-11-17 用户确认了目录、前端厚度、RLS 和本机 Compose。公司规范以 sy-standards 当时读到的最新版本为准,篇目见 Source Notes。
|
||||
|
||||
`D:\PROJECT\syops` 只作为既有工程参照。它是 Flask、自建 worker 和字符串错误码,不能当作 Watchman 的实现模板。
|
||||
|
||||
## In Scope
|
||||
|
||||
- uv 工作区和 `web/` pnpm 工作区的空工程。
|
||||
- 一个 Python 包同时提供 API、worker、beat 三个进程入口。
|
||||
- FastAPI 健康检查、统一成功/失败信封、请求号、数值错误码。
|
||||
- 环境变量按 `.env.shared`、`.env.dev`、`.env.local` 分层;机密不入库。
|
||||
- PostgreSQL 上的审计事件表和运行记录表,启用并强制 RLS。
|
||||
- 服务端注入租户会话。调用方不能提交 `tenant_id`。
|
||||
- Celery + RabbitMQ 的空队列进程,不承载业务任务。
|
||||
- 管理台薄壳:按页使用 Element Plus、Tailwind、四语言目录、一个能看见健康状态的空布局。
|
||||
- 开发 Compose 只绑定 127.0.0.1。
|
||||
- 依赖锁文件、迁移和测试命令。
|
||||
|
||||
## Out Of Scope
|
||||
|
||||
- Casdoor 真登录、权限点和业务授权。留到 M02。
|
||||
- 数据源、查询、规则、报警、通知、Cron 场景和 AI。
|
||||
- vben5、ProTable、业务列表和业务菜单。
|
||||
- Redis、微服务、把 syops 业务代码拷进本仓库。
|
||||
- 生产部署、对外监听、真实 MES 或企微。
|
||||
- 在 M01 锁定列表分页协议。
|
||||
|
||||
## Current Behavior
|
||||
|
||||
仓库只有文档和 Git 初始化。没有 `backend/`、`frontend/`、依赖安装、数据库或容器。
|
||||
|
||||
## Required Behavior
|
||||
|
||||
- 按开发手册能在本机启动 API、worker 和前端壳。
|
||||
- `GET` 健康检查返回成功信封,不返回连接串、租户标识或堆栈。
|
||||
- 失败响应使用数值错误码。参数问题 40000,认证 41000,权限 42000,服务错误 50000。500 响应不包含堆栈或 SQL。
|
||||
- 每个响应有 `request_id`,并与 `X-Request-Id` 对齐。
|
||||
- 写操作接受 `x-idempotency-key`。同一键重复提交不产生第二条审计或运行记录。
|
||||
- 应用数据库角色不是超级用户,也不是表所有者。未设置租户会话时读不到平台业务行,也不能写入。
|
||||
- 设置了服务端租户后,只能读写该租户的行。
|
||||
- 队列进程能连上本机 RabbitMQ 并注册一个无业务副作用的探测任务。探测任务不得写业务错误次数。
|
||||
- 前端壳能显示健康检查成功、失败和加载。文案来自四语言目录。
|
||||
|
||||
## User Flow
|
||||
|
||||
开发者启动 Compose 和两个进程,打开本机管理台,看到健康状态。没有登录墙,也没有业务功能入口。
|
||||
|
||||
## Business Rules
|
||||
|
||||
- 仍是一个模块化单体。目录采用公司落位,不拆成多个可独立部署的服务。
|
||||
- M01 只有一个由服务端配置的开发租户,没有租户管理功能。
|
||||
- 审计和运行记录是平台基础事实,不是报警、采样或通知。
|
||||
- 重试探测任务不得被记成业务异常。
|
||||
|
||||
## Data Rules
|
||||
|
||||
- M01 只建审计事件和运行记录两类平台表,外加迁移框架自身的表。
|
||||
- 平台表含服务端写入的租户列,并对应用角色启用强制 RLS。
|
||||
- 时间用 ISO 8601 UTC。
|
||||
- 迁移只新增,不修改已经合入的迁移文件。
|
||||
|
||||
## API Contract
|
||||
|
||||
- 线格式以 `standards://api/api-envelope?version=1.1.0` 为准:`success`、`data` 与 `error` 互斥,带 `request_id`。
|
||||
- `error.code` 使用 40000、41000、42000、43000、50000 段位。M01 不实现配额 43000 的业务。
|
||||
- 不采用 syops 的 `DOMAIN.SUBTYPE` 字符串码。
|
||||
- `error-handling?version=1.1.1` 示例里的 `SYSTEM.INTERNAL_ERROR` 与信封冲突。内部错误对外使用 50000。
|
||||
- 列表分页协议不在本需求冻结。信封要求 cursor,Element Plus 规范要求页码,留到第一个列表模块再决定。
|
||||
|
||||
## UI Requirements
|
||||
|
||||
- 一个空管理台,按页引入 Element Plus,不全局注册。
|
||||
- 四语言目录一次建齐:`zh-CN`、`zh-TW`、`en`、`th`。缺翻译回退 `zh-CN`。
|
||||
- 健康状态有加载、成功、失败。
|
||||
- 不引入 vben5,不做列表页骨架。
|
||||
|
||||
## Compatibility Requirements
|
||||
|
||||
- 前端落在 `web/`,后端落在 uv 工作区的一个服务包内,进程入口分开。
|
||||
- 开发数据库和队列只监听 127.0.0.1。具体端口写在实现计划,并标明只用于开发。
|
||||
- 新增第三方依赖先看许可证和维护状态。AGPL 不进入核心。
|
||||
|
||||
## Error Handling
|
||||
|
||||
- 路由不手写错误 JSON。服务层抛语义异常,全局处理成失败信封。
|
||||
- 前端只有一个 JSON 客户端。页面不直接 `fetch`。
|
||||
- M01 不登记信封例外出口。
|
||||
|
||||
## Permissions And Security
|
||||
|
||||
- 不读取、不提交真实密钥。样例值使用占位符。
|
||||
- 调用方不能伪造租户。
|
||||
- 健康检查不泄漏基础设施细节。
|
||||
- 内部端口不对 `0.0.0.0` 发布。
|
||||
|
||||
## Assumptions
|
||||
|
||||
- Python 以 3.12 为候选,具体次版本和库版本在实现时按官方兼容情况锁定,不在本需求里预写版本号。
|
||||
- 本机有 Docker,并能拉取 PostgreSQL 和 RabbitMQ 镜像。
|
||||
- 开发租户标识放在不提交的 env 文件。
|
||||
|
||||
## Risks
|
||||
|
||||
- RLS 配错会造成要么全表可见,要么应用完全不可写。
|
||||
- 公司落位规范里的目录例子来自多包平台,直接拆成多个服务会违反 D04。
|
||||
- 信封 cursor 分页和 Element Plus 页码分页尚未裁决。
|
||||
- 公司规范服务当前不在 Cursor 的 MCP 命名空间里,本次是经项目配置的 HTTP 端点读取的。
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- 新环境按手册启动后,健康检查返回成功信封且不含机密。
|
||||
- 依赖有锁文件。
|
||||
- 迁移可以向前应用到空库。回滚方式是新增迁移,不改已应用文件。
|
||||
- RLS 有正反测试:正确租户可见,未设置租户和其他租户不可见。
|
||||
- 同一幂等键不产生重复审计或运行记录。
|
||||
- worker 进程可以启动并发现探测任务。
|
||||
- 前端壳在成功、失败、加载三种状态下行为正确,四语言目录存在。
|
||||
- 测试命令真实执行。容器或工具缺失时标未运行,不写成通过。
|
||||
|
||||
## Deferred Questions
|
||||
|
||||
- 第一个业务列表用 cursor 还是页码。
|
||||
- vben5 在哪个后续模块引入。
|
||||
- Casdoor 的 issuer、audience 和权限点。属于 M02 和 O10。
|
||||
- O01 到 O07 的业务口径。不阻塞 M01。
|
||||
|
||||
## Source Notes
|
||||
|
||||
- 用户 2026-11-17:门禁选 autonomous;目录选公司落位;前端选薄壳;RLS 在 M01 实施;Compose 只绑本机。
|
||||
- `docs/tasks/INDEX.md` M01。
|
||||
- `docs/decisions.md` D01、D04。
|
||||
- `standards://api/api-envelope?version=1.1.0`
|
||||
- `standards://api/error-handling?version=1.1.1`
|
||||
- `standards://frontend/frontend-stack?version=2.1.0`
|
||||
- `standards://frontend/element-plus?version=1.0.2`
|
||||
- `standards://engineering/code-layout?version=1.0.1`
|
||||
- `standards://engineering/code-comments?version=1.1.1`
|
||||
- `standards://security/red-line?version=1.1.0`
|
||||
- `standards://security/env-secrets?version=1.1.1`
|
||||
- `standards://workflow/git-commit?version=1.1.0`
|
||||
@@ -0,0 +1,60 @@
|
||||
# Critic Review — M01 验收预期审计
|
||||
|
||||
模式:acceptance-expectation audit(非 pre-done 收口)。marionettist-reviewer 为 NOT_RUN,本结论只表示「预期是否达成、能否进入 review」,不授权 DONE_LOCAL,不代表 reviewPassed。
|
||||
|
||||
## Verdict
|
||||
|
||||
PASS_WITH_WARNINGS
|
||||
|
||||
M01 预期结果:**大部分达成,部分未验证**。可以开始独立 review;在补齐下列验收缺口前不能关闭 M01。
|
||||
|
||||
## 验收条款逐项
|
||||
|
||||
| 验收条款 | 结论 | 依据 |
|
||||
|---|---|---|
|
||||
| 按手册启动后健康检查返回成功信封且不含机密 | 达成(本机已有环境) | runbook 有完整步骤;test_envelope 断言无 traceback、50000。未做「全新环境」复现 |
|
||||
| 依赖有锁文件 | 达成 | `uv.lock`、`web/pnpm-lock.yaml` 存在 |
|
||||
| 迁移可向前应用到空库;回滚靠新增迁移 | 基本达成 | 单一迁移 `20261117_0001`;迁移者角色拥有 schema,应用角色非所有者。空库 upgrade 无独立留证 |
|
||||
| RLS 正反测试 | 部分达成 | 见 F1 |
|
||||
| 同一幂等键不重复记录 | 部分达成 | 见 F2 |
|
||||
| worker 可启动并发现探测任务 | 达成 | 任务注册测试 + 调用方称经 broker 执行且 audit 计数不变 |
|
||||
| 前端三态行为正确、四语言目录存在 | 部分达成 | 见 F3 |
|
||||
| 测试命令真实执行 | 达成(按调用方证据) | pytest 10 passed、typecheck、compose build;本次 critic 未重跑 |
|
||||
|
||||
## 产品/验收缺口(高信号)
|
||||
|
||||
- **F1 S4(high-risk / risk_score 5)RLS 证据不完整。** 已有:未设租户读不到、其他租户读不到、本租户读得到(仅 `audit_events`)。缺:
|
||||
- 未设租户 **不能写入** 的反向测试(需求 Required Behavior 明确要求)。
|
||||
- `run_records` 的 RLS 正反测试(仅靠同一迁移循环推断)。
|
||||
- 应用角色非超级用户/非所有者/NOBYPASSRLS 的显式断言(目前只能从「读不到」间接推出)。
|
||||
按 risk_score 5,S4 的验证证据应达到需求原文,而不是推断。
|
||||
- **F2 幂等只测了审计事件。** `run_records` 走同样代码路径但无测试;且现有测试只比对返回 id,没有断言库内行数为 1。需求写的是「不产生第二条审计或运行记录」。
|
||||
- **F3 前端三态未验证。** `App.vue` 有 loading/success/failure 分支和 i18n 键,但只有 typecheck,没有运行时断言或浏览器截图。这一条是验收条款本身,不只是流程证据。缺翻译回退 `zh-CN` 也未验证。
|
||||
|
||||
## 流程缺口(不影响「预期是否写出来」,但阻止关闭)
|
||||
|
||||
- 独立模块 review 未执行(`reviewPassed: false`,`criticPassed: false`)。
|
||||
- 浏览器三态证据未归档;AGENTS 要求 UI 模块有断言+截图。
|
||||
- `finalApprovalRequired: true`,需用户最终确认。
|
||||
- M01.md「实施委派」仍写 `8 passed`,与证据段 `10 passed` 不一致,需主 Agent 修正。
|
||||
- 无 commit;证据需按 AGENTS §9 用差异摘要或文件哈希绑定候选版本。
|
||||
|
||||
## 次要提示
|
||||
|
||||
- `WATCHMAN_TENANT_ID=dev-tenant` 放在入库的 `.env.shared`。不是密钥,但需求 Assumptions 写的是「放在不提交的 env 文件」。要么移到 `.env.local`,要么在 decisions 记一条偏差。
|
||||
- `.env.dev` 文件不存在。配置代码会加载它,缺失可接受,但 runbook 最好说明它是可选层。
|
||||
- `.env.local` 已被 `.env.*` 忽略且未被跟踪,符合要求。
|
||||
- Compose 宿主端口均绑 127.0.0.1;容器内 `API_HOST: 0.0.0.0` 只在容器网络内,可接受。
|
||||
|
||||
## Gate Readiness
|
||||
|
||||
- 可以开始独立 review:是。
|
||||
- review 后可以直接关闭:否。需先补 F1、F2(小型后端测试),补 F3(三态运行时断言或 Playwright+截图),再对受影响部分复审并重跑测试。
|
||||
|
||||
## Recommended Builder Action
|
||||
|
||||
1. 补 RLS 测试:未设租户插入应失败;`run_records` 读写隔离;查询 `pg_roles` 断言应用角色 `rolsuper=false`、`rolbypassrls=false`,且表所有者不是应用角色。
|
||||
2. 补幂等测试:`run_records` 重复键;两张表都断言 `count(*) = 1`。
|
||||
3. 用 Playwright 或组件测试覆盖健康三态(mock 成功、失败、挂起),截图存到 `docs/evidence/` 下非 raw 目录。
|
||||
4. 修正 M01.md 中 8/10 passed 不一致;决定 `WATCHMAN_TENANT_ID` 的存放位置。
|
||||
5. 之后再派独立 review(不同模型系列),通过后跑正式测试,再请求最终确认。
|
||||
@@ -0,0 +1,140 @@
|
||||
# Reviewer Review — M01 修复复审
|
||||
|
||||
模式:fuller two-stage review(沿用 S4 `gateClass: high-risk` / `risk_score: 5`)。
|
||||
范围:仅复审 `.task/2026-11-17/m01-foundation/reviews/reviewer-m01.md` 的必处理项与已实现的建议项。不重审已通过切片的基线设计。
|
||||
审查者不改产品代码,不授权 DONE_LOCAL。
|
||||
|
||||
## Recommendation
|
||||
|
||||
**PASS_WITH_WARNINGS**(复审当时)→ W1 已在复审后立刻收口
|
||||
|
||||
六条必处理项均已关闭。复审当时的非阻断残留 W1(`/openapi.json` 在 prod 仍 200)已在同会话补上:`openapi_url=None` + 测试断言 404。
|
||||
|
||||
可以进入用户最终确认(finalApproval)。本报告不将 M01 标为 DONE_LOCAL。
|
||||
|
||||
---
|
||||
|
||||
## 必处理项
|
||||
|
||||
| # | 原项 | 结论 |
|
||||
|---|---|---|
|
||||
| 1 | 重写配置分层测试 | **关闭** |
|
||||
| 2 | Playwright 三态证据 | **关闭** |
|
||||
| 3 | 启动期 `ensure_runtime_config` / `missing_required_keys` | **关闭** |
|
||||
| 4 | `ENV_NAME` 收口 `/_probe` 与 `/docs` | **关闭**(见残留 W1) |
|
||||
| 5 | 幂等 `IntegrityError` / 冲突回读 | **关闭** |
|
||||
| 6 | 回滚 `gatePolicy` / `tier-policy` 漂移 | **关闭** |
|
||||
|
||||
无仍开放的必处理项。
|
||||
|
||||
### 1. 配置分层
|
||||
|
||||
`services/watchman/tests/test_config_layering.py` 用 `tmp_path` 写入三份 env 文件。`.env.local` 的 `API_PORT=8002` / `WATCHMAN_TENANT_ID=local-tenant` 覆盖 dev 与 shared;进程环境 `API_PORT=9000` 覆盖文件。`CHANGE-ME` 与空值进入缺失列表。`ensure_runtime_config` 以 `SystemExit` 退出,消息含键名,不含 `CHANGE-ME` 或 `password`。
|
||||
|
||||
`merge_layered_env`(`core/config.py`)只返回 dict,不再写入 `os.environ`。加载顺序是 `.env.shared` → `.env.dev` → `.env.local`,然后进程环境覆盖。
|
||||
|
||||
残留:现有断言只锁住「local 为最高文件层」和「进程环境最高」。若有人把 `.env.dev` 与 `.env.shared` 对调、同时保持 `.env.local` 最后,该测试仍会通过。实现顺序是对的,不构成未关闭项。
|
||||
|
||||
### 2. Playwright 三态
|
||||
|
||||
`web/apps/console/e2e/health.spec.ts` 有 loading→success、failure(含 `50000`)、`?lang=en` 三条用例,截图写入 `docs/evidence/M01/ui/`。本审查查看了四张图,与证据描述一致:
|
||||
|
||||
- `health-loading.png`:卡片内「健康检查加载中」
|
||||
- `health-success.png`:绿色「健康检查成功」与「服务可用: watchman 0.1.0」
|
||||
- `health-failure.png`:红色告警「服务不可用: 50000: Internal server error」
|
||||
- `health-success-en.png`:「Health check succeeded」与「Service available: watchman 0.1.0」,无硬编码中文
|
||||
|
||||
用例通过 `page.route` 桩掉 `/health`,用来稳定拍出三态。这是 UI 证据,不是对活后端的联调。本审查未重跑 e2e,避免改写这些截图。
|
||||
|
||||
### 3. 启动缺键
|
||||
|
||||
`__main__.py` 在 api/worker/beat 分支之前调用 `ensure_runtime_config()`。`create_app()` 默认同样调用。必填键为 `DATABASE_URL`、`DATABASE_MIGRATOR_URL`、`WATCHMAN_TENANT_ID`;空串与含 `CHANGE-ME` 的值都算缺失。退出文本只拼接键名。
|
||||
|
||||
Compose 的 api/worker/beat 命令是 `python -m watchman`,走这条入口。
|
||||
|
||||
### 4. ENV_NAME
|
||||
|
||||
`is_non_production` 仅在 `env_name` 为 `dev` 或 `test` 时打开 `docs_url` 与 `/_probe/*`。`test_probe_and_docs_hidden_outside_non_production` 覆盖 prod 下 404。
|
||||
|
||||
本审查另起进程实测 `ENV_NAME=prod` 且 `validate_runtime=False`:
|
||||
|
||||
- `/docs` 404
|
||||
- `/redoc` 404
|
||||
- `/_probe/boom` 404
|
||||
- `/openapi.json` **200**
|
||||
|
||||
`create_app` 只把 `docs_url` 置空,并设置 `redoc_url=None`,没有设置 `openapi_url=None`。见下方 W1。缺省 `env_name` 仍是 `dev`,未设置 `ENV_NAME` 时探针与文档保持开启;`docs/runbook.md` 已写明仅 dev/test 暴露。
|
||||
|
||||
### 5. 幂等
|
||||
|
||||
`create_audit_event` 与 `create_run_record` 在 `begin_nested()` 内 `flush`,捕获 `IntegrityError` 后按 `(tenant_id, idempotency_key)` 回读首次行;回读仍为空则原样抛出。唯一约束 `uq_audit_events_tenant_idem` / `uq_run_records_tenant_idem` 仍在迁移中。
|
||||
|
||||
测试含串行重复、四线程并发同键(`count == 1` 且 id 相同),以及把第一次查询打成未命中以迫使冲突回退。本次 `pytest` 这些用例通过。
|
||||
|
||||
### 6. 门禁漂移
|
||||
|
||||
工作区相对基线提交未修改 `marionettist.config.yaml` 与 `.marionettist/tier-policy.yml`。当前 `gatePolicy.defaultMode` 为 `balanced`。Tier L 为 `workflowHint: full-marionettist`、`gateHint: prefer-strict`。`docs/decisions.md` D17 记录该回滚不作为 M01 交付。D18 与 Compose 行内注释一致:容器内 `API_HOST=0.0.0.0`,宿主发布仍是 `127.0.0.1:8000:8000`。
|
||||
|
||||
`docs/progress.md` 与 `docs/tasks/M01.md` 写的是等待复审/最终确认,没有把 M01 标成 DONE_LOCAL。
|
||||
|
||||
---
|
||||
|
||||
## 建议项(抽查)
|
||||
|
||||
已在代码或证据中对上,不单列缺陷:
|
||||
|
||||
- 调用方 `tenant_id` 反向测试:响应与库行均为服务端租户
|
||||
- Compose `0.0.0.0` 行内标注与 D18
|
||||
- Tailwind v4(`@tailwindcss/vite` + `@import "tailwindcss"`)、`element-theme.css` 令牌映射、`ElConfigProvider` 随 `zh-CN` / `zh-TW` / `en` / `th` 切换
|
||||
- 信封去掉顶层 `timestamp`;41000 / 42000(含 `permission_node`)/ HTTP 503 且 `retryable: true` 有断言;500 路径回写 `X-Request-Id`
|
||||
- `Session.after_begin` 跳过嵌套事务;`test_tenant_rebounds_after_commit` 在同一 session 上两次 `commit()` 后仍能数到两行
|
||||
- 非 JSON 响应抛 `BusinessError`(50000 + 响应头 request id)
|
||||
- `mountApp("en")` 断言英文健康文案;四份 `errors.json` 已并入 i18n
|
||||
- `bootstrap_local_db.py` 说明 `sql.Literal` 密码可能进入 `log_statement=all` 的服务器日志
|
||||
- Dockerfile `USER watchman`(uid 10001),并在 `uv sync` 后 `chown`
|
||||
- RLS fixture 按 `tracked_keys` 删除;未设租户的写入用例预期失败并 `rollback`
|
||||
- `guest:guest` 仅作 Compose 开发缺省,API 服务有 DEV ONLY 注释;Settings 缺省 broker 已改为 `CHANGE-ME`
|
||||
- `docs/evidence/M01/licenses.md` 的 fastapi 0.163.1、SQLAlchemy 2.0.57、Alembic 1.20.1、Celery 5.7.0、Pydantic 2.14.3 与 `uv.lock` 一致
|
||||
|
||||
---
|
||||
|
||||
## Stage 1:边界与合规
|
||||
|
||||
修复留在 M01 基础框架内:配置、启动、信封、RLS 会话、幂等、控制台健康壳、开发 Compose / Dockerfile、证据与 D17/D18。门禁文件已回到基线,没有把 `observed` / `target` 规则写成当前强制行为。
|
||||
|
||||
进度文档没有宣布 DONE_LOCAL。没有新的越权路径:租户仍只来自服务端设置,反向测试锁住了请求体里的 `tenant_id`。
|
||||
|
||||
W1 是收口不完整,不是对必处理项的回退。`/_probe` 与 `/docs` 的要求已经满足。
|
||||
|
||||
## Stage 2:实现质量
|
||||
|
||||
幂等冲突路径有真实数据库测试,不只是串行 check-then-insert。`after_begin` 有 commit 后重绑测试,不是只注册了监听器。信封与生产探针测试和本次抽查一致。
|
||||
|
||||
前端三态截图可读,英文态与中文态分开。Tailwind 布局在截图里生效(留白、浅底、单卡片)。
|
||||
|
||||
---
|
||||
|
||||
## 新发现(非阻断)
|
||||
|
||||
### W1(低)生产态仍提供 `/openapi.json`
|
||||
|
||||
`services/watchman/src/watchman/api/app.py` 在非 dev/test 时关闭 Swagger 与 ReDoc,未关闭 OpenAPI schema。本次实测 `ENV_NAME=prod` 时 `/openapi.json` 返回 200。schema 描述的是已经挂载的 `/health` 与 `/platform`,不额外泄露连接串。后续若要把文档面一并关掉,需同时设置 `openapi_url=None`。不阻塞本次最终确认。
|
||||
|
||||
### W2(低)分层测试没有单独锁住中间层
|
||||
|
||||
见必处理项 1 的残留。代码顺序正确。
|
||||
|
||||
---
|
||||
|
||||
## 本审查执行的验证
|
||||
|
||||
- `uv run pytest services/watchman/tests -q` → **23 passed**(1 条 Starlette/`httpx` 弃用警告)
|
||||
- `web/apps/console`:`pnpm test:unit` → **8 passed**;`pnpm typecheck` → 通过
|
||||
- `ENV_NAME=prod` 路由抽查:`/docs`、`/redoc`、`/_probe/boom` 为 404,`/openapi.json` 为 200
|
||||
- 四张 UI 截图已查看
|
||||
|
||||
未重跑 `pnpm test:e2e`(会重写 `docs/evidence/M01/ui/`)。未构建镜像,未做空库全新 `alembic upgrade`。工作区仍无 commit,证据没有 git 哈希绑定;这是既有状态,用户未授权提交。
|
||||
|
||||
## 最终确认
|
||||
|
||||
M01 修复复审没有剩余阻断项。用户可以做 finalApproval。只有用户确认之后,主 Agent 才能考虑 DONE_LOCAL。本审查不授予该状态。
|
||||
@@ -0,0 +1,215 @@
|
||||
# Reviewer Review — M01 基础框架模块整体独立审查
|
||||
|
||||
模式:fuller two-stage review(含 S4 `gateClass: high-risk` / `risk_score: 5`)。
|
||||
范围:S1–S7 全部已实现切片 + critic F1–F3 补齐。
|
||||
审查者与实现者不同模型系列。本报告不授权 DONE_LOCAL。
|
||||
|
||||
## Recommendation
|
||||
|
||||
**PASS_WITH_WARNINGS**
|
||||
|
||||
未发现阻断级边界违规、租户越权或机密入库。RLS 设计是 fail-closed 的,应用角色约束正确,critic 的 F1–F3 已被实测覆盖。
|
||||
但存在 1 条高信号测试失真(S2-1)和若干规范偏差,关闭 M01 前必须处理「必须修复」清单。
|
||||
|
||||
---
|
||||
|
||||
## Stage 1:边界与合规
|
||||
|
||||
### S1-1(中)S2 的 Done Criteria 未实现:缺配置不会在启动时失败
|
||||
|
||||
计划 S2 Done Criteria:「缺配置时进程失败并给出键名,不打印其他配置值。」
|
||||
|
||||
`services/watchman/src/watchman/core/config.py:86` 的 `missing_required_keys()` 写出来了,但全仓库无任何调用方(`__main__.py`、`api/app.py`、`jobs/celery_app.py` 都没有)。
|
||||
同时 `config.py:58-65` 给 `DATABASE_URL` / `DATABASE_MIGRATOR_URL` 配了含 `CHANGE-ME` 的默认值,所以在 `.env.local` 缺失时进程能正常启动,直到第一次连库才在运行期炸,错误信息来自 psycopg 而不是键名。
|
||||
|
||||
建议:在 `__main__.py` 三个 role 分支前统一调用 `missing_required_keys([...])`,缺键时 `SystemExit` 并只打印键名;补一条测试。
|
||||
|
||||
### S1-2(中)测试专用路由与 `/docs` 无条件注册,`ENV_NAME` 没有被任何代码使用
|
||||
|
||||
`services/watchman/src/watchman/api/app.py:75` 与 `:82` 把 `/_probe/validation-error`、`/_probe/boom` 注册进 `create_app()` 本体,没有任何环境开关。`/_probe/boom` 会稳定产生未捕获异常 + 500 + 错误日志,是可被外部触发的噪声/轻量 DoS 面。
|
||||
`app.py:34` 的 `docs_url="/docs"` 同样无条件开启。
|
||||
`config.py:55` 已经有 `env_name`,但全仓库只在 `settings_as_public_dict()`(本身也无调用方)里出现过一次。
|
||||
|
||||
建议:`if settings.env_name == "dev"` 包住两个 `_probe` 路由与 `docs_url`;让 `ENV_NAME` 成为真正的环境判别位。这是 M01 冻结进程行为的地方,拖到 M02 之后成本更高。
|
||||
|
||||
### S1-3(中)前端对公司规范有三处偏差
|
||||
|
||||
| 偏差 | 位置 | 规范出处 |
|
||||
|---|---|---|
|
||||
| Element Plus locale 写死 `zhCn`,不随 i18n 切换 | `web/apps/console/src/App.vue:34` | `standards://frontend/element-plus?version=1.0.2` §1 明文「禁止写死 `zh-cn`」 |
|
||||
| 未引入 Tailwind CSS v4,布局改用 `<style scoped>` 手写 | `web/apps/console/package.json`、`App.vue:77-90` | `frontend-stack?version=2.1.0` 裁定 Tailwind v4 为唯一原子样式层;D13 也点名 Tailwind |
|
||||
| 无 `element-theme.css` 令牌映射,未引暗色变量 | `web/apps/console/src/main.ts:3` 只引了 `element-plus/dist/index.css` | `element-plus` §1「样式引一次」+ §2「变量先行」 |
|
||||
|
||||
第三项的后果是:页面背景走了 `tokens.css`,但 `ElCard`/`ElTag`/`ElAlert` 内部仍是 Element 默认配色与字号,和品牌令牌不一致。
|
||||
注:ProTable / vben5 由 D13 明确延后,不计入偏差;Tailwind 与 locale 同步并未被任何决策延后。
|
||||
|
||||
### S1-4(中)UI 视觉验证未执行,M01 据此不能进 DONE_LOCAL
|
||||
|
||||
`docs/evidence/M01/health-states.md` 自述「未使用 Playwright 截图」,`state.json` S6 的 `gateReasons` 也记了 `browser-evidence-pending`。
|
||||
计划 S6 Validation 要求「浏览器打开本机控制台」看三态,且「抽查一种非默认语言,健康文案不是硬编码中文」;AGENTS §5/§10 要求 UI 模块有断言+截图+视觉检查才能关闭。
|
||||
|
||||
当前只有 vitest 组件级断言。这不是伪造,证据写得诚实,但验收条款本身未满足。
|
||||
|
||||
### S1-5(低)三个文件改动不在本次声明的 allowed scope 内,其中两个放宽了门禁姿态
|
||||
|
||||
- `marionettist.config.yaml`:`gatePolicy.defaultMode` 由 `balanced` 改为 `autonomous`
|
||||
- `.marionettist/tier-policy.yml`:Tier L 的 `workflowHint` 由 `full-marionettist` 降为 `analysis-context`,`gateHint` 由 `prefer-strict` 降为 `default`
|
||||
- `docs/development-plan.md`:2.1 目录草图标注被 D12 取代(内容本身合理且保留了旧稿)
|
||||
|
||||
前两项影响的是后续模块:Tier L 在本仓的定义恰好覆盖「权限模型、生产外发、真实外部系统、部署变更」,也就是 M02 Casdoor 与企微真实发送。`finalApprovalRequired: true` 和 `risk_score >= 4` 的强制停顿仍在,所以不是安全漏洞,但属于需要用户明确点头的流程变更,不应混在 M01 实现里顺带落地。
|
||||
`docs/progress.md` 与 `docs/handoffs/2026-11-17-002.md` 虽不在本次 allowed 列表,但计划 S7 和 AGENTS §7 要求更新,视为合规。
|
||||
|
||||
### S1-6(低)`API_HOST: 0.0.0.0` 写进了 Compose
|
||||
|
||||
`deploy/compose.dev.yml:55`。宿主发布仍是 `127.0.0.1:8000:8000`,容器内绑 `0.0.0.0` 是必要的,critic 也已接受运行时行为。
|
||||
但计划 S7 Forbidden Scope 原文是「不把 `0.0.0.0` 写进 Compose」,红线 #6 要求「dev 演示临时绑 `0.0.0.0` 须显式标注」。文件头只说明了发布端口绑回环,没有就这一行做标注。
|
||||
|
||||
建议:在该行加一句行内注释说明「容器内监听,宿主仅回环发布,不得复用到任何部署配置」,并在 `docs/decisions.md` 补一条偏差记录。
|
||||
|
||||
### S1-7(低)信封多了标准未定义的顶层 `timestamp`
|
||||
|
||||
`services/watchman/src/watchman/core/response.py:24` 与 `:50`。
|
||||
`standards://api/api-envelope?version=1.1.0` 的线格式只有 `success` / `data`|`error` / `request_id`,本篇自称「信封线格式唯一真源」。
|
||||
值本身是合法的 ISO-8601 UTC,不影响消费方;但这是要被后续全部模块继承的契约,建议要么确认公司侧允许扩展字段,要么现在去掉。
|
||||
|
||||
### S1-8(低)依赖许可证预检无留证
|
||||
|
||||
红线 #8 与计划 S1 Step 1 要求新依赖先查许可证(AGPL 不进核心)。
|
||||
实际锁定的版本与 `docs/decisions.md` O09 的记录完全一致(已核对 `uv.lock`:fastapi 0.163.1 / sqlalchemy 2.0.57 / alembic 1.20.1 / celery 5.7.0 / pydantic 2.14.3),版本记录可信;但没有任何文件记录许可证核查结果。实际依赖无 AGPL,补一行证据即可。
|
||||
|
||||
---
|
||||
|
||||
## Stage 2:实现质量
|
||||
|
||||
### S2-1(高)`test_config_layering.py` 并没有测试分层
|
||||
|
||||
`services/watchman/tests/test_config_layering.py`:
|
||||
|
||||
- `assert settings.api_host == "127.0.0.1"` 和 `settings.api_port == 8000` 与 `config.py:56-57` 的代码默认值相同,即使所有 env 文件都删掉也会通过
|
||||
- `assert settings.tenant_id` 同理(默认 `dev-tenant`)
|
||||
- 参数里的 `tmp_path` 根本没用,没有构造任何临时 env 文件
|
||||
- 仓库里 `.env.dev` 不存在,所以「`.env.local` 覆盖 `.env.dev`、`.env.dev` 覆盖 `.env.shared`」这条中间层从未被执行过
|
||||
- 唯一有效断言是 `if .env.local exists: "CHANGE-ME" not in database_url`,依赖本机文件存在,CI 上会静默跳过
|
||||
|
||||
计划 S2 Validation 原文是「测试证明 `.env.local` 覆盖 `.env.dev`,`.env.dev` 覆盖 `.env.shared`」。这条验收目前是假阳性。
|
||||
代码本身(`config.py:29-43`)我逐行读过,优先级顺序是对的,所以这是测试缺陷不是功能缺陷——但它会让后续改动误以为有回归保护。
|
||||
|
||||
建议:用 `tmp_path` 造三份 env 文件、把 `_load_layered_env` 的根目录参数化(它已经接受 `root`),对同一个 key 断言三层覆盖关系。
|
||||
|
||||
### S2-2(中)幂等是 check-then-insert,并发重复键会返回 50000 而不是首次结果
|
||||
|
||||
`services/watchman/src/watchman/services/platform_records.py:40-55`(`run_records` 同构于 `:74-90`):先 `select` 再 `add`,中间没有任何防并发手段。
|
||||
两个并发同键请求都查不到既有行 → 都 insert → 第二个撞 `uq_*_tenant_idem` → `IntegrityError` → 被兜底 handler 转成 50000。全仓库无 `IntegrityError` 捕获,也无 `ON CONFLICT`(已 grep 确认)。
|
||||
|
||||
需求写的是「重复键返回第一次的结果,不插入第二行」。现状只在串行下成立,现有两条幂等测试也都是串行的。
|
||||
幂等键的全部意义就是防重试/防重发(AGENTS §8「任务重试、重复采样、消息重发不得增加业务错误次数」),这个基础设施会被 M02+ 的报警写入直接继承。
|
||||
|
||||
建议:`INSERT ... ON CONFLICT (tenant_id, idempotency_key) DO NOTHING RETURNING`,未返回行时回查;或捕获 `IntegrityError` 后回滚到 savepoint 再回查。
|
||||
|
||||
### S2-3(中)租户设置只在请求开始注入一次,`commit()` 之后即失效
|
||||
|
||||
`core/db.py:71-81` 的 `get_db_session` 在创建 session 后调用一次 `set_tenant`,而 `set_config(..., true)` 是事务局部的。
|
||||
`api/routes/platform.py:52` 在路由里 `session.commit()`,该事务结束后 `app.tenant_id` 就没了。当前每个路由只提交一次,所以行为正确;但任何在 commit 之后继续用同一 session 的后续代码都会进入「无租户」事务,读为空、写被拒。
|
||||
|
||||
是 fail-closed,不是越权,但对 M02+ 是个安静的陷阱。
|
||||
建议:用 SQLAlchemy `event.listens_for(Session, "after_begin")` 在每个事务开始时重新注入,而不是依赖「一个请求只提交一次」这个隐式约定。
|
||||
|
||||
### S2-4(中)`_load_layered_env` 永久污染 `os.environ`
|
||||
|
||||
`core/config.py:38-42`:把文件值 `setdefault` 进 `os.environ`。副作用是 `reload_settings()` 永远拿不到改过的文件值(第二次调用时这些 key 已经在 `os.environ` 里,被当成「进程环境优先」跳过),测试之间也会互相串。
|
||||
`test_config_layering.py:14` 的 `monkeypatch.delenv` 就是在绕这个问题。
|
||||
|
||||
同一函数里 `__import__("os")` 内联了两次(`:40`、`:42`),`missing_required_keys` 里又 `import os`(`:88`)——顶层 import 即可,不符合 `standards://engineering/code-layout`。
|
||||
|
||||
建议:返回合并后的 dict 交给 pydantic-settings 消费,不要写 `os.environ`;至少提供一个显式的 `override=True` 路径给测试。
|
||||
|
||||
### S2-5(中)信封契约被冻结,但一半错误码没有测试
|
||||
|
||||
`core/errors.py` 定义了 40000/41000/42000/50000(503 retryable)五类。测试只覆盖 40000 与 50000。
|
||||
未覆盖的里面有一条是标准硬性要求:`api-envelope` 规定 42000 必须回显 `permission_node`。`response.error_body` 确实只在非 None 时才放这个字段(`response.py:44-45`),逻辑是对的,但没有任何断言锁住它,M02 接权限时很容易被改掉。
|
||||
|
||||
建议:补一组参数化测试,断言 41000 / 42000(含 `permission_node`)/ 503(`retryable: true`)的信封形状。
|
||||
|
||||
### S2-6(中)「调用方不可传租户」是 S4 的核心安全不变量,但没有反向测试
|
||||
|
||||
`api/routes/platform.py:22-30` 的 `AuditCreateRequest` / `RunCreateRequest` 不含 `tenant_id`,Pydantic v2 默认忽略额外字段,所以外部传 `tenant_id` 确实不生效——但这是靠一个默认行为兜住的,一旦有人加了 `model_config = ConfigDict(extra="allow")` 或改成 `**kwargs` 就会破。
|
||||
D14 和需求都把这条列为 M01 必须保证的行为,risk_score 5 的切片应该有显式断言。
|
||||
|
||||
建议:补一条「POST 带 `tenant_id: other-tenant` → 写入仍落在服务端租户」的测试。
|
||||
|
||||
### S2-7(低)500 响应丢失 `X-Request-Id` 响应头
|
||||
|
||||
`RequestIdMiddleware`(`api/app.py:20`)是用户中间件,位于 Starlette `ServerErrorMiddleware` 内层。未捕获异常会穿过它上抛,兜底 handler 返回的 `JSONResponse` 因此拿不到 `response.headers[...]` 回写。
|
||||
body 里的 `request_id` 仍然正确(`request.state` 挂在共享的 scope state 上)。`AppError` 和 `RequestValidationError` 路径不受影响。
|
||||
计划 S3 Step 3 要求「响应头回写同一个值」,这条在 500 路径上不成立。`test_envelope.py:34` 只断言了 body,没断言头,所以没发现。
|
||||
|
||||
### S2-8(低)前端客户端对非 JSON 响应抛裸错误
|
||||
|
||||
`web/packages/api/src/index.ts:60` 直接 `await response.json()`。遇到网关返回的 HTML 502 / 空响应时抛 `SyntaxError`,不是带 `code`/`requestId` 的 `BusinessError`,最终在 `health.ts:36` 以 `String(error)` 形式原样显示给用户。
|
||||
计划 S6 Step 1 要求「失败抛带 `code`、`requestId` 的错误对象」。建议把 `json()` 包进 try,失败时抛 50000 + 头里的 request id(该分支代码已经存在于 `:62-68`,只是够不着)。
|
||||
|
||||
### S2-9(低)「四语言」测试实际断言的是回退中文
|
||||
|
||||
`web/apps/console/src/App.spec.ts:101-110` 这条用例以 `locale="th"` 挂载,但故意不注入 th 文案(`:29` 有注释说明),断言结果是「显示中文」。它证明的是 fallback 机制,不是四语言可用。
|
||||
`mountApp` 里加载了 `en` 却没有任何用例用它。所以计划 S6「抽查一种非默认语言,健康文案不是硬编码中文」这条仍未验证。
|
||||
另外四份 `errors.json` 已建骨架(符合计划),但 `src/i18n.ts` 没有加载它们,目前是悬空文件。
|
||||
|
||||
建议:加一条 `mountApp("en")` 并断言出现英文文案的用例,成本极低。
|
||||
|
||||
### S2-10(低)`bootstrap_local_db.py` 的 SQL 组装前后不一致,密码会进语句文本
|
||||
|
||||
`scripts/bootstrap_local_db.py`:`_upsert_role` 用 `psycopg.sql.Identifier`/`Literal` 正确组装(`:32-39`),但 `main()` 里 `CREATE DATABASE "{db_name}"`(`:75`)和四条 `GRANT ... TO "{user}"`(`:86-92`)是 f-string 拼接。值来自环境变量、风险低,但同一文件两套写法容易被后人照抄错的那套。
|
||||
另外 `sql.Literal(password)` 会把明文密码放进语句文本,本机 Postgres 若开了 `log_statement=all` 就会落盘到服务端日志(红线 #1「密码绝不入…日志」)。本机开发可接受,建议在脚本 docstring 里显式标注这一限制。
|
||||
|
||||
### S2-11(低)死代码与为消除告警而写的占位
|
||||
|
||||
- `config.py:86 missing_required_keys`、`config.py:99 settings_as_public_dict`、`db.py:56 session_scope` 三个函数全仓库无调用方(已 grep)
|
||||
- `api/app.py:88` 的 `_ = success_body` 是为了压 unused import 告警——直接删掉该 import 即可,`app.py` 本身不需要它
|
||||
|
||||
### S2-12(低)镜像以 root 运行;RLS 测试不清理数据
|
||||
|
||||
`deploy/Dockerfile` 没有 `USER` 指令。仅开发镜像,但加一个非 root 用户成本很低。
|
||||
`tests/test_rls.py` 每次运行都往本机 `audit_events` / `run_records` 写入若干行且从不清理,长期会让本机库里积累测试数据,也会让「未设租户读不到」这类基于 `count(*) == 0` 的断言在未来更脆。建议用 fixture 在 teardown 里按 `idempotency_key` 前缀删除。
|
||||
|
||||
### S2-13(低)`guest:guest` 作为默认值写进了入库文件
|
||||
|
||||
`core/config.py:68` 与 `deploy/compose.dev.yml:56/80/102`。是 RabbitMQ 众所周知的开发默认账号,`docs/runbook.md:35` 也已标注「仅开发」,风险实际为零。
|
||||
但红线 #1 的字面要求是密码不进代码与配置样例,建议改成无默认的必填键或占位符,避免这个写法被后续模块照抄到真实 broker 上。
|
||||
|
||||
---
|
||||
|
||||
## 做得对、不需要改的部分
|
||||
|
||||
- RLS 是 fail-closed 的:`current_setting('app.tenant_id', true)` 未设置时返回 NULL,比较结果为 NULL,读写都被拒;`ENABLE` + `FORCE` 都加了,`USING` 和 `WITH CHECK` 都写了,策略限定 `TO watchman_app`
|
||||
- 角色分离正确:migrator 拥有 schema,app 角色 `NOSUPERUSER NOCREATEDB NOCREATEROLE NOBYPASSRLS`,`migrations/env.py` 明确走 migrator URL;`test_rls.py:29` 用 `pg_roles` + `pg_tables` 做了显式断言,不是间接推断
|
||||
- 迁移单一、未被改写,符合红线 #2
|
||||
- `/health` 只返回 `status`/`app`/`version`,不碰数据库、不回显租户或连接串,并有否定断言
|
||||
- 兜底 handler 不泄漏堆栈,`test_envelope.py:41` 直接断言异常文本 `boom` 不出现在响应里
|
||||
- Celery 无 result backend、探测任务无副作用并有计数不变的实测
|
||||
- `.env.local` 未被跟踪,`.gitignore` 的 `!.env.shared` 例外加得准确,`.env.example` 全部是 `CHANGE-ME` 占位
|
||||
- `uv.lock` 实际版本与 O09 记录逐项吻合,没有把未核实的版本写进文档
|
||||
- critic 的 F1–F3 确实补齐了,不是改文档糊弄:未设租户写入失败、`run_records` 正反隔离、`count(*) == 1`、三态运行时断言都能在测试里找到对应代码
|
||||
- 后端 13 条、前端 7 条测试与证据文档记的数量一致(已按文件逐条核对,未重跑)
|
||||
|
||||
---
|
||||
|
||||
## 关闭 M01 前必须处理
|
||||
|
||||
1. S2-1 —— 重写 `test_config_layering.py`,让它真的覆盖三层优先级
|
||||
2. S1-4 —— 补浏览器三态证据(截图存 `docs/evidence/M01/` 非 raw 目录),或由用户明确同意以组件测试代替并记一条决策
|
||||
3. S1-1 —— 启动期必填键校验接上 `missing_required_keys`
|
||||
4. S1-2 —— `_probe` 路由与 `/docs` 按 `ENV_NAME` 收口
|
||||
5. S2-2 —— 幂等改为 `ON CONFLICT` 或捕获 `IntegrityError`(这是会被所有业务模块继承的基础设施)
|
||||
6. S1-5 —— 就 `marionettist.config.yaml` 与 `tier-policy.yml` 的门禁放宽单独向用户确认,不要夹在 M01 里
|
||||
|
||||
## 建议但可以排进 M02
|
||||
|
||||
S1-3(Tailwind / locale 同步 / element-theme.css)、S1-6、S1-7、S2-3、S2-4、S2-5、S2-6、S2-7、S2-8、S2-9、S2-10 ~ S2-13。
|
||||
其中 S2-6(租户不可注入的反向测试)建议尽量不要拖——它是 S4 唯一没有测试锁住的安全不变量。
|
||||
|
||||
## 残余风险
|
||||
|
||||
- S4 是 `risk_score: 5`,但其安全保证目前靠「Pydantic 默认忽略额外字段」这一隐式行为兜底(S2-6),建议即使整体放行也先补这一条
|
||||
- 本次审查未重跑任何测试命令,全部验证状态采信调用方证据;测试文件内容与声称的用例数一致,但执行结果本身未经本审查独立确认
|
||||
- 空库全新 `alembic upgrade head` 没有独立留证(critic 也提过),本机库已存在,首次迁移路径未被重复验证
|
||||
- 没有 commit,证据与候选版本之间缺少 hash 绑定(AGENTS §9)
|
||||
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"taskId": "2026-11-17/m01-foundation",
|
||||
"type": "feature",
|
||||
"phase": "finalization",
|
||||
"status": "in_progress",
|
||||
"allowedToCode": true,
|
||||
"currentSlice": "S7",
|
||||
"gatePolicy": {
|
||||
"configDefault": "autonomous",
|
||||
"allowTaskOverride": true,
|
||||
"recommended": "strict",
|
||||
"selected": "autonomous",
|
||||
"reason": "User selected autonomous. Implementation slices S1-S7 complete; finalApprovalRequired remains true.",
|
||||
"effective": "autonomous",
|
||||
"finalApprovalRequired": true
|
||||
},
|
||||
"slices": [
|
||||
{
|
||||
"id": "S1",
|
||||
"status": "completed",
|
||||
"gateClass": "standard",
|
||||
"risk_score": 3,
|
||||
"gateReasons": ["new-dependencies"]
|
||||
},
|
||||
{
|
||||
"id": "S2",
|
||||
"status": "completed",
|
||||
"gateClass": "standard",
|
||||
"risk_score": 3,
|
||||
"gateReasons": ["secrets-config"]
|
||||
},
|
||||
{
|
||||
"id": "S3",
|
||||
"status": "completed",
|
||||
"gateClass": "standard",
|
||||
"risk_score": 3,
|
||||
"gateReasons": ["public-api-contract"]
|
||||
},
|
||||
{
|
||||
"id": "S4",
|
||||
"status": "completed",
|
||||
"gateClass": "high-risk",
|
||||
"risk_score": 5,
|
||||
"gateReasons": ["schema", "security", "rls", "local-postgres"]
|
||||
},
|
||||
{
|
||||
"id": "S5",
|
||||
"status": "completed",
|
||||
"gateClass": "standard",
|
||||
"risk_score": 3,
|
||||
"gateReasons": ["new-infrastructure"]
|
||||
},
|
||||
{
|
||||
"id": "S6",
|
||||
"status": "completed",
|
||||
"gateClass": "standard",
|
||||
"risk_score": 2,
|
||||
"gateReasons": ["thin-shell-landed", "browser-evidence-pending"]
|
||||
},
|
||||
{
|
||||
"id": "S7",
|
||||
"status": "completed",
|
||||
"gateClass": "standard",
|
||||
"risk_score": 3,
|
||||
"gateReasons": ["dev-runtime"]
|
||||
}
|
||||
],
|
||||
"gates": {
|
||||
"requirementFrozen": true,
|
||||
"planApproved": true,
|
||||
"contextPackReady": true,
|
||||
"criticPassed": false,
|
||||
"implementationDone": true,
|
||||
"reviewPassed": false,
|
||||
"validationPassed": true
|
||||
},
|
||||
"files": {
|
||||
"intake": ".task/2026-11-17/m01-foundation/intake.md",
|
||||
"requirement": ".task/2026-11-17/m01-foundation/requirement.md",
|
||||
"implementationPlan": ".task/2026-11-17/m01-foundation/implementation-plan.md",
|
||||
"contextPack": ".task/2026-11-17/m01-foundation/context-pack.md"
|
||||
},
|
||||
"updatedAt": "2026-11-17T05:20:00Z"
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
# Task Context Pack
|
||||
|
||||
## Task Goal
|
||||
|
||||
M02 用 Casdoor 做身份和三个粗角色。当前只实现 S2:可替换的 Casdoor 端口、服务端会话、密码登录、当前用户和退出。不保护平台写接口,不接收 HXOPS 断言,不做界面。
|
||||
|
||||
## Knowledge Posture
|
||||
|
||||
- Mode: standard
|
||||
- Maturity: L1
|
||||
|
||||
## Current Slice Or Group
|
||||
|
||||
S2 会话与密码登录。用户已确认继续。S1 已复审 PASS。S3 及以后未批准开做。
|
||||
|
||||
## Gate Policy
|
||||
|
||||
- Recommended: strict
|
||||
- Selected: balanced
|
||||
- finalApprovalRequired: true
|
||||
- Policy Notes: S2 是 high-risk、risk_score 4、critic-required。做完必须停,不能续跑 S3。S1 的验签模块保持不动,除非 S2 必须调用它且不改变其拒绝规则。
|
||||
|
||||
## Bugfix Context
|
||||
|
||||
不适用。
|
||||
|
||||
## Requirement Source
|
||||
|
||||
`.task/2026-11-17/m02-auth/requirement.md`
|
||||
|
||||
## Implementation Source
|
||||
|
||||
`.task/2026-11-17/m02-auth/implementation-plan.md` 的 Slice 2
|
||||
|
||||
## Involved Modules Or Areas
|
||||
|
||||
`services/watchman` 内新建 `watchman.auth` 校验模块和对应测试。
|
||||
|
||||
## Loaded Context
|
||||
|
||||
### Global Rules
|
||||
|
||||
AGENTS.md 的安全底线:秘密不入库、不进日志。D19 已确认授权模型。
|
||||
|
||||
### Knowledge Map Matches
|
||||
|
||||
无单独认证知识区。以任务需求和 M01 当前代码为准。
|
||||
|
||||
### Path-Proximity Rules
|
||||
|
||||
`services/watchman` 下没有 `MODULE_RULES.md`。
|
||||
|
||||
### Excluded Context
|
||||
|
||||
未加载 Cron、报警、企微、syops 实现源码。S1 不读 `.env.local`。
|
||||
|
||||
## Loaded Rules
|
||||
|
||||
- `standards://api/api-envelope?version=1.1.0`(本切片不新增 HTTP)
|
||||
- `standards://security/red-line?version=1.1.0`
|
||||
- `standards://engineering/code-comments?version=1.1.1`(实现时检索原文)
|
||||
- D14、D19
|
||||
|
||||
## Loaded Docs
|
||||
|
||||
- M02 requirement 与 implementation plan
|
||||
- `docs/decisions.md` 的 D19、O10
|
||||
|
||||
## Execution Mode
|
||||
|
||||
- Mode: sequential
|
||||
- Current Slice Or Group: S2
|
||||
- Parallel Members: 无
|
||||
- Fallback Order: 2
|
||||
- Shared Files: `app.py`、`config.py`、迁移目录
|
||||
- Merge Owner: 主 Agent
|
||||
- Conflict Resolution Rule: 不并行
|
||||
- Validation Level: slice
|
||||
|
||||
## Execution Chain
|
||||
|
||||
用户确认 S2 → critic → 只实现 S2 → 跑 pytest → 异系列审查 → 停在 S3 之前。
|
||||
|
||||
## Allowed Modification Scope
|
||||
|
||||
- `services/watchman/src/watchman/auth/`
|
||||
- `services/watchman/src/watchman/api/` 的登录路由和注册
|
||||
- `services/watchman/src/watchman/core/config.py`
|
||||
- `services/watchman/src/watchman/models/` 与 `services/watchman/migrations/`,仅限会话表
|
||||
- `services/watchman/tests/` 的登录与会话测试
|
||||
- `.env.example` 已有占位,不要写入真实值
|
||||
|
||||
## Forbidden Modification Scope
|
||||
|
||||
- 前端页面、平台写接口的授权、HXOPS 断言
|
||||
- `D:\PROJECT\syops` 的任何写入
|
||||
- 读取、打印或复制 `.env.local` 里的密钥
|
||||
- 新的直接依赖和 `uv.lock` 改写
|
||||
- 角色表、用户授权表、密码哈希
|
||||
|
||||
## Key Existing Classes Or Entrypoints
|
||||
|
||||
- S1:`watchman.auth.token_verifier.verify_rs256_token`
|
||||
- `UnauthorizedError` 为 41000,`ServiceUnavailableError` 为 503 且 `retryable`
|
||||
- 信封:`watchman.core.response.success_body`
|
||||
- RLS:`migrations/versions/20261117_0001_platform_rls.py`,`set_tenant` 只用服务端 `WATCHMAN_TENANT_ID`
|
||||
- 路由注册在 `watchman.api.app.create_app`
|
||||
|
||||
## Required Behavior
|
||||
|
||||
密码登录通过可注入端口。成功写入会话并保存端口返回的角色,失败 41000。端口未配置或不可用返回 503,且不建立会话。当前用户不返回秘密。退出后同一会话不能再读到当前用户。健康检查仍匿名。租户只来自服务端配置。不保存密码、client secret 和 Casdoor token。
|
||||
|
||||
## Non-goals
|
||||
|
||||
平台写接口收口、对象检查、HXOPS 断言、登录页、真实 Casdoor 网络测试。
|
||||
|
||||
## Implementation Steps
|
||||
|
||||
1. 增加带 RLS 的会话表和迁移,字段只包括身份主体、签发方、显示名、角色快照、角色确认时间、过期时间、服务端租户。
|
||||
2. 登录、当前用户、退出。Casdoor 调用可替换,测试不访问网络。
|
||||
3. 断言响应里没有密码、secret 和 token。
|
||||
|
||||
## Validation Commands
|
||||
|
||||
`uv run pytest services/watchman/tests -q`
|
||||
|
||||
## Assumptions
|
||||
|
||||
- 会话 8 小时。角色快照可以写入,但 5 分钟后的重新确认属于 S3。
|
||||
- 浏览器会话用 HttpOnly cookie。本地 HTTP 开发不强制 Secure。
|
||||
- 真实 Casdoor 客户端可以写,但测试必须注入替身,不能读取 `.env.local`。
|
||||
|
||||
## Risks
|
||||
|
||||
- 迁移一旦执行,回滚要有 down。
|
||||
- 测试若加载本机 `.env.local`,可能误打真实 Casdoor。
|
||||
- S2 结束时平台写接口仍然匿名可写。
|
||||
|
||||
## Stop Conditions
|
||||
|
||||
- critic 判定不能安全开做时停止。
|
||||
- S2 审查完成或需要用户决定时停止。
|
||||
- 不开始 S3。
|
||||
@@ -0,0 +1,398 @@
|
||||
# M02 统一登录与权限 Implementation Plan
|
||||
|
||||
## Requirement Source
|
||||
|
||||
`.task/2026-11-17/m02-auth/requirement.md`
|
||||
|
||||
## Scope Summary
|
||||
|
||||
按已冻结需求接入 Casdoor 身份、三个粗角色和 Watchman 会话,收口 M01 平台写接口,并加上登录壳。不建角色表,不改 syops,不实现业务模块。
|
||||
|
||||
## Involved Modules Or Areas
|
||||
|
||||
Watchman 认证与现有平台 API、管理台薄壳。Casdoor 仅作为外部身份与角色来源。HXOPS 只作为短时断言的签发方,本仓库实现接收端。
|
||||
|
||||
## Loaded Rules
|
||||
|
||||
- 本任务 `gatePolicy.selected=balanced`,`finalApprovalRequired=true`。分析到编码仍须用户确认。
|
||||
- `high-risk`、`boundary-sensitive`、critic 要求、`risk_score >= 4` 的切片完成后必须停。balanced 不能跳过这些停点。
|
||||
- `standards://api/api-envelope?version=1.1.0`
|
||||
- `standards://api/error-handling?version=1.1.1`
|
||||
- `standards://api/permission-nodes?version=1.0.0`
|
||||
- `standards://security/red-line?version=1.1.0`
|
||||
- `standards://frontend/frontend-stack?version=2.1.0`
|
||||
- `standards://frontend/element-plus?version=1.0.1`
|
||||
- Watchman D01、D12、D13、D14、D19。
|
||||
|
||||
## Loaded Docs
|
||||
|
||||
- `.task/2026-11-17/m02-auth/requirement.md`
|
||||
- `docs/tasks/INDEX.md` 的 M02
|
||||
- `docs/decisions.md`
|
||||
- syops 认证说明只作对照
|
||||
|
||||
## Global Forbidden Scope
|
||||
|
||||
- `D:\PROJECT\syops` 的任何写入,包括为了打通入口而改 HXOPS。
|
||||
- 复制 syops `.env.dev` 的密钥、client id 或 audience 进仓库、文档、测试夹具。
|
||||
- 用户表、角色表、授权管理页、密码哈希。
|
||||
- 数据源、查询、规则、报警、通知、场景、AI。
|
||||
- Redis、vben5、把健康检查改成必须登录。
|
||||
- 未确认就新增三枚以外的权限点。
|
||||
|
||||
## Execution Strategy
|
||||
|
||||
- Complexity: complex
|
||||
- Default Execution: sequential
|
||||
- Parallel Execution: not-needed
|
||||
- Fallback Execution: sequential
|
||||
- Merge Owner: 主 Agent
|
||||
- Conflict Resolution Rule: 认证切片按 S1 到 S6 的顺序写同一服务包。不并行。
|
||||
|
||||
selected `balanced` 对 S1–S5 不自动续跑:这些切片是 `high-risk` 或 `boundary-sensitive`,且要求 critic。S6 虽是 `simple`,也要等 S5 的停点结束之后再开始。
|
||||
|
||||
## Slice Dependency Graph
|
||||
|
||||
| Slice | Depends On | Can Run In Parallel With | Fallback Order | Shared Files | Merge Owner | Conflict Risk |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| S1 令牌校验 | 无 | 无 | 1 | 无 | 主 Agent | low |
|
||||
| S2 会话与密码登录 | S1 | 无 | 2 | `app.py`、`config.py` | 主 Agent | high |
|
||||
| S3 角色收口 | S2 | 无 | 3 | 平台路由 | 主 Agent | high |
|
||||
| S4 HXOPS 断言 | S2、S3 | 无 | 4 | `app.py`、会话 | 主 Agent | high |
|
||||
| S5 登录壳 | S4 | 无 | 5 | 前端 API 客户端 | 主 Agent | medium |
|
||||
| S6 文档与示例配置 | S5 | 无 | 6 | 任务卡、runbook、`.env.example` | 主 Agent | low |
|
||||
|
||||
## Implementation Slices
|
||||
|
||||
### Slice 1: 令牌校验
|
||||
|
||||
#### Goal
|
||||
|
||||
本地密钥下拒绝坏签名、错误 issuer、错误 audience 和过期令牌。这一步不发 HTTP 登录,不访问真实 Casdoor。
|
||||
|
||||
#### Allowed Modification Scope
|
||||
|
||||
- `services/watchman/src/watchman/auth/` 中的校验模块
|
||||
- `services/watchman/tests/` 中对应该校验的测试
|
||||
|
||||
#### Forbidden Scope
|
||||
|
||||
- 路由、迁移、前端、`.env.local`、syops
|
||||
|
||||
#### Execution
|
||||
|
||||
- Mode: sequential
|
||||
- Depends On: 无
|
||||
- Can Run With: 无
|
||||
- Must Not Run With: S2–S6
|
||||
- Fallback Order: 1
|
||||
- Shared Files: 无
|
||||
- Merge Owner: 主 Agent
|
||||
- Conflict Risk: low
|
||||
- Gate Class: high-risk
|
||||
- Risk Score: 4
|
||||
- Gate Reasons: security-logic, critic-required
|
||||
- Validation Level: slice
|
||||
- Recommended Agent Strategy: 实现用编码模型;本切片审查用另一系列,并先读冻结需求
|
||||
|
||||
#### Steps
|
||||
|
||||
1. 实现只接受已验签声明的校验:issuer、audience、有效期、签名。
|
||||
2. 用测试生成的密钥覆盖四类失败和一类成功。
|
||||
3. 确认失败结果不能被当成已登录。
|
||||
|
||||
#### Validation
|
||||
|
||||
`uv run pytest services/watchman/tests -q`
|
||||
|
||||
#### Done Criteria
|
||||
|
||||
验收标准 1 在单元测试中有对应断言。仓库里没有真实密钥。
|
||||
|
||||
#### Rollback Notes
|
||||
|
||||
删除新增的 auth 校验模块和测试即可。无迁移。
|
||||
|
||||
### Slice 2: 会话与密码登录
|
||||
|
||||
#### Goal
|
||||
|
||||
用可替换的 Casdoor 替身完成密码登录、当前用户和退出。会话写入服务端,遵守 RLS。未配置真实应用时登录失败为 503,测试不依赖内网 Casdoor。
|
||||
|
||||
#### Allowed Modification Scope
|
||||
|
||||
- `services/watchman/src/watchman/auth/`
|
||||
- `services/watchman/src/watchman/api/` 的登录路由和注册
|
||||
- `services/watchman/src/watchman/core/config.py`
|
||||
- `services/watchman/src/watchman/models/` 与对应 Alembic 迁移,仅限会话
|
||||
- `services/watchman/tests/` 的登录与会话测试
|
||||
- `.env.example` 只加占位键名,值为空或 CHANGE-ME
|
||||
|
||||
#### Forbidden Scope
|
||||
|
||||
- 前端页面、平台写接口的授权、HXOPS 断言、syops、真实 secret
|
||||
|
||||
#### Execution
|
||||
|
||||
- Mode: sequential
|
||||
- Depends On: S1
|
||||
- Can Run With: 无
|
||||
- Must Not Run With: S3–S6
|
||||
- Fallback Order: 2
|
||||
- Shared Files: `app.py`、`config.py`、迁移目录
|
||||
- Merge Owner: 主 Agent
|
||||
- Conflict Risk: high
|
||||
- Gate Class: high-risk
|
||||
- Risk Score: 4
|
||||
- Gate Reasons: security-logic, schema-change, critic-required
|
||||
- Validation Level: slice
|
||||
- Recommended Agent Strategy: 实现与审查分属不同模型系列
|
||||
|
||||
#### Steps
|
||||
|
||||
1. 增加会话存储。字段限于需求中的数据规则。租户只用服务端配置。
|
||||
2. 密码登录调用可注入的 Casdoor 端口。成功写会话并取回角色;失败 41000;端口不可用或未配置 503。
|
||||
3. 提供当前用户与退出。退出后会话不可再用于后续切片的平台写接口。
|
||||
4. 测试断言响应和日志路径不包含密码、secret、Casdoor token。
|
||||
|
||||
#### Validation
|
||||
|
||||
`uv run pytest services/watchman/tests -q`
|
||||
|
||||
#### Done Criteria
|
||||
|
||||
验收标准 2、8 的会话部分、9 有自动化证据。健康检查仍匿名可用。
|
||||
|
||||
#### Rollback Notes
|
||||
|
||||
回滚本切片迁移,并移除登录路由。不改动 S1 的纯校验测试。
|
||||
|
||||
### Slice 3: 角色收口与对象检查
|
||||
|
||||
#### Goal
|
||||
|
||||
平台写接口改为必须是 `watchman-admin`。进入能力与对象 ID 检查按冻结的三枚权限点拒绝。角色快照过期后,Casdoor 不可用则拒绝。
|
||||
|
||||
#### Allowed Modification Scope
|
||||
|
||||
- `services/watchman/src/watchman/auth/`
|
||||
- `services/watchman/src/watchman/api/routes/platform.py`
|
||||
- `services/watchman/tests/` 中权限与对象检查测试
|
||||
|
||||
#### Forbidden Scope
|
||||
|
||||
- 新的业务表、授权管理接口、前端、syops
|
||||
|
||||
#### Execution
|
||||
|
||||
- Mode: sequential
|
||||
- Depends On: S2
|
||||
- Can Run With: 无
|
||||
- Must Not Run With: S4–S6
|
||||
- Fallback Order: 3
|
||||
- Shared Files: 平台路由、auth 依赖
|
||||
- Merge Owner: 主 Agent
|
||||
- Conflict Risk: high
|
||||
- Gate Class: high-risk
|
||||
- Risk Score: 4
|
||||
- Gate Reasons: security-logic, permission-nodes, critic-required
|
||||
- Validation Level: slice
|
||||
- Recommended Agent Strategy: 实现与审查分属不同模型系列
|
||||
|
||||
#### Steps
|
||||
|
||||
1. 为三个权限点接上角色判断。无角色不升成查看者。
|
||||
2. 平台两个写接口接入 `perm:data:emp:watchman.platform.write`。
|
||||
3. 对象检查对两个合成 ID 在无授权时都返回 42000,权限点为 `perm:data:emp:watchman.object.read`。不新增公开的对象管理 API。
|
||||
4. 角色确认超过 5 分钟且替身失败时,返回 503,不放行。
|
||||
|
||||
#### Validation
|
||||
|
||||
`uv run pytest services/watchman/tests -q`
|
||||
|
||||
#### Done Criteria
|
||||
|
||||
验收标准 3、4 的服务端部分、5、7 通过。41000 的响应里没有 `permission_node`。
|
||||
|
||||
#### Rollback Notes
|
||||
|
||||
恢复平台路由的 M01 行为会重新变成匿名可写。回滚时要连同本切片测试一起撤下,并在进度里写明平台写接口重新失去保护。
|
||||
|
||||
### Slice 4: HXOPS 短时断言
|
||||
|
||||
#### Goal
|
||||
|
||||
接收端校验短时断言,建立与密码登录相同的会话。角色只从 Casdoor 端口读取。
|
||||
|
||||
#### Allowed Modification Scope
|
||||
|
||||
- `services/watchman/src/watchman/auth/`
|
||||
- `services/watchman/src/watchman/api/` 的断言入口
|
||||
- `services/watchman/tests/` 的断言测试
|
||||
|
||||
#### Forbidden Scope
|
||||
|
||||
- 修改 syops、在断言中信任 HXOPS 权限列表、前端以外的业务模块
|
||||
|
||||
#### Execution
|
||||
|
||||
- Mode: sequential
|
||||
- Depends On: S2、S3
|
||||
- Can Run With: 无
|
||||
- Must Not Run With: S5–S6
|
||||
- Fallback Order: 4
|
||||
- Shared Files: `app.py`、会话创建
|
||||
- Merge Owner: 主 Agent
|
||||
- Conflict Risk: high
|
||||
- Gate Class: high-risk
|
||||
- Risk Score: 4
|
||||
- Gate Reasons: security-logic, external-identity, critic-required
|
||||
- Validation Level: slice
|
||||
- Recommended Agent Strategy: 实现与审查分属不同模型系列
|
||||
|
||||
#### Steps
|
||||
|
||||
1. 校验断言的签名、issuer、audience、有效期和 Casdoor 身份引用。
|
||||
2. 缺少该引用,或只用 HXOPS 本地主键冒充时,返回 41000。
|
||||
3. 通过后调用与密码登录相同的角色读取。断言内的权限字段不写入会话。
|
||||
|
||||
#### Validation
|
||||
|
||||
`uv run pytest services/watchman/tests -q`
|
||||
|
||||
#### Done Criteria
|
||||
|
||||
验收标准 6 通过。真实 HXOPS 跳转未配置时,证据里写明未做真实联调。
|
||||
|
||||
#### Rollback Notes
|
||||
|
||||
移除断言路由。密码登录和平台收口保持可用。
|
||||
|
||||
### Slice 5: 登录壳
|
||||
|
||||
#### Goal
|
||||
|
||||
管理台可以登录、看到无权限、会话失效后离开、退出。本地身份模式有可见标识。
|
||||
|
||||
#### Allowed Modification Scope
|
||||
|
||||
- `web/apps/console/`
|
||||
- `web/packages/api/`
|
||||
- 对应的单元测试与 Playwright
|
||||
|
||||
#### Forbidden Scope
|
||||
|
||||
- 后端授权规则、vben5、把真实 secret 写进前端环境
|
||||
|
||||
#### Execution
|
||||
|
||||
- Mode: sequential
|
||||
- Depends On: S4
|
||||
- Can Run With: 无
|
||||
- Must Not Run With: S6
|
||||
- Fallback Order: 5
|
||||
- Shared Files: 前端 API 客户端、路由
|
||||
- Merge Owner: 主 Agent
|
||||
- Conflict Risk: medium
|
||||
- Gate Class: boundary-sensitive
|
||||
- Risk Score: 4
|
||||
- Gate Reasons: auth-ui, session-boundary, critic-required
|
||||
- Validation Level: slice
|
||||
- Recommended Agent Strategy: 实现后用浏览器走登录失败、无权限和退出;审查用另一系列
|
||||
|
||||
#### Steps
|
||||
|
||||
1. 登录页提交到 S2 的接口。失败展示通用文案。
|
||||
2. 按当前用户角色进入壳页或无权限页。
|
||||
3. 退出并确认再访问受保护调用会失败。
|
||||
4. 本地身份模式显示固定标识。
|
||||
5. 为 HXOPS 断言准备提交入口,不把断言写进日志或本地长期存储。
|
||||
|
||||
#### Validation
|
||||
|
||||
- `pnpm test:unit`
|
||||
- `pnpm test:e2e`
|
||||
- 浏览器实际走一遍登录失败、无权限和退出。只看截图不算完成。
|
||||
|
||||
#### Done Criteria
|
||||
|
||||
验收标准 11 有断言和浏览器操作证据。前端包里没有 client secret。
|
||||
|
||||
#### Rollback Notes
|
||||
|
||||
撤下登录页后,后端会话仍在。进度里要写明界面与接口暂时不一致。
|
||||
|
||||
### Slice 6: 文档与示例配置
|
||||
|
||||
#### Goal
|
||||
|
||||
任务卡、运行说明和示例环境变量与已实现行为一致,并写清真实联调尚未完成的条件。
|
||||
|
||||
#### Allowed Modification Scope
|
||||
|
||||
- `docs/tasks/M02.md`
|
||||
- `docs/runbook.md`
|
||||
- `docs/progress.md`
|
||||
- `docs/decisions.md`
|
||||
- `.env.example`
|
||||
|
||||
#### Forbidden Scope
|
||||
|
||||
- 业务代码、真实密钥、把本地测试写成真实 Casdoor 已通过
|
||||
|
||||
#### Execution
|
||||
|
||||
- Mode: sequential
|
||||
- Depends On: S5
|
||||
- Can Run With: 无
|
||||
- Must Not Run With: 无
|
||||
- Fallback Order: 6
|
||||
- Shared Files: 进度和任务卡
|
||||
- Merge Owner: 主 Agent
|
||||
- Conflict Risk: low
|
||||
- Gate Class: simple
|
||||
- Risk Score: 2
|
||||
- Gate Reasons: docs-only
|
||||
- Validation Level: final
|
||||
- Recommended Agent Strategy: 主 Agent 直接改文档,并对照验收标准 12
|
||||
|
||||
#### Steps
|
||||
|
||||
1. 写上 Watchman Application 需要哪些键,值保持占位。
|
||||
2. 写明真实密码登录和真实 HXOPS 跳转的完成条件。
|
||||
3. 更新 M02 任务卡证据。没有命令输出就写未运行。
|
||||
|
||||
#### Validation
|
||||
|
||||
对照需求验收标准逐条看证据路径是否存在。不新跑业务测试,除非文档改动同时改了示例配置的键名。
|
||||
|
||||
#### Done Criteria
|
||||
|
||||
验收标准 12 在进度和任务卡里有明确状态。示例文件没有真实 secret。
|
||||
|
||||
#### Rollback Notes
|
||||
|
||||
文档回退不影响已发布的会话行为。
|
||||
|
||||
## Parallel Slice Groups
|
||||
|
||||
本任务不设并行组。会话、路由注册和权限依赖是同一条链。
|
||||
|
||||
## Final Validation
|
||||
|
||||
- `uv run pytest services/watchman/tests -q`
|
||||
- `pnpm test:unit`
|
||||
- `pnpm test:e2e`
|
||||
- 浏览器走登录失败、无权限、退出
|
||||
- 检查响应与日志样本,确认没有密码和 client secret
|
||||
- 真实 Casdoor 与真实 HXOPS 入口未就绪时保持未完成,不并入上述通过结论
|
||||
|
||||
## Documentation Update Requirement
|
||||
|
||||
S6 更新运行说明和任务卡。不把本计划扩写成新的架构文档。若实现时发现会话规则和冻结需求不一致,先停下来改需求,再改代码。
|
||||
|
||||
## Risks
|
||||
|
||||
- S2 的迁移一旦执行,回滚需要明确的 down 步骤。
|
||||
- S3 之前平台写接口仍匿名可写。不要在 S2 做完时宣称模块已经收口。
|
||||
- S5 的 `risk_score` 为 4,即使界面工作看起来较小,也不能在 S4 通过后自动开做。
|
||||
@@ -0,0 +1,58 @@
|
||||
# Task Intake Result
|
||||
|
||||
## Task Type
|
||||
|
||||
feature。Tier L(认证、授权、会话;安全敏感,critic 建议保留)。
|
||||
|
||||
## Current Understanding
|
||||
|
||||
- 用户要求推进 M02(统一登录与权限),先规划并讨论疑问,不编码。
|
||||
- M01 已 DONE_LOCAL。现有 `/platform/*` 写接口没有登录校验。租户只来自服务端 `WATCHMAN_TENANT_ID`(D14)。
|
||||
- 冻结文档 15.1:接入 Casdoor,不另建正式账号密码体系;后端校验;无权限不能只靠隐藏按钮。无真实配置时只用显著标识的开发身份,不能当作正式验收。
|
||||
- O10 仍是 TECH_PENDING:issuer、client、audience、角色和数据范围映射未提供。
|
||||
- 用户已选:自有登录页 + 后端 password grant,并实现 HXOPS 短时 JWT 接收端。syops 平级服务文档把身份和业务权限分开;HXOPS 角色在本库,不在 Casdoor。
|
||||
- 公司权限点格式为 `perm:{data|app}:{emp|dept}:{action}`(`standards://api/permission-nodes?version=1.0.0`)。禁止在代码里编造未确认编码。M01 测试夹具 `perm:platform:audit.read` 不符合该格式,不能当成正式权限点。
|
||||
|
||||
## Gate Policy
|
||||
|
||||
- config/default: balanced
|
||||
- allowTaskOverride: true
|
||||
- recommended: strict
|
||||
- selected: balanced
|
||||
- reason or override reason: 用户在 2026-11-17 选择 balanced。推荐 strict 仅作建议,不覆盖该选择。
|
||||
- effective: balanced。分析到编码仍须确认。高风险切片、critic、显式停点不受 balanced 取消。
|
||||
- finalApprovalRequired: true
|
||||
|
||||
## Blocking Questions
|
||||
|
||||
已确认:
|
||||
|
||||
1. 门禁:balanced。
|
||||
2. 登录:Watchman 自有登录页,后端 password grant;同时做从 HXOPS 进入的短时 JWT 接收端。
|
||||
3. 用户倾向授权放在 Casdoor,不在 Watchman 再维护一套角色。syops 现状与此不同,见下方,待用户二选一。
|
||||
|
||||
仍待确认:
|
||||
|
||||
1. 授权来源按用户倾向(Casdoor 角色,Watchman 只校验)还是按 HXOPS 现状(本库角色表)。
|
||||
2. Casdoor Application:用户已选新建 Watchman Application。不复用 HXOPS client。密钥只进 `.env.local`。应用未建好前,真实密码登录不能当作通过。
|
||||
|
||||
## 已核对的 syops 事实
|
||||
|
||||
- HXOPS 把用户和密码同步到 Casdoor。角色、功能权限、权限组在 HXOPS 自己的库里,不在 Casdoor。
|
||||
- 平级服务 SSO 文档写明:认证只回答“是谁”;平级服务自己管业务权限;SSO JWT 不携带 HXOPS 权限列表。
|
||||
- `.env.dev` 的 Casdoor 指向内网 `organization_HX`。JWKS 本机可访问(HTTP 200)。回调地址是 HXOPS 前端端口,该 client 属于 HXOPS。密钥不写入本仓库。
|
||||
|
||||
## Non-blocking Assumptions
|
||||
|
||||
- M02 不实现用户管理后台、组织全量同步、企微发送、场景/数据源业务模块。
|
||||
- 对象级越权用合成对象 ID 验证检查器;场景、数据源等表留到对应模块。
|
||||
- 密钥只进 `.env.local`,不进对话、仓库和文档。
|
||||
- 分析到编码仍需用户明确确认。
|
||||
|
||||
## Recommended Next Step
|
||||
|
||||
用户回答阻塞问题后,写 `.task/2026-11-17/m02-auth/requirement.md`,再切片。在此之前不编码。
|
||||
|
||||
## Suggested Prompt For Next Step
|
||||
|
||||
确认门禁、登录方式、授权落点和有无测试应用后,冻结 M02 需求并给出实现切片。
|
||||
@@ -0,0 +1,168 @@
|
||||
# M02 统一登录与权限 Requirement
|
||||
|
||||
## Goal
|
||||
|
||||
Watchman 用 Casdoor 确认“是谁”,用 Casdoor 上的三个粗角色确认“能进到哪一档”。本服务强制校验,不另建账号密码,也不另建角色表或授权管理页。
|
||||
|
||||
## Background
|
||||
|
||||
- M01 已完成。`POST /platform/audit-events` 与 `POST /platform/run-records` 目前没有登录校验。健康检查保持公开。
|
||||
- 租户只来自服务端 `WATCHMAN_TENANT_ID`(D14)。调用方不能传租户。
|
||||
- 用户 2026-11-17 确认:门禁 balanced;自有登录页加后端向 Casdoor 校验密码;同时接收 HXOPS 短时 JWT;授权按 Casdoor 粗角色,不建本库角色;新建 Watchman 自己的 Casdoor Application,不复用 HXOPS client。
|
||||
- syops 的现状不同:HXOPS 把角色存在自己的库里。本需求不照搬该表结构。平级服务文档仍适用的部分是:认证与授权分开,SSO JWT 不携带 HXOPS 权限,退出只清本服务会话。
|
||||
- 公司权限点格式为 `perm:{data|app}:{emp|dept}:{action}`(`standards://api/permission-nodes?version=1.0.0`)。Watchman 此前没有已注册编码。下面三枚是本模块冻结的最小清单。
|
||||
|
||||
## In Scope
|
||||
|
||||
- 用户名和密码在 Watchman 登录页提交。后端用 Watchman Application 向 Casdoor 校验。浏览器不打开 Casdoor 登录页。
|
||||
- 接收 HXOPS 发来的短时身份断言,校验后建立与密码登录相同的 Watchman 会话。
|
||||
- 校验签名、issuer、audience、有效期。未验签的内容不能授权。
|
||||
- 三个 Casdoor 角色:`watchman-admin`、`watchman-operator`、`watchman-viewer`。
|
||||
- 保护现有平台写接口。未登录与无权限分开。
|
||||
- 对象 ID 本身不是授权。提供可复用的对象访问检查,并用两个合成 ID 证明未授权时都拒绝。
|
||||
- 登录、失败、过期、无权限、退出的界面,以及对应自动化测试。
|
||||
- 配置缺失或真实应用尚未建好时,自动测试用本地签名身份。这种身份必须显著标识,不能当作真实联调通过。
|
||||
|
||||
## Out Of Scope
|
||||
|
||||
- 用户管理、改密、把用户同步到 Casdoor。继续由 HXOPS 负责。
|
||||
- 本服务的角色表、授权管理页、按人编辑功能权限。
|
||||
- 场景、数据源、报警等业务模块,以及“某一行数据属于谁”的正式授权。
|
||||
- 修改 `D:\PROJECT\syops`,或在 HXOPS 里增加 Watchman 入口。
|
||||
- 复用 HXOPS 的 client id、client secret 或 audience。
|
||||
- 浏览器跳转到 Casdoor 授权页作为主登录方式。
|
||||
- 全局退出、退出 Casdoor、退出 HXOPS。
|
||||
- 企微登录按钮、企微通知。
|
||||
- Redis、微服务拆分、vben5。
|
||||
|
||||
## Current Behavior
|
||||
|
||||
- 平台写接口匿名可调用。
|
||||
- 没有登录页、会话或 Casdoor 配置。
|
||||
- 错误信封已能表达 41000 和 42000。42000 在有权限点时回显 `permission_node`。
|
||||
|
||||
## Required Behavior
|
||||
|
||||
- 健康检查仍不要求登录。
|
||||
- 平台写接口:无会话返回 41000;有会话但没有 `watchman-admin` 返回 42000,并带权限点 `perm:data:emp:watchman.platform.write`。
|
||||
- 进入管理台:三个角色之一即可。权限点 `perm:app:emp:watchman.enter`。已登录但没有任何这三个角色时,显示无权限,不显示业务操作。
|
||||
- 对象检查:权限点 `perm:data:emp:watchman.object.read`。调用方未获该对象授权时,两个不同的合成 ID 都拒绝。知道 ID 不能读到数据。M02 不提供按对象授权的维护功能,默认没有对象级授权。
|
||||
- 密码错误、断言无效、签名错误、issuer 或 audience 不符、令牌过期:拒绝,不建立会话。
|
||||
- Casdoor 在需要重新确认角色时不可用:拒绝本次操作,返回可重试的 503。不沿用已经过期的角色缓存。
|
||||
- 登录响应和日志不包含密码、client secret、Casdoor token。
|
||||
- 会话里的租户只等于服务端配置。请求或令牌里的租户值不生效。
|
||||
- 退出只清除 Watchman 会话。
|
||||
|
||||
## User Flow
|
||||
|
||||
1. 用户打开 Watchman 登录页,输入账号和密码。
|
||||
2. 后端向 Casdoor 校验。成功则建立本服务会话,并读回该用户在 Watchman Application 上的角色。
|
||||
3. 有三个角色之一:进入壳页。没有:进入无权限页。
|
||||
4. 从 HXOPS 进入时,HXOPS 交给 Watchman 一个短时断言。Watchman 校验断言后,再按同一身份向 Casdoor 取 Watchman 角色,然后进入与上面相同的会话。
|
||||
5. 会话过期或角色缓存过期且无法重新确认:回到登录或拒绝操作。
|
||||
6. 用户退出:只离开 Watchman。
|
||||
|
||||
## Business Rules
|
||||
|
||||
- Casdoor 是身份来源,也是这三个角色的分配来源。分配在 Casdoor 控制台完成。
|
||||
- Watchman 不解释 HXOPS 的角色和功能权限。断言里即使带了那些权限也忽略。
|
||||
- `watchman-admin` 覆盖处理者和查看者的本模块能力。`watchman-operator` 覆盖查看者的进入能力。本模块里处理者与查看者的差别只保留角色名,供后续模块使用;M02 没有单独的“处理”业务动作。
|
||||
- 无角色不等于查看者。不默认授予 `watchman-viewer`。
|
||||
- 本地签名身份只在非生产、且显式开启的测试或开发模式可用。界面必须看得出这不是正式登录。
|
||||
|
||||
## Data Rules
|
||||
|
||||
- 可以保存会话:身份主体、签发方、显示名、角色快照、角色确认时间、过期时间、服务端租户。
|
||||
- 不保存密码、密码哈希、client secret、Casdoor access token。
|
||||
- 不建角色定义表,不建用户授权表。
|
||||
- 会话上的租户来自服务端配置,并遵守现有 RLS。
|
||||
- 技术默认,不是业务制度:会话 8 小时;角色快照 5 分钟后必须向 Casdoor 重新确认。
|
||||
|
||||
## API Contract
|
||||
|
||||
沿用 M01 信封(`standards://api/api-envelope?version=1.1.0`)。
|
||||
|
||||
- 登录:提交用户名和密码。成功建立会话。失败 41000。Casdoor 未配置或暂时不可达:503,且可重试。
|
||||
- 退出:清除本服务会话。
|
||||
- 当前用户:返回身份和角色名。不返回秘密。
|
||||
- HXOPS 进入:提交短时断言。校验失败 41000。成功后的会话与密码登录相同。
|
||||
- 平台写接口按 Required Behavior 保护。
|
||||
|
||||
断言必须同时满足:签名有效、issuer 与 audience 符合 Watchman 期望的 HXOPS 入口配置、未过期,并且带有 Casdoor 身份引用。HXOPS 自己的本地用户主键不能冒充该身份。
|
||||
|
||||
## UI Requirements
|
||||
|
||||
- 登录页使用现有 Element Plus 薄壳,收集用户名和密码,展示失败原因的通用文案。
|
||||
- 无权限、会话过期、退出后的落点要能区分。
|
||||
- 本地身份模式有可见标识。
|
||||
- 不把 Casdoor 跳转作为主路径。
|
||||
- 界面隐藏按钮不是授权。后端结果为准。
|
||||
|
||||
## Compatibility Requirements
|
||||
|
||||
- 不改变健康检查的匿名访问。
|
||||
- 不改变信封形状。41000 不带 `permission_node`。42000 带上面列出的权限点。
|
||||
- 新的 Casdoor Application 与 HXOPS 共用同一 Casdoor 服务和组织。client 必须分开。
|
||||
- 真实密码登录和真实 HXOPS 跳转,在 Watchman Application 或 HXOPS 入口配置未就绪时记为未通过,不记为失败的产品逻辑。
|
||||
|
||||
## Error Handling
|
||||
|
||||
- 登录失败使用统一文案,不把 Casdoor 原文回给浏览器。
|
||||
- 秘密不进响应、日志和文档。
|
||||
- 角色刷新失败不降级为放行。
|
||||
|
||||
## Permissions And Security
|
||||
|
||||
冻结的权限点:
|
||||
|
||||
| 编码 | 含义 | 谁可以通过 |
|
||||
|---|---|---|
|
||||
| `perm:app:emp:watchman.enter` | 进入管理台 | 三个角色之一 |
|
||||
| `perm:data:emp:watchman.platform.write` | 写平台审计和运行记录 | 仅 `watchman-admin` |
|
||||
| `perm:data:emp:watchman.object.read` | 按对象 ID 读取 | M02 默认无人获得;检查必须拒绝未授权 ID |
|
||||
|
||||
公司规范要求权限点由代码声明且默认拒绝。本模块只声明这三枚。后续模块新增编码前要再确认,不能沿用 M01 测试里的 `perm:platform:audit.read`。
|
||||
|
||||
## Assumptions
|
||||
|
||||
- 用户会在同一 Casdoor、组织 `organization_HX` 下新建 Watchman Application,并把 issuer、client、audience、密钥放进不入库的 `.env.local`。
|
||||
- HXOPS 短时断言的真实签发不在本仓库完成。本模块先把接收和校验做对。
|
||||
- 8 小时会话和 5 分钟角色缓存是技术默认。
|
||||
- 处理者角色在 M02 没有独立业务按钮。
|
||||
|
||||
## Risks
|
||||
|
||||
- 应用未建好时,真实登录无法验收。
|
||||
- HXOPS 尚未把 Watchman 配成入口时,无感进入只能用测试断言。
|
||||
- 角色缓存在 5 分钟内不会反映 Casdoor 上的撤销。
|
||||
- 对象级范围还没做。后面的模块如果只信角色名,会把“能进入系统”误当成“能看每一行”。
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
1. 错误签名、错误 issuer、错误 audience、过期令牌都不能建立会话。
|
||||
2. 密码登录在 Casdoor 替身成功时建立会话,并带上替身返回的角色;替身失败时不建立会话。
|
||||
3. 无会话调用平台写接口得到 41000。查看者或处理者调用得到 42000,且 `permission_node` 为 `perm:data:emp:watchman.platform.write`。管理者可以写。
|
||||
4. 没有任何三个角色的已登录用户不能进入壳页。
|
||||
5. 两个合成对象 ID 在没有对象授权时都被拒绝。
|
||||
6. HXOPS 断言缺少 Casdoor 身份、或用 HXOPS 本地主键冒充时,不建立会话。合法断言建立会话后,角色仍以 Casdoor 为准,不采用断言里的 HXOPS 权限。
|
||||
7. 角色缓存过期且 Casdoor 不可用时,操作被拒绝,而不是继续放行。
|
||||
8. 退出后再调用平台写接口得到 41000。
|
||||
9. 日志和接口响应中没有密码和 client secret。
|
||||
10. 健康检查仍可匿名访问。
|
||||
11. 登录页能完成失败、成功进入、无权限、退出。本地身份模式有可见标识。
|
||||
12. 未配置 Watchman Application 时,真实联调单独标为未完成,本地签名测试的通过不替代它。
|
||||
|
||||
## Deferred Questions
|
||||
|
||||
- 会话 8 小时、角色 5 分钟是否要改成别的数字。
|
||||
- HXOPS 何时把 Watchman 加为真实入口。
|
||||
- 后续模块如何把场景、报警的行级范围接到 `perm:data:emp:watchman.object.read`,而仍然不在 Watchman 做角色管理页。
|
||||
|
||||
## Source Notes
|
||||
|
||||
- 用户确认记录:2026-11-17,门禁 balanced;登录含 HXOPS 接收端;授权用 Casdoor 三档粗角色;新建 Watchman Application。
|
||||
- `需求冻结文档_V1.1_交接稿.md` 第 15 节。
|
||||
- `docs/tasks/INDEX.md` 的 M02。
|
||||
- `docs/decisions.md` 的 D14、O10。O10 的 client 与 audience 仍要等新应用,角色落点已由本需求取代“存在本库”的选项。
|
||||
- syops:`docs/features/auth/hxops-peer-service-sso.md` 第 14、15 节。只读对照,不复制其用户表和权限表。
|
||||
- `.env.dev` 只用来确认 Casdoor 地址和组织。密钥不进入本仓库。JWKS 在规划时返回 HTTP 200。
|
||||
@@ -0,0 +1,6 @@
|
||||
# Critic — M02 S1(编码前)
|
||||
|
||||
- 模型:claude-opus-5-thinking-high
|
||||
- 子代理:eab6ed43-cf99-4c43-8b71-b813c4101161
|
||||
- 结论:PASS。无阻断项。
|
||||
- 开工约束:只加 `pyjwt[crypto]>=2.10,<3`;锁文件只含该库及其传递依赖;不改根 `pyproject.toml`。只允许 RS256,拒绝 `alg: none` 和 HS256 混淆。过期用确定性时间。密钥只在测试内存中生成。做完停在 S2 前。
|
||||
@@ -0,0 +1,6 @@
|
||||
# Critic — M02 S2(编码前)
|
||||
|
||||
- 模型:claude-opus-5-thinking-high
|
||||
- 子代理:03d34f4b-94e1-4072-8271-0e89c535dd0c
|
||||
- 结论:PASS。无阻断项。
|
||||
- 约束:不新增依赖,不改 `uv.lock`,运行时代码不 import `httpx`。不把 `CASDOOR_*` 放进启动必填项。登录失败 41000,未配置 503 且不建会话。测试注入替身,不读 `.env.local`,不访问网络。Cookie 为 HttpOnly,本地不强制 Secure。会话表走现有 RLS。本切片不保护平台写接口。做完停在 S3 前。
|
||||
@@ -0,0 +1,4 @@
|
||||
# Critic — M02 S3(编码前)
|
||||
|
||||
- 用户在 2026-11-17 明确要求跳过编程前 critic,并默认 PASS。
|
||||
- 未另派审查模型做编码前审计。
|
||||
@@ -0,0 +1,7 @@
|
||||
# Review — M02 模块整体
|
||||
|
||||
- 审查:claude-opus-5-thinking-high,f3455ae9-1f7a-4a5b-9d2e-a030e8e79d32。结论:FAIL。
|
||||
- 必改:HXOPS 断言在没有 `casdoor_sub` 时会回退到令牌自己的 `sub`,本地用户主键可以冒充 Casdoor 身份。
|
||||
- 修复:`casdoor_sub` 必须存在,不再回退到 `sub`。`CASDOOR_ISSUER` 未配置时入口返回 503。补了缺少 `casdoor_sub` 的拒绝测试,并去掉对未导入 `pytest` 的调用。
|
||||
- 复跑:`uv run pytest services/watchman/tests -q` → 54 passed。前端 unit 9 passed。这次没有重跑 Playwright,界面没有改。
|
||||
- 未做第二次独立复审。HXOPS 真实跳转仍未联调。未标 DONE_LOCAL。
|
||||
@@ -0,0 +1,7 @@
|
||||
# Review — M02 S1
|
||||
|
||||
- 第一次审查(claude-sonnet-5-5-high,9a4bae12-f271-4fee-9944-d8cdd8fc5740):FAIL。缺 `# GUARD:`;alg none / HS256 测试没有锁住本服务自己的算法限制。
|
||||
- 修复后复审(gemini-4-hydrogen-high,351c41be-cf86-450f-8490-4ca5cf507b42):PASS。
|
||||
- 实现(gpt-5.6-terra-medium,6d369019-b392-4f7c-914f-8e83405e8124)。
|
||||
- 主 Agent 复跑:`uv run pytest services/watchman/tests -q` → 30 passed。
|
||||
- 未开始 S2。
|
||||
@@ -0,0 +1,9 @@
|
||||
# Review — M02 S2
|
||||
|
||||
- 编码前 critic(claude-opus-5-thinking-high,03d34f4b-94e1-4072-8271-0e89c535dd0c):PASS。
|
||||
- 实现(gpt-5.6-terra-medium,a062b19b-2917-44f5-a294-5fb7c63c04b2)。
|
||||
- 审查(claude-sonnet-5-5-high,bb80f999-7799-4fe8-9a49-225c95d3d25d):PASS_WITH_WARNINGS。无必改项。
|
||||
- 主 Agent 复跑:`uv run pytest services/watchman/tests -q` → 35 passed。
|
||||
- 迁移:`uv run alembic -c alembic.ini upgrade head`(在 `services/watchman`)已由实现方执行成功。
|
||||
- 真实 Casdoor HTTP 按 critic 延后。默认登录端口固定返回 503。
|
||||
- 未开始 S3。平台写接口仍匿名。
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"taskId": "2026-11-17/m02-auth",
|
||||
"phase": "review",
|
||||
"allowedToCode": false,
|
||||
"gatePolicy": {
|
||||
"recommended": "strict",
|
||||
"selected": "balanced",
|
||||
"effective": "balanced",
|
||||
"finalApprovalRequired": true
|
||||
},
|
||||
"requirement": ".task/2026-11-17/m02-auth/requirement.md",
|
||||
"implementationPlan": ".task/2026-11-17/m02-auth/implementation-plan.md",
|
||||
"currentSlice": "S2",
|
||||
"nextGate": "user-confirm-s3"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"taskId": "2026-11-17/m02-auth",
|
||||
"type": "feature",
|
||||
"phase": "finalization",
|
||||
"allowedToCode": false,
|
||||
"currentSlice": "S6",
|
||||
"lastGate": "s6-docs",
|
||||
"nextCommand": "module-wide independent review before DONE_LOCAL",
|
||||
"updatedAt": "2026-11-17T09:50:00Z"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
# Dev/runtime image for Watchman API, worker, and beat.
|
||||
FROM python:3.12-slim-bookworm
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
UV_LINK_MODE=copy
|
||||
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.13.7 /uv /usr/local/bin/uv
|
||||
|
||||
COPY pyproject.toml uv.lock .python-version ./
|
||||
COPY services/watchman ./services/watchman
|
||||
|
||||
RUN uv sync --frozen --no-dev --package watchman \
|
||||
&& useradd --create-home --uid 10001 --shell /usr/sbin/nologin watchman \
|
||||
&& chown -R watchman:watchman /app
|
||||
|
||||
ENV PATH="/app/.venv/bin:$PATH"
|
||||
USER watchman
|
||||
WORKDIR /app
|
||||
|
||||
CMD ["python", "-m", "watchman", "api"]
|
||||
@@ -0,0 +1,116 @@
|
||||
# Dev-only Compose. All published ports bind to 127.0.0.1.
|
||||
# Do not reuse these bindings in test/prod deploy configs.
|
||||
# Secrets come from env_file / shell env — never commit real passwords here.
|
||||
|
||||
name: watchman-dev
|
||||
|
||||
services:
|
||||
rabbitmq:
|
||||
image: rabbitmq:3.13-management-alpine
|
||||
container_name: watchman-dev-rabbitmq
|
||||
ports:
|
||||
- "127.0.0.1:56729:5672"
|
||||
- "127.0.0.1:15679:15672"
|
||||
healthcheck:
|
||||
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 12
|
||||
volumes:
|
||||
- watchman_dev_rabbitmq:/var/lib/rabbitmq
|
||||
|
||||
# Optional isolated Postgres for containerized runs. Host Postgres on :5432 remains the
|
||||
# default for local M01 development documented in docs/runbook.md.
|
||||
postgres:
|
||||
profiles: ["compose-db"]
|
||||
image: postgres:17-alpine
|
||||
container_name: watchman-dev-postgres
|
||||
environment:
|
||||
POSTGRES_USER: ${COMPOSE_POSTGRES_USER:-postgres}
|
||||
POSTGRES_PASSWORD: ${COMPOSE_POSTGRES_PASSWORD:?set COMPOSE_POSTGRES_PASSWORD in .env.local}
|
||||
POSTGRES_DB: ${WATCHMAN_DATABASE_NAME:-watchman}
|
||||
ports:
|
||||
- "127.0.0.1:54329:5432"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 12
|
||||
volumes:
|
||||
- watchman_dev_postgres:/var/lib/postgresql/data
|
||||
|
||||
api:
|
||||
profiles: ["app"]
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: deploy/Dockerfile
|
||||
container_name: watchman-dev-api
|
||||
command: ["python", "-m", "watchman", "api"]
|
||||
env_file:
|
||||
- path: ../.env.shared
|
||||
required: false
|
||||
- path: ../.env.local
|
||||
required: true
|
||||
environment:
|
||||
# DEV ONLY: bind all interfaces inside the container network namespace.
|
||||
# Host publish remains 127.0.0.1:8000 (see ports). Do not copy to deploy configs.
|
||||
API_HOST: 0.0.0.0
|
||||
# DEV ONLY: RabbitMQ image default guest/guest — local compose only.
|
||||
CELERY_BROKER_URL: ${CELERY_BROKER_URL_DOCKER:-amqp://guest:guest@rabbitmq:5672//}
|
||||
DATABASE_URL: ${DATABASE_URL_DOCKER:?set DATABASE_URL_DOCKER in .env.local}
|
||||
DATABASE_MIGRATOR_URL: ${DATABASE_MIGRATOR_URL_DOCKER:?set DATABASE_MIGRATOR_URL_DOCKER in .env.local}
|
||||
ports:
|
||||
- "127.0.0.1:8000:8000"
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
depends_on:
|
||||
rabbitmq:
|
||||
condition: service_healthy
|
||||
|
||||
worker:
|
||||
profiles: ["app"]
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: deploy/Dockerfile
|
||||
container_name: watchman-dev-worker
|
||||
command: ["python", "-m", "watchman", "worker"]
|
||||
env_file:
|
||||
- path: ../.env.shared
|
||||
required: false
|
||||
- path: ../.env.local
|
||||
required: true
|
||||
environment:
|
||||
CELERY_BROKER_URL: ${CELERY_BROKER_URL_DOCKER:-amqp://guest:guest@rabbitmq:5672//}
|
||||
DATABASE_URL: ${DATABASE_URL_DOCKER:?set DATABASE_URL_DOCKER in .env.local}
|
||||
DATABASE_MIGRATOR_URL: ${DATABASE_MIGRATOR_URL_DOCKER:?set DATABASE_MIGRATOR_URL_DOCKER in .env.local}
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
depends_on:
|
||||
rabbitmq:
|
||||
condition: service_healthy
|
||||
|
||||
beat:
|
||||
profiles: ["app"]
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: deploy/Dockerfile
|
||||
container_name: watchman-dev-beat
|
||||
command: ["python", "-m", "watchman", "beat"]
|
||||
env_file:
|
||||
- path: ../.env.shared
|
||||
required: false
|
||||
- path: ../.env.local
|
||||
required: true
|
||||
environment:
|
||||
CELERY_BROKER_URL: ${CELERY_BROKER_URL_DOCKER:-amqp://guest:guest@rabbitmq:5672//}
|
||||
DATABASE_URL: ${DATABASE_URL_DOCKER:?set DATABASE_URL_DOCKER in .env.local}
|
||||
DATABASE_MIGRATOR_URL: ${DATABASE_MIGRATOR_URL_DOCKER:?set DATABASE_MIGRATOR_URL_DOCKER in .env.local}
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
depends_on:
|
||||
rabbitmq:
|
||||
condition: service_healthy
|
||||
|
||||
volumes:
|
||||
watchman_dev_rabbitmq:
|
||||
watchman_dev_postgres:
|
||||
@@ -17,6 +17,14 @@
|
||||
| D09 | MES 通过配置,不做客户核心定制;大屏独立、能力模块为流程/指标/视频 | 前轮用户明确答复 |
|
||||
| D10 | 以功能模块为大任务,一个会话聚焦一个大任务;Agent 可自主拆小步骤逐步实现,不再由用户管理 133 小片 | 2026-11-17 用户修正 |
|
||||
| D11 | Cron 编辑和调度优先复用开源库/框架,不自行开发通用编辑器和调度引擎 | 2026-11-17 用户要求及本轮公开资料核查 |
|
||||
| D12 | M01 目录采用公司代码落位:`web/` pnpm 工作区,后端为 uv 工作区中的一个服务包。API、worker、beat 是同一包的三个进程,不拆微服务 | 2026-11-17 用户在 M01 规划中选择公司落位。取代开发规划 2.1 的 `backend/` `frontend/` `infra/` 草图 |
|
||||
| D13 | M01 前端只做薄壳:按页使用 Element Plus、Tailwind 和四语言目录。vben5 与列表骨架留到第一个业务列表模块 | 2026-11-17 用户选择薄壳 |
|
||||
| D14 | M01 的平台表启用并强制 PostgreSQL RLS。租户只由服务端配置注入,调用方不能传 `tenant_id`。M01 没有租户管理功能 | 2026-11-17 用户选择 M01 实施 RLS |
|
||||
| D15 | 开发用 Docker Compose。Postgres 与 RabbitMQ 只绑定 127.0.0.1,端口仅用于开发,不写入部署配置 | 2026-11-17 用户选择本机 Compose |
|
||||
| D16 | `WATCHMAN_TENANT_ID` 放在不入库的 `.env.local`(及 `.env.example` 占位),不放 `.env.shared` | 2026-11-17 critic 对照需求 Assumptions;修正落位 |
|
||||
| D17 | 仓库 `gatePolicy.defaultMode` 保持 `balanced`;Tier L 保持 `prefer-strict`/`full-marionettist`。本任务曾出现的 autonomous/放宽漂移已回滚,不作为 M01 交付 | 2026-11-17 独立 review S1-5;用户授权处理必改项时回滚 |
|
||||
| D18 | Compose 容器内 `API_HOST=0.0.0.0` 仅开发且必须行内标注;宿主发布端口仍绑 `127.0.0.1` | 2026-11-17 独立 review 顺带项 |
|
||||
| D19 | M02 授权:Casdoor 分配 `watchman-admin`、`watchman-operator`、`watchman-viewer`。Watchman 只校验,不建角色表和授权管理页。登录用自有页面,后端向新建的 Watchman Application 校验密码,并接收 HXOPS 短时断言。不复用 HXOPS client。行级数据范围留到后续业务模块 | 2026-11-17 用户确认按此冻结 |
|
||||
|
||||
## 冻结前/相关模块实现前必须确认
|
||||
|
||||
@@ -32,8 +40,8 @@
|
||||
| O06 | OPEN | 同周期值更正是否更新原报警、是否允许新报警? | 同一输入身份重读不重报已确认;“版本变更”不能随意当新业务事件。建议保留修订记录,不自动重发,实际规则需批准 | P-006、A-023、A-039 |
|
||||
| O07 | OPEN | 停机漏跑、跨周期任务重叠、启停及改 Cron 后的旧任务 | 建议每场景不并发推进进度,逾期运行有界跳过/显式补跑且不自动补发历史消息;用户需确认具体业务行为 | P-004、A-033~A-036 |
|
||||
| O08 | OPEN | Cursor/Grok 等实际服务商能处理哪些项目资料?能否跨系列子 Agent? | 先确认交接文档、未来源码、合成数据和截图授权;默认不读取原会议或 MES 原始资料,不发真实凭证。用可用模型目录填写角色映射,不能默认已获所有服务商授权 | 所有实际模型委派 |
|
||||
| O09 | TECH_PENDING | Python/Node/依赖版本,Cron 解析器和编辑组件,AI SDK,企微库 | 由子 Agent 查官方资料做小验证,主 Agent 记录版本和理由;涉及新服务商或重大基础设施须问用户 | P-002、P-004、A-056、B-001 |
|
||||
| O10 | TECH_PENDING | Casdoor issuer/client/audience、角色和数据范围映射 | 使用隔离测试租户/合成身份,正式配置需维护方提供;签名、issuer、audience、有效期和权限都检验 | A-008~A-010、A-074 |
|
||||
| O09 | TECH_PENDING | Python/Node/依赖版本,Cron 解析器和编辑组件,AI SDK,企微库 | M01 已锁定:Python 3.12.16(uv)、FastAPI 0.163、SQLAlchemy 2.0.57、Alembic 1.20、Celery 5.7、Pydantic 2.14、Vue 3.5 / Element Plus 2.x / Vite 7 / pnpm 12。其余(Cron/AI/企微)仍待后续模块 | P-002、P-004、A-056、B-001 |
|
||||
| O10 | TECH_PENDING | Watchman Application 已在本机 `.env.local`。密码登录已用一个已有账号走过。HXOPS 真实断言签发仍未做 | 密钥不入库。本地签名测试和一次密码登录不能写成 A-074 真实入口已全部通过 | A-008~A-010、A-074 |
|
||||
|
||||
O01~O07 不要求全在第一天解决,但其依赖切片不能带着猜测宣布完成。用户可一次批准建议,也可逐项给不同口径。无关切片在授权开工后仍可推进。
|
||||
|
||||
|
||||
@@ -35,7 +35,11 @@
|
||||
|
||||
不现在指定具体版本号。M01 内依据官方资料及最小兼容验证确定版本矩阵,随工程生成依赖锁文件,先提供隔离 Postgres/RabbitMQ 和测试命令。M11 整合全部业务运行环境,不在没有工程时要求所有 lockfile。
|
||||
|
||||
### 2.1 推荐目录(后续任务建立,本次未创建业务目录)
|
||||
### 2.1 目录
|
||||
|
||||
2026-11-17 起,M01 的目录以 `docs/decisions.md` D12 为准,不再使用下面这张早期草图创建工程。早期草图保留,避免把当时的规划改写成从未存在的决定。
|
||||
|
||||
### 2.1a 早期目录草图(已被 D12 取代,不要按此创建)
|
||||
|
||||
```text
|
||||
watchman/
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
# M01 健康三态证据(脱敏摘要)
|
||||
|
||||
日期:2026-11-17
|
||||
|
||||
## 命令
|
||||
|
||||
```powershell
|
||||
cd web/apps/console
|
||||
pnpm test:unit
|
||||
pnpm test:e2e
|
||||
pnpm typecheck
|
||||
```
|
||||
|
||||
## 结果
|
||||
|
||||
- vitest:2 files / 8 tests passed(映射 + 组件三态 + locale 回退 + en 文案)
|
||||
- Playwright:3 passed
|
||||
- loading → success(含 loading 截图)
|
||||
- failure(含 50000)
|
||||
- `?lang=en` 英文成功文案
|
||||
- typecheck:通过
|
||||
|
||||
## 截图(可入库)
|
||||
|
||||
- `docs/evidence/M01/ui/health-loading.png` — 文案「健康检查加载中」
|
||||
- `docs/evidence/M01/ui/health-success.png` — 绿标「健康检查成功」+「服务可用: watchman 0.1.0」
|
||||
- `docs/evidence/M01/ui/health-failure.png` — 「健康检查失败」+ `50000: Internal server error`
|
||||
- `docs/evidence/M01/ui/health-success-en.png` — 「Health check succeeded」+「Service available: watchman 0.1.0」
|
||||
|
||||
## 视觉抽查
|
||||
|
||||
四张截图均可见:单层卡片、标题 Watchman、状态 Tag 与 Alert 分层清楚、无裁切/重叠;英文态无硬编码中文。
|
||||
@@ -0,0 +1,20 @@
|
||||
# M01 依赖许可证预检(脱敏)
|
||||
|
||||
日期:2026-11-17
|
||||
|
||||
对照 `uv.lock` 与 `web` lock 的主要运行时依赖,逐项确认核心路径无 AGPL:
|
||||
|
||||
| 依赖 | 锁定版本(摘要) | 许可证(公开记录) |
|
||||
|---|---|---|
|
||||
| fastapi | 0.163.1 | MIT |
|
||||
| sqlalchemy | 2.0.57 | MIT |
|
||||
| alembic | 1.20.1 | MIT |
|
||||
| celery | 5.7.0 | BSD-3-Clause |
|
||||
| pydantic | 2.14.3 | MIT |
|
||||
| vue | 3.5.x | MIT |
|
||||
| element-plus | 2.11.x | MIT |
|
||||
| vite | 7.1.x | MIT |
|
||||
| playwright | 1.65.x | Apache-2.0 |
|
||||
| tailwindcss | 4.x | MIT |
|
||||
|
||||
结论:M01 锁定核心依赖未见 AGPL;后续新增依赖须先补本表再合入。
|
||||
@@ -0,0 +1,24 @@
|
||||
# M01 RLS、幂等与 review 修复证据(脱敏摘要)
|
||||
|
||||
日期:2026-11-17
|
||||
|
||||
## 命令
|
||||
|
||||
```powershell
|
||||
uv run pytest services/watchman/tests -q
|
||||
```
|
||||
|
||||
## 结果
|
||||
|
||||
- **23 passed**
|
||||
- 覆盖:信封(含 41000/42000/503、无 timestamp)、env 分层真值、启动缺键失败、probe/docs 生产收口、RLS 读写/角色/commit 后重绑、幂等(含并发)、租户注入忽略、IntegrityError 回退、测试数据清理
|
||||
|
||||
## 关键修复
|
||||
|
||||
- `missing_required_keys` / `ensure_runtime_config` 已接入进程启动
|
||||
- `/_probe/*`、`/docs`、`/openapi.json` 仅 `ENV_NAME=dev|test`
|
||||
- 幂等 `begin_nested` + `IntegrityError` 回读首次结果
|
||||
- `Session.after_begin` 在非嵌套事务开始时重绑租户
|
||||
- 信封去掉未规范 `timestamp`
|
||||
- 门禁漂移已回滚(D17);Compose `0.0.0.0` 行内标注(D18)
|
||||
- 前端:Tailwind v4、`element-theme.css`、El locale 随 i18n、非 JSON → BusinessError、Playwright 三态
|
||||
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 108 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 10 KiB |
@@ -0,0 +1,40 @@
|
||||
# 交接 2026-11-17-002
|
||||
|
||||
## 当前任务
|
||||
|
||||
M01 基础框架。实现切片 S1–S7 已完成,等待最终确认与独立 review。
|
||||
|
||||
## 已完成
|
||||
|
||||
- uv + `web/` 工作区,Python 3.12.16
|
||||
- FastAPI 数值信封与 `/health`
|
||||
- 本机 Postgres 库 `watchman` + 强制 RLS + 幂等写入
|
||||
- `deploy/compose.dev.yml` RabbitMQ(127.0.0.1:56729 / 15679)
|
||||
- Celery `watchman.probe.ping` 经 broker 执行成功,审计表行数不变
|
||||
- 控制台薄壳与四语言目录
|
||||
- `docs/runbook.md`;API 镜像 `docker compose ... --profile app build api` 通过
|
||||
|
||||
## 验证
|
||||
|
||||
- `uv run pytest services/watchman/tests -q` → 10 passed
|
||||
- `pnpm --filter @watchman/console typecheck` → 通过
|
||||
- RabbitMQ healthy;worker 日志显示 probe succeeded
|
||||
|
||||
## 未完成
|
||||
|
||||
- 正式独立 code review
|
||||
- 浏览器健康三态截图/断言归档
|
||||
- Git commit(用户未要求)
|
||||
- M02 登录与权限
|
||||
|
||||
## 恢复点
|
||||
|
||||
1. 确认 `.env.local` 仍在本机且未入库
|
||||
2. `docker compose -f deploy/compose.dev.yml --env-file .env.local up -d rabbitmq`
|
||||
3. `uv run python -m watchman api` / `worker`
|
||||
4. 用户最终确认后可标 M01 进入 review/DONE_LOCAL 流程
|
||||
|
||||
## 不要重复的副作用
|
||||
|
||||
- 不要再次对已应用的 `20261117_0001` 迁移做 destructive reset,除非用户明确要求
|
||||
- 不要把 `.env.local` 提交进 Git
|
||||
@@ -0,0 +1,17 @@
|
||||
# 交接 2026-11-17-003 — M01 review 修复收尾
|
||||
|
||||
## 完成
|
||||
|
||||
- Review 必处理:分层真测、启动缺键、probe/docs 收口、幂等 IntegrityError、门禁漂移回滚、Playwright 三态截图。
|
||||
- 建议顺带:租户反向测、Compose 标注、Tailwind/element-theme/locale、信封去 timestamp、错误码测、commit 后重绑、非 JSON 客户端、en 单测、bootstrap 限制说明、Dockerfile USER、RLS 清理、guest 注释、许可证证据。
|
||||
- 证据:`docs/evidence/M01/`;进度与 M01 任务卡已更新。
|
||||
|
||||
## 验证
|
||||
|
||||
- `uv run pytest services/watchman/tests -q` → 23 passed
|
||||
- `pnpm test:unit` → 8 passed;`pnpm typecheck` 通过;`pnpm test:e2e` → 3 passed
|
||||
|
||||
## 未做/下一步
|
||||
|
||||
- 未独立复审本轮修复 diff;未标 DONE_LOCAL;未 commit。
|
||||
- 用户可要求复审或最终确认关 M01。
|
||||
@@ -0,0 +1,15 @@
|
||||
# 交接 2026-11-17-004 — M01 DONE_LOCAL + commit
|
||||
|
||||
## 完成
|
||||
|
||||
- 用户确认 finalApproval,并授权 commit。
|
||||
- M01 标 DONE_LOCAL;进度与任务卡已更新。
|
||||
|
||||
## 验证(收尾时)
|
||||
|
||||
- pytest 23;console unit 8;e2e 3;typecheck 通过。
|
||||
|
||||
## 下一步
|
||||
|
||||
- 默认开 M02(Casdoor/登录),或等用户指定。
|
||||
- 未授权 push/建远程。
|
||||
@@ -0,0 +1,16 @@
|
||||
# 交接 2026-11-17-005 — M02 分析开始
|
||||
|
||||
## 完成
|
||||
|
||||
- 用户要求推进 M02,先规划并讨论。
|
||||
- 已读索引、冻结文档第 15 节、O10、M01 现状,并只读参考了 syops 的 Casdoor 登录说明。
|
||||
- 任务入口:`.task/2026-11-17/m02-auth/intake.md`。`allowedToCode` 为 false。
|
||||
|
||||
## 未做
|
||||
|
||||
- 未冻结需求,未切片,未改业务代码。
|
||||
- 未读取 syops 的密钥或 `.env`。
|
||||
|
||||
## 下一步
|
||||
|
||||
- 用户确认门禁、登录交互、角色落点、有无 Watchman 测试应用,以及权限点编码由谁给定。
|
||||
@@ -2,31 +2,21 @@
|
||||
|
||||
## 当前快照
|
||||
|
||||
- 当前阶段:规划/文档初始化;业务开发未开始。
|
||||
- 当前大任务:无;当前内部步骤:无。
|
||||
- 用户授权:编制规划、初始化 AGENTS 和 Git;尚未授权本轮开始业务编码。
|
||||
- 已有成果:需求交接稿、模块级任务规划、15 个模块索引、测试计划和代理规范;133 个旧细项改为覆盖参考。
|
||||
- 业务源代码、依赖、数据库、Docker 服务:均未创建/安装/启动。
|
||||
- Git 初始化结果:已于 2026-11-16 执行 `git init`,创建本地空仓库;未 commit、未添加远程、未 push。
|
||||
- 模型配置:未知,待接手环境发现与用户授权;不得编造 Cursor 支持自动多模型子 Agent。
|
||||
- 下一步:按所属模块确认相关业务决策,获开工指令后从 M01 开始,主 Agent 在会话内拆步骤并委派。
|
||||
- 当前规划检查:15 个模块依赖无环,133 个旧细项全量映射且无重漏;见 planning-check。68 个 V 用例和 12 个 UI 用例仍是计划,未执行。
|
||||
- 最近交接:`handoffs/2026-11-17-001.md`。
|
||||
- 当前阶段:M02 模块审查发现的必改已修。pytest 54,前端 unit 9。未标 DONE_LOCAL。HXOPS 真实跳转仍未做。
|
||||
- 当前大任务:M02 统一登录与权限。上一完成:M01 基础框架(DONE_LOCAL)。
|
||||
- 用户授权:已确认提交并推送当前 M02 实现。HXOPS 真实跳转仍未做,不把本模块标成 DONE_LOCAL。
|
||||
- Git:本轮提交 M02,并推送到 origin。
|
||||
- 下一步:用户确认是否把 M02 标为 DONE_LOCAL。真实 HXOPS 跳转继续单列未完成。
|
||||
- RabbitMQ 容器可能仍在运行:`watchman-dev-rabbitmq`。
|
||||
|
||||
## 大任务状态
|
||||
|
||||
M01~M15 全部初始 TODO,未列于下表者仍 TODO;不再管理旧 P/A/B/C 编号的单独状态。内部步骤放当前模块任务卡,主 Agent 可自行推进,不逐步等用户审批。不要根据文档存在推断已经实现。
|
||||
|
||||
| 大任务/当前内部步骤 | 状态 | 负责人角色/实际模型 | 候选版本标识 | Review | 测试/UI 证据 | 阻塞/下一步 |
|
||||
|---|---|---|---|---|---|---|
|
||||
| — | NOT_STARTED | — | — | 未执行 | 未执行 | 规划阶段 |
|
||||
|
||||
状态:TODO → READY → IN_PROGRESS → IN_REVIEW → IN_TEST → DONE_LOCAL。可转 BLOCKED;验收失败转回 IN_PROGRESS。真实接入验收单列 REAL_ACCEPTED,不用 DONE_LOCAL 冒充。
|
||||
| M01 基础框架 | DONE_LOCAL | 实现 Composer;审查/复审异系列 | `8fb16f4` | PASS_WITH_WARNINGS(必改已关) | pytest 23;unit 8;e2e 3 | 已完成 |
|
||||
| M02 统一登录与权限 | 审查必改已修,待最终确认 | 审查 Claude;修复主 Agent | 未提交 | 整体审查 FAIL 后必改已关,未做第二次复审 | pytest 54;unit 9;此前 e2e 5 | HXOPS 真跳转未做 |
|
||||
|
||||
## 当前阻塞
|
||||
|
||||
详见决策表。Cron 方言、次数窗口及升级动作语义影响相关切片;真实访问条件只阻塞真实联调,不阻塞合成数据基础开发。不同服务商资料授权、子 Agent 能力和实际模型 ID 是委派前置条件。
|
||||
|
||||
## 会话结束前
|
||||
|
||||
更新本快照及台账;新增 `docs/handoffs/<日期>-<序号>.md`,使用模板。不保留完整对话,不写凭证。记录当前差异、最新审查结论、失败命令、下一精确动作及不能重复执行的副作用。
|
||||
- O08:跨系列子 Agent 授权仍开放(本轮已实际用过异系列审查)。
|
||||
- O01–O07:业务口径,不阻塞后续文档/基础模块开工;相关切片仍须确认。
|
||||
@@ -0,0 +1,118 @@
|
||||
# Watchman 本地开发手册(M01)
|
||||
|
||||
## 前置
|
||||
|
||||
- Python 通过 `uv` 使用 3.12
|
||||
- Node.js + pnpm 12
|
||||
- Docker Desktop(RabbitMQ)
|
||||
- 本机 PostgreSQL(默认);Compose 可选库见下文
|
||||
|
||||
## 安装
|
||||
|
||||
```powershell
|
||||
uv sync --group dev
|
||||
cd web
|
||||
pnpm install
|
||||
```
|
||||
|
||||
## 本机数据库(默认)
|
||||
|
||||
1. 确认 `.env.local` 存在且含密码与 `DATABASE_*_URL`(勿提交)。
|
||||
2. 建库与角色:
|
||||
|
||||
```powershell
|
||||
uv run python services/watchman/scripts/bootstrap_local_db.py
|
||||
uv run --directory services/watchman alembic upgrade head
|
||||
```
|
||||
|
||||
## RabbitMQ(Compose,仅本机回环)
|
||||
|
||||
```powershell
|
||||
docker compose -f deploy/compose.dev.yml --env-file .env.local up -d rabbitmq
|
||||
docker compose -f deploy/compose.dev.yml --env-file .env.local ps
|
||||
```
|
||||
|
||||
管理台:`http://127.0.0.1:15679`(默认 guest/guest,仅开发)。
|
||||
|
||||
停止:
|
||||
|
||||
```powershell
|
||||
docker compose -f deploy/compose.dev.yml --env-file .env.local stop rabbitmq
|
||||
```
|
||||
|
||||
## 启动 API / worker / beat(宿主机)
|
||||
|
||||
```powershell
|
||||
uv run python -m watchman api
|
||||
uv run python -m watchman worker
|
||||
uv run python -m watchman beat
|
||||
```
|
||||
|
||||
健康检查:`http://127.0.0.1:8000/health`
|
||||
|
||||
Windows 上 worker 自动使用 `--pool=solo`。
|
||||
|
||||
## 启动控制台壳
|
||||
|
||||
```powershell
|
||||
cd web
|
||||
pnpm --filter @watchman/console dev
|
||||
```
|
||||
|
||||
打开:`http://127.0.0.1:5173`
|
||||
|
||||
## Compose 应用进程(可选 profile)
|
||||
|
||||
`.env.local` 需提供 `DATABASE_URL_DOCKER` / `DATABASE_MIGRATOR_URL_DOCKER` / `CELERY_BROKER_URL_DOCKER`。
|
||||
|
||||
```powershell
|
||||
docker compose -f deploy/compose.dev.yml --env-file .env.local --profile app up -d --build
|
||||
```
|
||||
|
||||
可选隔离 Postgres(端口 `127.0.0.1:54329`):
|
||||
|
||||
```powershell
|
||||
docker compose -f deploy/compose.dev.yml --env-file .env.local --profile compose-db up -d postgres
|
||||
```
|
||||
|
||||
## 测试
|
||||
|
||||
```powershell
|
||||
uv run pytest services/watchman/tests -q
|
||||
cd web
|
||||
pnpm --filter @watchman/console test:unit
|
||||
pnpm --filter @watchman/console typecheck
|
||||
pnpm --filter @watchman/console test:e2e
|
||||
```
|
||||
|
||||
Playwright 截图写入 `docs/evidence/M01/ui/`(相对仓库根,勿再多上一级)。`/_probe/*` 与 `/docs` 仅在 `ENV_NAME=dev|test` 暴露。
|
||||
|
||||
`.env.dev` 可选;缺失时加载顺序会跳过该文件。租户 id 放在 `.env.local`(见 D16)。Casdoor 与 HXOPS 入口的地址、应用名和密钥也只放 `.env.local`,键名见 `.env.example`。
|
||||
|
||||
## 登录(M02)
|
||||
|
||||
管理台先访问 `GET /auth/me`。没有会话时进入登录页。密码登录走 `POST /auth/login`,成功后浏览器只保存 HttpOnly cookie。`GET /auth/me` 返回身份和角色,`POST /auth/logout` 只结束 Watchman 会话。
|
||||
|
||||
Casdoor 上的三个角色是 `watchman-admin`、`watchman-operator`、`watchman-viewer`。没有这三个角色时,页面只显示无权限。`POST /platform/audit-events` 和 `POST /platform/run-records` 需要 `watchman-admin`:未登录是 41000,已登录但角色不够是 42000。角色快照超过 5 分钟会按登录名再问 Casdoor;问失败则本次操作返回 503,不沿用旧角色。
|
||||
|
||||
`POST /auth/hxops-entry` 接收短时断言,并且必须带 `casdoor_sub`。HXOPS 令牌自己的 `sub` 不能当作 Casdoor 身份。未配置 `HXOPS_SSO_ISSUER`、`HXOPS_SSO_AUDIENCE`、`HXOPS_SSO_PUBLIC_KEY` 或 `CASDOOR_ISSUER` 时返回 503。断言里的角色不会被采用。HXOPS 尚未向 Watchman 签发真实断言,所以这条路径只有本地签名测试,不能写成真实跳转已通过。
|
||||
|
||||
本机曾用一个已有 Casdoor 账号走通密码登录、当前用户和退出。这不替代 HXOPS 真实入口验收。密钥和密码不写入仓库。前端 `VITE_AUTH_MODE=fixture` 时,登录页会显示本地身份标识。
|
||||
|
||||
## 端口(仅开发,全部绑 127.0.0.1)
|
||||
|
||||
| 服务 | 地址 |
|
||||
|---|---|
|
||||
| API | 127.0.0.1:8000 |
|
||||
| Console | 127.0.0.1:5173 |
|
||||
| Postgres(本机) | 127.0.0.1:5432 |
|
||||
| Postgres(Compose 可选) | 127.0.0.1:54329 |
|
||||
| RabbitMQ | 127.0.0.1:56729 |
|
||||
| RabbitMQ 管理台 | 127.0.0.1:15679 |
|
||||
|
||||
## 当前已知限制
|
||||
|
||||
- 正式 Casdoor 密码登录已在本机走过一次;HXOPS 真实跳转仍未做。
|
||||
- 平台写接口需要已登录的 `watchman-admin`。健康检查仍然匿名。
|
||||
- Compose `app` profile 依赖 Docker 构建;日常开发可用宿主机进程 + 仅 RabbitMQ 容器。
|
||||
- 容器内 `API_HOST=0.0.0.0` 仅开发监听(D18);宿主端口仍绑 `127.0.0.1`。
|
||||
@@ -0,0 +1,27 @@
|
||||
# M01 搭建基础框架和开发环境
|
||||
|
||||
一个会话聚焦本模块。实现切片见 `.task/2026-11-17/m01-foundation/implementation-plan.md`。
|
||||
|
||||
## 内部步骤(主 Agent 根据现有代码安排)
|
||||
- [x] 明确边界、依赖和复用方案。口径见 D12–D18。
|
||||
- [x] S1–S7 实现与 critic 缺口补齐。
|
||||
- [x] 独立 review(PASS_WITH_WARNINGS)及必改/顺带项修复。
|
||||
- [x] 受影响部分复审:`.task/2026-11-17/m01-foundation/reviews/reviewer-m01-fixup.md`(W1 openapi 已补)。
|
||||
- [x] 主 Agent 最终验收与用户确认(2026-11-17 finalApproval + commit)。
|
||||
|
||||
当前恢复点:DONE_LOCAL。下一模块默认 M02。
|
||||
|
||||
## 目标与边界
|
||||
- 阶段/需求编号:M01。
|
||||
- 依赖及当前状态:本机 Postgres + RabbitMQ Compose。
|
||||
- 必须已确认的决策:D01、D04、D12–D18。
|
||||
- 明确不做:登录、业务模块、vben5、Redis、微服务、生产部署。
|
||||
|
||||
## 证据与结论(主 Agent 汇总)
|
||||
- Review:`reviewer-m01.md` → PASS_WITH_WARNINGS;`reviewer-m01-fixup.md` → 必改全关。
|
||||
- 后端:`uv run pytest services/watchman/tests -q` → **23 passed**
|
||||
- 前端 unit:`pnpm test:unit` → **8 passed**
|
||||
- Playwright:`pnpm test:e2e` → **3 passed**;截图见 `docs/evidence/M01/ui/`
|
||||
- typecheck:通过
|
||||
- 顺带落地:Tailwind v4、element-theme、信封去 timestamp、41000/42000/503 测试、commit 后租户重绑、非 JSON BusinessError、Dockerfile 非 root、许可证预检、openapi 收口
|
||||
- 结论:**DONE_LOCAL**(非真实生产联调验收)
|
||||
@@ -0,0 +1,41 @@
|
||||
# M02 统一登录与权限
|
||||
|
||||
一个会话聚焦本模块。S1–S6 已实现并写入说明。模块整体独立 review 尚未做,不能标 DONE_LOCAL。
|
||||
|
||||
## 内部步骤(主 Agent 根据现有代码安排)
|
||||
- [x] 确认门禁、登录方式、授权落点和 Casdoor 应用策略。见 D19。
|
||||
- [x] 冻结需求并切片。见 `.task/2026-11-17/m02-auth/requirement.md` 与 `implementation-plan.md`。
|
||||
- [x] S1 令牌校验。critic PASS,复审 PASS。
|
||||
- [x] S2 会话与密码登录。审查 PASS_WITH_WARNINGS。随后补上真实 Casdoor 密码校验。
|
||||
- [x] S3 角色收口。匿名 41000,非管理者 42000,过期角色刷新失败则 503。
|
||||
- [x] S4 HXOPS 短时断言。验签后按 Casdoor 角色建会话。真实跳转未联调。
|
||||
- [x] S5 登录壳。失败、无权限、退出已由 Playwright 覆盖。
|
||||
- [x] S6 运行说明和示例配置。`.env.example` 只有占位。
|
||||
- [ ] 模块整体独立 review、修复和复审。
|
||||
- [ ] 对最终候选再跑一轮正式测试。
|
||||
- [ ] 主 Agent 验收、进度和交接。
|
||||
|
||||
当前恢复点:S6 文档已更新。下一步是模块整体 review,而不是下一个业务模块。
|
||||
|
||||
## 目标与边界
|
||||
- 阶段/需求编号:M02;覆盖原细项 A-008~A-010、A-074。
|
||||
- 依赖及当前状态:M01 DONE_LOCAL。平台写接口现在要求 `watchman-admin`。
|
||||
- 必须已确认的决策:D01、D14、D19。门禁 selected=balanced。
|
||||
- 模块可验收行为:后端校验签名、issuer、audience、期限和角色;对象 ID 本身不能授权。
|
||||
- 明确不做:用户管理后台、组织全量同步、企微通知、场景与数据源业务功能。HXOPS 真实跳转未做,不能写成通过。
|
||||
- 输入/输出契约及失败语义:沿用 M01 信封。未登录 41000,无权限 42000 且带权限点。
|
||||
- 权限点:`perm:app:emp:watchman.enter`、`perm:data:emp:watchman.platform.write`、`perm:data:emp:watchman.object.read`。
|
||||
|
||||
## 模块验收
|
||||
- 正常:密码登录建立会话;管理者可写平台记录。
|
||||
- 边界:过期令牌、错误 issuer/audience、本地用户主键冒充 Casdoor 身份。
|
||||
- 故障/权限/重复:无会话 41000;角色不够 42000;角色刷新失败 503。两个合成对象 ID 都拒绝。
|
||||
- 回归范围:M01 健康检查、信封、幂等和 RLS。
|
||||
- UI:登录失败、无权限、退出。截图在 `docs/evidence/M02/ui/`。
|
||||
|
||||
## 证据与结论(主 Agent 汇总)
|
||||
- 后端测试:`uv run pytest services/watchman/tests -q` → **54 passed**(审查必改之后)。
|
||||
- 前端:`pnpm --filter @watchman/console test:unit` → 9 passed。Playwright 健康检查 3 在 S5 通过。登录模拟又补了成功路径:`pnpm exec playwright test e2e/login.spec.ts -g "sign in as an admin"` → 1 passed。截图 `docs/evidence/M02/ui/login-success.png`。这次是拦截接口的模拟,不是再打真实 Casdoor。
|
||||
- 本机密码登录、当前用户和退出走过一次。HXOPS 真实跳转未做。
|
||||
- 模块整体审查为 FAIL。必改是 HXOPS `sub` 冒充,已改为必须带 `casdoor_sub`。没有第二次独立复审。
|
||||
- 最终状态:必改已关,等待用户确认是否标 DONE_LOCAL。真实 HXOPS 入口仍单列未完成。
|
||||
@@ -0,0 +1,22 @@
|
||||
[project]
|
||||
name = "watchman-workspace"
|
||||
version = "0.1.0"
|
||||
description = "Watchman uv workspace root"
|
||||
requires-python = ">=3.12,<3.13"
|
||||
readme = "README.md"
|
||||
|
||||
[tool.uv.workspace]
|
||||
members = ["services/watchman"]
|
||||
|
||||
[tool.uv]
|
||||
package = false
|
||||
|
||||
[tool.uv.sources]
|
||||
watchman = { workspace = true }
|
||||
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
"watchman",
|
||||
"pytest>=8.3,<9",
|
||||
"httpx>=0.28,<1",
|
||||
]
|
||||
@@ -0,0 +1,40 @@
|
||||
[alembic]
|
||||
script_location = migrations
|
||||
prepend_sys_path = src
|
||||
version_path_separator = os
|
||||
|
||||
sqlalchemy.url = driver://user:pass@localhost/dbname
|
||||
|
||||
[loggers]
|
||||
keys = root,sqlalchemy,alembic
|
||||
|
||||
[handlers]
|
||||
keys = console
|
||||
|
||||
[formatters]
|
||||
keys = generic
|
||||
|
||||
[logger_root]
|
||||
level = WARN
|
||||
handlers = console
|
||||
qualname =
|
||||
|
||||
[logger_sqlalchemy]
|
||||
level = WARN
|
||||
handlers =
|
||||
qualname = sqlalchemy.engine
|
||||
|
||||
[logger_alembic]
|
||||
level = INFO
|
||||
handlers =
|
||||
qualname = alembic
|
||||
|
||||
[handler_console]
|
||||
class = StreamHandler
|
||||
args = (sys.stderr,)
|
||||
level = NOTSET
|
||||
formatter = generic
|
||||
|
||||
[formatter_generic]
|
||||
format = %(levelname)-5.5s [%(name)s] %(message)s
|
||||
datefmt = %H:%M:%S
|
||||
@@ -0,0 +1,59 @@
|
||||
"""Alembic environment for Watchman migrations.
|
||||
|
||||
Uses the migrator database URL, never the constrained app role.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from logging.config import fileConfig
|
||||
|
||||
from alembic import context
|
||||
from sqlalchemy import engine_from_config, pool
|
||||
|
||||
from watchman.core.config import get_settings
|
||||
from watchman.models.base import Base
|
||||
from watchman.models import AuthSession, AuditEvent, RunRecord # noqa: F401
|
||||
|
||||
config = context.config
|
||||
if config.config_file_name is not None:
|
||||
fileConfig(config.config_file_name)
|
||||
|
||||
target_metadata = Base.metadata
|
||||
|
||||
|
||||
def get_url() -> str:
|
||||
"""Resolve the migrator URL from layered settings."""
|
||||
return get_settings().database_migrator_url
|
||||
|
||||
|
||||
def run_migrations_offline() -> None:
|
||||
"""Run migrations in offline mode."""
|
||||
context.configure(
|
||||
url=get_url(),
|
||||
target_metadata=target_metadata,
|
||||
literal_binds=True,
|
||||
dialect_opts={"paramstyle": "named"},
|
||||
)
|
||||
with context.begin_transaction():
|
||||
context.run_migrations()
|
||||
|
||||
|
||||
def run_migrations_online() -> None:
|
||||
"""Run migrations in online mode."""
|
||||
configuration = config.get_section(config.config_ini_section) or {}
|
||||
configuration["sqlalchemy.url"] = get_url()
|
||||
connectable = engine_from_config(
|
||||
configuration,
|
||||
prefix="sqlalchemy.",
|
||||
poolclass=pool.NullPool,
|
||||
)
|
||||
with connectable.connect() as connection:
|
||||
context.configure(connection=connection, target_metadata=target_metadata)
|
||||
with context.begin_transaction():
|
||||
context.run_migrations()
|
||||
|
||||
|
||||
if context.is_offline_mode():
|
||||
run_migrations_offline()
|
||||
else:
|
||||
run_migrations_online()
|
||||
@@ -0,0 +1,27 @@
|
||||
"""${message}
|
||||
|
||||
Revision ID: ${up_revision}
|
||||
Revises: ${down_revision | comma,n}
|
||||
Create Date: ${create_date}
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
${imports if imports else ""}
|
||||
|
||||
revision: str = ${repr(up_revision)}
|
||||
down_revision: Union[str, None] = ${repr(down_revision)}
|
||||
branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
|
||||
depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
${upgrades if upgrades else "pass"}
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
${downgrades if downgrades else "pass"}
|
||||
@@ -0,0 +1,66 @@
|
||||
"""Create platform tables with forced RLS.
|
||||
|
||||
Revision ID: 20261117_0001
|
||||
Revises:
|
||||
Create Date: 2026-11-17
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision: str = "20261117_0001"
|
||||
down_revision: Union[str, None] = None
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
APP_ROLE = "watchman_app"
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# gen_random_uuid() is built into PostgreSQL 13+; no pgcrypto required.
|
||||
op.create_table(
|
||||
"audit_events",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), primary_key=True),
|
||||
sa.Column("tenant_id", sa.String(length=64), nullable=False),
|
||||
sa.Column("action", sa.String(length=128), nullable=False),
|
||||
sa.Column("payload", postgresql.JSONB(astext_type=sa.Text()), server_default=sa.text("'{}'::jsonb"), nullable=False),
|
||||
sa.Column("idempotency_key", sa.String(length=128), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False),
|
||||
sa.UniqueConstraint("tenant_id", "idempotency_key", name="uq_audit_events_tenant_idem"),
|
||||
)
|
||||
op.create_table(
|
||||
"run_records",
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), primary_key=True),
|
||||
sa.Column("tenant_id", sa.String(length=64), nullable=False),
|
||||
sa.Column("kind", sa.String(length=128), nullable=False),
|
||||
sa.Column("status", sa.String(length=64), nullable=False),
|
||||
sa.Column("detail", postgresql.JSONB(astext_type=sa.Text()), server_default=sa.text("'{}'::jsonb"), nullable=False),
|
||||
sa.Column("idempotency_key", sa.String(length=128), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False),
|
||||
sa.UniqueConstraint("tenant_id", "idempotency_key", name="uq_run_records_tenant_idem"),
|
||||
)
|
||||
|
||||
for table in ("audit_events", "run_records"):
|
||||
op.execute(f"ALTER TABLE {table} ENABLE ROW LEVEL SECURITY")
|
||||
op.execute(f"ALTER TABLE {table} FORCE ROW LEVEL SECURITY")
|
||||
op.execute(
|
||||
f"""
|
||||
CREATE POLICY tenant_isolation ON {table}
|
||||
FOR ALL
|
||||
TO {APP_ROLE}
|
||||
USING (tenant_id = current_setting('app.tenant_id', true))
|
||||
WITH CHECK (tenant_id = current_setting('app.tenant_id', true))
|
||||
"""
|
||||
)
|
||||
op.execute(f"GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE {table} TO {APP_ROLE}")
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
for table in ("run_records", "audit_events"):
|
||||
op.execute(f"DROP POLICY IF EXISTS tenant_isolation ON {table}")
|
||||
op.drop_table(table)
|
||||
@@ -0,0 +1,61 @@
|
||||
"""Create tenant-scoped Watchman authentication sessions.
|
||||
|
||||
Revision ID: 20261117_0002
|
||||
Revises: 20261117_0001
|
||||
Create Date: 2026-11-17
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision: str = "20261117_0002"
|
||||
down_revision: Union[str, None] = "20261117_0001"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
APP_ROLE = "watchman_app"
|
||||
TABLE_NAME = "auth_sessions"
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Create the session table without storing credentials or raw tokens."""
|
||||
op.create_table(
|
||||
TABLE_NAME,
|
||||
sa.Column("token_hash", sa.String(length=64), primary_key=True),
|
||||
sa.Column("subject", sa.String(length=255), nullable=False),
|
||||
sa.Column("issuer", sa.String(length=512), nullable=False),
|
||||
sa.Column("display_name", sa.String(length=255), nullable=False),
|
||||
sa.Column(
|
||||
"role_snapshot",
|
||||
postgresql.JSONB(astext_type=sa.Text()),
|
||||
server_default=sa.text("'[]'::jsonb"),
|
||||
nullable=False,
|
||||
),
|
||||
sa.Column("role_checked_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("expires_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("tenant_id", sa.String(length=64), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False),
|
||||
)
|
||||
op.execute(f"ALTER TABLE {TABLE_NAME} ENABLE ROW LEVEL SECURITY")
|
||||
op.execute(f"ALTER TABLE {TABLE_NAME} FORCE ROW LEVEL SECURITY")
|
||||
op.execute(
|
||||
f"""
|
||||
CREATE POLICY tenant_isolation ON {TABLE_NAME}
|
||||
FOR ALL
|
||||
TO {APP_ROLE}
|
||||
USING (tenant_id = current_setting('app.tenant_id', true))
|
||||
WITH CHECK (tenant_id = current_setting('app.tenant_id', true))
|
||||
"""
|
||||
)
|
||||
op.execute(f"GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE {TABLE_NAME} TO {APP_ROLE}")
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Remove the auth session RLS policy and table."""
|
||||
op.execute(f"DROP POLICY IF EXISTS tenant_isolation ON {TABLE_NAME}")
|
||||
op.drop_table(TABLE_NAME)
|
||||
@@ -0,0 +1,31 @@
|
||||
"""Store the Casdoor login name used to refresh roles.
|
||||
|
||||
Revision ID: 20261117_0003
|
||||
Revises: 20261117_0002
|
||||
Create Date: 2026-11-17
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision: str = "20261117_0003"
|
||||
down_revision: Union[str, None] = "20261117_0002"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Add the non-secret login name required to reload Casdoor roles."""
|
||||
op.add_column(
|
||||
"auth_sessions",
|
||||
sa.Column("login_name", sa.String(length=255), nullable=False, server_default=""),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Remove the login name column."""
|
||||
op.drop_column("auth_sessions", "login_name")
|
||||
@@ -0,0 +1,28 @@
|
||||
[project]
|
||||
name = "watchman"
|
||||
version = "0.1.0"
|
||||
description = "Watchman modular monolith service package"
|
||||
requires-python = ">=3.12,<3.13"
|
||||
dependencies = [
|
||||
"fastapi>=0.115,<1",
|
||||
"uvicorn[standard]>=0.32,<1",
|
||||
"pydantic>=2.10,<3",
|
||||
"pydantic-settings>=2.6,<3",
|
||||
"sqlalchemy>=2.0.36,<2.1",
|
||||
"alembic>=1.14,<2",
|
||||
"psycopg[binary]>=3.2,<4",
|
||||
"celery>=5.4,<6",
|
||||
"python-dotenv>=1.0,<2",
|
||||
"pyjwt[crypto]>=2.10,<3",
|
||||
]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["src/watchman"]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = ["tests"]
|
||||
pythonpath = ["src"]
|
||||
@@ -0,0 +1,105 @@
|
||||
"""Bootstrap a local Watchman database and constrained roles.
|
||||
|
||||
Reads bootstrap credentials from environment / .env.local.
|
||||
Never prints password values.
|
||||
|
||||
LIMITATION: PostgreSQL DDL cannot bind PASSWORD / role / database identifiers,
|
||||
so passwords are embedded in statement text via psycopg.sql.Literal. If the
|
||||
local server has log_statement=all (or equivalent), those statements may land
|
||||
in Postgres server logs. Use only for local bootstrap; never against shared
|
||||
production clusters.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from psycopg import sql
|
||||
from sqlalchemy import create_engine, text
|
||||
|
||||
|
||||
def _load_env() -> None:
|
||||
root = Path(__file__).resolve().parents[3]
|
||||
sys.path.insert(0, str(root / "services" / "watchman" / "src"))
|
||||
from watchman.core.config import merge_layered_env, _repo_root
|
||||
|
||||
# Apply layered file values for bootstrap CLI without clobbering real process env.
|
||||
for key, value in merge_layered_env(_repo_root()).items():
|
||||
os.environ.setdefault(key, value)
|
||||
|
||||
|
||||
def _upsert_role(conn, role: str, password: str) -> None:
|
||||
"""Create or update a non-superuser login role."""
|
||||
role_exists = conn.execute(
|
||||
text("SELECT 1 FROM pg_roles WHERE rolname = :name"),
|
||||
{"name": role},
|
||||
).scalar()
|
||||
# PASSWORD cannot use bind parameters in PostgreSQL DDL.
|
||||
statement = sql.SQL(
|
||||
"{verb} ROLE {role} WITH LOGIN PASSWORD {password} "
|
||||
"NOSUPERUSER NOCREATEDB NOCREATEROLE NOBYPASSRLS"
|
||||
).format(
|
||||
verb=sql.SQL("ALTER" if role_exists else "CREATE"),
|
||||
role=sql.Identifier(role),
|
||||
password=sql.Literal(password),
|
||||
)
|
||||
raw = conn.connection.driver_connection
|
||||
with raw.cursor() as cur:
|
||||
cur.execute(statement)
|
||||
print(f"{'updated' if role_exists else 'created'} role {role}")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
_load_env()
|
||||
bootstrap_url = os.environ.get(
|
||||
"WATCHMAN_BOOTSTRAP_DATABASE_URL",
|
||||
"postgresql+psycopg://postgres:postgres@127.0.0.1:5432/postgres",
|
||||
)
|
||||
db_name = os.environ.get("WATCHMAN_DATABASE_NAME", "watchman")
|
||||
migrator_user = os.environ.get("WATCHMAN_MIGRATOR_USER", "watchman_migrator")
|
||||
migrator_password = os.environ.get("WATCHMAN_MIGRATOR_PASSWORD")
|
||||
app_user = os.environ.get("WATCHMAN_APP_USER", "watchman_app")
|
||||
app_password = os.environ.get("WATCHMAN_APP_PASSWORD")
|
||||
missing = [
|
||||
name
|
||||
for name, value in (
|
||||
("WATCHMAN_MIGRATOR_PASSWORD", migrator_password),
|
||||
("WATCHMAN_APP_PASSWORD", app_password),
|
||||
)
|
||||
if not value or value == "CHANGE-ME"
|
||||
]
|
||||
if missing:
|
||||
raise SystemExit(f"missing required env keys: {', '.join(missing)}")
|
||||
|
||||
engine = create_engine(bootstrap_url, isolation_level="AUTOCOMMIT")
|
||||
with engine.connect() as conn:
|
||||
exists = conn.execute(
|
||||
text("SELECT 1 FROM pg_database WHERE datname = :name"),
|
||||
{"name": db_name},
|
||||
).scalar()
|
||||
if not exists:
|
||||
conn.execute(text(f'CREATE DATABASE "{db_name}"'))
|
||||
print(f"created database {db_name}")
|
||||
else:
|
||||
print(f"database {db_name} already exists")
|
||||
|
||||
_upsert_role(conn, migrator_user, migrator_password)
|
||||
_upsert_role(conn, app_user, app_password)
|
||||
|
||||
db_url = bootstrap_url.rsplit("/", 1)[0] + f"/{db_name}"
|
||||
db_engine = create_engine(db_url, isolation_level="AUTOCOMMIT")
|
||||
with db_engine.connect() as conn:
|
||||
conn.execute(text(f'GRANT CONNECT ON DATABASE "{db_name}" TO "{migrator_user}"'))
|
||||
conn.execute(text(f'GRANT CONNECT ON DATABASE "{db_name}" TO "{app_user}"'))
|
||||
conn.execute(text(f'GRANT CREATE ON DATABASE "{db_name}" TO "{migrator_user}"'))
|
||||
conn.execute(text(f'GRANT USAGE, CREATE ON SCHEMA public TO "{migrator_user}"'))
|
||||
conn.execute(text(f'GRANT USAGE ON SCHEMA public TO "{app_user}"'))
|
||||
# Migrator owns the schema objects it creates; app role remains non-owner.
|
||||
conn.execute(text(f'ALTER SCHEMA public OWNER TO "{migrator_user}"'))
|
||||
print("granted schema privileges")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,7 @@
|
||||
"""Watchman service package.
|
||||
|
||||
Owns the modular-monolith runtime for API, worker, and beat processes.
|
||||
Does not own business modules such as alarms or notifications.
|
||||
"""
|
||||
|
||||
__version__ = "0.1.0"
|
||||
@@ -0,0 +1,53 @@
|
||||
"""Process entrypoints for the Watchman service package.
|
||||
|
||||
Chooses API, worker, or beat from the first CLI argument.
|
||||
Business task registration is out of scope for M01.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import platform
|
||||
import sys
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""Dispatch the requested process role."""
|
||||
if len(sys.argv) < 2:
|
||||
raise SystemExit("usage: python -m watchman <api|worker|beat>")
|
||||
|
||||
role = sys.argv[1]
|
||||
from watchman.core.config import ensure_runtime_config, get_settings
|
||||
|
||||
ensure_runtime_config()
|
||||
if role == "api":
|
||||
import uvicorn
|
||||
|
||||
settings = get_settings()
|
||||
uvicorn.run(
|
||||
"watchman.api.app:create_app",
|
||||
factory=True,
|
||||
host=settings.api_host,
|
||||
port=settings.api_port,
|
||||
reload=False,
|
||||
)
|
||||
return
|
||||
if role == "worker":
|
||||
from watchman.jobs.celery_app import celery_app
|
||||
|
||||
argv = ["worker", "--loglevel=INFO"]
|
||||
# Prefork pool is unreliable on native Windows; containers use Linux prefork.
|
||||
if platform.system() == "Windows":
|
||||
argv.extend(["--pool=solo"])
|
||||
celery_app.worker_main(argv=argv)
|
||||
return
|
||||
if role == "beat":
|
||||
from watchman.jobs.celery_app import celery_app
|
||||
|
||||
# M01 registers no business schedules; beat must still be startable.
|
||||
celery_app.start(argv=["beat", "--loglevel=INFO"])
|
||||
return
|
||||
raise SystemExit(f"unknown role: {role}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,5 @@
|
||||
"""HTTP API layer.
|
||||
|
||||
Reads parameters, enforces permissions later in M02, and calls services.
|
||||
Must not hand-write error JSON responses.
|
||||
"""
|
||||
@@ -0,0 +1,125 @@
|
||||
"""FastAPI application factory.
|
||||
|
||||
Registers envelope middleware and global exception handlers.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi import FastAPI, Request
|
||||
from fastapi.exceptions import RequestValidationError
|
||||
from fastapi.responses import JSONResponse
|
||||
from starlette.middleware.base import BaseHTTPMiddleware
|
||||
|
||||
from watchman.api.routes import auth, health, platform
|
||||
from watchman.core.config import ensure_runtime_config, get_settings, is_non_production
|
||||
from watchman.core.errors import AppError, ValidationError
|
||||
from watchman.core.request_id import REQUEST_ID_HEADER, resolve_request_id
|
||||
from watchman.core.response import error_body
|
||||
|
||||
|
||||
class RequestIdMiddleware(BaseHTTPMiddleware):
|
||||
"""Attach a request id to every response."""
|
||||
|
||||
async def dispatch(self, request: Request, call_next): # type: ignore[no-untyped-def]
|
||||
request_id = resolve_request_id(request.headers.get(REQUEST_ID_HEADER))
|
||||
request.state.request_id = request_id
|
||||
response = await call_next(request)
|
||||
response.headers[REQUEST_ID_HEADER] = request_id
|
||||
return response
|
||||
|
||||
|
||||
def _json_error(
|
||||
*,
|
||||
request: Request,
|
||||
status_code: int,
|
||||
code: int,
|
||||
message: str,
|
||||
details: dict | None = None,
|
||||
retryable: bool = False,
|
||||
permission_node: str | None = None,
|
||||
) -> JSONResponse:
|
||||
request_id = getattr(request.state, "request_id", resolve_request_id(None))
|
||||
body = error_body(
|
||||
code=code,
|
||||
message=message,
|
||||
request_id=request_id,
|
||||
details=details,
|
||||
retryable=retryable,
|
||||
permission_node=permission_node,
|
||||
)
|
||||
return JSONResponse(
|
||||
status_code=status_code,
|
||||
content=body,
|
||||
headers={REQUEST_ID_HEADER: request_id},
|
||||
)
|
||||
|
||||
|
||||
def create_app(*, validate_runtime: bool = True) -> FastAPI:
|
||||
"""Create the Watchman API app.
|
||||
|
||||
Args:
|
||||
validate_runtime: When True, fail fast if required env keys are missing.
|
||||
Tests that only exercise envelope handlers may disable this.
|
||||
"""
|
||||
if validate_runtime:
|
||||
ensure_runtime_config()
|
||||
settings = get_settings()
|
||||
expose_docs = is_non_production(settings)
|
||||
docs_url = "/docs" if expose_docs else None
|
||||
openapi_url = "/openapi.json" if expose_docs else None
|
||||
app = FastAPI(
|
||||
title=settings.app_name,
|
||||
docs_url=docs_url,
|
||||
redoc_url=None,
|
||||
openapi_url=openapi_url,
|
||||
)
|
||||
app.add_middleware(RequestIdMiddleware)
|
||||
app.include_router(health.router)
|
||||
app.include_router(auth.router)
|
||||
app.include_router(platform.router)
|
||||
|
||||
@app.exception_handler(AppError)
|
||||
async def app_error_handler(request: Request, exc: AppError) -> JSONResponse:
|
||||
return _json_error(
|
||||
request=request,
|
||||
status_code=exc.http_status,
|
||||
code=exc.code,
|
||||
message=exc.message,
|
||||
details=exc.details,
|
||||
retryable=exc.retryable,
|
||||
permission_node=exc.permission_node,
|
||||
)
|
||||
|
||||
@app.exception_handler(RequestValidationError)
|
||||
async def validation_handler(request: Request, exc: RequestValidationError) -> JSONResponse:
|
||||
return _json_error(
|
||||
request=request,
|
||||
status_code=400,
|
||||
code=40000,
|
||||
message="Validation failed",
|
||||
details={"errors": exc.errors()},
|
||||
)
|
||||
|
||||
@app.exception_handler(Exception)
|
||||
async def unhandled_handler(request: Request, exc: Exception) -> JSONResponse:
|
||||
# GUARD: never leak stack traces or SQL to clients.
|
||||
return _json_error(
|
||||
request=request,
|
||||
status_code=500,
|
||||
code=50000,
|
||||
message="Internal server error",
|
||||
retryable=True,
|
||||
)
|
||||
|
||||
if is_non_production(settings):
|
||||
@app.get("/_probe/validation-error")
|
||||
async def probe_validation_error(request: Request) -> JSONResponse:
|
||||
"""Test-only path that forces a 40000 envelope via AppError."""
|
||||
raise ValidationError("Name is required", details={"field": "name"})
|
||||
|
||||
@app.get("/_probe/boom")
|
||||
async def probe_boom() -> dict[str, str]:
|
||||
"""Test-only path that forces an unhandled 50000 envelope."""
|
||||
raise RuntimeError("boom")
|
||||
|
||||
return app
|
||||
@@ -0,0 +1 @@
|
||||
"""HTTP route modules."""
|
||||
@@ -0,0 +1,148 @@
|
||||
"""Password login, HXOPS entry, current-user, and logout endpoints.
|
||||
|
||||
These routes establish Watchman sessions. Platform writes are authorized separately.
|
||||
Depends on injectable Casdoor and session-store ports plus the standard response envelope.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi import APIRouter, Cookie, Depends, Request
|
||||
from fastapi.responses import JSONResponse
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from watchman.auth.casdoor import CasdoorPort, get_casdoor_port
|
||||
from watchman.auth.hxops import HxopsAssertionLogin, get_hxops_login
|
||||
from watchman.auth.sessions import (
|
||||
SESSION_COOKIE_NAME,
|
||||
SESSION_LIFETIME,
|
||||
SessionStore,
|
||||
get_session_store,
|
||||
hash_cookie_token,
|
||||
issue_cookie_token,
|
||||
read_session_token,
|
||||
utc_now,
|
||||
)
|
||||
from watchman.core.errors import UnauthorizedError
|
||||
from watchman.core.response import success_body
|
||||
|
||||
router = APIRouter(prefix="/auth", tags=["auth"])
|
||||
|
||||
|
||||
class PasswordLoginRequest(BaseModel):
|
||||
"""Password-login input passed only to the injectable Casdoor port."""
|
||||
|
||||
username: str = Field(min_length=1)
|
||||
password: str = Field(min_length=1)
|
||||
|
||||
|
||||
class HxopsEntryRequest(BaseModel):
|
||||
"""One short-lived HXOPS assertion. It is not stored."""
|
||||
|
||||
assertion: str = Field(min_length=1)
|
||||
|
||||
|
||||
def _public_identity(row: object, *, access_token: str | None = None) -> dict[str, object]:
|
||||
"""Map stored session data to the fields the browser is allowed to keep."""
|
||||
data: dict[str, object] = {
|
||||
"subject": row.subject, # type: ignore[attr-defined]
|
||||
"display_name": row.display_name, # type: ignore[attr-defined]
|
||||
"login_name": row.login_name, # type: ignore[attr-defined]
|
||||
"roles": list(row.role_snapshot), # type: ignore[attr-defined]
|
||||
}
|
||||
if access_token is not None:
|
||||
data["access_token"] = access_token
|
||||
data["token_type"] = "Bearer"
|
||||
data["expires_in"] = int(SESSION_LIFETIME.total_seconds())
|
||||
return data
|
||||
|
||||
|
||||
def _session_response(request: Request, row: object, token: str) -> JSONResponse:
|
||||
"""Return the session token for the frontend and set the HttpOnly cookie."""
|
||||
response = JSONResponse(
|
||||
content=success_body(
|
||||
_public_identity(row, access_token=token),
|
||||
request_id=request.state.request_id,
|
||||
)
|
||||
)
|
||||
response.set_cookie(
|
||||
key=SESSION_COOKIE_NAME,
|
||||
value=token,
|
||||
httponly=True,
|
||||
samesite="lax",
|
||||
path="/",
|
||||
)
|
||||
return response
|
||||
|
||||
|
||||
@router.post("/login")
|
||||
def login(
|
||||
request: Request,
|
||||
body: PasswordLoginRequest,
|
||||
casdoor: CasdoorPort = Depends(get_casdoor_port),
|
||||
sessions: SessionStore = Depends(get_session_store),
|
||||
) -> JSONResponse:
|
||||
"""Verify submitted credentials, create a server-side session, and set its HttpOnly cookie."""
|
||||
identity = casdoor.authenticate_password(username=body.username, password=body.password)
|
||||
token = issue_cookie_token()
|
||||
row = sessions.create(
|
||||
token_hash=hash_cookie_token(token),
|
||||
identity=identity,
|
||||
now=utc_now(),
|
||||
login_name=body.username,
|
||||
)
|
||||
return _session_response(request, row, token)
|
||||
|
||||
|
||||
@router.post("/hxops-entry")
|
||||
def hxops_entry(
|
||||
request: Request,
|
||||
body: HxopsEntryRequest,
|
||||
entry: HxopsAssertionLogin = Depends(get_hxops_login),
|
||||
sessions: SessionStore = Depends(get_session_store),
|
||||
) -> JSONResponse:
|
||||
"""Verify an HXOPS assertion and open the same kind of session as password login.
|
||||
|
||||
Roles are loaded by the entry service. The assertion body is not written to the session.
|
||||
"""
|
||||
identity, login_name = entry.authenticate(body.assertion)
|
||||
token = issue_cookie_token()
|
||||
row = sessions.create(
|
||||
token_hash=hash_cookie_token(token),
|
||||
identity=identity,
|
||||
now=utc_now(),
|
||||
login_name=login_name,
|
||||
)
|
||||
return _session_response(request, row, token)
|
||||
|
||||
|
||||
@router.get("/me")
|
||||
def current_user(
|
||||
request: Request,
|
||||
session_token: str | None = Cookie(default=None, alias=SESSION_COOKIE_NAME),
|
||||
sessions: SessionStore = Depends(get_session_store),
|
||||
) -> JSONResponse:
|
||||
"""Return the current public identity only when a non-expired server session exists."""
|
||||
token = read_session_token(request, session_token)
|
||||
if token is None:
|
||||
raise UnauthorizedError()
|
||||
row = sessions.get(token_hash=hash_cookie_token(token), now=utc_now())
|
||||
if row is None:
|
||||
raise UnauthorizedError()
|
||||
return JSONResponse(content=success_body(_public_identity(row), request_id=request.state.request_id))
|
||||
|
||||
|
||||
@router.post("/logout")
|
||||
def logout(
|
||||
request: Request,
|
||||
session_token: str | None = Cookie(default=None, alias=SESSION_COOKIE_NAME),
|
||||
sessions: SessionStore = Depends(get_session_store),
|
||||
) -> JSONResponse:
|
||||
"""Invalidate this Watchman session and remove its browser cookie."""
|
||||
token = read_session_token(request, session_token)
|
||||
if token is not None:
|
||||
sessions.invalidate(token_hash=hash_cookie_token(token))
|
||||
response = JSONResponse(
|
||||
content=success_body({"logged_out": True}, request_id=request.state.request_id)
|
||||
)
|
||||
response.delete_cookie(key=SESSION_COOKIE_NAME, path="/")
|
||||
return response
|
||||
@@ -0,0 +1,22 @@
|
||||
"""Health check route.
|
||||
|
||||
Reports process liveness only. Must not touch the database or return secrets.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi import APIRouter, Request
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
from watchman.core.response import success_body
|
||||
from watchman.services.health import get_health
|
||||
|
||||
router = APIRouter(tags=["health"])
|
||||
|
||||
|
||||
@router.get("/health")
|
||||
async def health(request: Request) -> JSONResponse:
|
||||
"""Return a success envelope for process liveness."""
|
||||
request_id = request.state.request_id
|
||||
payload = get_health()
|
||||
return JSONResponse(content=success_body(payload, request_id=request_id))
|
||||
@@ -0,0 +1,81 @@
|
||||
"""Minimal platform write routes for M01 foundation.
|
||||
|
||||
These endpoints exist to exercise RLS and idempotency. They are not business APIs.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from fastapi import APIRouter, Depends, Header, Request
|
||||
from fastapi.responses import JSONResponse
|
||||
from pydantic import BaseModel, Field
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from watchman.auth.principal import require_platform_writer
|
||||
from watchman.core.db import get_db_session
|
||||
from watchman.core.response import success_body
|
||||
from watchman.services.platform_records import create_audit_event, create_run_record
|
||||
|
||||
router = APIRouter(prefix="/platform", tags=["platform"])
|
||||
|
||||
|
||||
class AuditCreateRequest(BaseModel):
|
||||
action: str = Field(min_length=1, max_length=128)
|
||||
payload: dict[str, Any] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class RunCreateRequest(BaseModel):
|
||||
kind: str = Field(min_length=1, max_length=128)
|
||||
status: str = Field(min_length=1, max_length=64)
|
||||
detail: dict[str, Any] = Field(default_factory=dict)
|
||||
|
||||
|
||||
@router.post("/audit-events")
|
||||
def post_audit_event(
|
||||
request: Request,
|
||||
body: AuditCreateRequest,
|
||||
_: None = Depends(require_platform_writer),
|
||||
session: Session = Depends(get_db_session),
|
||||
x_idempotency_key: str | None = Header(default=None, alias="x-idempotency-key"),
|
||||
) -> JSONResponse:
|
||||
"""Create an audit event under the server-configured tenant."""
|
||||
row = create_audit_event(
|
||||
session,
|
||||
action=body.action,
|
||||
payload=body.payload,
|
||||
idempotency_key=x_idempotency_key,
|
||||
)
|
||||
data = {
|
||||
"id": str(row.id),
|
||||
"action": row.action,
|
||||
"idempotency_key": row.idempotency_key,
|
||||
}
|
||||
session.commit()
|
||||
return JSONResponse(content=success_body(data, request_id=request.state.request_id))
|
||||
|
||||
|
||||
@router.post("/run-records")
|
||||
def post_run_record(
|
||||
request: Request,
|
||||
body: RunCreateRequest,
|
||||
_: None = Depends(require_platform_writer),
|
||||
session: Session = Depends(get_db_session),
|
||||
x_idempotency_key: str | None = Header(default=None, alias="x-idempotency-key"),
|
||||
) -> JSONResponse:
|
||||
"""Create a run record under the server-configured tenant."""
|
||||
row = create_run_record(
|
||||
session,
|
||||
kind=body.kind,
|
||||
status=body.status,
|
||||
detail=body.detail,
|
||||
idempotency_key=x_idempotency_key,
|
||||
)
|
||||
data = {
|
||||
"id": str(row.id),
|
||||
"kind": row.kind,
|
||||
"status": row.status,
|
||||
"idempotency_key": row.idempotency_key,
|
||||
}
|
||||
session.commit()
|
||||
return JSONResponse(content=success_body(data, request_id=request.state.request_id))
|
||||
@@ -0,0 +1,3 @@
|
||||
"""Authentication primitives for verified Watchman identities.
|
||||
Only local token verification belongs here; sessions and external identity calls do not.
|
||||
Depends on watchman.core.errors for authentication failures."""
|
||||
@@ -0,0 +1,48 @@
|
||||
"""Role checks for the three Watchman permission nodes.
|
||||
|
||||
Decides enter, platform write, and object read from Casdoor role names.
|
||||
Depends on semantic errors only; it does not call Casdoor or open a session.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from watchman.core.errors import ForbiddenError
|
||||
|
||||
ENTER_NODE = "perm:app:emp:watchman.enter"
|
||||
PLATFORM_WRITE_NODE = "perm:data:emp:watchman.platform.write"
|
||||
OBJECT_READ_NODE = "perm:data:emp:watchman.object.read"
|
||||
|
||||
ROLE_ADMIN = "watchman-admin"
|
||||
ROLE_OPERATOR = "watchman-operator"
|
||||
ROLE_VIEWER = "watchman-viewer"
|
||||
# GUARD: empty roles must never be treated as viewer. Do not add other names here.
|
||||
ENTER_ROLES = frozenset({ROLE_ADMIN, ROLE_OPERATOR, ROLE_VIEWER})
|
||||
|
||||
|
||||
def allows_enter(role_names: list[str]) -> bool:
|
||||
"""Return whether these roles may open the shell.
|
||||
|
||||
Any of the three Watchman roles is enough. An empty or unknown list is denied,
|
||||
and this function does not raise.
|
||||
"""
|
||||
return bool(ENTER_ROLES.intersection(role_names))
|
||||
|
||||
|
||||
def require_platform_write(role_names: list[str]) -> None:
|
||||
"""Allow a platform write only for watchman-admin.
|
||||
|
||||
Other roles, including viewer and operator, raise ForbiddenError with the
|
||||
platform write permission node.
|
||||
"""
|
||||
if ROLE_ADMIN not in role_names:
|
||||
raise ForbiddenError(permission_node=PLATFORM_WRITE_NODE)
|
||||
|
||||
|
||||
def require_object_access(role_names: list[str], object_id: str) -> None:
|
||||
"""Reject every object id until a later module grants row access.
|
||||
|
||||
M02 has no object grants, so admin and every other role are refused with
|
||||
the object-read permission node. The id is not used as proof of access.
|
||||
"""
|
||||
del role_names, object_id
|
||||
raise ForbiddenError(permission_node=OBJECT_READ_NODE)
|
||||
@@ -0,0 +1,225 @@
|
||||
"""Injectable Casdoor password-login port using OpenID Connect discovery."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
import json
|
||||
from typing import Protocol
|
||||
from urllib.error import HTTPError
|
||||
from urllib.parse import urlencode
|
||||
from urllib.request import Request, urlopen
|
||||
|
||||
from watchman.core.config import Settings, get_settings
|
||||
from watchman.core.errors import ServiceUnavailableError, UnauthorizedError
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class CasdoorIdentity:
|
||||
"""Verified identity returned by a Casdoor password-login adapter."""
|
||||
|
||||
subject: str
|
||||
issuer: str
|
||||
display_name: str
|
||||
role_names: list[str]
|
||||
|
||||
|
||||
class CasdoorPort(Protocol):
|
||||
"""Authenticate credentials through Casdoor without exposing upstream tokens."""
|
||||
|
||||
def authenticate_password(self, *, username: str, password: str) -> CasdoorIdentity:
|
||||
"""Return a verified identity or raise a semantic authentication/service error."""
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class HttpResponse:
|
||||
"""Minimal HTTP response used by the injectable Casdoor transport."""
|
||||
|
||||
status_code: int
|
||||
body: bytes
|
||||
|
||||
|
||||
class CasdoorHttpTransport(Protocol):
|
||||
"""Perform one HTTP request for the Casdoor adapter."""
|
||||
|
||||
def request(
|
||||
self,
|
||||
*,
|
||||
method: str,
|
||||
url: str,
|
||||
headers: dict[str, str],
|
||||
data: bytes | None = None,
|
||||
) -> HttpResponse:
|
||||
"""Return a response or raise a network exception."""
|
||||
|
||||
|
||||
class UrllibCasdoorHttpTransport:
|
||||
"""Production transport with a bounded timeout and no response logging."""
|
||||
|
||||
def request(
|
||||
self,
|
||||
*,
|
||||
method: str,
|
||||
url: str,
|
||||
headers: dict[str, str],
|
||||
data: bytes | None = None,
|
||||
) -> HttpResponse:
|
||||
request = Request(url, data=data, headers=headers, method=method)
|
||||
try:
|
||||
with urlopen(request, timeout=8) as response:
|
||||
return HttpResponse(status_code=response.status, body=response.read())
|
||||
except HTTPError as error:
|
||||
return HttpResponse(status_code=error.code, body=error.read())
|
||||
|
||||
|
||||
class DefaultCasdoorPort:
|
||||
"""Authenticate passwords through Casdoor's discovered OpenID Connect endpoints."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
settings: Settings | None = None,
|
||||
transport: CasdoorHttpTransport | None = None,
|
||||
) -> None:
|
||||
self._settings = settings or get_settings()
|
||||
self._transport = transport or UrllibCasdoorHttpTransport()
|
||||
|
||||
def authenticate_password(self, *, username: str, password: str) -> CasdoorIdentity:
|
||||
"""Exchange credentials for a verified identity without retaining credentials or tokens."""
|
||||
configured = (
|
||||
self._settings.casdoor_endpoint
|
||||
and self._settings.casdoor_client_id
|
||||
and self._settings.casdoor_client_secret
|
||||
)
|
||||
# GUARD: never log password, client secret, or tokens.
|
||||
if not configured:
|
||||
raise ServiceUnavailableError("Casdoor login is unavailable")
|
||||
|
||||
try:
|
||||
discovery = self._json_response(
|
||||
self._transport.request(
|
||||
method="GET",
|
||||
url=f"{self._settings.casdoor_endpoint.rstrip('/')}/.well-known/openid-configuration",
|
||||
headers={"Accept": "application/json"},
|
||||
)
|
||||
)
|
||||
token_endpoint = self._required_endpoint(discovery, "token_endpoint")
|
||||
userinfo_endpoint = self._required_endpoint(discovery, "userinfo_endpoint")
|
||||
token_response = self._transport.request(
|
||||
method="POST",
|
||||
url=token_endpoint,
|
||||
headers={
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
data=urlencode(
|
||||
{
|
||||
"grant_type": "password",
|
||||
"username": username,
|
||||
"password": password,
|
||||
"client_id": self._settings.casdoor_client_id,
|
||||
"client_secret": self._settings.casdoor_client_secret,
|
||||
"scope": "openid profile email",
|
||||
}
|
||||
).encode("utf-8"),
|
||||
)
|
||||
except UnauthorizedError:
|
||||
raise
|
||||
except Exception as error:
|
||||
raise ServiceUnavailableError("Casdoor login is unavailable") from error
|
||||
|
||||
token_body = self._decode_json(token_response.body)
|
||||
if self._is_credential_rejection(token_response, token_body):
|
||||
raise UnauthorizedError("Invalid username or password")
|
||||
if token_response.status_code < 200 or token_response.status_code >= 300:
|
||||
raise ServiceUnavailableError("Casdoor login is unavailable")
|
||||
|
||||
access_token = token_body.get("access_token")
|
||||
if not isinstance(access_token, str) or not access_token:
|
||||
raise ServiceUnavailableError("Casdoor login is unavailable")
|
||||
|
||||
try:
|
||||
userinfo_response = self._transport.request(
|
||||
method="GET",
|
||||
url=userinfo_endpoint,
|
||||
headers={
|
||||
"Accept": "application/json",
|
||||
"Authorization": f"Bearer {access_token}",
|
||||
},
|
||||
)
|
||||
except Exception as error:
|
||||
raise ServiceUnavailableError("Casdoor login is unavailable") from error
|
||||
|
||||
userinfo = self._decode_json(userinfo_response.body)
|
||||
if userinfo_response.status_code in {400, 401}:
|
||||
raise UnauthorizedError("Invalid username or password")
|
||||
if userinfo_response.status_code < 200 or userinfo_response.status_code >= 300:
|
||||
raise ServiceUnavailableError("Casdoor login is unavailable")
|
||||
|
||||
subject = userinfo.get("sub")
|
||||
if not isinstance(subject, str) or not subject:
|
||||
raise UnauthorizedError("Invalid username or password")
|
||||
display_name = userinfo.get("name") or userinfo.get("preferred_username") or username
|
||||
return CasdoorIdentity(
|
||||
subject=subject,
|
||||
issuer=self._settings.casdoor_issuer or self._settings.casdoor_endpoint,
|
||||
display_name=display_name if isinstance(display_name, str) else username,
|
||||
role_names=self._role_names(userinfo.get("roles")),
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _json_response(response: HttpResponse) -> dict[str, object]:
|
||||
"""Require a successful JSON discovery response."""
|
||||
if response.status_code < 200 or response.status_code >= 300:
|
||||
raise ServiceUnavailableError("Casdoor login is unavailable")
|
||||
return DefaultCasdoorPort._decode_json(response.body)
|
||||
|
||||
@staticmethod
|
||||
def _decode_json(body: bytes) -> dict[str, object]:
|
||||
"""Decode a JSON object without including upstream response content in errors."""
|
||||
try:
|
||||
decoded = json.loads(body)
|
||||
except (TypeError, UnicodeDecodeError, json.JSONDecodeError) as error:
|
||||
raise ServiceUnavailableError("Casdoor login is unavailable") from error
|
||||
if not isinstance(decoded, dict):
|
||||
raise ServiceUnavailableError("Casdoor login is unavailable")
|
||||
return decoded
|
||||
|
||||
@staticmethod
|
||||
def _required_endpoint(document: dict[str, object], key: str) -> str:
|
||||
"""Read a non-empty endpoint URL from the discovery document."""
|
||||
endpoint = document.get(key)
|
||||
if not isinstance(endpoint, str) or not endpoint:
|
||||
raise ServiceUnavailableError("Casdoor login is unavailable")
|
||||
return endpoint
|
||||
|
||||
@staticmethod
|
||||
def _is_credential_rejection(response: HttpResponse, payload: dict[str, object]) -> bool:
|
||||
"""Recognize password-grant rejection without exposing upstream text."""
|
||||
error = payload.get("error")
|
||||
if error in {"unsupported_grant_type", "invalid_client", "server_error"}:
|
||||
return False
|
||||
if error == "invalid_grant" or response.status_code in {400, 401}:
|
||||
return True
|
||||
description = payload.get("error_description")
|
||||
return (
|
||||
error == "invalid_request"
|
||||
and isinstance(description, str)
|
||||
and any(term in description.lower() for term in ("user", "username", "password", "credential"))
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _role_names(roles: object) -> list[str]:
|
||||
"""Extract configured role names while ignoring unsupported role shapes."""
|
||||
if not isinstance(roles, list):
|
||||
return []
|
||||
names: list[str] = []
|
||||
for role in roles:
|
||||
if isinstance(role, str):
|
||||
names.append(role)
|
||||
elif isinstance(role, dict) and isinstance(role.get("name"), str):
|
||||
names.append(role["name"])
|
||||
return names
|
||||
|
||||
|
||||
def get_casdoor_port() -> CasdoorPort:
|
||||
"""Provide the production port; tests override this dependency with a stand-in."""
|
||||
return DefaultCasdoorPort()
|
||||
@@ -0,0 +1,84 @@
|
||||
"""Accept a short-lived HXOPS assertion and turn it into a Watchman identity.
|
||||
|
||||
Verifies the assertion, then loads roles from Casdoor. Assertion permission claims are ignored.
|
||||
Depends on the RS256 verifier, settings, and a role directory.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi import Depends
|
||||
|
||||
from watchman.auth.casdoor import CasdoorIdentity
|
||||
from watchman.auth.principal import RoleDirectory, get_role_directory
|
||||
from watchman.auth.token_verifier import verify_rs256_token
|
||||
from watchman.core.config import Settings, get_settings
|
||||
from watchman.core.errors import ServiceUnavailableError, UnauthorizedError
|
||||
|
||||
|
||||
class HxopsAssertionLogin:
|
||||
"""Create a Casdoor identity from one HXOPS SSO assertion."""
|
||||
|
||||
def __init__(self, settings: Settings, directory: RoleDirectory) -> None:
|
||||
self._settings = settings
|
||||
self._directory = directory
|
||||
|
||||
def authenticate(self, assertion: str) -> tuple[CasdoorIdentity, str]:
|
||||
"""Return a Casdoor identity and login name, or refuse the assertion.
|
||||
|
||||
Missing HXOPS key material is unavailable. A bad signature, a missing
|
||||
Casdoor reference, or a local user id used as that reference is unauthorized.
|
||||
Roles come only from the directory. Directory failure does not create an identity.
|
||||
"""
|
||||
settings = self._settings
|
||||
if not (settings.hxops_sso_issuer and settings.hxops_sso_audience and settings.hxops_sso_public_key):
|
||||
raise ServiceUnavailableError("HXOPS entry is unavailable")
|
||||
claims = verify_rs256_token(
|
||||
assertion,
|
||||
public_key=settings.hxops_sso_public_key,
|
||||
issuer=settings.hxops_sso_issuer,
|
||||
audience=settings.hxops_sso_audience,
|
||||
)
|
||||
subject, issuer = _casdoor_reference(claims, expected_issuer=settings.casdoor_issuer)
|
||||
login_name = _login_name(claims)
|
||||
# GUARD: never copy roles, permissions, or tokens from the assertion.
|
||||
roles = self._directory.lookup_roles(login_name=login_name)
|
||||
display_name = claims.get("name") or claims.get("preferred_username") or login_name
|
||||
if not isinstance(display_name, str) or not display_name:
|
||||
display_name = login_name
|
||||
identity = CasdoorIdentity(
|
||||
subject=subject,
|
||||
issuer=issuer,
|
||||
display_name=display_name,
|
||||
role_names=list(roles),
|
||||
)
|
||||
return identity, login_name
|
||||
|
||||
|
||||
def _casdoor_reference(claims: dict[str, object], *, expected_issuer: str) -> tuple[str, str]:
|
||||
"""Read the explicit Casdoor subject. The HXOPS token subject is not that identity."""
|
||||
if not expected_issuer:
|
||||
raise ServiceUnavailableError("HXOPS entry is unavailable")
|
||||
issuer = claims.get("identity_issuer") or claims.get("casdoor_iss")
|
||||
if not isinstance(issuer, str) or issuer != expected_issuer:
|
||||
raise UnauthorizedError()
|
||||
subject = claims.get("casdoor_sub")
|
||||
if not isinstance(subject, str) or not subject:
|
||||
raise UnauthorizedError()
|
||||
local_id = claims.get("user_id")
|
||||
if local_id is not None and str(local_id) == subject:
|
||||
raise UnauthorizedError()
|
||||
return subject, issuer
|
||||
|
||||
|
||||
def _login_name(claims: dict[str, object]) -> str:
|
||||
"""Choose the Casdoor login name used for a later role refresh."""
|
||||
for key in ("preferred_username", "employee_id"):
|
||||
value = claims.get(key)
|
||||
if isinstance(value, str) and value:
|
||||
return value
|
||||
raise UnauthorizedError()
|
||||
|
||||
|
||||
def get_hxops_login(directory: RoleDirectory = Depends(get_role_directory)) -> HxopsAssertionLogin:
|
||||
"""Provide HXOPS entry from server settings. Tests replace this dependency."""
|
||||
return HxopsAssertionLogin(get_settings(), directory)
|
||||
@@ -0,0 +1,119 @@
|
||||
"""Reload Casdoor roles for a login name without keeping a user token.
|
||||
|
||||
Uses the application client to read one user. Tests replace the transport.
|
||||
Depends on settings and the shared HTTP transport used by password login.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import base64
|
||||
from datetime import timedelta
|
||||
from typing import Protocol
|
||||
from urllib.parse import quote
|
||||
|
||||
from fastapi import Cookie, Depends, Request
|
||||
|
||||
from watchman.auth.casdoor import DefaultCasdoorPort, UrllibCasdoorHttpTransport
|
||||
from watchman.auth.access import require_platform_write
|
||||
from watchman.auth.sessions import (
|
||||
SESSION_COOKIE_NAME,
|
||||
SessionStore,
|
||||
get_session_store,
|
||||
hash_cookie_token,
|
||||
read_session_token,
|
||||
utc_now,
|
||||
)
|
||||
from watchman.core.config import Settings, get_settings
|
||||
from watchman.core.errors import ServiceUnavailableError, UnauthorizedError
|
||||
|
||||
|
||||
class RoleDirectory(Protocol):
|
||||
"""Fetch the current role names for a Casdoor login name."""
|
||||
|
||||
def lookup_roles(self, *, login_name: str) -> list[str]:
|
||||
"""Return role names or raise ServiceUnavailableError. Never returns a token."""
|
||||
|
||||
|
||||
class CasdoorRoleDirectory:
|
||||
"""Read roles from Casdoor get-user using the application client."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
settings: Settings | None = None,
|
||||
transport: UrllibCasdoorHttpTransport | None = None,
|
||||
) -> None:
|
||||
self._settings = settings or get_settings()
|
||||
self._transport = transport or UrllibCasdoorHttpTransport()
|
||||
|
||||
def lookup_roles(self, *, login_name: str) -> list[str]:
|
||||
"""Load role names for organization/login_name.
|
||||
|
||||
Missing configuration, an empty login name, or a failed response raises
|
||||
ServiceUnavailableError and does not include credentials in the message.
|
||||
"""
|
||||
settings = self._settings
|
||||
# GUARD: never log the client secret or the Authorization header.
|
||||
if not (
|
||||
settings.casdoor_endpoint
|
||||
and settings.casdoor_client_id
|
||||
and settings.casdoor_client_secret
|
||||
and settings.casdoor_organization
|
||||
and login_name
|
||||
):
|
||||
raise ServiceUnavailableError("Casdoor login is unavailable")
|
||||
user_id = f"{quote(settings.casdoor_organization, safe='')}/{quote(login_name, safe='')}"
|
||||
url = f"{settings.casdoor_endpoint.rstrip('/')}/api/get-user?id={user_id}"
|
||||
basic = base64.b64encode(
|
||||
f"{settings.casdoor_client_id}:{settings.casdoor_client_secret}".encode()
|
||||
).decode("ascii")
|
||||
try:
|
||||
response = self._transport.request(
|
||||
method="GET",
|
||||
url=url,
|
||||
headers={"Accept": "application/json", "Authorization": f"Basic {basic}"},
|
||||
)
|
||||
except Exception as error:
|
||||
raise ServiceUnavailableError("Casdoor login is unavailable") from error
|
||||
if response.status_code < 200 or response.status_code >= 300:
|
||||
raise ServiceUnavailableError("Casdoor login is unavailable")
|
||||
payload = DefaultCasdoorPort._decode_json(response.body)
|
||||
if payload.get("status") == "error":
|
||||
raise ServiceUnavailableError("Casdoor login is unavailable")
|
||||
data = payload.get("data")
|
||||
if not isinstance(data, dict):
|
||||
raise ServiceUnavailableError("Casdoor login is unavailable")
|
||||
return DefaultCasdoorPort._role_names(data.get("roles"))
|
||||
|
||||
|
||||
def get_role_directory() -> RoleDirectory:
|
||||
"""Provide the production role lookup; tests override this dependency."""
|
||||
return CasdoorRoleDirectory()
|
||||
|
||||
|
||||
ROLE_FRESHNESS = timedelta(minutes=5)
|
||||
|
||||
|
||||
def require_platform_writer(
|
||||
request: Request,
|
||||
session_token: str | None = Cookie(default=None, alias=SESSION_COOKIE_NAME),
|
||||
sessions: SessionStore = Depends(get_session_store),
|
||||
directory: RoleDirectory = Depends(get_role_directory),
|
||||
) -> None:
|
||||
"""Reject a platform write unless a fresh watchman-admin session is present.
|
||||
|
||||
A missing or expired session is 41000. A stale role snapshot is reloaded from
|
||||
Casdoor; if that reload fails the write is refused with 503 and the old
|
||||
roles are not used. Any other role is 42000.
|
||||
"""
|
||||
token = read_session_token(request, session_token)
|
||||
if token is None:
|
||||
raise UnauthorizedError()
|
||||
now = utc_now()
|
||||
row = sessions.get(token_hash=hash_cookie_token(token), now=now)
|
||||
if row is None:
|
||||
raise UnauthorizedError()
|
||||
roles = list(row.role_snapshot)
|
||||
if now - row.role_checked_at >= ROLE_FRESHNESS:
|
||||
roles = directory.lookup_roles(login_name=row.login_name)
|
||||
sessions.update_roles(token_hash=row.token_hash, role_names=roles, now=now)
|
||||
require_platform_write(roles)
|
||||
@@ -0,0 +1,141 @@
|
||||
"""Session creation, lookup, and revocation for authenticated browsers.
|
||||
|
||||
Persists only token hashes and public identity snapshots through tenant-scoped SQLAlchemy sessions.
|
||||
Depends on the auth-session model and server-side Watchman settings.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import secrets
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from typing import Protocol
|
||||
|
||||
from fastapi import Depends, Request
|
||||
from sqlalchemy import delete, select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from watchman.auth.casdoor import CasdoorIdentity
|
||||
from watchman.core.config import get_settings
|
||||
from watchman.core.db import get_db_session
|
||||
from watchman.models.auth_session import AuthSession
|
||||
|
||||
SESSION_LIFETIME = timedelta(hours=8)
|
||||
SESSION_COOKIE_NAME = "watchman_session"
|
||||
|
||||
|
||||
class SessionStore(Protocol):
|
||||
"""Persist and retrieve browser sessions without exposing their raw cookie token."""
|
||||
|
||||
def create(
|
||||
self,
|
||||
*,
|
||||
token_hash: str,
|
||||
identity: CasdoorIdentity,
|
||||
now: datetime,
|
||||
login_name: str,
|
||||
) -> AuthSession:
|
||||
"""Store one identity snapshot and return its new session record."""
|
||||
|
||||
def get(self, *, token_hash: str, now: datetime) -> AuthSession | None:
|
||||
"""Return a live session or remove and hide an expired session."""
|
||||
|
||||
def invalidate(self, *, token_hash: str) -> None:
|
||||
"""Invalidate a browser session identified by its hashed cookie token."""
|
||||
|
||||
def update_roles(self, *, token_hash: str, role_names: list[str], now: datetime) -> None:
|
||||
"""Replace a live session's role snapshot after a successful Casdoor refresh."""
|
||||
|
||||
|
||||
class SqlAlchemySessionStore:
|
||||
"""Tenant-scoped session store backed by the application database session."""
|
||||
|
||||
def __init__(self, session: Session) -> None:
|
||||
self._session = session
|
||||
|
||||
def create(
|
||||
self,
|
||||
*,
|
||||
token_hash: str,
|
||||
identity: CasdoorIdentity,
|
||||
now: datetime,
|
||||
login_name: str,
|
||||
) -> AuthSession:
|
||||
"""Save a server-owned session using only the configured tenant identity."""
|
||||
row = AuthSession(
|
||||
token_hash=token_hash,
|
||||
subject=identity.subject,
|
||||
issuer=identity.issuer,
|
||||
display_name=identity.display_name,
|
||||
login_name=login_name,
|
||||
role_snapshot=list(identity.role_names),
|
||||
role_checked_at=now,
|
||||
expires_at=now + SESSION_LIFETIME,
|
||||
tenant_id=get_settings().tenant_id,
|
||||
)
|
||||
self._session.add(row)
|
||||
self._session.commit()
|
||||
return row
|
||||
|
||||
def get(self, *, token_hash: str, now: datetime) -> AuthSession | None:
|
||||
"""Read a live session and remove stale rows so expiry cannot be reused."""
|
||||
row = self._session.scalar(
|
||||
select(AuthSession).where(
|
||||
AuthSession.token_hash == token_hash,
|
||||
AuthSession.expires_at > now,
|
||||
)
|
||||
)
|
||||
if row is not None:
|
||||
return row
|
||||
self._session.execute(
|
||||
delete(AuthSession).where(
|
||||
AuthSession.token_hash == token_hash,
|
||||
AuthSession.expires_at <= now,
|
||||
)
|
||||
)
|
||||
self._session.commit()
|
||||
return None
|
||||
|
||||
def update_roles(self, *, token_hash: str, role_names: list[str], now: datetime) -> None:
|
||||
"""Persist a refreshed role snapshot without changing who the session belongs to."""
|
||||
row = self._session.scalar(select(AuthSession).where(AuthSession.token_hash == token_hash))
|
||||
if row is None:
|
||||
return
|
||||
row.role_snapshot = list(role_names)
|
||||
row.role_checked_at = now
|
||||
self._session.commit()
|
||||
|
||||
def invalidate(self, *, token_hash: str) -> None:
|
||||
"""Delete the row so logout takes effect before the cookie itself expires."""
|
||||
self._session.execute(delete(AuthSession).where(AuthSession.token_hash == token_hash))
|
||||
self._session.commit()
|
||||
|
||||
|
||||
def get_session_store(session: Session = Depends(get_db_session)) -> SessionStore:
|
||||
"""Provide the tenant-scoped SQLAlchemy store; tests replace this dependency."""
|
||||
return SqlAlchemySessionStore(session)
|
||||
|
||||
|
||||
def issue_cookie_token() -> str:
|
||||
"""Return an unguessable token that is sent only in the HttpOnly cookie."""
|
||||
return secrets.token_urlsafe(32)
|
||||
|
||||
|
||||
def hash_cookie_token(token: str) -> str:
|
||||
"""Hash a raw browser token before it is used as a database lookup key."""
|
||||
return hashlib.sha256(token.encode("utf-8")).hexdigest()
|
||||
|
||||
|
||||
def read_session_token(request: Request, cookie_token: str | None) -> str | None:
|
||||
"""Prefer the bearer token the browser stored, and fall back to the cookie."""
|
||||
authorization = request.headers.get("authorization", "")
|
||||
if authorization.lower().startswith("bearer "):
|
||||
token = authorization[7:].strip()
|
||||
if token:
|
||||
return token
|
||||
return cookie_token
|
||||
|
||||
|
||||
def utc_now() -> datetime:
|
||||
"""Return the current timezone-aware UTC instant for session expiry checks."""
|
||||
return datetime.now(timezone.utc)
|
||||
@@ -0,0 +1,63 @@
|
||||
"""Verify signed JWT identity assertions with local public keys.
|
||||
Only validates tokens; session creation and Casdoor communication remain outside this module.
|
||||
Depends on PyJWT and watchman.core.errors.UnauthorizedError."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from datetime import datetime, timezone
|
||||
from typing import Any
|
||||
|
||||
import jwt
|
||||
|
||||
from watchman.core.errors import UnauthorizedError
|
||||
|
||||
|
||||
def verify_rs256_token(
|
||||
token: str,
|
||||
*,
|
||||
public_key: str,
|
||||
issuer: str,
|
||||
audience: str,
|
||||
now: datetime | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Return claims only after local signature and identity checks succeed.
|
||||
|
||||
Inputs are an RS256 token, trusted public key, expected issuer/audience, and optional UTC clock;
|
||||
invalid signatures, algorithms, claims, or expiry raise UnauthorizedError without exposing details.
|
||||
"""
|
||||
current_time = now or datetime.now(timezone.utc)
|
||||
if current_time.tzinfo is None or current_time.utcoffset() is None:
|
||||
raise ValueError("now must be timezone-aware")
|
||||
|
||||
try:
|
||||
header = jwt.get_unverified_header(token)
|
||||
if header.get("alg") != "RS256":
|
||||
raise UnauthorizedError()
|
||||
claims = jwt.decode(
|
||||
token,
|
||||
public_key,
|
||||
# GUARD: RS256 only; never include none or HS*.
|
||||
algorithms=["RS256"],
|
||||
audience=audience,
|
||||
issuer=issuer,
|
||||
options={"require": ["exp"], "verify_exp": False},
|
||||
)
|
||||
_verify_expiration(claims, now=current_time)
|
||||
except (jwt.PyJWTError, TypeError, ValueError):
|
||||
raise UnauthorizedError() from None
|
||||
|
||||
return dict(claims)
|
||||
|
||||
|
||||
def _verify_expiration(claims: Mapping[str, Any], *, now: datetime) -> None:
|
||||
"""Reject expired or malformed expiry claims using the injected deterministic clock.
|
||||
|
||||
Input is a signature-verified claim mapping and UTC clock; returns only for a future numeric expiry;
|
||||
malformed, missing, or expired values raise ValueError for the public verifier to map to UnauthorizedError.
|
||||
"""
|
||||
expires_at = claims["exp"]
|
||||
if isinstance(expires_at, bool) or not isinstance(expires_at, int | float):
|
||||
raise ValueError("exp must be a numeric date")
|
||||
if expires_at <= now.timestamp():
|
||||
raise ValueError("token has expired")
|
||||
@@ -0,0 +1,5 @@
|
||||
"""Shared runtime primitives for Watchman.
|
||||
|
||||
Holds config, errors, response helpers, and database session utilities.
|
||||
Does not contain business domain services.
|
||||
"""
|
||||
@@ -0,0 +1,173 @@
|
||||
"""Layered environment configuration.
|
||||
|
||||
Load order for local development (highest wins):
|
||||
system env → .env.local → .env.dev → .env.shared → code defaults.
|
||||
|
||||
Secrets must never be committed. Prefer .env.local for machine-specific values.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from dotenv import dotenv_values
|
||||
from pydantic import Field
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
REQUIRED_RUNTIME_KEYS = (
|
||||
"DATABASE_URL",
|
||||
"DATABASE_MIGRATOR_URL",
|
||||
"WATCHMAN_TENANT_ID",
|
||||
)
|
||||
|
||||
|
||||
def _repo_root() -> Path:
|
||||
"""Resolve repository root from this file location."""
|
||||
# services/watchman/src/watchman/core/config.py -> repo root
|
||||
return Path(__file__).resolve().parents[5]
|
||||
|
||||
|
||||
def merge_layered_env(root: Path | None = None) -> dict[str, str]:
|
||||
"""Merge env files into a dict without mutating os.environ.
|
||||
|
||||
Later files override earlier ones. Process environment wins over files.
|
||||
"""
|
||||
base = root or _repo_root()
|
||||
merged: dict[str, str] = {}
|
||||
for name in (".env.shared", ".env.dev", ".env.local"):
|
||||
path = base / name
|
||||
if not path.exists():
|
||||
continue
|
||||
values = dotenv_values(path)
|
||||
for key, value in values.items():
|
||||
if value is None:
|
||||
continue
|
||||
merged[key] = value
|
||||
for key, value in os.environ.items():
|
||||
merged[key] = value
|
||||
return merged
|
||||
|
||||
|
||||
def missing_required_keys(
|
||||
required: list[str] | tuple[str, ...] = REQUIRED_RUNTIME_KEYS,
|
||||
*,
|
||||
root: Path | None = None,
|
||||
) -> list[str]:
|
||||
"""Return required keys that are empty after layered loading."""
|
||||
env = merge_layered_env(root)
|
||||
missing: list[str] = []
|
||||
for key in required:
|
||||
value = env.get(key)
|
||||
if value is None or value.strip() == "" or "CHANGE-ME" in value:
|
||||
missing.append(key)
|
||||
return missing
|
||||
|
||||
|
||||
def ensure_runtime_config(*, root: Path | None = None) -> None:
|
||||
"""Fail fast when required runtime keys are missing.
|
||||
|
||||
Raises SystemExit with key names only — never prints secret values.
|
||||
"""
|
||||
missing = missing_required_keys(root=root)
|
||||
if missing:
|
||||
raise SystemExit(f"missing required env keys: {', '.join(missing)}")
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
"""Runtime settings for API, worker, and beat processes."""
|
||||
|
||||
model_config = SettingsConfigDict(
|
||||
env_file_encoding="utf-8",
|
||||
extra="ignore",
|
||||
populate_by_name=True,
|
||||
)
|
||||
|
||||
app_name: str = Field(default="watchman", alias="APP_NAME")
|
||||
env_name: str = Field(default="dev", alias="ENV_NAME")
|
||||
api_host: str = Field(default="127.0.0.1", alias="API_HOST")
|
||||
api_port: int = Field(default=8000, alias="API_PORT")
|
||||
database_url: str = Field(
|
||||
default="postgresql+psycopg://watchman_app:CHANGE-ME@127.0.0.1:5432/watchman",
|
||||
alias="DATABASE_URL",
|
||||
)
|
||||
database_migrator_url: str = Field(
|
||||
default="postgresql+psycopg://watchman_migrator:CHANGE-ME@127.0.0.1:5432/watchman",
|
||||
alias="DATABASE_MIGRATOR_URL",
|
||||
)
|
||||
tenant_id: str = Field(default="dev-tenant", alias="WATCHMAN_TENANT_ID")
|
||||
celery_broker_url: str = Field(
|
||||
# DEV ONLY placeholder — real broker URL comes from env / .env.local.
|
||||
default="amqp://guest:CHANGE-ME@127.0.0.1:56729//",
|
||||
alias="CELERY_BROKER_URL",
|
||||
)
|
||||
casdoor_endpoint: str = Field(default="", alias="CASDOOR_ENDPOINT")
|
||||
casdoor_issuer: str = Field(default="", alias="CASDOOR_ISSUER")
|
||||
casdoor_client_id: str = Field(default="", alias="CASDOOR_CLIENT_ID")
|
||||
casdoor_client_secret: str = Field(default="", alias="CASDOOR_CLIENT_SECRET")
|
||||
casdoor_organization: str = Field(default="", alias="CASDOOR_ORGANIZATION")
|
||||
hxops_sso_issuer: str = Field(default="", alias="HXOPS_SSO_ISSUER")
|
||||
hxops_sso_audience: str = Field(default="", alias="HXOPS_SSO_AUDIENCE")
|
||||
hxops_sso_public_key: str = Field(default="", alias="HXOPS_SSO_PUBLIC_KEY")
|
||||
|
||||
|
||||
def _settings_from_env_map(env: dict[str, str]) -> Settings:
|
||||
"""Build Settings from an already-merged env map."""
|
||||
return Settings(
|
||||
app_name=env.get("APP_NAME", "watchman"),
|
||||
env_name=env.get("ENV_NAME", "dev"),
|
||||
api_host=env.get("API_HOST", "127.0.0.1"),
|
||||
api_port=int(env.get("API_PORT", "8000")),
|
||||
database_url=env.get(
|
||||
"DATABASE_URL",
|
||||
"postgresql+psycopg://watchman_app:CHANGE-ME@127.0.0.1:5432/watchman",
|
||||
),
|
||||
database_migrator_url=env.get(
|
||||
"DATABASE_MIGRATOR_URL",
|
||||
"postgresql+psycopg://watchman_migrator:CHANGE-ME@127.0.0.1:5432/watchman",
|
||||
),
|
||||
tenant_id=env.get("WATCHMAN_TENANT_ID", "dev-tenant"),
|
||||
celery_broker_url=env.get(
|
||||
"CELERY_BROKER_URL",
|
||||
"amqp://guest:CHANGE-ME@127.0.0.1:56729//",
|
||||
),
|
||||
casdoor_endpoint=env.get("CASDOOR_ENDPOINT", ""),
|
||||
casdoor_issuer=env.get("CASDOOR_ISSUER", ""),
|
||||
casdoor_client_id=env.get("CASDOOR_CLIENT_ID", ""),
|
||||
casdoor_client_secret=env.get("CASDOOR_CLIENT_SECRET", ""),
|
||||
casdoor_organization=env.get("CASDOOR_ORGANIZATION", ""),
|
||||
hxops_sso_issuer=env.get("HXOPS_SSO_ISSUER", ""),
|
||||
hxops_sso_audience=env.get("HXOPS_SSO_AUDIENCE", ""),
|
||||
hxops_sso_public_key=env.get("HXOPS_SSO_PUBLIC_KEY", ""),
|
||||
)
|
||||
|
||||
|
||||
@lru_cache
|
||||
def get_settings() -> Settings:
|
||||
"""Load settings once from layered env files + process environment."""
|
||||
return _settings_from_env_map(merge_layered_env(_repo_root()))
|
||||
|
||||
|
||||
def reload_settings() -> Settings:
|
||||
"""Clear the settings cache. Intended for tests."""
|
||||
get_settings.cache_clear()
|
||||
return get_settings()
|
||||
|
||||
|
||||
def settings_as_public_dict(settings: Settings) -> dict[str, Any]:
|
||||
"""Expose non-secret settings for diagnostics. Never include passwords."""
|
||||
return {
|
||||
"app_name": settings.app_name,
|
||||
"env_name": settings.env_name,
|
||||
"api_host": settings.api_host,
|
||||
"api_port": settings.api_port,
|
||||
"tenant_configured": bool(settings.tenant_id),
|
||||
}
|
||||
|
||||
|
||||
def is_non_production(settings: Settings | None = None) -> bool:
|
||||
"""Return True when probe routes and OpenAPI docs may be enabled."""
|
||||
current = settings or get_settings()
|
||||
return current.env_name.lower() in {"dev", "test"}
|
||||
@@ -0,0 +1,118 @@
|
||||
"""Database engine and tenant-scoped sessions.
|
||||
|
||||
# GUARD: tenant_id is injected only from server settings.
|
||||
# Callers must never supply tenant_id through request parameters.
|
||||
# set_config(..., true) is transaction-local. Session.after_begin rebinds
|
||||
# on each non-nested transaction so commit() does not drop RLS context.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Generator
|
||||
from contextlib import contextmanager
|
||||
|
||||
from sqlalchemy import create_engine, event, text
|
||||
from sqlalchemy.engine import Engine
|
||||
from sqlalchemy.orm import Session, sessionmaker
|
||||
|
||||
from watchman.core.config import get_settings
|
||||
|
||||
_engine: Engine | None = None
|
||||
_SessionLocal: sessionmaker[Session] | None = None
|
||||
_TENANT_INFO_KEY = "tenant_id"
|
||||
_after_begin_bound = False
|
||||
|
||||
|
||||
def _rebind_tenant_after_begin(session: Session, transaction, connection) -> None: # type: ignore[no-untyped-def]
|
||||
"""Re-apply tenant RLS setting whenever a non-nested transaction starts."""
|
||||
if transaction.nested:
|
||||
return
|
||||
tenant_id = session.info.get(_TENANT_INFO_KEY)
|
||||
if not tenant_id:
|
||||
return
|
||||
connection.execute(
|
||||
text("SELECT set_config('app.tenant_id', :tenant_id, true)"),
|
||||
{"tenant_id": tenant_id},
|
||||
)
|
||||
|
||||
|
||||
def _ensure_after_begin_listener() -> None:
|
||||
"""Bind the tenant rebind listener once for all Session instances."""
|
||||
global _after_begin_bound
|
||||
if _after_begin_bound:
|
||||
return
|
||||
event.listen(Session, "after_begin", _rebind_tenant_after_begin)
|
||||
_after_begin_bound = True
|
||||
|
||||
|
||||
def get_engine() -> Engine:
|
||||
"""Return a process-wide SQLAlchemy engine for the app role."""
|
||||
global _engine, _SessionLocal
|
||||
_ensure_after_begin_listener()
|
||||
if _engine is None:
|
||||
settings = get_settings()
|
||||
_engine = create_engine(settings.database_url, pool_pre_ping=True)
|
||||
# expire_on_commit=False: avoid refreshing attrs after commit under RLS.
|
||||
_SessionLocal = sessionmaker(
|
||||
bind=_engine,
|
||||
autoflush=False,
|
||||
autocommit=False,
|
||||
expire_on_commit=False,
|
||||
)
|
||||
return _engine
|
||||
|
||||
|
||||
def get_session_factory() -> sessionmaker[Session]:
|
||||
"""Return the session factory, initializing the engine if needed."""
|
||||
get_engine()
|
||||
assert _SessionLocal is not None
|
||||
return _SessionLocal
|
||||
|
||||
|
||||
def set_tenant(session: Session, tenant_id: str) -> None:
|
||||
"""Set the Postgres session variable used by RLS policies."""
|
||||
_ensure_after_begin_listener()
|
||||
session.info[_TENANT_INFO_KEY] = tenant_id
|
||||
# GUARD: use set_config so the value stays transaction-local.
|
||||
session.execute(
|
||||
text("SELECT set_config('app.tenant_id', :tenant_id, true)"),
|
||||
{"tenant_id": tenant_id},
|
||||
)
|
||||
|
||||
|
||||
@contextmanager
|
||||
def session_scope(*, with_tenant: bool = True) -> Generator[Session, None, None]:
|
||||
"""Provide a short-lived session, optionally scoped to the server tenant."""
|
||||
session = get_session_factory()()
|
||||
try:
|
||||
if with_tenant:
|
||||
set_tenant(session, get_settings().tenant_id)
|
||||
yield session
|
||||
session.commit()
|
||||
except Exception:
|
||||
session.rollback()
|
||||
raise
|
||||
finally:
|
||||
session.close()
|
||||
|
||||
|
||||
def get_db_session() -> Generator[Session, None, None]:
|
||||
"""FastAPI dependency that yields a tenant-scoped session."""
|
||||
session = get_session_factory()()
|
||||
try:
|
||||
set_tenant(session, get_settings().tenant_id)
|
||||
yield session
|
||||
except Exception:
|
||||
session.rollback()
|
||||
raise
|
||||
finally:
|
||||
session.close()
|
||||
|
||||
|
||||
def reset_engine() -> None:
|
||||
"""Dispose the cached engine. Intended for tests."""
|
||||
global _engine, _SessionLocal
|
||||
if _engine is not None:
|
||||
_engine.dispose()
|
||||
_engine = None
|
||||
_SessionLocal = None
|
||||
@@ -0,0 +1,79 @@
|
||||
"""Semantic application errors.
|
||||
|
||||
Services raise these; the API layer must not hand-write error JSON.
|
||||
Maps to numeric envelope codes from standards://api/api-envelope?version=1.1.0.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
|
||||
class AppError(Exception):
|
||||
"""Base semantic error for Watchman APIs."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
message: str,
|
||||
*,
|
||||
code: int,
|
||||
http_status: int,
|
||||
details: dict[str, Any] | None = None,
|
||||
retryable: bool = False,
|
||||
permission_node: str | None = None,
|
||||
) -> None:
|
||||
super().__init__(message)
|
||||
self.message = message
|
||||
self.code = code
|
||||
self.http_status = http_status
|
||||
self.details = details or {}
|
||||
self.retryable = retryable
|
||||
self.permission_node = permission_node
|
||||
|
||||
|
||||
class ValidationError(AppError):
|
||||
"""Caller sent an invalid parameter."""
|
||||
|
||||
def __init__(self, message: str, *, details: dict[str, Any] | None = None) -> None:
|
||||
super().__init__(message, code=40000, http_status=400, details=details)
|
||||
|
||||
|
||||
class UnauthorizedError(AppError):
|
||||
"""Authentication failed or is missing."""
|
||||
|
||||
def __init__(self, message: str = "Unauthorized") -> None:
|
||||
super().__init__(message, code=41000, http_status=401)
|
||||
|
||||
|
||||
class ForbiddenError(AppError):
|
||||
"""Authenticated caller lacks a required permission."""
|
||||
|
||||
def __init__(self, message: str = "Forbidden", *, permission_node: str | None = None) -> None:
|
||||
super().__init__(
|
||||
message,
|
||||
code=42000,
|
||||
http_status=403,
|
||||
permission_node=permission_node,
|
||||
)
|
||||
|
||||
|
||||
class NotFoundError(AppError):
|
||||
"""Requested resource does not exist in the caller's scope."""
|
||||
|
||||
def __init__(self, message: str = "Not found") -> None:
|
||||
# Keep 404 HTTP, but stay inside the 40000 parameter/client family for machine code.
|
||||
super().__init__(message, code=40000, http_status=404, details={"reason": "not_found"})
|
||||
|
||||
|
||||
class ConflictError(AppError):
|
||||
"""Request conflicts with current state."""
|
||||
|
||||
def __init__(self, message: str, *, details: dict[str, Any] | None = None) -> None:
|
||||
super().__init__(message, code=40000, http_status=409, details=details)
|
||||
|
||||
|
||||
class ServiceUnavailableError(AppError):
|
||||
"""Transient infrastructure failure."""
|
||||
|
||||
def __init__(self, message: str = "Service unavailable") -> None:
|
||||
super().__init__(message, code=50000, http_status=503, retryable=True)
|
||||
@@ -0,0 +1,21 @@
|
||||
"""Request ID helpers.
|
||||
|
||||
Prefer the inbound X-Request-Id when present; otherwise generate one.
|
||||
The same value is returned in the body and response header.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import uuid
|
||||
|
||||
REQUEST_ID_HEADER = "X-Request-Id"
|
||||
|
||||
|
||||
def resolve_request_id(incoming: str | None) -> str:
|
||||
"""Normalize or generate a request id."""
|
||||
if incoming is None:
|
||||
return uuid.uuid4().hex
|
||||
cleaned = incoming.strip()
|
||||
if not cleaned:
|
||||
return uuid.uuid4().hex
|
||||
return cleaned[:128]
|
||||
@@ -0,0 +1,44 @@
|
||||
"""API envelope helpers.
|
||||
|
||||
Line format follows standards://api/api-envelope?version=1.1.0.
|
||||
Success uses data; failure uses error; the two are mutually exclusive.
|
||||
Do not add undeclared top-level fields (no timestamp).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
|
||||
def success_body(data: Any, *, request_id: str) -> dict[str, Any]:
|
||||
"""Build a success envelope body."""
|
||||
return {
|
||||
"success": True,
|
||||
"data": data,
|
||||
"request_id": request_id,
|
||||
}
|
||||
|
||||
|
||||
def error_body(
|
||||
*,
|
||||
code: int,
|
||||
message: str,
|
||||
request_id: str,
|
||||
details: dict[str, Any] | None = None,
|
||||
retryable: bool = False,
|
||||
permission_node: str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Build a failure envelope body."""
|
||||
error: dict[str, Any] = {
|
||||
"code": code,
|
||||
"message": message,
|
||||
"details": details or {},
|
||||
"retryable": retryable,
|
||||
}
|
||||
if permission_node is not None:
|
||||
error["permission_node"] = permission_node
|
||||
return {
|
||||
"success": False,
|
||||
"error": error,
|
||||
"request_id": request_id,
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
"""Background job entrypoints.
|
||||
|
||||
Celery worker and beat share this package with the API process.
|
||||
Business schedules are out of scope until later modules.
|
||||
"""
|
||||
@@ -0,0 +1,38 @@
|
||||
"""Celery application for Watchman process roles.
|
||||
|
||||
Broker is RabbitMQ. No Redis result backend.
|
||||
Probe tasks must not write platform audit or business occurrence facts.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from celery import Celery
|
||||
|
||||
from watchman.core.config import get_settings
|
||||
|
||||
|
||||
def create_celery_app() -> Celery:
|
||||
"""Build the Celery app from layered settings."""
|
||||
settings = get_settings()
|
||||
app = Celery("watchman", broker=settings.celery_broker_url)
|
||||
# GUARD: do not configure a result backend; DB records are the business source of truth.
|
||||
app.conf.update(
|
||||
task_ignore_result=True,
|
||||
result_backend=None,
|
||||
accept_content=["json"],
|
||||
task_serializer="json",
|
||||
result_serializer="json",
|
||||
timezone="UTC",
|
||||
enable_utc=True,
|
||||
worker_hijack_root_logger=False,
|
||||
)
|
||||
return app
|
||||
|
||||
|
||||
celery_app = create_celery_app()
|
||||
|
||||
|
||||
@celery_app.task(name="watchman.probe.ping")
|
||||
def probe_ping() -> dict[str, str]:
|
||||
"""Return a static probe payload with no database side effects."""
|
||||
return {"status": "pong"}
|
||||
@@ -0,0 +1,6 @@
|
||||
"""SQLAlchemy models for the Watchman service package."""
|
||||
|
||||
from watchman.models.auth_session import AuthSession
|
||||
from watchman.models.platform import AuditEvent, RunRecord
|
||||
|
||||
__all__ = ["AuthSession", "AuditEvent", "RunRecord"]
|
||||
@@ -0,0 +1,40 @@
|
||||
"""Server-side authentication session persistence.
|
||||
|
||||
Stores only public identity snapshots and a hash of the browser token; it never stores credentials.
|
||||
Depends on SQLAlchemy and the shared Watchman declarative base.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy import DateTime, String, func, text
|
||||
from sqlalchemy.dialects.postgresql import JSONB
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from watchman.models.base import Base
|
||||
|
||||
|
||||
class AuthSession(Base):
|
||||
"""A tenant-scoped browser session with an opaque, hashed lookup token."""
|
||||
|
||||
__tablename__ = "auth_sessions"
|
||||
|
||||
token_hash: Mapped[str] = mapped_column(String(64), primary_key=True)
|
||||
subject: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||
issuer: Mapped[str] = mapped_column(String(512), nullable=False)
|
||||
display_name: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||
login_name: Mapped[str] = mapped_column(String(255), nullable=False, server_default="")
|
||||
role_snapshot: Mapped[list[str]] = mapped_column(
|
||||
JSONB,
|
||||
nullable=False,
|
||||
server_default=text("'[]'::jsonb"),
|
||||
)
|
||||
role_checked_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False)
|
||||
expires_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False)
|
||||
tenant_id: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True),
|
||||
nullable=False,
|
||||
server_default=func.now(),
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
"""Declarative base for Watchman models."""
|
||||
|
||||
from sqlalchemy.orm import DeclarativeBase
|
||||
|
||||
|
||||
class Base(DeclarativeBase):
|
||||
"""Shared metadata base."""
|
||||
@@ -0,0 +1,64 @@
|
||||
"""Platform foundation tables for audit events and run records.
|
||||
|
||||
Business alarm tables are intentionally absent in M01.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy import DateTime, String, UniqueConstraint, func, text
|
||||
from sqlalchemy.dialects.postgresql import JSONB, UUID
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from watchman.models.base import Base
|
||||
|
||||
|
||||
class AuditEvent(Base):
|
||||
"""Append-only platform audit fact."""
|
||||
|
||||
__tablename__ = "audit_events"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("tenant_id", "idempotency_key", name="uq_audit_events_tenant_idem"),
|
||||
)
|
||||
|
||||
id: Mapped[uuid.UUID] = mapped_column(
|
||||
UUID(as_uuid=True),
|
||||
primary_key=True,
|
||||
server_default=text("gen_random_uuid()"),
|
||||
)
|
||||
tenant_id: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
action: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
payload: Mapped[dict] = mapped_column(JSONB, nullable=False, server_default=text("'{}'::jsonb"))
|
||||
idempotency_key: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True),
|
||||
nullable=False,
|
||||
server_default=func.now(),
|
||||
)
|
||||
|
||||
|
||||
class RunRecord(Base):
|
||||
"""Platform run fact used by later modules for tracing."""
|
||||
|
||||
__tablename__ = "run_records"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("tenant_id", "idempotency_key", name="uq_run_records_tenant_idem"),
|
||||
)
|
||||
|
||||
id: Mapped[uuid.UUID] = mapped_column(
|
||||
UUID(as_uuid=True),
|
||||
primary_key=True,
|
||||
server_default=text("gen_random_uuid()"),
|
||||
)
|
||||
tenant_id: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
kind: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
status: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
detail: Mapped[dict] = mapped_column(JSONB, nullable=False, server_default=text("'{}'::jsonb"))
|
||||
idempotency_key: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True),
|
||||
nullable=False,
|
||||
server_default=func.now(),
|
||||
)
|
||||
@@ -0,0 +1,4 @@
|
||||
"""Domain and platform services.
|
||||
|
||||
Raise semantic AppError subclasses. Do not construct HTTP responses here.
|
||||
"""
|
||||
@@ -0,0 +1,19 @@
|
||||
"""Health service.
|
||||
|
||||
Returns only non-sensitive liveness fields.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from watchman import __version__
|
||||
from watchman.core.config import get_settings
|
||||
|
||||
|
||||
def get_health() -> dict[str, str]:
|
||||
"""Build the health payload without infrastructure details."""
|
||||
settings = get_settings()
|
||||
return {
|
||||
"status": "ok",
|
||||
"app": settings.app_name,
|
||||
"version": __version__,
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
"""Platform audit and run record writes.
|
||||
|
||||
Tenant identity comes only from server settings. Callers must not supply tenant_id.
|
||||
Idempotent writes key on (tenant_id, idempotency_key).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from watchman.core.config import get_settings
|
||||
from watchman.core.errors import ValidationError
|
||||
from watchman.models.platform import AuditEvent, RunRecord
|
||||
|
||||
|
||||
def _require_idempotency_key(idempotency_key: str | None) -> str:
|
||||
if idempotency_key is None or not idempotency_key.strip():
|
||||
raise ValidationError(
|
||||
"x-idempotency-key is required",
|
||||
details={"field": "x-idempotency-key"},
|
||||
)
|
||||
return idempotency_key.strip()[:128]
|
||||
|
||||
|
||||
def _get_audit(session: Session, *, tenant_id: str, key: str) -> AuditEvent | None:
|
||||
return session.scalar(
|
||||
select(AuditEvent).where(
|
||||
AuditEvent.tenant_id == tenant_id,
|
||||
AuditEvent.idempotency_key == key,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def _get_run(session: Session, *, tenant_id: str, key: str) -> RunRecord | None:
|
||||
return session.scalar(
|
||||
select(RunRecord).where(
|
||||
RunRecord.tenant_id == tenant_id,
|
||||
RunRecord.idempotency_key == key,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def create_audit_event(
|
||||
session: Session,
|
||||
*,
|
||||
action: str,
|
||||
payload: dict[str, Any] | None,
|
||||
idempotency_key: str | None,
|
||||
) -> AuditEvent:
|
||||
"""Insert or return an existing audit event for the server tenant."""
|
||||
key = _require_idempotency_key(idempotency_key)
|
||||
if not action or not action.strip():
|
||||
raise ValidationError("action is required", details={"field": "action"})
|
||||
tenant_id = get_settings().tenant_id
|
||||
existing = _get_audit(session, tenant_id=tenant_id, key=key)
|
||||
if existing is not None:
|
||||
return existing
|
||||
row = AuditEvent(
|
||||
tenant_id=tenant_id,
|
||||
action=action.strip(),
|
||||
payload=payload or {},
|
||||
idempotency_key=key,
|
||||
)
|
||||
try:
|
||||
with session.begin_nested():
|
||||
session.add(row)
|
||||
session.flush()
|
||||
return row
|
||||
except IntegrityError:
|
||||
existing = _get_audit(session, tenant_id=tenant_id, key=key)
|
||||
if existing is None:
|
||||
raise
|
||||
return existing
|
||||
|
||||
|
||||
def create_run_record(
|
||||
session: Session,
|
||||
*,
|
||||
kind: str,
|
||||
status: str,
|
||||
detail: dict[str, Any] | None,
|
||||
idempotency_key: str | None,
|
||||
) -> RunRecord:
|
||||
"""Insert or return an existing run record for the server tenant."""
|
||||
key = _require_idempotency_key(idempotency_key)
|
||||
if not kind or not kind.strip():
|
||||
raise ValidationError("kind is required", details={"field": "kind"})
|
||||
if not status or not status.strip():
|
||||
raise ValidationError("status is required", details={"field": "status"})
|
||||
tenant_id = get_settings().tenant_id
|
||||
existing = _get_run(session, tenant_id=tenant_id, key=key)
|
||||
if existing is not None:
|
||||
return existing
|
||||
row = RunRecord(
|
||||
tenant_id=tenant_id,
|
||||
kind=kind.strip(),
|
||||
status=status.strip(),
|
||||
detail=detail or {},
|
||||
idempotency_key=key,
|
||||
)
|
||||
try:
|
||||
with session.begin_nested():
|
||||
session.add(row)
|
||||
session.flush()
|
||||
return row
|
||||
except IntegrityError:
|
||||
existing = _get_run(session, tenant_id=tenant_id, key=key)
|
||||
if existing is None:
|
||||
raise
|
||||
return existing
|
||||
@@ -0,0 +1,364 @@
|
||||
"""Acceptance tests for M02 S2 password sessions without external Casdoor calls.
|
||||
|
||||
Uses injected in-memory ports so API tests do not require a network or local PostgreSQL.
|
||||
Depends on FastAPI dependency overrides and public authentication interfaces.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from watchman.api.app import create_app
|
||||
from watchman.auth.casdoor import CasdoorIdentity, DefaultCasdoorPort, HttpResponse, get_casdoor_port
|
||||
from watchman.auth.sessions import SESSION_LIFETIME, SessionStore, get_session_store
|
||||
from watchman.core.config import Settings
|
||||
from watchman.core.errors import ServiceUnavailableError, UnauthorizedError
|
||||
|
||||
FAKE_PASSWORD = "fixed-fake-password"
|
||||
FAKE_ACCESS_TOKEN = "fixed-fake-access-token"
|
||||
|
||||
|
||||
@dataclass
|
||||
class StoredSession:
|
||||
"""Minimal stored-session shape used by the in-memory API-test port."""
|
||||
|
||||
token_hash: str
|
||||
subject: str
|
||||
issuer: str
|
||||
display_name: str
|
||||
login_name: str
|
||||
role_snapshot: list[str]
|
||||
role_checked_at: datetime
|
||||
expires_at: datetime
|
||||
|
||||
|
||||
class InMemorySessionStore:
|
||||
"""Test-only session store preserving the production port contract."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.rows: dict[str, StoredSession] = {}
|
||||
|
||||
def create(
|
||||
self,
|
||||
*,
|
||||
token_hash: str,
|
||||
identity: CasdoorIdentity,
|
||||
now: datetime,
|
||||
login_name: str,
|
||||
) -> StoredSession:
|
||||
row = StoredSession(
|
||||
token_hash=token_hash,
|
||||
subject=identity.subject,
|
||||
issuer=identity.issuer,
|
||||
display_name=identity.display_name,
|
||||
login_name=login_name,
|
||||
role_snapshot=list(identity.role_names),
|
||||
role_checked_at=now,
|
||||
expires_at=now + SESSION_LIFETIME,
|
||||
)
|
||||
self.rows[token_hash] = row
|
||||
return row
|
||||
|
||||
def get(self, *, token_hash: str, now: datetime) -> StoredSession | None:
|
||||
row = self.rows.get(token_hash)
|
||||
if row is not None and row.expires_at > now:
|
||||
return row
|
||||
self.rows.pop(token_hash, None)
|
||||
return None
|
||||
|
||||
def invalidate(self, *, token_hash: str) -> None:
|
||||
self.rows.pop(token_hash, None)
|
||||
|
||||
def update_roles(self, *, token_hash: str, role_names: list[str], now: datetime) -> None:
|
||||
row = self.rows.get(token_hash)
|
||||
if row is None:
|
||||
return
|
||||
row.role_snapshot = list(role_names)
|
||||
row.role_checked_at = now
|
||||
|
||||
|
||||
class AcceptingCasdoor:
|
||||
"""Stand-in that returns only safe identity values and never contacts Casdoor."""
|
||||
|
||||
def authenticate_password(self, *, username: str, password: str) -> CasdoorIdentity:
|
||||
if password != FAKE_PASSWORD:
|
||||
raise UnauthorizedError()
|
||||
return CasdoorIdentity(
|
||||
subject="casdoor-subject-1",
|
||||
issuer="https://casdoor.test",
|
||||
display_name="Test Operator",
|
||||
role_names=["watchman-operator", "watchman-viewer"],
|
||||
)
|
||||
|
||||
|
||||
class RejectingCasdoor:
|
||||
"""Stand-in for generic upstream credential rejection."""
|
||||
|
||||
def authenticate_password(self, *, username: str, password: str) -> CasdoorIdentity:
|
||||
raise UnauthorizedError()
|
||||
|
||||
|
||||
class FakeCasdoorTransport:
|
||||
"""Queue controlled HTTP results so Casdoor adapter tests never use the network."""
|
||||
|
||||
def __init__(self, responses: list[HttpResponse | Exception]) -> None:
|
||||
self._responses = iter(responses)
|
||||
self.calls: list[tuple[str, str, dict[str, str], bytes | None]] = []
|
||||
|
||||
def request(
|
||||
self,
|
||||
*,
|
||||
method: str,
|
||||
url: str,
|
||||
headers: dict[str, str],
|
||||
data: bytes | None = None,
|
||||
) -> HttpResponse:
|
||||
self.calls.append((method, url, headers, data))
|
||||
result = next(self._responses)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
return result
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def auth_client() -> tuple[TestClient, InMemorySessionStore]:
|
||||
"""Return a client with only local stand-ins, avoiding database and network access."""
|
||||
app = create_app(validate_runtime=False)
|
||||
store = InMemorySessionStore()
|
||||
app.dependency_overrides[get_casdoor_port] = lambda: AcceptingCasdoor()
|
||||
app.dependency_overrides[get_session_store] = lambda: store
|
||||
with TestClient(app) as client:
|
||||
yield client, store
|
||||
|
||||
|
||||
def test_password_login_creates_session_returns_roles_and_hides_password(
|
||||
auth_client: tuple[TestClient, InMemorySessionStore],
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Successful injected login must create a session without leaking the submitted password."""
|
||||
client, store = auth_client
|
||||
caplog.set_level(logging.DEBUG)
|
||||
|
||||
response = client.post(
|
||||
"/auth/login",
|
||||
json={"username": "operator", "password": FAKE_PASSWORD},
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
body = response.json()
|
||||
assert body["success"] is True
|
||||
assert body["data"]["subject"] == "casdoor-subject-1"
|
||||
assert body["data"]["display_name"] == "Test Operator"
|
||||
assert body["data"]["login_name"] == "operator"
|
||||
assert body["data"]["roles"] == ["watchman-operator", "watchman-viewer"]
|
||||
assert body["data"]["token_type"] == "Bearer"
|
||||
assert body["data"]["expires_in"] == 8 * 60 * 60
|
||||
assert body["data"]["access_token"]
|
||||
assert FAKE_PASSWORD not in body["data"]["access_token"]
|
||||
assert len(store.rows) == 1
|
||||
assert FAKE_PASSWORD not in response.text
|
||||
assert FAKE_PASSWORD not in caplog.text
|
||||
cookie = response.headers["set-cookie"].lower()
|
||||
assert "httponly" in cookie
|
||||
assert "samesite=lax" in cookie
|
||||
assert "path=/" in cookie
|
||||
assert "secure" not in cookie
|
||||
|
||||
|
||||
def test_bearer_token_reads_current_user_without_cookie(
|
||||
auth_client: tuple[TestClient, InMemorySessionStore],
|
||||
) -> None:
|
||||
"""The access token returned to the browser can authorize a later request."""
|
||||
client, _store = auth_client
|
||||
login = client.post("/auth/login", json={"username": "operator", "password": FAKE_PASSWORD})
|
||||
token = login.json()["data"]["access_token"]
|
||||
bare = TestClient(client.app)
|
||||
response = bare.get("/auth/me", headers={"Authorization": f"Bearer {token}"})
|
||||
assert response.status_code == 200
|
||||
assert response.json()["data"]["subject"] == "casdoor-subject-1"
|
||||
assert "access_token" not in response.json()["data"]
|
||||
|
||||
|
||||
def test_rejected_login_is_unauthorized_and_creates_no_session() -> None:
|
||||
"""Casdoor credential rejection must map to 41000 without persisting a session."""
|
||||
app = create_app(validate_runtime=False)
|
||||
store = InMemorySessionStore()
|
||||
app.dependency_overrides[get_casdoor_port] = lambda: RejectingCasdoor()
|
||||
app.dependency_overrides[get_session_store] = lambda: store
|
||||
|
||||
with TestClient(app, raise_server_exceptions=False) as client:
|
||||
response = client.post("/auth/login", json={"username": "operator", "password": FAKE_PASSWORD})
|
||||
|
||||
assert response.status_code == 401
|
||||
assert response.json()["error"]["code"] == 41000
|
||||
assert len(store.rows) == 0
|
||||
|
||||
|
||||
def test_unconfigured_default_port_returns_retryable_503_without_session() -> None:
|
||||
"""Incomplete Casdoor settings must fail closed before session creation."""
|
||||
app = create_app(validate_runtime=False)
|
||||
store = InMemorySessionStore()
|
||||
incomplete_settings = Settings(
|
||||
casdoor_endpoint="",
|
||||
casdoor_client_id="",
|
||||
casdoor_client_secret="",
|
||||
)
|
||||
app.dependency_overrides[get_casdoor_port] = lambda: DefaultCasdoorPort(incomplete_settings)
|
||||
app.dependency_overrides[get_session_store] = lambda: store
|
||||
|
||||
with TestClient(app, raise_server_exceptions=False) as client:
|
||||
response = client.post("/auth/login", json={"username": "operator", "password": FAKE_PASSWORD})
|
||||
|
||||
assert response.status_code == 503
|
||||
assert response.json()["error"]["code"] == 50000
|
||||
assert response.json()["error"]["retryable"] is True
|
||||
assert len(store.rows) == 0
|
||||
|
||||
|
||||
def test_default_port_password_grant_returns_safe_identity_and_roles() -> None:
|
||||
"""A discovered password grant returns userinfo roles without retaining credentials."""
|
||||
transport = FakeCasdoorTransport(
|
||||
[
|
||||
HttpResponse(
|
||||
200,
|
||||
b'{"token_endpoint":"https://casdoor.test/token","userinfo_endpoint":"https://casdoor.test/userinfo"}',
|
||||
),
|
||||
HttpResponse(200, b'{"access_token":"fixed-fake-access-token"}'),
|
||||
HttpResponse(200, b'{"sub":"employee-1","name":"Employee","roles":["watchman-admin"]}'),
|
||||
]
|
||||
)
|
||||
port = DefaultCasdoorPort(
|
||||
Settings(
|
||||
casdoor_endpoint="https://casdoor.test/",
|
||||
casdoor_issuer="https://issuer.casdoor.test",
|
||||
casdoor_client_id="test-client",
|
||||
casdoor_client_secret="test-secret",
|
||||
),
|
||||
transport,
|
||||
)
|
||||
|
||||
identity = port.authenticate_password(username="employee-1", password=FAKE_PASSWORD)
|
||||
|
||||
assert identity == CasdoorIdentity(
|
||||
subject="employee-1",
|
||||
issuer="https://issuer.casdoor.test",
|
||||
display_name="Employee",
|
||||
role_names=["watchman-admin"],
|
||||
)
|
||||
assert FAKE_PASSWORD not in repr(identity)
|
||||
assert FAKE_ACCESS_TOKEN not in repr(identity)
|
||||
assert [call[0] for call in transport.calls] == ["GET", "POST", "GET"]
|
||||
assert transport.calls[0][1] == "https://casdoor.test/.well-known/openid-configuration"
|
||||
assert b"grant_type=password" in transport.calls[1][3]
|
||||
assert transport.calls[2][2]["Authorization"] == f"Bearer {FAKE_ACCESS_TOKEN}"
|
||||
|
||||
|
||||
def test_default_port_invalid_grant_is_unauthorized() -> None:
|
||||
"""Casdoor invalid_grant is a generic credential rejection."""
|
||||
transport = FakeCasdoorTransport(
|
||||
[
|
||||
HttpResponse(
|
||||
200,
|
||||
b'{"token_endpoint":"https://casdoor.test/token","userinfo_endpoint":"https://casdoor.test/userinfo"}',
|
||||
),
|
||||
HttpResponse(400, b'{"error":"invalid_grant","error_description":"upstream secret detail"}'),
|
||||
]
|
||||
)
|
||||
port = DefaultCasdoorPort(
|
||||
Settings(
|
||||
casdoor_endpoint="https://casdoor.test",
|
||||
casdoor_client_id="test-client",
|
||||
casdoor_client_secret="test-secret",
|
||||
),
|
||||
transport,
|
||||
)
|
||||
|
||||
with pytest.raises(UnauthorizedError, match="Invalid username or password"):
|
||||
port.authenticate_password(username="employee-1", password=FAKE_PASSWORD)
|
||||
|
||||
|
||||
def test_default_port_unsupported_grant_is_unavailable() -> None:
|
||||
"""A disabled grant type is a configuration failure, not a wrong password."""
|
||||
transport = FakeCasdoorTransport(
|
||||
[
|
||||
HttpResponse(
|
||||
200,
|
||||
b'{"token_endpoint":"https://casdoor.test/token","userinfo_endpoint":"https://casdoor.test/userinfo"}',
|
||||
),
|
||||
HttpResponse(400, b'{"error":"unsupported_grant_type"}'),
|
||||
]
|
||||
)
|
||||
port = DefaultCasdoorPort(
|
||||
Settings(
|
||||
casdoor_endpoint="https://casdoor.test",
|
||||
casdoor_client_id="test-client",
|
||||
casdoor_client_secret="test-secret",
|
||||
),
|
||||
transport,
|
||||
)
|
||||
|
||||
with pytest.raises(ServiceUnavailableError):
|
||||
port.authenticate_password(username="employee-1", password=FAKE_PASSWORD)
|
||||
|
||||
|
||||
def test_default_port_transport_failure_is_retryable() -> None:
|
||||
"""Network failures are mapped to the retryable integration error."""
|
||||
transport = FakeCasdoorTransport([OSError("network unavailable")])
|
||||
port = DefaultCasdoorPort(
|
||||
Settings(
|
||||
casdoor_endpoint="https://casdoor.test",
|
||||
casdoor_client_id="test-client",
|
||||
casdoor_client_secret="test-secret",
|
||||
),
|
||||
transport,
|
||||
)
|
||||
|
||||
with pytest.raises(ServiceUnavailableError):
|
||||
port.authenticate_password(username="employee-1", password=FAKE_PASSWORD)
|
||||
|
||||
|
||||
def test_unconfigured_default_port_does_not_call_transport() -> None:
|
||||
"""Missing Casdoor configuration fails before the injected transport is used."""
|
||||
transport = FakeCasdoorTransport([])
|
||||
port = DefaultCasdoorPort(Settings(), transport)
|
||||
|
||||
with pytest.raises(ServiceUnavailableError):
|
||||
port.authenticate_password(username="employee-1", password=FAKE_PASSWORD)
|
||||
|
||||
assert transport.calls == []
|
||||
|
||||
|
||||
def test_logout_invalidates_session_and_me_then_returns_41000(
|
||||
auth_client: tuple[TestClient, InMemorySessionStore],
|
||||
) -> None:
|
||||
"""Logout must remove the server-side session before a later current-user request."""
|
||||
client, _store = auth_client
|
||||
assert client.post("/auth/login", json={"username": "operator", "password": FAKE_PASSWORD}).status_code == 200
|
||||
assert client.get("/auth/me").status_code == 200
|
||||
|
||||
logout = client.post("/auth/logout")
|
||||
assert logout.status_code == 200
|
||||
assert "max-age=0" in logout.headers["set-cookie"].lower()
|
||||
|
||||
me = client.get("/auth/me")
|
||||
assert me.status_code == 401
|
||||
assert me.json()["error"]["code"] == 41000
|
||||
|
||||
|
||||
def test_health_remains_anonymous_and_missing_login_fields_are_40000() -> None:
|
||||
"""The auth router must not introduce a global auth requirement or bypass validation envelopes."""
|
||||
app = create_app(validate_runtime=False)
|
||||
app.dependency_overrides[get_casdoor_port] = lambda: AcceptingCasdoor()
|
||||
app.dependency_overrides[get_session_store] = lambda: InMemorySessionStore()
|
||||
|
||||
with TestClient(app) as client:
|
||||
assert client.get("/health").status_code == 200
|
||||
response = client.post("/auth/login", json={"username": "operator"})
|
||||
|
||||
assert response.status_code == 400
|
||||
assert response.json()["error"]["code"] == 40000
|
||||
@@ -0,0 +1,79 @@
|
||||
"""Environment layering and required-key validation tests."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from watchman.core.config import (
|
||||
_settings_from_env_map,
|
||||
ensure_runtime_config,
|
||||
merge_layered_env,
|
||||
missing_required_keys,
|
||||
)
|
||||
|
||||
|
||||
def _write_env(path: Path, content: str) -> None:
|
||||
path.write_text(content.strip() + "\n", encoding="utf-8")
|
||||
|
||||
|
||||
def test_local_overrides_dev_overrides_shared(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
_write_env(tmp_path / ".env.shared", "API_PORT=8000\nWATCHMAN_TENANT_ID=shared-tenant")
|
||||
_write_env(tmp_path / ".env.dev", "API_PORT=8001\nWATCHMAN_TENANT_ID=dev-tenant")
|
||||
_write_env(tmp_path / ".env.local", "API_PORT=8002\nWATCHMAN_TENANT_ID=local-tenant")
|
||||
monkeypatch.delenv("API_PORT", raising=False)
|
||||
monkeypatch.delenv("WATCHMAN_TENANT_ID", raising=False)
|
||||
|
||||
env = merge_layered_env(tmp_path)
|
||||
assert env["API_PORT"] == "8002"
|
||||
assert env["WATCHMAN_TENANT_ID"] == "local-tenant"
|
||||
settings = _settings_from_env_map(env)
|
||||
assert settings.api_port == 8002
|
||||
assert settings.tenant_id == "local-tenant"
|
||||
|
||||
|
||||
def test_process_env_wins_over_files(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
_write_env(tmp_path / ".env.shared", "API_PORT=8000")
|
||||
_write_env(tmp_path / ".env.local", "API_PORT=8002")
|
||||
monkeypatch.setenv("API_PORT", "9000")
|
||||
|
||||
env = merge_layered_env(tmp_path)
|
||||
assert env["API_PORT"] == "9000"
|
||||
|
||||
|
||||
def test_missing_required_keys_detects_placeholders(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
_write_env(
|
||||
tmp_path / ".env.local",
|
||||
"\n".join(
|
||||
[
|
||||
"DATABASE_URL=postgresql+psycopg://watchman_app:CHANGE-ME@127.0.0.1:5432/watchman",
|
||||
"DATABASE_MIGRATOR_URL=",
|
||||
"WATCHMAN_TENANT_ID=dev-tenant",
|
||||
]
|
||||
),
|
||||
)
|
||||
for key in ("DATABASE_URL", "DATABASE_MIGRATOR_URL", "WATCHMAN_TENANT_ID"):
|
||||
monkeypatch.delenv(key, raising=False)
|
||||
|
||||
missing = missing_required_keys(root=tmp_path)
|
||||
assert "DATABASE_URL" in missing
|
||||
assert "DATABASE_MIGRATOR_URL" in missing
|
||||
assert "WATCHMAN_TENANT_ID" not in missing
|
||||
|
||||
|
||||
def test_ensure_runtime_config_exits_with_key_names(
|
||||
tmp_path: Path,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
_write_env(tmp_path / ".env.local", "WATCHMAN_TENANT_ID=dev-tenant")
|
||||
for key in ("DATABASE_URL", "DATABASE_MIGRATOR_URL", "WATCHMAN_TENANT_ID"):
|
||||
monkeypatch.delenv(key, raising=False)
|
||||
|
||||
with pytest.raises(SystemExit, match="missing required env keys") as exc:
|
||||
ensure_runtime_config(root=tmp_path)
|
||||
message = str(exc.value)
|
||||
assert "DATABASE_URL" in message
|
||||
assert "DATABASE_MIGRATOR_URL" in message
|
||||
assert "CHANGE-ME" not in message
|
||||
assert "password" not in message.lower()
|
||||
@@ -0,0 +1,103 @@
|
||||
"""Envelope and health-check acceptance tests."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from watchman.api.app import create_app
|
||||
from watchman.core.config import reload_settings
|
||||
from watchman.core.db import reset_engine
|
||||
|
||||
|
||||
def test_health_success_envelope() -> None:
|
||||
client = TestClient(create_app())
|
||||
response = client.get("/health", headers={"X-Request-Id": "req-health-1"})
|
||||
assert response.status_code == 200
|
||||
body = response.json()
|
||||
assert body["success"] is True
|
||||
assert body["request_id"] == "req-health-1"
|
||||
assert response.headers["X-Request-Id"] == "req-health-1"
|
||||
assert body["data"]["status"] == "ok"
|
||||
assert "database" not in body["data"]
|
||||
assert "tenant" not in str(body).lower()
|
||||
assert "password" not in str(body).lower()
|
||||
|
||||
|
||||
def test_validation_error_envelope() -> None:
|
||||
client = TestClient(create_app())
|
||||
response = client.get("/_probe/validation-error")
|
||||
assert response.status_code == 400
|
||||
body = response.json()
|
||||
assert body["success"] is False
|
||||
assert body["error"]["code"] == 40000
|
||||
assert "traceback" not in str(body).lower()
|
||||
assert response.headers["X-Request-Id"]
|
||||
|
||||
|
||||
def test_unhandled_error_envelope_hides_stack_and_keeps_request_id() -> None:
|
||||
client = TestClient(create_app(), raise_server_exceptions=False)
|
||||
response = client.get("/_probe/boom", headers={"X-Request-Id": "req-boom-1"})
|
||||
assert response.status_code == 500
|
||||
body = response.json()
|
||||
assert body["success"] is False
|
||||
assert body["error"]["code"] == 50000
|
||||
assert body["request_id"] == "req-boom-1"
|
||||
assert response.headers["X-Request-Id"] == "req-boom-1"
|
||||
assert body["error"]["message"] == "Internal server error"
|
||||
assert "traceback" not in str(body).lower()
|
||||
assert "runtimeerror" not in str(body).lower()
|
||||
|
||||
|
||||
def test_probe_and_docs_hidden_outside_non_production(monkeypatch) -> None: # type: ignore[no-untyped-def]
|
||||
monkeypatch.setenv("ENV_NAME", "prod")
|
||||
reload_settings()
|
||||
reset_engine()
|
||||
client = TestClient(create_app(validate_runtime=False))
|
||||
assert client.get("/_probe/boom").status_code == 404
|
||||
assert client.get("/docs").status_code == 404
|
||||
assert client.get("/openapi.json").status_code == 404
|
||||
monkeypatch.setenv("ENV_NAME", "dev")
|
||||
reload_settings()
|
||||
reset_engine()
|
||||
|
||||
|
||||
def test_health_envelope_has_no_timestamp() -> None:
|
||||
client = TestClient(create_app())
|
||||
body = client.get("/health").json()
|
||||
assert "timestamp" not in body
|
||||
|
||||
|
||||
def test_app_error_codes_envelope_shape() -> None:
|
||||
from watchman.core.errors import ForbiddenError, ServiceUnavailableError, UnauthorizedError
|
||||
|
||||
app = create_app(validate_runtime=False)
|
||||
|
||||
@app.get("/_probe/unauthorized")
|
||||
async def probe_unauthorized() -> None:
|
||||
raise UnauthorizedError()
|
||||
|
||||
@app.get("/_probe/forbidden")
|
||||
async def probe_forbidden() -> None:
|
||||
raise ForbiddenError(permission_node="perm:platform:audit.read")
|
||||
|
||||
@app.get("/_probe/unavailable")
|
||||
async def probe_unavailable() -> None:
|
||||
raise ServiceUnavailableError()
|
||||
|
||||
client = TestClient(app, raise_server_exceptions=False)
|
||||
|
||||
unauthorized = client.get("/_probe/unauthorized").json()
|
||||
assert unauthorized["success"] is False
|
||||
assert unauthorized["error"]["code"] == 41000
|
||||
assert "permission_node" not in unauthorized["error"]
|
||||
assert "timestamp" not in unauthorized
|
||||
|
||||
forbidden = client.get("/_probe/forbidden").json()
|
||||
assert forbidden["error"]["code"] == 42000
|
||||
assert forbidden["error"]["permission_node"] == "perm:platform:audit.read"
|
||||
|
||||
unavailable = client.get("/_probe/unavailable")
|
||||
assert unavailable.status_code == 503
|
||||
body = unavailable.json()
|
||||
assert body["error"]["code"] == 50000
|
||||
assert body["error"]["retryable"] is True
|
||||
@@ -0,0 +1,221 @@
|
||||
"""HXOPS assertion entry tests.
|
||||
|
||||
Uses an in-memory session and a scripted role directory. No network and no .env.local.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
import jwt
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from watchman.api.app import create_app
|
||||
from watchman.auth.casdoor import CasdoorIdentity
|
||||
from watchman.auth.hxops import HxopsAssertionLogin, get_hxops_login
|
||||
from watchman.auth.sessions import SESSION_LIFETIME, get_session_store
|
||||
from watchman.core.config import Settings
|
||||
from watchman.core.errors import ServiceUnavailableError
|
||||
|
||||
ISSUER = "https://hxops.test"
|
||||
AUDIENCE = "watchman"
|
||||
CASDOOR_ISSUER = "https://casdoor.test"
|
||||
NOW = datetime(2030, 1, 1, tzinfo=timezone.utc)
|
||||
|
||||
|
||||
class MemoryStore:
|
||||
"""Small session stand-in for the assertion route."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.rows: dict[str, object] = {}
|
||||
|
||||
def create(self, *, token_hash: str, identity: CasdoorIdentity, now: datetime, login_name: str) -> object:
|
||||
row = type(
|
||||
"Row",
|
||||
(),
|
||||
{
|
||||
"subject": identity.subject,
|
||||
"display_name": identity.display_name,
|
||||
"role_snapshot": list(identity.role_names),
|
||||
"login_name": login_name,
|
||||
"expires_at": now + SESSION_LIFETIME,
|
||||
},
|
||||
)()
|
||||
self.rows[token_hash] = row
|
||||
return row
|
||||
|
||||
def get(self, *, token_hash: str, now: datetime) -> object | None:
|
||||
row = self.rows.get(token_hash)
|
||||
if row is not None and row.expires_at > now:
|
||||
return row
|
||||
return None
|
||||
|
||||
def invalidate(self, *, token_hash: str) -> None:
|
||||
self.rows.pop(token_hash, None)
|
||||
|
||||
def update_roles(self, *, token_hash: str, role_names: list[str], now: datetime) -> None:
|
||||
del token_hash, role_names, now
|
||||
|
||||
|
||||
class Directory:
|
||||
def __init__(self, roles: list[str] | None = None, fail: bool = False) -> None:
|
||||
self.roles = roles or ["watchman-viewer"]
|
||||
self.fail = fail
|
||||
self.login_name = ""
|
||||
|
||||
def lookup_roles(self, *, login_name: str) -> list[str]:
|
||||
if self.fail:
|
||||
raise ServiceUnavailableError("Casdoor login is unavailable")
|
||||
self.login_name = login_name
|
||||
return list(self.roles)
|
||||
|
||||
|
||||
def _keys() -> tuple[rsa.RSAPrivateKey, str]:
|
||||
private_key = rsa.generate_private_key(public_exponent=65537, key_size=2048)
|
||||
public_pem = private_key.public_key().public_bytes(
|
||||
encoding=serialization.Encoding.PEM,
|
||||
format=serialization.PublicFormat.SubjectPublicKeyInfo,
|
||||
).decode()
|
||||
return private_key, public_pem
|
||||
|
||||
|
||||
def _settings(public_pem: str) -> Settings:
|
||||
return Settings(
|
||||
hxops_sso_issuer=ISSUER,
|
||||
hxops_sso_audience=AUDIENCE,
|
||||
hxops_sso_public_key=public_pem,
|
||||
casdoor_issuer=CASDOOR_ISSUER,
|
||||
)
|
||||
|
||||
|
||||
def _token(private_key: rsa.RSAPrivateKey, **overrides: object) -> str:
|
||||
claims: dict[str, object] = {
|
||||
"iss": ISSUER,
|
||||
"aud": AUDIENCE,
|
||||
"sub": "1001",
|
||||
"casdoor_sub": "casdoor-subject-1",
|
||||
"identity_issuer": CASDOOR_ISSUER,
|
||||
"preferred_username": "26110002",
|
||||
"name": "Worker",
|
||||
"user_id": 1001,
|
||||
"roles": ["watchman-admin"],
|
||||
"exp": int((NOW + timedelta(seconds=60)).timestamp()),
|
||||
}
|
||||
claims.update(overrides)
|
||||
return jwt.encode(claims, private_key, algorithm="RS256")
|
||||
|
||||
|
||||
def _client(entry: HxopsAssertionLogin, store: MemoryStore) -> TestClient:
|
||||
app = create_app(validate_runtime=False)
|
||||
app.dependency_overrides[get_hxops_login] = lambda: entry
|
||||
app.dependency_overrides[get_session_store] = lambda: store
|
||||
return TestClient(app)
|
||||
|
||||
|
||||
def test_valid_assertion_uses_directory_roles_not_assertion_roles() -> None:
|
||||
"""A signed assertion opens a session, and Casdoor roles replace assertion roles."""
|
||||
private_key, public_pem = _keys()
|
||||
directory = Directory(["watchman-viewer"])
|
||||
store = MemoryStore()
|
||||
entry = HxopsAssertionLogin(_settings(public_pem), directory)
|
||||
client = _client(entry, store)
|
||||
|
||||
response = client.post("/auth/hxops-entry", json={"assertion": _token(private_key)})
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json()["data"]["roles"] == ["watchman-viewer"]
|
||||
assert response.json()["data"]["subject"] == "casdoor-subject-1"
|
||||
assert directory.login_name == "26110002"
|
||||
assert len(store.rows) == 1
|
||||
assert "watchman-admin" not in response.text
|
||||
|
||||
|
||||
def test_local_user_id_cannot_impersonate_casdoor_subject() -> None:
|
||||
"""Using the HXOPS primary key as the Casdoor subject does not create a session."""
|
||||
private_key, public_pem = _keys()
|
||||
store = MemoryStore()
|
||||
entry = HxopsAssertionLogin(_settings(public_pem), Directory())
|
||||
client = _client(entry, store)
|
||||
|
||||
response = client.post(
|
||||
"/auth/hxops-entry",
|
||||
json={"assertion": _token(private_key, casdoor_sub="1001")},
|
||||
)
|
||||
|
||||
assert response.status_code == 401
|
||||
assert response.json()["error"]["code"] == 41000
|
||||
assert len(store.rows) == 0
|
||||
|
||||
|
||||
def test_hxops_subject_without_casdoor_sub_is_unauthorized() -> None:
|
||||
"""The HXOPS token subject is not accepted when casdoor_sub is absent."""
|
||||
private_key, public_pem = _keys()
|
||||
store = MemoryStore()
|
||||
entry = HxopsAssertionLogin(_settings(public_pem), Directory())
|
||||
client = _client(entry, store)
|
||||
|
||||
response = client.post(
|
||||
"/auth/hxops-entry",
|
||||
json={"assertion": _token(private_key, sub="1001", casdoor_sub="", user_id=None)},
|
||||
)
|
||||
|
||||
assert response.status_code == 401
|
||||
assert response.json()["error"]["code"] == 41000
|
||||
assert len(store.rows) == 0
|
||||
|
||||
|
||||
def test_missing_casdoor_reference_is_unauthorized() -> None:
|
||||
"""An assertion without a Casdoor issuer reference is rejected."""
|
||||
private_key, public_pem = _keys()
|
||||
store = MemoryStore()
|
||||
entry = HxopsAssertionLogin(_settings(public_pem), Directory())
|
||||
client = _client(entry, store)
|
||||
token = _token(private_key, identity_issuer="", casdoor_iss="")
|
||||
|
||||
response = client.post("/auth/hxops-entry", json={"assertion": token})
|
||||
|
||||
assert response.status_code == 401
|
||||
assert len(store.rows) == 0
|
||||
|
||||
|
||||
def test_bad_signature_creates_no_session() -> None:
|
||||
"""A token signed by another key cannot enter."""
|
||||
_, public_pem = _keys()
|
||||
other, _ = _keys()
|
||||
store = MemoryStore()
|
||||
entry = HxopsAssertionLogin(_settings(public_pem), Directory())
|
||||
client = _client(entry, store)
|
||||
|
||||
response = client.post("/auth/hxops-entry", json={"assertion": _token(other)})
|
||||
|
||||
assert response.status_code == 401
|
||||
assert len(store.rows) == 0
|
||||
|
||||
|
||||
def test_directory_failure_creates_no_session() -> None:
|
||||
"""If Casdoor cannot supply roles, the assertion does not become a session."""
|
||||
private_key, public_pem = _keys()
|
||||
store = MemoryStore()
|
||||
entry = HxopsAssertionLogin(_settings(public_pem), Directory(fail=True))
|
||||
client = _client(entry, store)
|
||||
|
||||
response = client.post("/auth/hxops-entry", json={"assertion": _token(private_key)})
|
||||
|
||||
assert response.status_code == 503
|
||||
assert response.json()["error"]["retryable"] is True
|
||||
assert len(store.rows) == 0
|
||||
|
||||
|
||||
def test_unconfigured_hxops_entry_is_unavailable() -> None:
|
||||
"""Missing HXOPS key material fails before role lookup."""
|
||||
directory = Directory()
|
||||
entry = HxopsAssertionLogin(Settings(), directory)
|
||||
try:
|
||||
entry.authenticate("not-a-token")
|
||||
except ServiceUnavailableError:
|
||||
pass
|
||||
else:
|
||||
raise AssertionError("unconfigured entry did not fail")
|
||||
assert directory.login_name == ""
|
||||
@@ -0,0 +1,214 @@
|
||||
"""Idempotent platform write tests."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import uuid
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlalchemy import create_engine, text
|
||||
|
||||
from watchman.api.app import create_app
|
||||
from watchman.auth.sessions import SESSION_COOKIE_NAME, hash_cookie_token, issue_cookie_token
|
||||
from watchman.core.config import get_settings, reload_settings
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from watchman.core.db import get_session_factory, reset_engine, set_tenant
|
||||
from watchman.models.auth_session import AuthSession
|
||||
from watchman.models.platform import AuditEvent
|
||||
from watchman.services import platform_records
|
||||
from sqlalchemy import select
|
||||
|
||||
|
||||
def _count_for_key(table: str, key: str) -> int:
|
||||
settings = get_settings()
|
||||
engine = create_engine(settings.database_url, pool_pre_ping=True)
|
||||
with engine.connect() as conn:
|
||||
conn.execute(
|
||||
text("SELECT set_config('app.tenant_id', :tenant, true)"),
|
||||
{"tenant": settings.tenant_id},
|
||||
)
|
||||
value = conn.execute(
|
||||
text(f"SELECT count(*) FROM {table} WHERE idempotency_key = :key"),
|
||||
{"key": key},
|
||||
).scalar_one()
|
||||
engine.dispose()
|
||||
return int(value)
|
||||
|
||||
|
||||
def _admin_token() -> str:
|
||||
"""Insert a fresh admin session and return the raw cookie token."""
|
||||
token = issue_cookie_token()
|
||||
now = datetime.now(timezone.utc)
|
||||
settings = get_settings()
|
||||
factory = get_session_factory()
|
||||
session = factory()
|
||||
try:
|
||||
set_tenant(session, settings.tenant_id)
|
||||
session.add(
|
||||
AuthSession(
|
||||
token_hash=hash_cookie_token(token),
|
||||
subject="idem-admin",
|
||||
issuer="https://casdoor.test",
|
||||
display_name="Idem Admin",
|
||||
login_name="idem-admin",
|
||||
role_snapshot=["watchman-admin"],
|
||||
role_checked_at=now,
|
||||
expires_at=now + timedelta(hours=1),
|
||||
tenant_id=settings.tenant_id,
|
||||
)
|
||||
)
|
||||
session.commit()
|
||||
finally:
|
||||
session.close()
|
||||
return token
|
||||
|
||||
|
||||
def _admin_client() -> TestClient:
|
||||
"""Return an API client that already carries a fresh admin session."""
|
||||
client = TestClient(create_app())
|
||||
client.cookies.set(SESSION_COOKIE_NAME, _admin_token())
|
||||
return client
|
||||
|
||||
|
||||
def test_duplicate_idempotency_key_returns_same_audit() -> None:
|
||||
reload_settings()
|
||||
reset_engine()
|
||||
client = _admin_client()
|
||||
key = f"idem-audit-{uuid.uuid4().hex}"
|
||||
headers = {"x-idempotency-key": key, "X-Request-Id": "req-idem-1"}
|
||||
body = {"action": "idem-test", "payload": {"n": 1}}
|
||||
first = client.post("/platform/audit-events", json=body, headers=headers)
|
||||
second = client.post("/platform/audit-events", json=body, headers=headers)
|
||||
assert first.status_code == 200
|
||||
assert second.status_code == 200
|
||||
assert first.json()["data"]["id"] == second.json()["data"]["id"]
|
||||
assert _count_for_key("audit_events", key) == 1
|
||||
|
||||
|
||||
def test_duplicate_idempotency_key_returns_same_run_record() -> None:
|
||||
reload_settings()
|
||||
reset_engine()
|
||||
client = _admin_client()
|
||||
key = f"idem-run-{uuid.uuid4().hex}"
|
||||
headers = {"x-idempotency-key": key, "X-Request-Id": "req-idem-2"}
|
||||
body = {"kind": "idem-test", "status": "ok", "detail": {"n": 1}}
|
||||
first = client.post("/platform/run-records", json=body, headers=headers)
|
||||
second = client.post("/platform/run-records", json=body, headers=headers)
|
||||
assert first.status_code == 200
|
||||
assert second.status_code == 200
|
||||
assert first.json()["data"]["id"] == second.json()["data"]["id"]
|
||||
assert _count_for_key("run_records", key) == 1
|
||||
|
||||
|
||||
def test_missing_idempotency_key_is_40000() -> None:
|
||||
reload_settings()
|
||||
reset_engine()
|
||||
client = _admin_client()
|
||||
response = client.post("/platform/audit-events", json={"action": "no-key", "payload": {}})
|
||||
assert response.status_code == 400
|
||||
assert response.json()["error"]["code"] == 40000
|
||||
|
||||
|
||||
def test_concurrent_duplicate_audit_returns_same_id() -> None:
|
||||
reload_settings()
|
||||
reset_engine()
|
||||
key = f"idem-race-{uuid.uuid4().hex}"
|
||||
body = {"action": "race", "payload": {}}
|
||||
|
||||
token = _admin_token()
|
||||
|
||||
def _post() -> str:
|
||||
client = TestClient(create_app())
|
||||
client.cookies.set(SESSION_COOKIE_NAME, token)
|
||||
response = client.post(
|
||||
"/platform/audit-events",
|
||||
json=body,
|
||||
headers={"x-idempotency-key": key},
|
||||
)
|
||||
assert response.status_code == 200, response.text
|
||||
return response.json()["data"]["id"]
|
||||
|
||||
with ThreadPoolExecutor(max_workers=4) as pool:
|
||||
ids = list(pool.map(lambda _: _post(), range(4)))
|
||||
assert len(set(ids)) == 1
|
||||
assert _count_for_key("audit_events", key) == 1
|
||||
|
||||
|
||||
def test_caller_tenant_id_is_ignored() -> None:
|
||||
reload_settings()
|
||||
reset_engine()
|
||||
settings = get_settings()
|
||||
client = _admin_client()
|
||||
key = f"tenant-inject-{uuid.uuid4().hex}"
|
||||
response = client.post(
|
||||
"/platform/audit-events",
|
||||
json={
|
||||
"action": "inject",
|
||||
"payload": {},
|
||||
"tenant_id": "attacker-tenant",
|
||||
},
|
||||
headers={"x-idempotency-key": key},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert "attacker" not in response.text.lower()
|
||||
|
||||
reload_settings()
|
||||
reset_engine()
|
||||
factory = get_session_factory()
|
||||
session: Session = factory()
|
||||
try:
|
||||
set_tenant(session, settings.tenant_id)
|
||||
row = session.scalar(select(AuditEvent).where(AuditEvent.idempotency_key == key))
|
||||
assert row is not None
|
||||
assert row.tenant_id == settings.tenant_id
|
||||
assert row.tenant_id != "attacker-tenant"
|
||||
finally:
|
||||
session.close()
|
||||
|
||||
|
||||
def test_integrity_fallback_returns_seeded_row(monkeypatch) -> None: # type: ignore[no-untyped-def]
|
||||
reload_settings()
|
||||
reset_engine()
|
||||
settings = get_settings()
|
||||
key = f"integrity-{uuid.uuid4().hex}"
|
||||
factory = get_session_factory()
|
||||
seed = factory()
|
||||
try:
|
||||
set_tenant(seed, settings.tenant_id)
|
||||
seeded = platform_records.create_audit_event(
|
||||
seed,
|
||||
action="seed",
|
||||
payload={},
|
||||
idempotency_key=key,
|
||||
)
|
||||
seed.commit()
|
||||
seeded_id = seeded.id
|
||||
finally:
|
||||
seed.close()
|
||||
|
||||
session = factory()
|
||||
try:
|
||||
set_tenant(session, settings.tenant_id)
|
||||
calls = {"n": 0}
|
||||
real_get = platform_records._get_audit
|
||||
|
||||
def fake_get(*args, **kwargs): # type: ignore[no-untyped-def]
|
||||
calls["n"] += 1
|
||||
if calls["n"] == 1:
|
||||
return None
|
||||
return real_get(*args, **kwargs)
|
||||
|
||||
monkeypatch.setattr(platform_records, "_get_audit", fake_get)
|
||||
row = platform_records.create_audit_event(
|
||||
session,
|
||||
action="seed",
|
||||
payload={},
|
||||
idempotency_key=key,
|
||||
)
|
||||
assert row.id == seeded_id
|
||||
assert calls["n"] >= 2
|
||||
finally:
|
||||
session.close()
|
||||
@@ -0,0 +1,191 @@
|
||||
"""Platform write authorization and object-access checks.
|
||||
|
||||
Covers anonymous denial, role denial, admin allowance, and stale role refresh.
|
||||
Depends on a local Postgres session row and an injected role directory.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import uuid
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from watchman.api.app import create_app
|
||||
from watchman.auth.access import (
|
||||
OBJECT_READ_NODE,
|
||||
PLATFORM_WRITE_NODE,
|
||||
allows_enter,
|
||||
require_object_access,
|
||||
)
|
||||
from watchman.auth.casdoor import HttpResponse
|
||||
from watchman.auth.principal import CasdoorRoleDirectory, get_role_directory
|
||||
from watchman.auth.sessions import SESSION_COOKIE_NAME, hash_cookie_token, issue_cookie_token
|
||||
from watchman.core.config import Settings, get_settings, reload_settings
|
||||
from watchman.core.db import get_session_factory, reset_engine, set_tenant
|
||||
from watchman.core.errors import ForbiddenError, ServiceUnavailableError
|
||||
from watchman.models.auth_session import AuthSession
|
||||
|
||||
|
||||
def _seed(roles: list[str], *, age: timedelta = timedelta(0), login_name: str = "worker") -> str:
|
||||
"""Insert one session and return its raw cookie token."""
|
||||
token = issue_cookie_token()
|
||||
now = datetime.now(timezone.utc)
|
||||
settings = get_settings()
|
||||
session = get_session_factory()()
|
||||
try:
|
||||
set_tenant(session, settings.tenant_id)
|
||||
session.add(
|
||||
AuthSession(
|
||||
token_hash=hash_cookie_token(token),
|
||||
subject=f"subject-{uuid.uuid4().hex}",
|
||||
issuer="https://casdoor.test",
|
||||
display_name="Worker",
|
||||
login_name=login_name,
|
||||
role_snapshot=list(roles),
|
||||
role_checked_at=now - age,
|
||||
expires_at=now + timedelta(hours=1),
|
||||
tenant_id=settings.tenant_id,
|
||||
)
|
||||
)
|
||||
session.commit()
|
||||
finally:
|
||||
session.close()
|
||||
return token
|
||||
|
||||
|
||||
def _client(token: str | None, directory: object | None = None) -> TestClient:
|
||||
"""Build a client, optionally replacing Casdoor role lookup."""
|
||||
reload_settings()
|
||||
reset_engine()
|
||||
app = create_app()
|
||||
if directory is not None:
|
||||
app.dependency_overrides[get_role_directory] = lambda: directory
|
||||
client = TestClient(app)
|
||||
if token is not None:
|
||||
client.cookies.set(SESSION_COOKIE_NAME, token)
|
||||
return client
|
||||
|
||||
|
||||
def test_anonymous_platform_write_is_401_without_permission_node() -> None:
|
||||
"""A missing session is unauthorized and must not name a permission node."""
|
||||
client = _client(None)
|
||||
response = client.post(
|
||||
"/platform/audit-events",
|
||||
json={"action": "hidden", "payload": {}},
|
||||
headers={"x-idempotency-key": f"anon-{uuid.uuid4().hex}"},
|
||||
)
|
||||
assert response.status_code == 401
|
||||
error = response.json()["error"]
|
||||
assert error["code"] == 41000
|
||||
assert "permission_node" not in error
|
||||
|
||||
|
||||
def test_viewer_platform_write_is_forbidden() -> None:
|
||||
"""A viewer session cannot create an audit event."""
|
||||
client = _client(_seed(["watchman-viewer"]))
|
||||
response = client.post(
|
||||
"/platform/audit-events",
|
||||
json={"action": "hidden", "payload": {}},
|
||||
headers={"x-idempotency-key": f"viewer-{uuid.uuid4().hex}"},
|
||||
)
|
||||
assert response.status_code == 403
|
||||
assert response.json()["error"]["permission_node"] == PLATFORM_WRITE_NODE
|
||||
|
||||
|
||||
def test_admin_platform_write_is_allowed() -> None:
|
||||
"""A fresh admin session can create a run record."""
|
||||
client = _client(_seed(["watchman-admin"]))
|
||||
response = client.post(
|
||||
"/platform/run-records",
|
||||
json={"kind": "check", "status": "ok", "detail": {}},
|
||||
headers={"x-idempotency-key": f"admin-{uuid.uuid4().hex}"},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert response.json()["success"] is True
|
||||
|
||||
|
||||
def test_stale_roles_fail_closed_when_directory_is_down() -> None:
|
||||
"""An expired role snapshot is not reused when Casdoor cannot be asked."""
|
||||
|
||||
class DownDirectory:
|
||||
def lookup_roles(self, *, login_name: str) -> list[str]:
|
||||
raise ServiceUnavailableError("Casdoor login is unavailable")
|
||||
|
||||
client = _client(_seed(["watchman-admin"], age=timedelta(minutes=6)), DownDirectory())
|
||||
response = client.post(
|
||||
"/platform/audit-events",
|
||||
json={"action": "stale", "payload": {}},
|
||||
headers={"x-idempotency-key": f"stale-{uuid.uuid4().hex}"},
|
||||
)
|
||||
assert response.status_code == 503
|
||||
assert response.json()["error"]["retryable"] is True
|
||||
|
||||
|
||||
def test_stale_roles_refresh_before_write() -> None:
|
||||
"""A successful refresh replaces the snapshot and then allows the admin write."""
|
||||
|
||||
class AdminDirectory:
|
||||
def lookup_roles(self, *, login_name: str) -> list[str]:
|
||||
assert login_name == "worker"
|
||||
return ["watchman-admin"]
|
||||
|
||||
client = _client(_seed(["watchman-viewer"], age=timedelta(minutes=6)), AdminDirectory())
|
||||
response = client.post(
|
||||
"/platform/audit-events",
|
||||
json={"action": "refreshed", "payload": {}},
|
||||
headers={"x-idempotency-key": f"refresh-{uuid.uuid4().hex}"},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
||||
|
||||
def test_enter_and_object_rules() -> None:
|
||||
"""Enter allows only the three roles. Object ids never authorize themselves."""
|
||||
assert allows_enter(["watchman-admin"])
|
||||
assert allows_enter(["watchman-operator"])
|
||||
assert allows_enter(["watchman-viewer"])
|
||||
assert not allows_enter([])
|
||||
assert not allows_enter(["someone-else"])
|
||||
for object_id in ("object-a", "object-b"):
|
||||
try:
|
||||
require_object_access(["watchman-admin"], object_id)
|
||||
except ForbiddenError as exc:
|
||||
assert exc.permission_node == OBJECT_READ_NODE
|
||||
else:
|
||||
raise AssertionError(object_id)
|
||||
|
||||
|
||||
class _ScriptedTransport:
|
||||
def __init__(self, response: HttpResponse) -> None:
|
||||
self.response = response
|
||||
self.calls = 0
|
||||
|
||||
def request(self, *, method: str, url: str, headers: dict[str, str], data: bytes | None = None) -> HttpResponse:
|
||||
self.calls += 1
|
||||
return self.response
|
||||
|
||||
|
||||
def test_role_directory_reads_names_without_calling_when_unconfigured() -> None:
|
||||
"""Role lookup parses Casdoor role names and does not run without configuration."""
|
||||
transport = _ScriptedTransport(
|
||||
HttpResponse(200, b'{"status":"ok","data":{"roles":[{"name":"watchman-admin"}]}}')
|
||||
)
|
||||
directory = CasdoorRoleDirectory(
|
||||
Settings(
|
||||
casdoor_endpoint="https://casdoor.test",
|
||||
casdoor_client_id="client",
|
||||
casdoor_client_secret="secret",
|
||||
casdoor_organization="organization_HX",
|
||||
),
|
||||
transport,
|
||||
)
|
||||
assert directory.lookup_roles(login_name="worker") == ["watchman-admin"]
|
||||
assert transport.calls == 1
|
||||
bare = CasdoorRoleDirectory(Settings(), transport)
|
||||
try:
|
||||
bare.lookup_roles(login_name="worker")
|
||||
except ServiceUnavailableError:
|
||||
pass
|
||||
else:
|
||||
raise AssertionError("unconfigured lookup called the transport")
|
||||
assert transport.calls == 1
|
||||
@@ -0,0 +1,28 @@
|
||||
"""Celery probe task has no platform audit side effects."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from sqlalchemy import create_engine, text
|
||||
|
||||
from watchman.core.config import get_settings, reload_settings
|
||||
from watchman.jobs.celery_app import probe_ping
|
||||
|
||||
|
||||
def test_probe_ping_is_side_effect_free() -> None:
|
||||
reload_settings()
|
||||
settings = get_settings()
|
||||
engine = create_engine(settings.database_url, pool_pre_ping=True)
|
||||
with engine.connect() as conn:
|
||||
conn.execute(text("SELECT set_config('app.tenant_id', :tenant, true)"), {"tenant": settings.tenant_id})
|
||||
before = conn.execute(text("SELECT count(*) FROM audit_events")).scalar_one()
|
||||
result = probe_ping()
|
||||
after = conn.execute(text("SELECT count(*) FROM audit_events")).scalar_one()
|
||||
engine.dispose()
|
||||
assert result == {"status": "pong"}
|
||||
assert after == before
|
||||
|
||||
|
||||
def test_probe_task_is_registered() -> None:
|
||||
from watchman.jobs.celery_app import celery_app
|
||||
|
||||
assert "watchman.probe.ping" in celery_app.tasks
|
||||
@@ -0,0 +1,225 @@
|
||||
"""RLS positive and negative tests against local Postgres."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import uuid
|
||||
|
||||
import pytest
|
||||
from sqlalchemy import create_engine, text
|
||||
from sqlalchemy.exc import DBAPIError
|
||||
from sqlalchemy.orm import Session, sessionmaker
|
||||
|
||||
from watchman.core.config import get_settings, reload_settings
|
||||
from watchman.core.db import reset_engine, set_tenant
|
||||
from watchman.models.platform import AuditEvent, RunRecord
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def app_session_factory():
|
||||
reload_settings()
|
||||
reset_engine()
|
||||
# Ensure Session.after_begin tenant rebind is registered for this process.
|
||||
from watchman.core.db import _ensure_after_begin_listener
|
||||
|
||||
_ensure_after_begin_listener()
|
||||
settings = get_settings()
|
||||
engine = create_engine(settings.database_url, pool_pre_ping=True)
|
||||
factory = sessionmaker(bind=engine, autoflush=False, autocommit=False, expire_on_commit=False)
|
||||
tracked_keys: list[str] = []
|
||||
yield factory, tracked_keys, settings
|
||||
cleanup = factory()
|
||||
try:
|
||||
if tracked_keys:
|
||||
set_tenant(cleanup, settings.tenant_id)
|
||||
cleanup.execute(
|
||||
text("DELETE FROM audit_events WHERE idempotency_key = ANY(:keys)"),
|
||||
{"keys": tracked_keys},
|
||||
)
|
||||
cleanup.execute(
|
||||
text("DELETE FROM run_records WHERE idempotency_key = ANY(:keys)"),
|
||||
{"keys": tracked_keys},
|
||||
)
|
||||
cleanup.commit()
|
||||
finally:
|
||||
cleanup.close()
|
||||
engine.dispose()
|
||||
reset_engine()
|
||||
|
||||
|
||||
def test_app_role_is_constrained() -> None:
|
||||
"""Application role must not be superuser, must not bypass RLS, must not own tables."""
|
||||
reload_settings()
|
||||
settings = get_settings()
|
||||
engine = create_engine(settings.database_url, pool_pre_ping=True)
|
||||
with engine.connect() as conn:
|
||||
role = conn.execute(text("SELECT current_user")).scalar_one()
|
||||
flags = conn.execute(
|
||||
text(
|
||||
"SELECT rolsuper, rolbypassrls FROM pg_roles WHERE rolname = current_user"
|
||||
)
|
||||
).one()
|
||||
audit_owner = conn.execute(
|
||||
text(
|
||||
"SELECT tableowner FROM pg_tables "
|
||||
"WHERE schemaname = 'public' AND tablename = 'audit_events'"
|
||||
)
|
||||
).scalar_one()
|
||||
run_owner = conn.execute(
|
||||
text(
|
||||
"SELECT tableowner FROM pg_tables "
|
||||
"WHERE schemaname = 'public' AND tablename = 'run_records'"
|
||||
)
|
||||
).scalar_one()
|
||||
engine.dispose()
|
||||
assert role == "watchman_app"
|
||||
assert flags.rolsuper is False
|
||||
assert flags.rolbypassrls is False
|
||||
assert audit_owner != "watchman_app"
|
||||
assert run_owner != "watchman_app"
|
||||
|
||||
|
||||
def test_rls_requires_tenant_for_read(app_session_factory) -> None: # type: ignore[no-untyped-def]
|
||||
factory, tracked_keys, settings = app_session_factory
|
||||
setup_key = f"rls-setup-{uuid.uuid4().hex}"
|
||||
tracked_keys.append(setup_key)
|
||||
session: Session = factory()
|
||||
try:
|
||||
set_tenant(session, settings.tenant_id)
|
||||
session.add(
|
||||
AuditEvent(
|
||||
tenant_id=settings.tenant_id,
|
||||
action="rls-setup",
|
||||
payload={},
|
||||
idempotency_key=setup_key,
|
||||
)
|
||||
)
|
||||
session.commit()
|
||||
finally:
|
||||
session.close()
|
||||
|
||||
bare: Session = factory()
|
||||
try:
|
||||
count = bare.execute(text("SELECT count(*) FROM audit_events")).scalar()
|
||||
assert count == 0
|
||||
finally:
|
||||
bare.close()
|
||||
|
||||
|
||||
def test_rls_blocks_write_without_tenant(app_session_factory) -> None: # type: ignore[no-untyped-def]
|
||||
factory, _tracked_keys, settings = app_session_factory
|
||||
bare: Session = factory()
|
||||
try:
|
||||
bare.add(
|
||||
AuditEvent(
|
||||
tenant_id=settings.tenant_id,
|
||||
action="rls-write-denied",
|
||||
payload={},
|
||||
idempotency_key=f"rls-write-{uuid.uuid4().hex}",
|
||||
)
|
||||
)
|
||||
with pytest.raises(DBAPIError):
|
||||
bare.commit()
|
||||
bare.rollback()
|
||||
finally:
|
||||
bare.close()
|
||||
|
||||
|
||||
def test_rls_isolates_other_tenant_on_audit_and_runs(app_session_factory) -> None: # type: ignore[no-untyped-def]
|
||||
factory, tracked_keys, settings = app_session_factory
|
||||
audit_key = f"rls-iso-audit-{uuid.uuid4().hex}"
|
||||
run_key = f"rls-iso-run-{uuid.uuid4().hex}"
|
||||
tracked_keys.extend([audit_key, run_key])
|
||||
session: Session = factory()
|
||||
try:
|
||||
set_tenant(session, settings.tenant_id)
|
||||
session.add(
|
||||
AuditEvent(
|
||||
tenant_id=settings.tenant_id,
|
||||
action="rls-iso",
|
||||
payload={},
|
||||
idempotency_key=audit_key,
|
||||
)
|
||||
)
|
||||
session.add(
|
||||
RunRecord(
|
||||
tenant_id=settings.tenant_id,
|
||||
kind="rls-iso",
|
||||
status="ok",
|
||||
detail={},
|
||||
idempotency_key=run_key,
|
||||
)
|
||||
)
|
||||
session.commit()
|
||||
finally:
|
||||
session.close()
|
||||
|
||||
other: Session = factory()
|
||||
try:
|
||||
set_tenant(other, "other-tenant")
|
||||
audit_count = other.execute(
|
||||
text("SELECT count(*) FROM audit_events WHERE idempotency_key = :k"),
|
||||
{"k": audit_key},
|
||||
).scalar()
|
||||
run_count = other.execute(
|
||||
text("SELECT count(*) FROM run_records WHERE idempotency_key = :k"),
|
||||
{"k": run_key},
|
||||
).scalar()
|
||||
assert audit_count == 0
|
||||
assert run_count == 0
|
||||
finally:
|
||||
other.close()
|
||||
|
||||
same: Session = factory()
|
||||
try:
|
||||
set_tenant(same, settings.tenant_id)
|
||||
audit_count = same.execute(
|
||||
text("SELECT count(*) FROM audit_events WHERE idempotency_key = :k"),
|
||||
{"k": audit_key},
|
||||
).scalar()
|
||||
run_count = same.execute(
|
||||
text("SELECT count(*) FROM run_records WHERE idempotency_key = :k"),
|
||||
{"k": run_key},
|
||||
).scalar()
|
||||
assert audit_count == 1
|
||||
assert run_count == 1
|
||||
finally:
|
||||
same.close()
|
||||
|
||||
|
||||
def test_tenant_rebounds_after_commit(app_session_factory) -> None: # type: ignore[no-untyped-def]
|
||||
"""after_begin must restore tenant RLS after an explicit commit()."""
|
||||
factory, tracked_keys, settings = app_session_factory
|
||||
first_key = f"rls-rebind-1-{uuid.uuid4().hex}"
|
||||
second_key = f"rls-rebind-2-{uuid.uuid4().hex}"
|
||||
tracked_keys.extend([first_key, second_key])
|
||||
session: Session = factory()
|
||||
try:
|
||||
set_tenant(session, settings.tenant_id)
|
||||
session.add(
|
||||
AuditEvent(
|
||||
tenant_id=settings.tenant_id,
|
||||
action="rls-rebind-1",
|
||||
payload={},
|
||||
idempotency_key=first_key,
|
||||
)
|
||||
)
|
||||
session.commit()
|
||||
session.add(
|
||||
AuditEvent(
|
||||
tenant_id=settings.tenant_id,
|
||||
action="rls-rebind-2",
|
||||
payload={},
|
||||
idempotency_key=second_key,
|
||||
)
|
||||
)
|
||||
session.commit()
|
||||
count = session.execute(
|
||||
text(
|
||||
"SELECT count(*) FROM audit_events "
|
||||
"WHERE idempotency_key IN (:a, :b)"
|
||||
),
|
||||
{"a": first_key, "b": second_key},
|
||||
).scalar()
|
||||
assert count == 2
|
||||
finally:
|
||||
session.close()
|
||||
@@ -0,0 +1,205 @@
|
||||
"""Acceptance tests for local RS256 JWT verification.
|
||||
Locks requirement criterion 1 without HTTP routes, sessions, or external identity providers.
|
||||
Depends on in-memory RSA keys, PyJWT, and the Watchman verifier."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import base64
|
||||
from datetime import datetime, timedelta, timezone
|
||||
import hashlib
|
||||
import hmac
|
||||
import json
|
||||
from typing import Any
|
||||
|
||||
import jwt
|
||||
import pytest
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
|
||||
from watchman.auth.token_verifier import verify_rs256_token
|
||||
from watchman.core.errors import UnauthorizedError
|
||||
|
||||
ISSUER = "https://issuer.test/watchman"
|
||||
AUDIENCE = "watchman-test"
|
||||
NOW = datetime(2030, 1, 1, tzinfo=timezone.utc)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def rsa_keys() -> tuple[rsa.RSAPrivateKey, str, bytes]:
|
||||
"""Create test-only RSA material without persisting any key data.
|
||||
|
||||
Returns private signing material plus PEM and DER public representations for local verification;
|
||||
key generation failures fail the test process before any token assertion can run.
|
||||
"""
|
||||
private_key = rsa.generate_private_key(public_exponent=65537, key_size=2048)
|
||||
public_key = private_key.public_key()
|
||||
public_pem = public_key.public_bytes(
|
||||
encoding=serialization.Encoding.PEM,
|
||||
format=serialization.PublicFormat.SubjectPublicKeyInfo,
|
||||
).decode()
|
||||
public_der = public_key.public_bytes(
|
||||
encoding=serialization.Encoding.DER,
|
||||
format=serialization.PublicFormat.SubjectPublicKeyInfo,
|
||||
)
|
||||
return private_key, public_pem, public_der
|
||||
|
||||
|
||||
def _claims(**overrides: Any) -> dict[str, Any]:
|
||||
"""Build signed-token claims that satisfy the local verifier's expected identity contract.
|
||||
|
||||
Optional overrides replace the default issuer, audience, or expiry values; callers use them to create
|
||||
a specific rejection case while retaining a valid claim shape.
|
||||
"""
|
||||
claims: dict[str, Any] = {
|
||||
"sub": "test-subject",
|
||||
"iss": ISSUER,
|
||||
"aud": AUDIENCE,
|
||||
"exp": int((NOW + timedelta(minutes=5)).timestamp()),
|
||||
}
|
||||
claims.update(overrides)
|
||||
return claims
|
||||
|
||||
|
||||
def _signed_token(private_key: rsa.RSAPrivateKey, **overrides: Any) -> str:
|
||||
"""Sign a valid baseline claim set so each test isolates one acceptance condition.
|
||||
|
||||
Input is in-memory RSA material and optional claim replacements; signing failures surface to the test
|
||||
rather than being confused with the verifier's unauthorized result.
|
||||
"""
|
||||
return jwt.encode(_claims(**overrides), private_key, algorithm="RS256")
|
||||
|
||||
|
||||
def test_verifier_returns_claims_after_valid_rs256_signature_and_checks(
|
||||
rsa_keys: tuple[rsa.RSAPrivateKey, str, bytes],
|
||||
) -> None:
|
||||
"""Locks acceptance criterion 1's required success case after all verification checks pass."""
|
||||
private_key, public_pem, _ = rsa_keys
|
||||
|
||||
claims = verify_rs256_token(
|
||||
_signed_token(private_key),
|
||||
public_key=public_pem,
|
||||
issuer=ISSUER,
|
||||
audience=AUDIENCE,
|
||||
now=NOW,
|
||||
)
|
||||
|
||||
assert claims["sub"] == "test-subject"
|
||||
|
||||
|
||||
def test_verifier_rejects_invalid_signature(
|
||||
rsa_keys: tuple[rsa.RSAPrivateKey, str, bytes],
|
||||
) -> None:
|
||||
"""Locks acceptance criterion 1: a token signed by another key cannot authenticate."""
|
||||
_, public_pem, _ = rsa_keys
|
||||
other_private_key = rsa.generate_private_key(public_exponent=65537, key_size=2048)
|
||||
|
||||
with pytest.raises(UnauthorizedError):
|
||||
verify_rs256_token(
|
||||
_signed_token(other_private_key),
|
||||
public_key=public_pem,
|
||||
issuer=ISSUER,
|
||||
audience=AUDIENCE,
|
||||
now=NOW,
|
||||
)
|
||||
|
||||
|
||||
def test_verifier_rejects_wrong_issuer(
|
||||
rsa_keys: tuple[rsa.RSAPrivateKey, str, bytes],
|
||||
) -> None:
|
||||
"""Locks acceptance criterion 1: a signed token from another issuer cannot authenticate."""
|
||||
private_key, public_pem, _ = rsa_keys
|
||||
|
||||
with pytest.raises(UnauthorizedError):
|
||||
verify_rs256_token(
|
||||
_signed_token(private_key, iss="https://issuer.test/other"),
|
||||
public_key=public_pem,
|
||||
issuer=ISSUER,
|
||||
audience=AUDIENCE,
|
||||
now=NOW,
|
||||
)
|
||||
|
||||
|
||||
def test_verifier_rejects_wrong_audience(
|
||||
rsa_keys: tuple[rsa.RSAPrivateKey, str, bytes],
|
||||
) -> None:
|
||||
"""Locks acceptance criterion 1: a signed token for another audience cannot authenticate."""
|
||||
private_key, public_pem, _ = rsa_keys
|
||||
|
||||
with pytest.raises(UnauthorizedError):
|
||||
verify_rs256_token(
|
||||
_signed_token(private_key, aud="another-service"),
|
||||
public_key=public_pem,
|
||||
issuer=ISSUER,
|
||||
audience=AUDIENCE,
|
||||
now=NOW,
|
||||
)
|
||||
|
||||
|
||||
def test_verifier_rejects_clearly_expired_token(
|
||||
rsa_keys: tuple[rsa.RSAPrivateKey, str, bytes],
|
||||
) -> None:
|
||||
"""Locks acceptance criterion 1: deterministic expiry before now cannot authenticate."""
|
||||
private_key, public_pem, _ = rsa_keys
|
||||
|
||||
with pytest.raises(UnauthorizedError):
|
||||
verify_rs256_token(
|
||||
_signed_token(private_key, exp=int((NOW - timedelta(days=1)).timestamp())),
|
||||
public_key=public_pem,
|
||||
issuer=ISSUER,
|
||||
audience=AUDIENCE,
|
||||
now=NOW,
|
||||
)
|
||||
|
||||
|
||||
def test_verifier_rejects_unsigned_none_algorithm_token(
|
||||
rsa_keys: tuple[rsa.RSAPrivateKey, str, bytes],
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
"""Locks the explicit S1 algorithm policy: unsigned alg none tokens cannot authenticate."""
|
||||
_, public_pem, _ = rsa_keys
|
||||
token = jwt.encode(_claims(), key=None, algorithm="none")
|
||||
monkeypatch.setattr(
|
||||
jwt,
|
||||
"decode",
|
||||
lambda *args, **kwargs: pytest.fail("jwt.decode must not process alg none tokens"),
|
||||
)
|
||||
|
||||
with pytest.raises(UnauthorizedError):
|
||||
verify_rs256_token(
|
||||
token,
|
||||
public_key=public_pem,
|
||||
issuer=ISSUER,
|
||||
audience=AUDIENCE,
|
||||
now=NOW,
|
||||
)
|
||||
|
||||
|
||||
def test_verifier_rejects_hs256_public_key_confusion(
|
||||
rsa_keys: tuple[rsa.RSAPrivateKey, str, bytes],
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
"""Locks the explicit S1 algorithm policy: public-key-as-HMAC tokens cannot authenticate."""
|
||||
_, public_pem, public_der = rsa_keys
|
||||
encoded_header = base64.urlsafe_b64encode(
|
||||
json.dumps({"alg": "HS256", "typ": "JWT"}, separators=(",", ":")).encode()
|
||||
).rstrip(b"=")
|
||||
encoded_claims = base64.urlsafe_b64encode(
|
||||
json.dumps(_claims(), separators=(",", ":")).encode()
|
||||
).rstrip(b"=")
|
||||
signing_input = encoded_header + b"." + encoded_claims
|
||||
signature = hmac.new(public_der, signing_input, hashlib.sha256).digest()
|
||||
token = f"{signing_input.decode()}.{base64.urlsafe_b64encode(signature).rstrip(b'=').decode()}"
|
||||
monkeypatch.setattr(
|
||||
jwt,
|
||||
"decode",
|
||||
lambda *args, **kwargs: pytest.fail("jwt.decode must not process HS256 tokens"),
|
||||
)
|
||||
|
||||
with pytest.raises(UnauthorizedError):
|
||||
verify_rs256_token(
|
||||
token,
|
||||
public_key=public_pem,
|
||||
issuer=ISSUER,
|
||||
audience=AUDIENCE,
|
||||
now=NOW,
|
||||
)
|
||||
@@ -0,0 +1,879 @@
|
||||
version = 1
|
||||
revision = 5
|
||||
requires-python = "==3.12.*"
|
||||
|
||||
[manifest]
|
||||
members = [
|
||||
"watchman",
|
||||
"watchman-workspace",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alembic"
|
||||
version = "1.20.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "mako" },
|
||||
{ name = "sqlalchemy" },
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/93/1c/00909e0fbebad2121d916fdcab044cae988146680e9ee4387ba25fef8747/alembic-1.20.1.tar.gz", hash = "sha256:83490def1f723413db5096591f7609ac52544805be93849170088ed04f5a2e0b", size = 2103576, upload-time = "2026-10-22T03:24:35.93Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/11/3c/8740f5b4e1bd57333e4f84265b9b6363da4f7cf70f5622dd1e2fde7a0bd5/alembic-1.20.1-py3-none-any.whl", hash = "sha256:9970712cfb81ea26c8658d378aaa5b8f6ff9146e5bb111d70497c164016cf598", size = 270355, upload-time = "2026-10-22T03:24:37.667Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "amqp"
|
||||
version = "5.4.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "vine" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/4b/46/64c69cdd9705a5b312920cf76c3cb7c2c4718ffeafbfbcf87a842890765e/amqp-5.4.2.tar.gz", hash = "sha256:9362660c4a31150cf18e78cae2ce8aa1e929fc6c6739e69f6dd5dbea9c3edc82", size = 133663, upload-time = "2026-11-02T10:34:18.483Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e1/1d/2da3a059d2736e2ad8104762f93ad2145b6b0586aaa6be5290bab5d96c68/amqp-5.4.2-py3-none-any.whl", hash = "sha256:e6e756b15c89c86818b48a4947a424706238afbf67d457428d3269bc4590db9e", size = 51956, upload-time = "2026-11-02T10:34:16.66Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "annotated-doc"
|
||||
version = "0.0.6"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/0f/6e/a61e86e43bb6039b31a33a8f5fba76fe1cdacf3661e7b9756d4ff1b28cdc/annotated_doc-0.0.6.tar.gz", hash = "sha256:7969bb69912085b2285849c0dcac0b4b374fd180c13cf10a87f284ffcf347bbf", size = 10767, upload-time = "2026-11-10T18:17:11.28Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/cd/f5/3dd85d583e55be76cd02b1fc9bbec771b12d63124b01661d9535ccf8721f/annotated_doc-0.0.6-py3-none-any.whl", hash = "sha256:361ca0950cc7082f53fa69e9328409f40a62c61e57e0a47e1825a08078a58a53", size = 5293, upload-time = "2026-11-10T18:17:10.249Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "annotated-types"
|
||||
version = "0.8.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/5f/56/a8120250d128bed162cd73c76d45f6ef9991f3e068f62a8ee060afa3104a/annotated_types-0.8.0.tar.gz", hash = "sha256:13b2beaad985e05e2d6407ee4c4f35590b11f8d693a258a561055cac8f64cab7", size = 15893, upload-time = "2026-07-23T20:16:13.995Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/99/91/8acff4f5e50511b911bbccb72b8628a49c68ce14148cd9f6431094859a90/annotated_types-0.8.0-py3-none-any.whl", hash = "sha256:f072f4d804ea359e4eaf198b1af7a8b0943881a87f31bb764f8bf219bb9419e0", size = 13427, upload-time = "2026-07-23T20:16:12.938Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyio"
|
||||
version = "4.16.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "idna" },
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/a1/98/7e457a3b014976887a050561955c0b76e1e7e2d6e27b78ecef2ef80518f2/anyio-4.16.0.tar.gz", hash = "sha256:59bb03251907983d1603d27c3087ddb1e93299ea2163adcdba37899a4fb12ffb", size = 310971, upload-time = "2026-11-01T11:20:07.282Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/a9/16/7757fb84c819accc7d7e9af5291b261e4abb8627ee040f99e7d35ef2457a/anyio-4.16.0-py3-none-any.whl", hash = "sha256:c66ae634e0b8228396b801741beb3294326d4b6102f7bba4041c0dfb58c29026", size = 134521, upload-time = "2026-11-01T11:20:05.59Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "billiard"
|
||||
version = "4.3.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/96/ba/4ee8c6d14b3e9b5ce89b5b070f1352e6cadefde3f6bc36afcfee5e7158a2/billiard-4.3.2.tar.gz", hash = "sha256:9eb83c99b1cf7acb1fed86c1dfd477157000a1a2c0108005c1e5837b55d2acba", size = 169668, upload-time = "2026-11-02T09:12:45.346Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/21/05/3d445479b3f7e4ae0901cdf2c45f561b436d1a5b8ed1c5c97e260152ae50/billiard-4.3.2-py3-none-any.whl", hash = "sha256:37735a7b4117aafa73532b3b493db4c02fb85c0e69d5f3447f113fd30ff27872", size = 90632, upload-time = "2026-11-02T09:12:43.707Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "celery"
|
||||
version = "5.7.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "billiard" },
|
||||
{ name = "click" },
|
||||
{ name = "click-didyoumean" },
|
||||
{ name = "click-plugins" },
|
||||
{ name = "click-repl" },
|
||||
{ name = "kombu" },
|
||||
{ name = "python-dateutil" },
|
||||
{ name = "tzlocal" },
|
||||
{ name = "vine" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/ef/f7/166bfd22cbd0dd4f77715ddd207881c1332cd1f304d79b1a123aff7cdf10/celery-5.7.0.tar.gz", hash = "sha256:6a5dfcf6662287204f009a02002b9e66c83d4105e47ebabdc7079108772fc6f0", size = 2075113, upload-time = "2026-11-05T15:14:24.027Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e9/cf/cd7fcb9d8f5a21fa420ddf19ee96969e36820182275a731abdf4260ed86a/celery-5.7.0-py3-none-any.whl", hash = "sha256:18310a9c919f9029e4735367484d93e6a25cdfd30afdc474622cc263d9b35f6e", size = 519594, upload-time = "2026-11-05T15:14:17.649Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "certifi"
|
||||
version = "2026.10.23"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/fd/11/b524cbd9bbdaca58608e4cf4053fd463417549e1959fa8d3aa18319f9555/certifi-2026.10.23.tar.gz", hash = "sha256:a9895e6e2758b371e0545e321a3a8fd1fcfd9829ada8824a936dfb16aaaf36cd", size = 136225, upload-time = "2026-10-23T11:36:16.478Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/32/d1/a3652fe2c19134d0d15922177821d863cbd7e842d53a21bbe7e8e3a1b5ac/certifi-2026.10.23-py3-none-any.whl", hash = "sha256:e9b54de76e530bb6cf0ccd036787103acb58fd42ba930ea8bf948ddbaa2f61d1", size = 135082, upload-time = "2026-10-23T11:36:14.763Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cffi"
|
||||
version = "2.1.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "pycparser", marker = "implementation_name != 'PyPy'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/9e/ef/008a1939e372c06329a3fce4279c02f328488f3526744906eeec3da7ad5f/cffi-2.1.1.tar.gz", hash = "sha256:dd31f52ea1086513bb9df30f8fcee9b8918323ae067a3d5b78bc826a000712be", size = 530807, upload-time = "2026-08-03T21:21:18.939Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/10/69/43965eccfdead3b9220015fd1320e117be8c6ed01a62ffab76eeb752f5d5/cffi-2.1.1-cp312-cp312-macosx_10_15_x86_64.whl", hash = "sha256:c8c69575568085ba0b1b10c0249d779a214aea6f6522e949a0fc9fb0fcb449d0", size = 184821, upload-time = "2026-08-03T21:19:44.887Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/54/7d/16e5a096677b5e313ca80cd5e5170efa3ea44624a82bb111925522da64b1/cffi-2.1.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:f81b3b8f3d4e343550fa4baa0e479bba9f2d29ce9c2e9b51d1ce1718d7442fcf", size = 184719, upload-time = "2026-08-03T21:19:46.129Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/56/e6/8941622732edec876dd17d0453dce07317ae96db34f2ec1436c9d3785986/cffi-2.1.1-cp312-cp312-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:811bd1e21d32de12efca32393a0ab3f5133b54fce9bd44b8bd77ab07da14bf6a", size = 214799, upload-time = "2026-08-03T21:19:47.218Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/44/de/f98430906df1545ffde0d543dd124a7a439bc2cd32b36b9c53f805df7333/cffi-2.1.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:68e62fe11f30d5ca8289242866f0a5291402d8529ca2178ab8afc5c9694ae890", size = 222389, upload-time = "2026-08-03T21:19:48.331Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/6a/5b/717f1526b9957b34456313c31645c5b82b8fb5c3fe9e4752999be7128bfc/cffi-2.1.1-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:4a7c934f7360e8cd64fe9efadcbd10c7c6364f531e432b9a4bf5ccbc9e0e8b50", size = 210249, upload-time = "2026-08-03T21:19:49.543Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/64/b3/f8aa4f3e34986c7e4ec45072d1b1b9dd295b6b18007b45518d79726dd725/cffi-2.1.1-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:3143d81e29e1e20a9ce10901ec369012947876596f75a222235965f2b7ae832e", size = 208775, upload-time = "2026-08-03T21:19:50.918Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b1/db/dceb9dd5b231e1da801793f8acc9f3c52a7e1afe40bb1aae37e02b0faad5/cffi-2.1.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:c1453022f490d2459a11819d83ad1d586e9ff65a12ac3e705ffebd46d3685dcf", size = 221822, upload-time = "2026-08-03T21:19:52.054Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a0/d2/6cd24ae3be000a634109c247d1475d62e5616d0dc78c82770942ec384248/cffi-2.1.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:208f941bb9d18e768138677f0a6d2ce01f590df56043dda1df1535ac57c88517", size = 225232, upload-time = "2026-08-03T21:19:53.109Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/cb/52/3fa190537004dd7f0ab860a6dc7c0175b8667f68d1e618a46f5498d30250/cffi-2.1.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:210019b6c7cf07f081b4c54635c8cf744377001350e29cc0f81c4377b4797735", size = 223597, upload-time = "2026-08-03T21:19:54.515Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/80/fb/0bb75b7039588c074b37ae99f40d9bfddf990ecb2fbc346ebccd2e56b9be/cffi-2.1.1-cp312-cp312-win32.whl", hash = "sha256:046bfc24911b37851ee1b51aab8bffe713d89c68c6a057b09484ce9fd5f69b4e", size = 175292, upload-time = "2026-08-03T21:19:55.566Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d9/79/615cc094e2fb508cade7de88d3b4f6c4ec2bab695c97bce9153dc65aadf5/cffi-2.1.1-cp312-cp312-win_amd64.whl", hash = "sha256:f53e442b08449d42821fa4a4fba000095af9f62742a500f978a9f557ec44339a", size = 185919, upload-time = "2026-08-03T21:19:56.89Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/70/c6/d0ea84713fe46b243a436a18fcd47d639732747e21635c8a27191b06dc30/cffi-2.1.1-cp312-cp312-win_arm64.whl", hash = "sha256:7bde5e4cc5c10140859842b9d383af292b22639a4dffb725314baf45968cef80", size = 180093, upload-time = "2026-08-03T21:19:58.155Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "click"
|
||||
version = "8.5.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/45/37/edbf1b0707709013c0cf2e8317e03d97ed29bf4cac709fe328904ae92a38/click-8.5.1.tar.gz", hash = "sha256:9bbfada76703fd1d784b83eea012e3e8c6a001a876543ef104fa56aaaeb072b4", size = 399151, upload-time = "2026-11-06T17:37:01.021Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/31/7d/164b7ffc8624fe9efb4221bf9af485d5c1e41b9ae118045d2b6dc5457d8b/click-8.5.1-py3-none-any.whl", hash = "sha256:8bb5376d2006950386f8c6427613334a2acadc5f559cb80e638d00b4df957e37", size = 126163, upload-time = "2026-11-06T17:36:59.287Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "click-didyoumean"
|
||||
version = "0.3.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "click" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/30/ce/217289b77c590ea1e7c24242d9ddd6e249e52c795ff10fac2c50062c48cb/click_didyoumean-0.3.1.tar.gz", hash = "sha256:4f82fdff0dbe64ef8ab2279bd6aa3f6a99c3b28c05aa09cbfc07c9d7fbb5a463", size = 3089, upload-time = "2024-03-24T08:22:07.499Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/1b/5b/974430b5ffdb7a4f1941d13d83c64a0395114503cc357c6b9ae4ce5047ed/click_didyoumean-0.3.1-py3-none-any.whl", hash = "sha256:5c4bb6007cfea5f2fd6583a2fb6701a22a41eb98957e63d0fac41c10e7c3117c", size = 3631, upload-time = "2024-03-24T08:22:06.356Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "click-plugins"
|
||||
version = "1.1.1.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "click" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/c3/a4/34847b59150da33690a36da3681d6bbc2ec14ee9a846bc30a6746e5984e4/click_plugins-1.1.1.2.tar.gz", hash = "sha256:d7af3984a99d243c131aa1a828331e7630f4a88a9741fd05c927b204bcf92261", size = 8343, upload-time = "2025-06-25T00:47:37.555Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/3d/9a/2abecb28ae875e39c8cad711eb1186d8d14eab564705325e77e4e6ab9ae5/click_plugins-1.1.1.2-py2.py3-none-any.whl", hash = "sha256:008d65743833ffc1f5417bf0e78e8d2c23aab04d9745ba817bd3e71b0feb6aa6", size = 11051, upload-time = "2025-06-25T00:47:36.731Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "click-repl"
|
||||
version = "0.4.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "click" },
|
||||
{ name = "prompt-toolkit" },
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/28/50/bea78619ff1fc0fbd61882f64a1302a8abb2ea0b3db92907042d0e362df2/click_repl-0.4.1.tar.gz", hash = "sha256:c32a1cf6f95e5bd6e92076f81ce24eafd33f2f0ffb0135887e335b8e446d1c0b", size = 16403, upload-time = "2026-10-05T06:01:57.607Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/a4/f6/12dc0f2e0159c2b416818b7fedcda15b520043773364a81d7389809a5af5/click_repl-0.4.1-py3-none-any.whl", hash = "sha256:5cb10881d4c5ebaa8695eceb69911af3062ee78342812b713564b17aad333eb5", size = 14988, upload-time = "2026-10-05T06:01:55.611Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "colorama"
|
||||
version = "0.4.6"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cryptography"
|
||||
version = "50.0.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "cffi", marker = "platform_python_implementation != 'PyPy'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/9d/af/182eb91b0df3fe75c4d9f26fe70684569566745f6ba7e5c9c73a862c5252/cryptography-50.0.2.tar.gz", hash = "sha256:7b46165bb56eb4704e2eaaf86f3c940d19154535d9b0ca7d6d590b04060e00d5", size = 880623, upload-time = "2026-09-30T15:30:04.884Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e5/56/d194340cc4a57535e82e1bee9e89667ac4b7c13b5d3f59686deae3094dd5/cryptography-50.0.2-cp311-abi3-macosx_11_0_arm64.whl", hash = "sha256:fa8f5efb344d6908a1ce62f4a24e2e5780f825d6f53f5f50ec5ffacac72936cb", size = 3914904, upload-time = "2026-09-30T14:43:44.339Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d9/69/c9bd862c3bf43d6399c433caf002df16e2dffd4be49bdf515cda38038711/cryptography-50.0.2-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:79def8d059362e7831389ed3be0ecdf58a89386e1271e35dd9f5af84e81bffd0", size = 4731146, upload-time = "2026-09-30T14:43:47.113Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/21/69/64cef1f702bf6657e0cc186ed1a2891d50d29fb41586b254e1c07adea261/cryptography-50.0.2-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:630ebfea3bf689d075f82316324ff7433dc447fe6bc1bfc76524b74b4a9567d2", size = 4719841, upload-time = "2026-09-30T14:43:49.01Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/38/6b/61a3f8d8c5e1e49a6cddccafc4015cc1c0021360ab0acb4080e7a423644a/cryptography-50.0.2-cp311-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:f9f6143a8c75945eb960d9eb98905a441394abfa24afaae239d514ffb2586480", size = 4738340, upload-time = "2026-09-30T14:43:50.932Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7b/2e/7212ca32fd43dc91f2f41db20160b268098874b4c9a0e7be94d6835f5b2e/cryptography-50.0.2-cp311-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:a582ab2ae1d34f67112cadc86702774c9ea4374df6bca6afe672817203c99134", size = 5367029, upload-time = "2026-09-30T14:43:52.911Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/1a/f1/b474e930c4d910328780e3940da76f5aa5cbc48ce1fc14e44d239d9ea9db/cryptography-50.0.2-cp311-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:4061c0079120205fb760c58acab6443e217307dcf05e3702cf970e0689972856", size = 4753050, upload-time = "2026-09-30T14:43:55.272Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7c/52/9af10e80ac16b0fcc2123f9cbd5e7afbd0fd5075bb7a607c592258a39cda/cryptography-50.0.2-cp311-abi3-manylinux_2_31_armv7l.whl", hash = "sha256:ac9ed99d81760c62fe89d5f0815cdfa1ba9a35141cf30f1c2d044f04b4803d2e", size = 4376724, upload-time = "2026-09-30T14:43:57.24Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/71/37/6202e488cc1eb625ea110c292c6bda92823176e023f427d8d5660ce8d632/cryptography-50.0.2-cp311-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:87e9ce85beb6b328ba370cc6e6aea483c92617b4c95b1d33a49297eb662bfb04", size = 4737859, upload-time = "2026-09-30T14:43:59.541Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8f/30/e86d7d518489b0ae2497091a35287abcb1a2ce4037837a34afbe9b1d6964/cryptography-50.0.2-cp311-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:f265528741e048bce55c3463ed721fb0aa45a5888d8add8cfeccb3035451bbdc", size = 5324103, upload-time = "2026-09-30T14:44:01.901Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d3/69/2c833a049475e0a3444e94c7d0aca0aa51d166374a449b09e92ac98138de/cryptography-50.0.2-cp311-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:9dab55f57c74c3cad24c323bacbbd04be4705ba6eb0d92e920b1fc4837ed5079", size = 4752576, upload-time = "2026-09-30T14:44:04.545Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/6c/5d/906970b83bbfc1f5bbfb677a143c181f2801f23b6a7204a3b47c42c97e65/cryptography-50.0.2-cp311-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:25784ce8b9621c90c643efb9e1e2162ab3b0224cae446ad5e70e7fcb1ce18b51", size = 4870819, upload-time = "2026-09-30T14:44:06.884Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/68/e3/f2298d3bb55e0c4a91841ec4d01b3f020ba8c5fbf15ccdcc6dcf03f97025/cryptography-50.0.2-cp311-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:85d0d9a31b9098e98534226d5686b47264b95e62ce459dc2e62fdfc809f9fe93", size = 5030152, upload-time = "2026-09-30T14:44:09.443Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/9a/4f/adfc442765721292fff86d314ce385d3249d22db42295c0dd057727b60f3/cryptography-50.0.2-cp311-abi3-win_amd64.whl", hash = "sha256:7afa5a6602a9f29af1f3a2965f831bae7c9d5d597b7cbb716d41ab3b7d89879c", size = 3824692, upload-time = "2026-09-30T14:44:11.671Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/2d/49/93f6a6e7a87c9aa68d44d3e1cdb5fe8f60c90d5d2f46acae9a56892816b8/cryptography-50.0.2-cp315-abi3.abi3t-macosx_11_0_arm64.whl", hash = "sha256:edc3342adf8f697fc5f59c887a304356f147b397809440ed64e2fa6af2f50f37", size = 4133708, upload-time = "2026-09-30T14:44:41.807Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8c/75/32ac2a56243d778805c16ca6a32b8f74fb757df7e28d7ecb560afafb59cf/cryptography-50.0.2-cp315-abi3.abi3t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d370b8d1dfcdf7130178137f6fbee6140774a1acc6cacefc4b42643ec11d0a3a", size = 4956267, upload-time = "2026-09-30T14:44:43.693Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/aa/a4/2c8d734e43d97f0842ee9f1b7b4bfb3d0cf5e19edebf43c2afe6675c2320/cryptography-50.0.2-cp315-abi3.abi3t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:f2f9bd7f90c64fe89253f0a2c05e3c4856072660429ce8831b4235bf29403a67", size = 4966465, upload-time = "2026-09-30T14:44:45.769Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c2/58/ee288c829a6f41f6235ae9dd33d82fd19b45442b65b4c8a3da36963d9f7a/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_28_aarch64.whl", hash = "sha256:e275096ea1e60cc595cda2836fd4a6c725d1125108b868be17f53684d164e2cc", size = 4959356, upload-time = "2026-09-30T14:44:48.211Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/92/20/9ded6d51ddd9897f6b6e81fb9ebea7951d7cc5d6c890b0ed8abf77a51a80/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_28_ppc64le.whl", hash = "sha256:b13478603dcd0a2479ff8e87e2c19a7d525734686fe3c49542472293a204212d", size = 5548822, upload-time = "2026-09-30T14:44:50.86Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/02/a8/8df951850d6b31d2a00218f19e2b3f999523437ed7a819df7fa427942fca/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl", hash = "sha256:58a0c478eeca76fe5e07993c5a0703def34a6dc6a0cda4f5564639b33112ffe7", size = 5001199, upload-time = "2026-09-30T14:44:53.379Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8b/f9/36b3022218ce75b7cdf068fb95f809f9bd0d820e4955ef43b90c255cc7ac/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_31_armv7l.whl", hash = "sha256:d38cdff612d06fa6a32840d5e1b1f7a27cee4a349aa9085d94a67789d6bfd408", size = 4629333, upload-time = "2026-09-30T14:44:55.635Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8c/72/20f99a219f6af47cdd1cbd978c243b92d71496e168a746138af44ded4f29/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_34_aarch64.whl", hash = "sha256:fdd28f912fccfec1846a94e2e1e8f9b0012f557f0c46fe4f3eb0d7a87afcf90b", size = 4958822, upload-time = "2026-09-30T14:44:59.639Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f2/20/196f112617fb08eb4d608a2a6c422373d46f9cc2857f38fc0667033c0899/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_34_ppc64le.whl", hash = "sha256:cbc8738fd8526d80f35cb3a40d41f41a2e7030bb3b18b09a6778ef63d291c2fd", size = 5506351, upload-time = "2026-09-30T14:45:02.267Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/24/95/83378121ef3eaaaf71d4b781577ff794acb39b9e1b87a3f156898c8497ed/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_34_x86_64.whl", hash = "sha256:e105ab60406787da31fccc883fc0f733af1efd78f0136a4599692c4083a73d0c", size = 5000859, upload-time = "2026-09-30T14:45:05.009Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/22/f7/70fd7ae4d1dbfa7ba29b02e1b9068771519a86027756510b700ce81086a8/cryptography-50.0.2-cp315-abi3.abi3t-musllinux_1_2_aarch64.whl", hash = "sha256:6f8700550aa1474a91e5dc07049c46f98b423b5b1ddd0483e0b51362eeeaf5be", size = 5092151, upload-time = "2026-09-30T15:29:15.932Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d4/be/688367b74de86984bd58d8efacfc7c9e68b89a6a22ced0fb4f38db50254a/cryptography-50.0.2-cp315-abi3.abi3t-musllinux_1_2_x86_64.whl", hash = "sha256:c71be1cbfa5cd9a41ee452acf1eccd82b2c05950358b106ec8ceb83411d1a020", size = 5286120, upload-time = "2026-09-30T15:29:18.309Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/39/d1/55f8a3f2ef5d1529e16835ef10cf0fe3d559ce237b46dddc440c0bba3649/cryptography-50.0.2-cp315-abi3.abi3t-win_amd64.whl", hash = "sha256:c423ab384a46c4dff7217b2ea5ba2e11cffdeab6441acd04cf65a369caf0366c", size = 4111557, upload-time = "2026-09-30T15:29:20.155Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/23/ad/ac987755d00e1e64273760228d2635ae38dae2be83e3c6e0d3289d91dec3/cryptography-50.0.2-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:0ec5f09541743261e66e291b4a0cbf0fb2997aeaab6d9e9c740b9dba1b58d1c2", size = 3943588, upload-time = "2026-09-30T15:29:22.265Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d5/8d/6d585339bedf85d45044c85d8412dac53f2bb6f918e8b7777efba1787844/cryptography-50.0.2-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:c5e67125c7dca78d199ec4e116aa93dbb83494808ecbb8211a2cb09b1bf41dbd", size = 4756166, upload-time = "2026-09-30T15:29:24.58Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/bf/f1/1c1f6874e8550cfddd4b688ceb38cefb6ed15ceed224d56f133f3d88c214/cryptography-50.0.2-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:ee247f5c245c9a2fe7c8e2214e295918838e44e00a45a6718451e4004219e767", size = 4749145, upload-time = "2026-09-30T15:29:26.807Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c1/63/61b15dc1a8de03fe0adbe3fd7608b3ad5c73bf50993bbcb1faaa930afe33/cryptography-50.0.2-cp39-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:dfe9763530994147d9af1def057a5b9658b00e8f8fe8743d144d1e0911c2e454", size = 4763638, upload-time = "2026-09-30T15:29:28.588Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fc/35/b345bdfa40c9126df1a9d33236aa98418367931b8725f84fc3ae2b98dc59/cryptography-50.0.2-cp39-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:58ddb5a8e3179d12f19e4ea34d2d32e9d63a4baa142c875c1eb59f41b7243acd", size = 5382217, upload-time = "2026-09-30T15:29:30.589Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4f/87/ef344a9e616871f2519c22d6afcda79ddd5d35e9592d95eb6e677608d055/cryptography-50.0.2-cp39-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:f21e8a22c8605750c7af886bab299a363721264061b4ac0a30efb73cfd58efc5", size = 4781387, upload-time = "2026-09-30T15:29:32.605Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/90/5b/f2fdb13cd0b96f6f932c8627bb292a45f11c64d21620a8e120aee9a3b848/cryptography-50.0.2-cp39-abi3-manylinux_2_31_armv7l.whl", hash = "sha256:9c8402a82ea0dc4ceeab793db05f0fafa8ca139ca34fcde5df0f596103c74107", size = 4403790, upload-time = "2026-09-30T15:29:34.374Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/bc/ce/7e4f662b1e3c393513569e402cfc85ac7da0bd3d5435e122a3140219eb2d/cryptography-50.0.2-cp39-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:0ddc924c04591c2811ca024d62ecad4f7f6f08af8939c211438f48a16bd23602", size = 4764319, upload-time = "2026-09-30T15:29:36.149Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3c/3f/86ff33ce34cc0de6847fb96e035a1a760d81652e38643f617c02ad32ef7a/cryptography-50.0.2-cp39-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:a6557e5f38e065ca9fbdaf7cfc7435ecb1d113aa81a022d1b51921ee7432e227", size = 5338560, upload-time = "2026-09-30T15:29:39.053Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/40/cf/6b5c8e2fd9202d98988ab7cb5cc5c991704c4ad55f492ff408e4969f83f1/cryptography-50.0.2-cp39-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:1981f1db4630889b9ef7803fadef12b056f428cb6b85c27ba57b774793b6093c", size = 4780973, upload-time = "2026-09-30T15:29:41.251Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/10/bf/8d6ebc7dded797bd0f0160d52188021211f011a2b164ef0ae1dac4587465/cryptography-50.0.2-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:7a8701d6b584d76e909e3d305b7d126b41439876a5aaf76cddc67fc230eafa2e", size = 4897738, upload-time = "2026-09-30T15:29:43.106Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d4/aa/f3f6e0de7e6253b8baa8b2d8fb9d50924fa75cee3d4624bd4bc1208ee923/cryptography-50.0.2-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:ce47f66801c20ec6c6632453bb5960fe38939e9306970b48b3a5a26de7745d94", size = 5058280, upload-time = "2026-09-30T15:29:44.827Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f6/b6/a1faf3a27ae9405fb34b1713cc73b2d8a26b04d5c561578fa2e6ef3e5bb9/cryptography-50.0.2-cp39-abi3-win_amd64.whl", hash = "sha256:4e81d95e5bafc2d6e34e4bed780e53e4d5b9a2f928573428aa4d35fbec1eb0de", size = 3854095, upload-time = "2026-09-30T15:29:46.782Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastapi"
|
||||
version = "0.163.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "annotated-doc" },
|
||||
{ name = "anyio" },
|
||||
{ name = "opentelemetry-api" },
|
||||
{ name = "pydantic" },
|
||||
{ name = "starlette" },
|
||||
{ name = "typing-extensions" },
|
||||
{ name = "typing-inspection" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/a4/62/19000d0f3699cacaeffe8a3c4cc7046d87aac3291163ffeb2ef08b82d859/fastapi-0.163.1.tar.gz", hash = "sha256:3d364b02a68b67292e833ff2dfed3b8dc3aeadf73e271c15316c6c166668792f", size = 544796, upload-time = "2026-11-15T09:51:31.271Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/20/b6/2424da1e40825d3fc54539621811f34e21472499677c9490e4967270e38e/fastapi-0.163.1-py3-none-any.whl", hash = "sha256:68f2d8050f5c3583121c0d203046cc7def5c16a7d6c43a0e7707a8ea610fe2d3", size = 154541, upload-time = "2026-11-15T09:51:29.726Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "greenlet"
|
||||
version = "3.5.6"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/3e/6e/0091f175ccd02b02bc8811bbcbcc6ac2e980be116e3b2f7a736ca322bf84/greenlet-3.5.6.tar.gz", hash = "sha256:8e67c43bdfc88d5fee6db0d3e40175b362fc95fb85f0412d233b9b203c53a575", size = 207653, upload-time = "2026-09-14T15:42:51.806Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/72/18/3fc6d951466ae9a2a688edcddde3b2e388da0a8244e0caf7117bbeb0eb95/greenlet-3.5.6-cp312-cp312-macosx_11_0_universal2.whl", hash = "sha256:a5876d0a60355af98d535c47f6cd6eb0f8a432396dab26845d380b92f8412422", size = 295668, upload-time = "2026-09-14T14:22:33.241Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/27/89/366d2af5061eeefa5012f510d95a99c8620dcc457609838db4d538820318/greenlet-3.5.6-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e85880b538e59a59f55117b81f208a6660ad5ac328aad9305f812d9b8bc67a0f", size = 611700, upload-time = "2026-09-14T15:12:01.962Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/54/1c/07f133f865fd58ae593dd2bbec3144acaee9b04ffe2eb48c6e121747ceef/greenlet-3.5.6-cp312-cp312-manylinux_2_24_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f0ba7c2a329d650628f4c8572fd1db29f0a59dd70a3e3e0710dcf18a35cce9d8", size = 624223, upload-time = "2026-09-14T15:20:42.459Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/66/6a/1594f3869c57c149abdb380492529e04d4c0229b5e4d79572c5bd0aaa673/greenlet-3.5.6-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:975736b002ed080d124cf81a79cb7e05cb26d6b3f5c7a7b651c0fcce70353aa1", size = 621404, upload-time = "2026-09-14T14:35:59.027Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a2/f5/33e5c9e48178b9259fd000f8f45caa4a65036f65d3d0c06a602f570f025d/greenlet-3.5.6-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:0616b8f878098c5681fd8f0dc92d887551717402342a70f0abcbfea5f5ad8a44", size = 1584998, upload-time = "2026-09-14T15:10:06.653Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ef/31/9b4e140bc24d0ad7927ebd651f5608b0acc2334d061748c3b6ad19085cfa/greenlet-3.5.6-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3dbb4596a6a4e5d47121a33ff20533a81e60f302d9e67b69909a8bc21a43f0a7", size = 1647568, upload-time = "2026-09-14T14:35:49.787Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c3/71/d79f1791f824f8ff15c2978746640467ae932a2365e0201069f7f272395f/greenlet-3.5.6-cp312-cp312-win_amd64.whl", hash = "sha256:7ac4abb3877c43af320392c664774eef6fa2cc063c79a55fc02d844a3cbe7395", size = 324203, upload-time = "2026-09-14T14:22:54.504Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/63/af/42aca4d56e8cb321912203069d8d34734cb288222f10ad2ae102718cc577/greenlet-3.5.6-cp312-cp312-win_arm64.whl", hash = "sha256:301102a49120b095e72a7838792b41233975fc1c155daec6d98f81c00c9280e0", size = 308310, upload-time = "2026-09-14T14:24:03.008Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "h11"
|
||||
version = "0.16.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/01/ee/02a2c011bdab74c6fb3c75474d40b3052059d95df7e73351460c8588d963/h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1", size = 101250, upload-time = "2025-04-24T03:35:25.427Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515, upload-time = "2025-04-24T03:35:24.344Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "httpcore"
|
||||
version = "1.0.9"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "certifi" },
|
||||
{ name = "h11" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/06/94/82699a10bca87a5556c9c59b5963f2d039dbd239f25bc2a63907a05a14cb/httpcore-1.0.9.tar.gz", hash = "sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8", size = 85484, upload-time = "2025-04-24T22:06:22.219Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/7e/f5/f66802a942d491edb555dd61e3a9961140fd64c90bce1eafd741609d334d/httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55", size = 78784, upload-time = "2025-04-24T22:06:20.566Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "httptools"
|
||||
version = "0.9.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/3a/ec/deed52912ab7ca6c0b12859330c571c60c61d7267b341b28951fcbf13694/httptools-0.9.0.tar.gz", hash = "sha256:d484ebb7e3a3f3597b0f645fbd1b85633674ca808c1f5ba11c2caf7c66f5c8b6", size = 282523, upload-time = "2026-10-09T19:57:04.301Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/da/ed/0916b8b7ebd1deeaf22acba71b68c57b4b6b69aa1918f3812dea208b4276/httptools-0.9.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:f9ccc9884241efceb4547a92955d128574c864681f11b7ea3ecbde295fafbe8b", size = 119039, upload-time = "2026-10-09T19:54:32.556Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c2/0b/9b6de4a01a563a904d0826c9069c824b330e1816df26c9bdf93f60b50857/httptools-0.9.0-cp312-cp312-macosx_11_0_x86_64.whl", hash = "sha256:45b3002392948dcf578029c89f6318e1289a993a1a5ec38a4161560fab60f811", size = 115051, upload-time = "2026-10-09T19:54:33.908Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/85/3f/642113e9882f53158ecddf58003d25f18ded2c210ed23bf6eb663d4d51c3/httptools-0.9.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:3e3201fe4d46e0d15d7ff9fafc94a605da9eb82d2c5b9837f0368acb325481f1", size = 552848, upload-time = "2026-10-09T19:54:35.434Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/95/4c/3ecc59c99c28652d8d08d9b5be65770a14d2cadc616dad94224cee2b0e7e/httptools-0.9.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:58a1b0ec4cbb930e69669f9771715b2c7898d3cdf064d9811f7a66afef96b544", size = 549181, upload-time = "2026-10-09T19:54:37.099Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/43/ce/21f5b2759590b7054e38d3b704a3c6b853c3395c370b3d6f16c45aea0fc0/httptools-0.9.0-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4c58dc91aefb31adad500aa68054334f429b840b36dd29e34e834101044cb2ef", size = 569121, upload-time = "2026-10-09T19:54:38.772Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/52/c3/7c523aa8d0fa7a57010a3e1bbdebc209585009076465f3d1ae6a3f54b814/httptools-0.9.0-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:6b900073e7b8481ef1aaf4f6c1789d210a1db01a9da8789821578cfeb4c2d540", size = 487649, upload-time = "2026-10-09T19:54:40.398Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/94/e2/d90d60002692b8afcbc06fb49ca3a4365b32abed6c40fb2b612c67721a00/httptools-0.9.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6c12d0393a903b58bc5f5a7406d6c5290acfb8284290d68547ce620c06f7d133", size = 529583, upload-time = "2026-10-09T19:54:42.296Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/46/c0/19172874cde0344a20c85877a0b2d0dcfca31111729ad8a79e8b4ac4e207/httptools-0.9.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:29b0d823e3c1e7cd1093a5dc889245db693ef13ada624cd66e2262421ef38867", size = 552414, upload-time = "2026-10-09T19:54:44.19Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/1b/b8/02ea7910f69e5371986b025fb3b410592106df54e977a5732fd1d95917b5/httptools-0.9.0-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:6ebd39ee26db460cfe5ab8b71a15d1149b289139a0d3981522757d6af620887e", size = 482400, upload-time = "2026-10-09T19:54:46.064Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/de/97/f05eac916d44cbbfe43668a6a40ab93e7fd8f94d5120d1ce2d8e55c69871/httptools-0.9.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:4efbee349138a3fee7a4cc3a95abd2d499fae70dd5bff9fed9138d6f570f4283", size = 536148, upload-time = "2026-10-09T19:54:47.695Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b6/e9/9435dfcb7f1a1d6ebdc79a902164dfca70e33774c80bb60d25c630c31ef1/httptools-0.9.0-cp312-cp312-win32.whl", hash = "sha256:36fac804b8cfd6b935ae64f71349f833d2b6298404626d017a2c57bb942bc643", size = 86274, upload-time = "2026-10-09T19:54:49.1Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8b/69/813f1bf90be507d4166c437be1a413574d0e0abf36e2fec10c266661b0ee/httptools-0.9.0-cp312-cp312-win_amd64.whl", hash = "sha256:7e32b83bd8c2f8b6fa726ef34e63e21c4d7eddc277d40d4ef7245ea3ed28e5b6", size = 92446, upload-time = "2026-10-09T19:54:50.498Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ae/e0/1d29e328c4cafe843403341e1455e0aec18b0e6910fbb14f12b36b563f19/httptools-0.9.0-cp312-cp312-win_arm64.whl", hash = "sha256:813a32f94991b9627795528053c73a57d2ce3eb98ede89f0e1c7a31095938e81", size = 88676, upload-time = "2026-10-09T19:54:51.844Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "httpx"
|
||||
version = "0.28.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "anyio" },
|
||||
{ name = "certifi" },
|
||||
{ name = "httpcore" },
|
||||
{ name = "idna" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/b1/df/48c586a5fe32a0f01324ee087459e112ebb7224f646c0b5023f5e79e9956/httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc", size = 141406, upload-time = "2024-12-06T15:37:23.222Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", size = 73517, upload-time = "2024-12-06T15:37:21.509Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "3.20"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f5/08/8eea9d4b8302028f3abb2c0813953f7aec26d33b7a8960ed760e65ff29fa/idna-3.20.tar.gz", hash = "sha256:a7db850025b95ded1eae8a46181a1a6c56c92c96f0e2b005d9ff8dc0210cab44", size = 216463, upload-time = "2026-09-17T14:11:04.752Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/58/a2/bb081bab032533a855d44de1d56f8e8426114ff1ba5d1f07a438a0a654f8/idna-3.20-py3-none-any.whl", hash = "sha256:ab7ae7122974553370f0bdb919e1a960b2cd1bc1ef0276416d896db81c14582c", size = 69583, upload-time = "2026-09-17T14:11:03.168Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iniconfig"
|
||||
version = "2.3.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/01/e1/2069291243c926a2ff1cd706c7f3eeb9b62144bf60f77c9fb9ff2fb26bd3/iniconfig-2.3.1.tar.gz", hash = "sha256:67f4b9c50da0dedf52af349e7749a80a9057a5031199791b906c3bb3ae878960", size = 21209, upload-time = "2026-10-06T22:48:38.076Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/56/43/4ca9e49d27a1fcf6bece6f6aec0ea46bb9112489b93d4b688fb415457bdb/iniconfig-2.3.1-py3-none-any.whl", hash = "sha256:9121e2c1fdb355232495be3194c8dfe87ccc2d5dee45947b78e68f499790d7a7", size = 7552, upload-time = "2026-10-06T22:48:36.959Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kombu"
|
||||
version = "5.7.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "amqp" },
|
||||
{ name = "tzdata", marker = "sys_platform == 'win32'" },
|
||||
{ name = "vine" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/57/31/3e632ebce43c684dcc6eead4660b33307e6153be87e33c14e1ed9875deff/kombu-5.7.0.tar.gz", hash = "sha256:31e62fdfd2381caa3422f8e02b84a491d9a2180ddda74507b57f4cb1e1c2c2c9", size = 627051, upload-time = "2026-11-03T05:58:33.446Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/84/20/f73d8e0bff9708b0f2337220be1b5d7ebd738bc3a89b63cf44d257157014/kombu-5.7.0-py3-none-any.whl", hash = "sha256:dede73bff4c89175be382c4203d2f167cf7017c384396ec75c36a1b5678f1587", size = 266635, upload-time = "2026-11-03T05:58:31.475Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mako"
|
||||
version = "1.4.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "markupsafe" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/5a/09/e07c4b5579a79f4b16f8d4f29f6c54514ac787c4ad506b8c4f28a0e6b0bf/mako-1.4.3.tar.gz", hash = "sha256:cd6537fe88d5fec315c55c2f8529bc4ce7a9a352ad7db3eeaa6a66e2dd4ec37a", size = 412799, upload-time = "2026-09-22T20:54:31.509Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/6d/a0/053d6af3e8f871e0073b4a36732d9e65be77a72e5434c31b94f6af78a6bb/mako-1.4.3-py3-none-any.whl", hash = "sha256:723296007c870bfd6b3f0c3230dba7198096e5269297ebf5e4eff9e7ffa39d4f", size = 80164, upload-time = "2026-09-22T20:54:33.128Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "markupsafe"
|
||||
version = "3.0.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/38/9b/e422a865e1d5d57d0e509b4e0bf1c1a70a7f6382c29a5aa428df994c8bc8/markupsafe-3.0.4.tar.gz", hash = "sha256:2e9ad7dd851bf45fab9f75cbff4cb493fee9979e8d8c7c9c3ee119022518edd6", size = 153777, upload-time = "2026-10-02T23:07:22.29Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/81/09/4c59d56b8461ae8eb0d8ba34bb25b7e618547044679d58a82ef9b2479fc1/markupsafe-3.0.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:61631e08084be9e21a8967ec3139c7616ed7c5e9368e05c86d1b39562c8a57b6", size = 11658, upload-time = "2026-10-02T23:04:51.876Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a2/f0/d6613774d86fbf6d145751d43c59875e47a6f9f17daee0aef173bd36d90e/markupsafe-3.0.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0930db9bdc62d22944e10b066448bb65dc9abe9112880c7cab8da54db4284d5f", size = 12050, upload-time = "2026-10-02T23:04:52.931Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/0d/f2/8f18e0b806eb13c1f8d07d917a720831ead54253a6dec011fbc78098a6f8/markupsafe-3.0.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6a45c3d514f2436064db00d7fc8778d888f0236ebfed649b53d13a59e69ad51b", size = 24363, upload-time = "2026-10-02T23:04:53.895Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/60/ce/fa07dbe8a5675558fa36dea033e19995bc783de2dec5f540ccb9030b06aa/markupsafe-3.0.4-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:1e1451fab512d1bcc3dc26988ec1edb0b82c2db909132872cd9356070a6b63df", size = 28525, upload-time = "2026-10-02T23:04:54.905Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/85/40/be87c01f3868ec217f8a2015089d71c22c8c5a75324822e5ed1cdd87210d/markupsafe-3.0.4-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:bd3ce56ae2cbae3ba82b683bc425cd7e48d2ed8b10f3e818186b6f5646d9271c", size = 24733, upload-time = "2026-10-02T23:04:56.229Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4f/a7/aeedb5140afa41fc74c225e9184ab96723a6e873b6ee1c9fede7283456d8/markupsafe-3.0.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8e124f974786f831d6043728e38296969d3579db8896fe004682f5758e613581", size = 22985, upload-time = "2026-10-02T23:04:57.521Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c3/fc/e91352bb08c6a59da3ef0909d457bf95a5f5908fbf151b30a06d9dbcfbb4/markupsafe-3.0.4-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:c02e8f18bdedba082cef725942ac823b9b60656db07f7e265cb31618dfd00d77", size = 22001, upload-time = "2026-10-02T23:04:58.597Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5d/f8/bffee5e7d2a3deb59748a797650a48af7e672025cf641a79344a771ad106/markupsafe-3.0.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:9f098115c247e11d138ab83a28fa0323c77015007ea2df73ba5fd714dfefd67c", size = 23793, upload-time = "2026-10-02T23:04:59.686Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ed/59/b853d6628ecb4d658e1d637224846d5e9bb4adf4f8df97f3be9f29dce2ec/markupsafe-3.0.4-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:d5f93ebbeb8032d47e349328ec8662d973d9b05a70b3c35df1f91fe419b84749", size = 22640, upload-time = "2026-10-02T23:05:00.768Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/09/b2/1506df394f0f075797c418d0301498f49e43be194e3ffcb49e6fe6ccf022/markupsafe-3.0.4-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:64511c54db4e4987aef4c41923235927428729e8174c5dba488429be70a998ed", size = 24074, upload-time = "2026-10-02T23:05:01.813Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c7/81/5ed69cda630ac69ef60d06c09ba5a7f84ff66a2e28cf986fd5614ab3c6e6/markupsafe-3.0.4-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:e1a622f13970d81f95d0c72f9dc090dce9085fccfa4c9f2174377ee32bd15786", size = 21563, upload-time = "2026-10-02T23:05:03.239Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/0c/fe/fb1e79be0fea60aa32602ebefc9c35a82bb42b4df157285ab7dfec12341a/markupsafe-3.0.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c9a7f43c0b202b334cc9184af09bb8f21d3a209e038efaf106936fb69e6b026e", size = 23048, upload-time = "2026-10-02T23:05:04.479Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c8/52/7632a53360671a9b750cdbabaf9cdd89f18b42248b8e4cb42c0b0296e459/markupsafe-3.0.4-cp312-cp312-win32.whl", hash = "sha256:f0ec3b750b59375eab5b0fb2b9254810c00a3375be6d789899f1055a1d556237", size = 14108, upload-time = "2026-10-02T23:05:05.513Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3f/bf/62495e180b7000aaf30000fff849e933f74264638057176cf46852500adc/markupsafe-3.0.4-cp312-cp312-win_amd64.whl", hash = "sha256:11935df9bf455ed0c04eb87bcd720f02b1fe5e02128a9430f23aed6f93336fc7", size = 14303, upload-time = "2026-10-02T23:05:06.538Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c5/8e/4c24208776a65878d656996945aacfbfe010d3720d1a98fc0eb8491fc03b/markupsafe-3.0.4-cp312-cp312-win_arm64.whl", hash = "sha256:a4bbd2d87dd233b9fc5812160c3d0ffbe42edc22a26ce0469f58479ede633fe9", size = 14174, upload-time = "2026-10-02T23:05:07.617Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "opentelemetry-api"
|
||||
version = "1.45.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/19/14/cf3a6b6448849656e1e5f4e2101f3988dc6789724050096aba1bc5ccf592/opentelemetry_api-1.45.2.tar.gz", hash = "sha256:d7b0008e21e5fd61cbe7a7f34ca3b6905a78ab677d9bc395e299359c75cda6b4", size = 73277, upload-time = "2026-10-29T17:29:37.888Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/a9/2d/610db864d7513158cebb8f36cc88e67e73bd6c7aa1905ef18d89e1281c81/opentelemetry_api-1.45.2-py3-none-any.whl", hash = "sha256:2cbd737377e710ee740d261c94e93fa0f08e6d037c18f17513cc0a2d94479a34", size = 60335, upload-time = "2026-10-29T17:29:06.955Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "packaging"
|
||||
version = "26.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/7d/fa/3944b40b07da9ce895c0e6303a5ab7d53da063554f534556b134a54d6093/packaging-26.3.tar.gz", hash = "sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79", size = 313412, upload-time = "2026-08-04T18:15:28.737Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/63/34/ba1c580383c9eada3711951fef0795c80b829a078d72188184bcab9dd527/packaging-26.3-py3-none-any.whl", hash = "sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c", size = 129956, upload-time = "2026-08-04T18:15:27.159Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pluggy"
|
||||
version = "1.7.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/bf/db/7fc19e6f2dc92a966727031389fc2e08b558f0f25eb7403c1119ad4713cd/pluggy-1.7.0.tar.gz", hash = "sha256:d1eaa46ebb595891b860ab086b4d09c8588af65ebd4361b8e8f4bb8920b90ba8", size = 123304, upload-time = "2026-10-15T09:50:58.343Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/40/9e/2b38731e0fc536806f16490e1a12d7f0dc2a1235aa8cc07bcc75416a7daa/pluggy-1.7.0-py3-none-any.whl", hash = "sha256:7dd7b0d8832ba3cb632c306926ded123429211b83641b35dc5c41ad2d34f9bec", size = 27082, upload-time = "2026-10-15T09:50:56.808Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prompt-toolkit"
|
||||
version = "3.0.53"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "wcwidth" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/7d/ea/39b988c938f75cb75d7045b5c69f8bfed47ee2152c8837fb403de29d6fb8/prompt_toolkit-3.0.53.tar.gz", hash = "sha256:9ec8a0ad96d5c56148b3f914aa79c1564c3fde5d2e6b876e7bc327e353cf8fa6", size = 435492, upload-time = "2026-07-26T20:56:14.758Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/54/6f/84908cad2d6aa5144abcf7b42709fe4fdb459bc640ec7ac5786e7693dabc/prompt_toolkit-3.0.53-py3-none-any.whl", hash = "sha256:01c0891d7f9237d5e339f7d3e42cdae80b7534abb1c7c0e3352efba6231492f2", size = 392288, upload-time = "2026-07-26T20:56:12.512Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "psycopg"
|
||||
version = "3.3.9"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "typing-extensions" },
|
||||
{ name = "tzdata", marker = "sys_platform == 'win32'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/b4/74/ff710399dfa9fe9b546c2f5a05ea2f9b9d1dc2145c0b59e53a3fa2013679/psycopg-3.3.9.tar.gz", hash = "sha256:87c1d85c3e0e88e811d3c0b3808f947bd967c6faf34af6cd86fd021f77793d6c", size = 171122, upload-time = "2026-11-12T09:04:06.548Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/52/5d/a7957d1b5484f8e5094a15b1a400929324f978b670bd4a95179e1a012ec2/psycopg-3.3.9-py3-none-any.whl", hash = "sha256:d2d7d04a1ce6dab4f5b27316bea3b52585cafa2f2d631e5b09dd69823f5c26f6", size = 219041, upload-time = "2026-11-12T08:58:18.454Z" },
|
||||
]
|
||||
|
||||
[package.optional-dependencies]
|
||||
binary = [
|
||||
{ name = "psycopg-binary", marker = "implementation_name != 'pypy'" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "psycopg-binary"
|
||||
version = "3.3.9"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/6e/0c/7fc92c3135ce195bb86052d18f9ef5f64b1592d8f3a5f1d90e9b49c72448/psycopg_binary-3.3.9-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:fcdb76adaab57fdd5b789b13b20699bffaf17000a4bbc0527327581cfdd55e3d", size = 4048935, upload-time = "2026-11-12T09:00:08.958Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f0/a4/e62d11a85fc1a3a49f95b308bd5e2299dfc11125ef87043f6dfc29297d0c/psycopg_binary-3.3.9-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:08689018e9169ca8e6769f5b3f2ce748442bda95b5f1ec260995a8ff63e6d6a4", size = 4111565, upload-time = "2026-11-12T09:00:14.788Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4a/89/d9ca02dfe30a6dc51e7796617dd69cc5c2e66bcc89ced44df4f4a3b5e402/psycopg_binary-3.3.9-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:e7e2e3543ac17cf5bb3eaf738606fc52bcedf993500b9fc8c55a4475a3731ef9", size = 4207484, upload-time = "2026-11-12T09:00:23.781Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4d/aa/f1b6e1cd71aeafa78ab33875adf0339818fe014cde197a1c0c7c419dd0b0/psycopg_binary-3.3.9-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:a99f0b9a19ed7a56bf5d6776456b8f15f5364db8853b0f5d184db394a45c391d", size = 3913036, upload-time = "2026-11-12T09:00:30.144Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ae/fe/9e967bfacdda0fef48fee1d869b13de016d82d846a805745b0985ac94a5b/psycopg_binary-3.3.9-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b081348d8992af26e9b252f04876c286428418a6b7845d8d4caae2044b259668", size = 4132657, upload-time = "2026-11-12T09:00:34.401Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/cb/b3/c6a9f0bca0fdb06cf408235b698710f400a1d6376ab77e5fec887115aaa5/psycopg_binary-3.3.9-cp312-cp312-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:66b20619acbd434e4e46d734a915768a1192db09754c2ad041d391d72f30e5eb", size = 3545187, upload-time = "2026-11-12T09:00:38.595Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/61/24/0443e50d382d3f6dcc03530560e02a02646af6bd8fcbd5a60add68c80208/psycopg_binary-3.3.9-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:b7c4b2039d82f635311e41e7d392ff1bddd94a2447f9668c6531489cc86a8ce2", size = 3897551, upload-time = "2026-11-12T09:00:43.769Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c5/18/e576c5f50f4751ad9f1770134ad57ef216d00e5d79caa1c5b091f41275dc/psycopg_binary-3.3.9-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:3efe96cd98081b755ee3b0a50f2d35d9af55cb1ba462440a41048b9e7c6b9caa", size = 3577016, upload-time = "2026-11-12T09:00:49.375Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/cb/c6/434e01b19af141540147427675c116b2205ea58e3ec99e26431edf2d0714/psycopg_binary-3.3.9-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:80ce081d2512ced75f1ca08ff80257a1288a3555079c5fa622164a0f9ed6533a", size = 3305336, upload-time = "2026-11-12T09:00:55.531Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/eb/84/0ea715e106cc80a89aca36e34dd6685fa1ee75da9546d41a1d87356efb9f/psycopg_binary-3.3.9-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:30a95cb2b00b94b4ec4fd5d41de047598c60e0db26fd43bd9154152cc380b282", size = 3620366, upload-time = "2026-11-12T09:01:01.033Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/81/a7/afe5fe01b4100454ea6543ac84c8b38a3713d6f27790253798ba50f2ef2a/psycopg_binary-3.3.9-cp312-cp312-win_amd64.whl", hash = "sha256:1ce1a6f04211626ca1a3deadee560235e8686e3888fb18f78d2be3e83bceabc4", size = 2907832, upload-time = "2026-11-12T09:01:04.735Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pycparser"
|
||||
version = "3.12"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/cb/27/eeb9f307bf07060f3d9f9aa0fb8c15b01bdfded0a941e4b2719c7f94cacd/pycparser-3.12.tar.gz", hash = "sha256:f03387877eab82ce01bbdfd0ba7252ee55a90b1c708d5129e2ce915475cf1db6", size = 158785, upload-time = "2026-10-22T13:40:03.56Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/b6/ae/315bbeee126a769cbde43cf4908acb4b40408d8bf8bbf334dd7368d8dadf/pycparser-3.12-py3-none-any.whl", hash = "sha256:a076f3f489b39b43ed13563a1dafe42447445bec2e294154ec5c57fcdda4c85e", size = 62600, upload-time = "2026-10-22T13:40:02.021Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pydantic"
|
||||
version = "2.14.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "annotated-types" },
|
||||
{ name = "pydantic-core" },
|
||||
{ name = "typing-extensions" },
|
||||
{ name = "typing-inspection" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/b4/fc/1203d011145c98ddce3cd2f505bb54375ef8d43223053df6bfcf3c746f46/pydantic-2.14.3.tar.gz", hash = "sha256:1054f237f4d4733e5a30e1e2333bd33a2004ab9ab1510bd053a9a31bb48e232d", size = 925636, upload-time = "2026-11-05T09:17:04.686Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/72/b8/b864503789ef5c58597d2a7b4adbee62c26440ab1e682581fc6838df8947/pydantic-2.14.3-py3-none-any.whl", hash = "sha256:3f7b347782ab7e4cf4c798496ae3a82787d9f21ec12676a9c564355eeef8daa8", size = 494071, upload-time = "2026-11-05T09:17:02.426Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pydantic-core"
|
||||
version = "2.50.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/9c/0f/34f9ce4ba701dd0b815033ef94d99b56f66200e578ee6052aa3ac26f064e/pydantic_core-2.50.4.tar.gz", hash = "sha256:aead3b74b68396bf0feab5d57e050b730ded7df55853c1e048a87e00aaf033c6", size = 522249, upload-time = "2026-11-05T09:15:26.774Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/10/bf/d1f6b81709538f831ebe1c42f50fb89db3dfda06f9e9b1ea24e90fc69209/pydantic_core-2.50.4-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:32a991aebd165f227b7c7c60bb9d66c2c7de9c24308552da264c9938fde0f8d6", size = 2231444, upload-time = "2026-11-05T09:12:06.969Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c1/39/6618e541658d5a687a8d4962fc304350073a8f322bc4c62e8ed4c2d514d6/pydantic_core-2.50.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1e20cbde2b6deb33a51d08cd168454dd9044ec7d4474056f4d98d63f51578783", size = 2108048, upload-time = "2026-11-05T09:12:08.85Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d9/54/1c941fffa4e14bfc9ab0cd4977075f0e03201447856130d08a33cd45e47b/pydantic_core-2.50.4-cp312-cp312-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:8cceae48ae7f94990c2f4e36291e9ec9868735e8b0f19e4489a17b0422338466", size = 2256866, upload-time = "2026-11-05T09:12:10.495Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/61/a0/8028ef3e014be522ce43060aeac82a5be2288215e660866f5e6260acc123/pydantic_core-2.50.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:16902a147b3da4840612164a5e67947104d63e978f7a57c395877a5e26690b9c", size = 2125682, upload-time = "2026-11-05T09:12:12.278Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c3/f2/b98bb73b1734ec4e42e786a766abc24f3c89620a0ddbaf8aa14e4b4c628c/pydantic_core-2.50.4-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.whl", hash = "sha256:d6e3485a5e5c01fb5339c1ee3d4b9e21e2135a2a9d44caafb71acd994487ee7c", size = 2197108, upload-time = "2026-11-05T09:12:13.873Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f1/d1/7a7142786781400143e8806633fe5b65e2d407c311041fc9494490f05b18/pydantic_core-2.50.4-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:629eae995185540406e3635df5d5cf1d44f19ea240840b835d3f44541ff694d8", size = 2380521, upload-time = "2026-11-05T09:12:15.539Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b5/34/cf710ca48d4498b04a3ea605d45892675dc2b14a94a25121a8d03f56d3e9/pydantic_core-2.50.4-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:41b2cd8b29dbb5a4c9828a70f50d1abfc92011115c813213d3a91205c6f731b3", size = 2457436, upload-time = "2026-11-05T09:12:17.447Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/91/23/e0c6e3cd09a0ac809953fea698c816b9f03bf0b35b6820c9553e4f5d85a8/pydantic_core-2.50.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:c81d98e27d9d9261909dcccab1ba5d6ea1c98b0bb9470e368604614fd1d36ddd", size = 2261727, upload-time = "2026-11-05T09:12:19.097Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f9/00/292a0ed96d5d2d6edb49468ef481336e5b7e54f13435d73b7c912c891c23/pydantic_core-2.50.4-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:ca83a32b2b41653d89f09a3d22b770bca96da72273bef8f7a68136bdd1e8b823", size = 2262071, upload-time = "2026-11-05T09:12:20.78Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f8/36/d4690faf8c082eacf7754e52ab6bebe1bc73b167272e28699c00480ee908/pydantic_core-2.50.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:817953730e4a73a09008b010c4a42396cefe799616a22df2ac21d3927b3080cf", size = 2298931, upload-time = "2026-11-05T09:12:22.614Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/21/17/b180af6d17cf6c8e0d3d2661fc501a4a40959744ca4947d6ad0db81b1416/pydantic_core-2.50.4-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:664e74848c2f5fc27db8505fe24e1ecd3ac669412913bf73d176916f86cc08e2", size = 2474285, upload-time = "2026-11-05T09:12:24.842Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/6e/bb/7e44d4ac6e1292f1859384c688713045bdf5448e0635c49c003d2be3bb6c/pydantic_core-2.50.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:219114f8dcdcbe4720d82ef016b1287ce5a0a67d7c69ca61524eb72e82aac344", size = 2498172, upload-time = "2026-11-05T09:12:26.434Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d8/84/5101f35294579c4bef7dc32fd4f097d91eedac2e195894266bdabc1e6dfd/pydantic_core-2.50.4-cp312-cp312-win32.whl", hash = "sha256:67f7cc397e1d5556a801d1cba74de0d27d827eb242e6c036c0ca273c745414f1", size = 2119592, upload-time = "2026-11-05T09:12:27.971Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/82/88/d438a8fcf3738e9ff2670f724047ca3893ec899bcd5cdfc077a2aab133c6/pydantic_core-2.50.4-cp312-cp312-win_amd64.whl", hash = "sha256:ea2f61b0bc12f3592288503961b764579dea0658852d96a0b3d823614d808821", size = 2264064, upload-time = "2026-11-05T09:12:29.538Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/77/d4/4a0c73dc3ef9e50b122b8c3527afcded15a44838f1c9668d2d4b72cc09f0/pydantic_core-2.50.4-cp312-cp312-win_arm64.whl", hash = "sha256:32d6dda86383645ec428ea64dfc277036f5cbc60a72238eab28b91a3fdb9a113", size = 2167792, upload-time = "2026-11-05T09:12:31.103Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/9a/18/2f6a25e9104d5af713d16671711927601da1f0db74e785be67bd590385c9/pydantic_core-2.50.4-graalpy312-graalpy250_312_native-macosx_10_12_x86_64.whl", hash = "sha256:c04e9d920e2674f54651fd260a15c5d2843526c73d5242ee4311325ddc9573b3", size = 2212591, upload-time = "2026-11-05T09:14:56.262Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4c/1b/ba8b721af10a7659e7fbbef320ff8eb55462557a72607858af5a9bd22cb1/pydantic_core-2.50.4-graalpy312-graalpy250_312_native-macosx_11_0_arm64.whl", hash = "sha256:5bc1811ef2b4d4ba63e8e452f6e332b6374bd1d2cbbfdf66826c8cb1f71dd10d", size = 2048167, upload-time = "2026-11-05T09:14:57.681Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/48/42/3f8638e7d90bdd9a7c7f3e5084723af59e7f43f15a292e242d35624073ce/pydantic_core-2.50.4-graalpy312-graalpy250_312_native-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:0b059a7968b1911be5a2d9a8234827ab0bef9d1e465d4b42da525894143550e8", size = 2119548, upload-time = "2026-11-05T09:14:59.317Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e0/8d/4bfbacaf191f7939893d165e18eb301731fa3366c59a6e57336c4f168fbd/pydantic_core-2.50.4-graalpy312-graalpy250_312_native-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:bee28aab5a580eec673f7b68dfa8dece3dd37bd207ef8d22fafe23a8e9837296", size = 2279952, upload-time = "2026-11-05T09:15:00.907Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pydantic-settings"
|
||||
version = "2.16.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "pydantic" },
|
||||
{ name = "python-dotenv" },
|
||||
{ name = "typing-extensions" },
|
||||
{ name = "typing-inspection" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/59/28/227c843eedd29bd78e132e5aafa420d83154b10465c312f9c21ff2eaf77d/pydantic_settings-2.16.3.tar.gz", hash = "sha256:10e36f616623ebb586c05ca3d3cd22927146869db413d4f14c20c514442a1337", size = 311716, upload-time = "2026-11-13T11:18:30.102Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/4c/26/3e68379ca313b6aa58e11fbd8b28d5c6f1b9f4428d70222ba021a76797ec/pydantic_settings-2.16.3-py3-none-any.whl", hash = "sha256:d1db16a2d34006323a1b42c0640898da58adfbad7ec30baaa9e2b18aafc08999", size = 82679, upload-time = "2026-11-13T11:18:28.73Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pygments"
|
||||
version = "2.21.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/49/2e/ced460408999b33da6b31b0021b0f37d329e202d4169aeb164493778f25b/pygments-2.21.0.tar.gz", hash = "sha256:610ca751c9bc2492b38eb9a38a7fbc93edbbb2d7182edaf34e66ae493dee5c8c", size = 5005329, upload-time = "2026-08-17T08:02:48.824Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/71/46/17f022dd3e953bf20a04a028a21ec746d942f8d2af30fa0f124fa0e6a684/pygments-2.21.0-py3-none-any.whl", hash = "sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9", size = 1250147, upload-time = "2026-08-17T08:02:44.912Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pyjwt"
|
||||
version = "2.15.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/43/ea/5194e52748b0da83d71e082d75496eaec6e58f419f5e184786ded517e6a9/pyjwt-2.15.1.tar.gz", hash = "sha256:4f259e80cdfb6b3fc18a7de51fd1ef9ec79652f25019bae68975ca2468a34df8", size = 121252, upload-time = "2026-09-28T18:40:42.598Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/50/ca/44de4e75f8aadc457f0634be3b542815078ded46dca30efb960edeecad6e/pyjwt-2.15.1-py3-none-any.whl", hash = "sha256:42d59d631f7768a1028a64c7ff581a9bf7519804daf91fc5b6c56e30eec5e193", size = 33860, upload-time = "2026-09-28T18:40:41.429Z" },
|
||||
]
|
||||
|
||||
[package.optional-dependencies]
|
||||
crypto = [
|
||||
{ name = "cryptography" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pytest"
|
||||
version = "8.4.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
||||
{ name = "iniconfig" },
|
||||
{ name = "packaging" },
|
||||
{ name = "pluggy" },
|
||||
{ name = "pygments" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/a3/5c/00a0e072241553e1a7496d638deababa67c5058571567b92a7eaa258397c/pytest-8.4.2.tar.gz", hash = "sha256:86c0d0b93306b961d58d62a4db4879f27fe25513d4b969df351abdddb3c30e01", size = 1519618, upload-time = "2025-09-04T14:34:22.711Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/a8/a4/20da314d277121d6534b3a980b29035dcd51e6744bd79075a6ce8fa4eb8d/pytest-8.4.2-py3-none-any.whl", hash = "sha256:872f880de3fc3a5bdc88a11b39c9710c3497a547cfa9320bc3c5e62fbf272e79", size = 365750, upload-time = "2025-09-04T14:34:20.226Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "python-dateutil"
|
||||
version = "2.9.0.post0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "six" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/66/c0/0c8b6ad9f17a802ee498c46e004a0eb49bc148f2fd230864601a86dcf6db/python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3", size = 342432, upload-time = "2024-03-01T18:36:20.211Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/ec/57/56b9bcc3c9c6a792fcbaf139543cee77261f3651ca9da0c93f5c1221264b/python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427", size = 229892, upload-time = "2024-03-01T18:36:18.57Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "python-dotenv"
|
||||
version = "1.2.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/74/26/2fbeedb218a787a5eea551c7532cac4e009f83d689dd2faa0d0353473f86/python_dotenv-1.2.4.tar.gz", hash = "sha256:f0d53e69935a851c0dcc78f3ab7aaccd8cabef0b92382b576b824212902873c0", size = 60824, upload-time = "2026-10-01T05:36:10Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/60/d1/38f3a3405989a89ac18390803e70c6ad7c7760da4f9b83cbeca0c44a0c72/python_dotenv-1.2.4-py3-none-any.whl", hash = "sha256:42269a8a5b3fd54ffa6f3d84b18abed50064717576b4ecf03dc4a55d8aa04fdc", size = 23266, upload-time = "2026-10-01T05:36:08.633Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pyyaml"
|
||||
version = "6.0.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/05/8e/961c0007c59b8dd7729d542c61a4d537767a59645b82a0b521206e1e25c2/pyyaml-6.0.3.tar.gz", hash = "sha256:d76623373421df22fb4cf8817020cbb7ef15c725b9d5e45f17e189bfc384190f", size = 130960, upload-time = "2025-09-25T21:33:16.546Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d1/33/422b98d2195232ca1826284a76852ad5a86fe23e31b009c9886b2d0fb8b2/pyyaml-6.0.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:7f047e29dcae44602496db43be01ad42fc6f1cc0d8cd6c83d342306c32270196", size = 182063, upload-time = "2025-09-25T21:32:11.445Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/89/a0/6cf41a19a1f2f3feab0e9c0b74134aa2ce6849093d5517a0c550fe37a648/pyyaml-6.0.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:fc09d0aa354569bc501d4e787133afc08552722d3ab34836a80547331bb5d4a0", size = 173973, upload-time = "2025-09-25T21:32:12.492Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ed/23/7a778b6bd0b9a8039df8b1b1d80e2e2ad78aa04171592c8a5c43a56a6af4/pyyaml-6.0.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9149cad251584d5fb4981be1ecde53a1ca46c891a79788c0df828d2f166bda28", size = 775116, upload-time = "2025-09-25T21:32:13.652Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/65/30/d7353c338e12baef4ecc1b09e877c1970bd3382789c159b4f89d6a70dc09/pyyaml-6.0.3-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:5fdec68f91a0c6739b380c83b951e2c72ac0197ace422360e6d5a959d8d97b2c", size = 844011, upload-time = "2025-09-25T21:32:15.21Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8b/9d/b3589d3877982d4f2329302ef98a8026e7f4443c765c46cfecc8858c6b4b/pyyaml-6.0.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ba1cc08a7ccde2d2ec775841541641e4548226580ab850948cbfda66a1befcdc", size = 807870, upload-time = "2025-09-25T21:32:16.431Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/05/c0/b3be26a015601b822b97d9149ff8cb5ead58c66f981e04fedf4e762f4bd4/pyyaml-6.0.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:8dc52c23056b9ddd46818a57b78404882310fb473d63f17b07d5c40421e47f8e", size = 761089, upload-time = "2025-09-25T21:32:17.56Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/be/8e/98435a21d1d4b46590d5459a22d88128103f8da4c2d4cb8f14f2a96504e1/pyyaml-6.0.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:41715c910c881bc081f1e8872880d3c650acf13dfa8214bad49ed4cede7c34ea", size = 790181, upload-time = "2025-09-25T21:32:18.834Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/74/93/7baea19427dcfbe1e5a372d81473250b379f04b1bd3c4c5ff825e2327202/pyyaml-6.0.3-cp312-cp312-win32.whl", hash = "sha256:96b533f0e99f6579b3d4d4995707cf36df9100d67e0c8303a0c55b27b5f99bc5", size = 137658, upload-time = "2025-09-25T21:32:20.209Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/86/bf/899e81e4cce32febab4fb42bb97dcdf66bc135272882d1987881a4b519e9/pyyaml-6.0.3-cp312-cp312-win_amd64.whl", hash = "sha256:5fcd34e47f6e0b794d17de1b4ff496c00986e1c83f7ab2fb8fcfe9616ff7477b", size = 154003, upload-time = "2025-09-25T21:32:21.167Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/1a/08/67bd04656199bbb51dbed1439b7f27601dfb576fb864099c7ef0c3e55531/pyyaml-6.0.3-cp312-cp312-win_arm64.whl", hash = "sha256:64386e5e707d03a7e172c0701abfb7e10f0fb753ee1d773128192742712a98fd", size = 140344, upload-time = "2025-09-25T21:32:22.617Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "six"
|
||||
version = "1.17.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/94/e7/b2c673351809dca68a0e064b6af791aa332cf192da575fd474ed7d6f16a2/six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81", size = 34031, upload-time = "2024-12-04T17:35:28.174Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274", size = 11050, upload-time = "2024-12-04T17:35:26.475Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sqlalchemy"
|
||||
version = "2.0.57"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "greenlet", marker = "platform_machine == 'AMD64' or platform_machine == 'WIN32' or platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'ppc64le' or platform_machine == 'win32' or platform_machine == 'x86_64'" },
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/19/df/7611a37edc4cfa118c364a7f5dec4889ad0e9f84638a789bbf864c5f7a63/sqlalchemy-2.0.57.tar.gz", hash = "sha256:892e0edd06b8ca2a8a3f9107611047914fd82ccd03735efd706d12aa4da1b773", size = 10018207, upload-time = "2026-11-04T00:58:47.151Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/68/78/27f8b0f5c59006f98875b3166347615a2aaf196ccd9a400d6a95f56e0364/sqlalchemy-2.0.57-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:e33889a6f292db9ed2278d5562717c96432651ec558417a7acf17d9549fd6935", size = 2197129, upload-time = "2026-11-04T01:05:44.509Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/41/f3/702ae27c52acfaeb6dde5ef1a49a8fa1793e28834fe77be7c3a4cb7abfb5/sqlalchemy-2.0.57-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:75135c4c54be953730e41203f38ced685b60dfb16d61a7d4d9a7ab8d87ced6f1", size = 3461341, upload-time = "2026-11-04T01:57:50.242Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/df/2b/6722fc370f7cbc75fd6df6ba3d870ab4ee40a02c4875162e2bcfe4a5ad83/sqlalchemy-2.0.57-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4ff9f7dda4d136bfd7fab44384ef7e3135c9826da815d6248f713d0035a6274b", size = 3478029, upload-time = "2026-11-04T01:12:47.545Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8e/9d/4ff40e4d17c36c6b8d328ddefc66abe0b5f3b4d257a61d430a6dcded4ab5/sqlalchemy-2.0.57-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e8d67fa9935021bdccd02d313a1b5ce92531f679b0e70ea7b9f5d651fab7f742", size = 3412804, upload-time = "2026-11-04T01:57:52.379Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fc/39/6bc26429849cc799ae5a5c9c8657491eff777f50a5e38e91626d79984d68/sqlalchemy-2.0.57-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:d55ea24654f8d982c5aabd6e6779eac3ed15f420f629761c4eb627399e9d8cec", size = 3444039, upload-time = "2026-11-04T01:12:50.017Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/6b/b4/5c67a4c220c84ac9923bea8035e1ad6e0982191ddf56008228ad30edc974/sqlalchemy-2.0.57-cp312-cp312-win32.whl", hash = "sha256:ffaedafb38901bc72efcaf9fdf57bc363be24bd67a8bce8e3afe4ec75bc82833", size = 2150331, upload-time = "2026-11-04T01:32:28.689Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c9/72/406430db968b16104bb4132fc6394d279e1e96b36994200879f76eb8da52/sqlalchemy-2.0.57-cp312-cp312-win_amd64.whl", hash = "sha256:4972e01af81b72b78e335735eddf9d4ef8980eca1e8364552715991a454eea97", size = 2179710, upload-time = "2026-11-04T01:32:30.265Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fd/0e/ed54ed17987f65115360b124ab943d955c04906fd589411627805afe7b57/sqlalchemy-2.0.57-py3-none-any.whl", hash = "sha256:e31639a78045134a39e14f287b647fd9537cdd71978ea9c11bf7d905d70e473d", size = 1967625, upload-time = "2026-11-04T00:59:28.703Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "starlette"
|
||||
version = "1.10.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "anyio" },
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/48/bb/3d8757f21e9a53d9035c9eb039a777047139a16bfdbedfc7a58241c3d914/starlette-1.10.0.tar.gz", hash = "sha256:b8399098d4c1e3522734f7235dc79b1fc967f96cf139c81e0fa30479e0685f9b", size = 2734356, upload-time = "2026-10-24T15:04:12.342Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/88/2e/947cfe02def9371c07cd5bf5b6b61c829e9aecb9904db02a66cfafbc1eec/starlette-1.10.0-py3-none-any.whl", hash = "sha256:478c0ab3b4ced6e82719849c118fa406f0278a3499c1a898cd15cd31bdc38ce4", size = 80571, upload-time = "2026-10-24T15:04:10.371Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typing-extensions"
|
||||
version = "4.16.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f6/cc/6253133b5bb138fc3306cebfbda2c520f545d36b5be2c7255cc528bb45d6/typing_extensions-4.16.0.tar.gz", hash = "sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5", size = 113555, upload-time = "2026-07-02T08:40:05.92Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/49/d3/b8441a820a491ddfc024b0b0cf0393375b75ea13866d9c66727e54c2fc80/typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8", size = 45571, upload-time = "2026-07-02T08:40:04.659Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typing-inspection"
|
||||
version = "0.4.5"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/ff/50/0195198eb1d75bab716bb0a813abea4cc394bfa17a92a189f021a34859af/typing_inspection-0.4.5.tar.gz", hash = "sha256:7f16c411e7930dc79596d42ab44672a3fe5f60eb34b781a1647e7872363120c7", size = 81194, upload-time = "2026-11-04T14:13:23.774Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/de/0c/ea2544850a7c135e15033a5c7a8e7211136184b7ae63e2239d557c2b3019/typing_inspection-0.4.5-py3-none-any.whl", hash = "sha256:bc210535442b39e1bf2805e0c7a17dfd6a4ace760c84c7f7d16245d23a6b1c39", size = 14874, upload-time = "2026-11-04T14:13:22.616Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tzdata"
|
||||
version = "2026.6"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/7a/29/6a1391d31cd00ff9e927215a224a880e1e84e826b64ba80a499e51c074d8/tzdata-2026.6.tar.gz", hash = "sha256:85d2cd9c09f81f0bb29db27759fc83af4f1e620efb814f8c5bf8b4cc4feece6d", size = 201017, upload-time = "2026-10-28T09:57:09.137Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/0a/66/9a06c2227fedfd4919f0eaaa8b94377d9730882a7e4f95823c9a331ab5e1/tzdata-2026.6-py2.py3-none-any.whl", hash = "sha256:0a10eec6e13ef16b627fabed9a5f2ba61a62b1c67f327305f4e7e412a70b4aec", size = 348210, upload-time = "2026-10-28T09:57:07.276Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tzlocal"
|
||||
version = "5.4.5"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "tzdata", marker = "sys_platform == 'win32'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/d8/89/2bd035df331499589fc92e59375c17c6cea6a500453b2c5f6a6ec9572825/tzlocal-5.4.5.tar.gz", hash = "sha256:ba976898bad27945178c9ca25c222c19e322b30c10342b9f40b46714f70d2d5f", size = 31483, upload-time = "2026-10-22T09:09:26.38Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/7b/c1/9be4e1a8a30db8729a86628073910e56f85aaf8a659e053f376a2e6ea5a8/tzlocal-5.4.5-py3-none-any.whl", hash = "sha256:ecab534f6d65d9deb4c4ea52c121ab6dd5958e9b878e71dcb102578269752454", size = 18215, upload-time = "2026-10-22T09:09:24.447Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uvicorn"
|
||||
version = "0.54.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "click" },
|
||||
{ name = "h11" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/da/34/30e9280707135d2cfc589dfff3cb796bd07a3aeb1a3e415ba09dd89d7bb4/uvicorn-0.54.0.tar.gz", hash = "sha256:a2e33cbfaa0306f8e6b0c13e0cb89d7d7a2da3e62b90c66e18c33d9807b28620", size = 112283, upload-time = "2026-09-25T06:52:37.601Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/38/0c/b54a4fdd7f90a3af8b02ebc9ce6712c2c208b7926a2f7bad95c33ebbe943/uvicorn-0.54.0-py3-none-any.whl", hash = "sha256:505bdb0f318731d45f1f712071fc781a8981f6847a31c902c9f5e652d4f67faf", size = 87427, upload-time = "2026-09-25T06:52:35.829Z" },
|
||||
]
|
||||
|
||||
[package.optional-dependencies]
|
||||
standard = [
|
||||
{ name = "httptools" },
|
||||
{ name = "python-dotenv" },
|
||||
{ name = "pyyaml" },
|
||||
{ name = "uvloop", marker = "platform_python_implementation != 'PyPy' and sys_platform != 'cygwin' and sys_platform != 'win32'" },
|
||||
{ name = "watchfiles" },
|
||||
{ name = "websockets" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uvloop"
|
||||
version = "0.23.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/fa/42/02c739ce85fb2ee8d99212c61417da8140c6b87e9d97c430bea520d76044/uvloop-0.23.0.tar.gz", hash = "sha256:28d160f51ab4da3b187063652e643dea6831072add4adc1e6d62afbe73b6be27", size = 2559185, upload-time = "2026-10-01T03:17:04.4Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/05/98/04e766a6de99e6f7f955ecb7829e8d5a557de3427cb85be2236de54dda0c/uvloop-0.23.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:93935ab27b6eaef4c3e5489aebc84284f0644592f7ab516df60ee1b27eaf5eb3", size = 1393055, upload-time = "2026-10-01T03:15:42.526Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/33/8a/499e7b863a848ede009539bce39806b66205da5f8779354228e785601144/uvloop-0.23.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4448e9124537620f9c25d004c227bb5104440b58955c19bbd312d910af919a63", size = 768909, upload-time = "2026-10-01T03:15:43.974Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3d/95/a880f8ce3b87ac5b307c354e8ee480be4658d24bf01f87921d57e3530b4a/uvloop-0.23.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f7548ede3ee908cfabc0d068106e303a9a2d811af959cdf6ab85676344cedcda", size = 4419106, upload-time = "2026-10-01T03:15:45.551Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/51/27/c1d2f9fa977f8f42ea294604166df10e0027e6dc6cd17f85ede386c9bf36/uvloop-0.23.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:090865d8ce7a03986755a3ce711b7dd0d4b44eb14ab74368b717f3fad1180208", size = 4532597, upload-time = "2026-10-01T03:15:47.258Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/42/dd/2cb6a2c8a30ca55c07a882dd4ae4ceae0fa7d8c15b25b3b7cb9a4b6cf4ca/uvloop-0.23.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:bd6f2f81c7b9da99d301c0b16b82044e76fe887086e42e1590ecf520b94dbdac", size = 4230048, upload-time = "2026-10-01T03:15:49.119Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f4/52/29989cbaa4022dc4ef35c1dd60a4ab989e4c2065f341ed483ae71d2bd950/uvloop-0.23.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:a6ac96da66c35bf789bdcde78a88dc7d56b7907d8379648c54adc1c61594575d", size = 4394152, upload-time = "2026-10-01T03:15:50.829Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vine"
|
||||
version = "5.1.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/bd/e4/d07b5f29d283596b9727dd5275ccbceb63c44a1a82aa9e4bfd20426762ac/vine-5.1.0.tar.gz", hash = "sha256:8b62e981d35c41049211cf62a0a1242d8c1ee9bd15bb196ce38aefd6799e61e0", size = 48980, upload-time = "2023-11-05T08:46:53.857Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/03/ff/7c0c86c43b3cbb927e0ccc0255cb4057ceba4799cd44ae95174ce8e8b5b2/vine-5.1.0-py3-none-any.whl", hash = "sha256:40fdf3c48b2cfe1c38a49e9ae2da6fda88e4794c810050a728bd7413811fb1dc", size = 9636, upload-time = "2023-11-05T08:46:51.205Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "watchfiles"
|
||||
version = "1.3.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "anyio" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/b3/68/e6aa0b77d217b31f8f486ec0cdfe5e00e6e38dc0be657e7d85819b9faf0a/watchfiles-1.3.0.tar.gz", hash = "sha256:99aee4a07847c06820765fd7b1b49ceac4f3f711ccb7d104655a33231de1c207", size = 108119, upload-time = "2026-09-21T09:08:55.664Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/68/fa/c0b840d5d8bafe640925408ce11095948c8945bb61be1e67d0ab629b872a/watchfiles-1.3.0-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:000b9688fc8133037a8b075c8ebf98f32844ff8964dda61e85c1db547dafc441", size = 399703, upload-time = "2026-09-21T09:08:13.518Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c7/8a/894799b485fe9473ad10422a0d9668e53fb78e3a2b5cc6061159572844ad/watchfiles-1.3.0-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:bbc1198edfdc90fda0600f825aa94150f428dfcbf8138746f55998e0e660d64c", size = 397647, upload-time = "2026-09-21T09:08:15.16Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5a/61/f277cd5ead05f5d37b98b41fbdd0c943ee0c04d49738f62e902cb291cf43/watchfiles-1.3.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4af9c464d410e8c44b58ddf1cbec7c3a02c1cb2c6c80df9c74659ba2fbda0ab5", size = 454994, upload-time = "2026-09-21T09:08:16.587Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/46/66/ea4c01382975e53b1ac1b0a0ea1b353416b8127fb6e04f5c1c313119aab6/watchfiles-1.3.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:eb94e40b9a0db19636b5e3fed0a9803452ecc7381df13b385272abb779ee83ca", size = 460105, upload-time = "2026-09-21T09:08:17.961Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/31/c3/1a501b597817096c9831c255f6270c124ce0e2faeb74124be24dcc93b86d/watchfiles-1.3.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7398930a2b76b9dc67a4e6b8bfc7baf30946892a86f417a3920c07bdd6febc30", size = 493761, upload-time = "2026-09-21T09:08:19.327Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5a/16/77352d05e152c7786a016e9f1decdb4507e8aa5bcf3343c72142a0413d14/watchfiles-1.3.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:025b108f2d5cc2799cb941f79380df3e8b22bfb589c218e801767fe78d598c95", size = 577500, upload-time = "2026-09-21T09:08:20.723Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/95/fe/81001c55b24466fe9911135e50269fd3a29f43e446627a92adfab54553b6/watchfiles-1.3.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:be9ef3cd403d756a304a0a08a112163c63da7ec72c8c9d083c98818291ff8f29", size = 469209, upload-time = "2026-09-21T09:08:22.346Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8a/cf/e3ad894ed5909a7c44b0707e89bc25d19a3d78b3a7aec846119443b6ae56/watchfiles-1.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b5768b49e426fd5b550b012c866db347cdf15c398ef98dc557b6e6b72fa74cd1", size = 458353, upload-time = "2026-09-21T09:08:23.7Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7f/f5/2f106829e6e2bc91ad74614730f6df484202b9a4d20d927dbf2f08d37d44/watchfiles-1.3.0-cp310-abi3-manylinux_2_31_riscv64.whl", hash = "sha256:d36c72fcdc08f143d87316a4c4c3b064e340da2c7383d39803950740ed418935", size = 468707, upload-time = "2026-09-21T09:08:25.167Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/15/37/2741ab776b978669c1f3bba1e573f1a184f727ab8b4d3a6d9c61090800ed/watchfiles-1.3.0-cp310-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:f0c9865240e065a2247f4b5248528ae3d01e0e8ae071462c250c884dc16e3ee3", size = 632510, upload-time = "2026-09-21T09:08:26.532Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/48/64/db4a4684275fe9b696ee5118c194705c1423b3d42181c3f8ee70194d5c73/watchfiles-1.3.0-cp310-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:380f513d26cc2e598266b88d66456e07d67ef4be8f0f435a1154d9c44b43d509", size = 661723, upload-time = "2026-09-21T09:08:28.004Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/52/80/95ddb24f6a2f595c031c24432ab7b8aa7d6d1ada0c6d63a552166e06e8d1/watchfiles-1.3.0-cp310-abi3-win32.whl", hash = "sha256:509d9f74d2bec5c1f4cd868ddcfe0c9601f7ea53066dfcb19d8ede742c4de661", size = 277761, upload-time = "2026-09-21T09:08:29.335Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/48/a1/1c4a1b3c8030cd03206232612be8a6e8799093490c220b0fcb935d02b75a/watchfiles-1.3.0-cp310-abi3-win_amd64.whl", hash = "sha256:1acabde19b67e673274e89a04d613b7fb1f122e2c4b8ec9a581e59c149264b61", size = 290643, upload-time = "2026-09-21T09:08:30.45Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/82/e0/d2db577c632d26d08078c4390dd870b8555c4e558df25d22270f0166c71f/watchfiles-1.3.0-cp310-abi3-win_arm64.whl", hash = "sha256:d978cc1dd7ba44f5590d7de74f7a9c8be7262d9e469c2c0efb8bbfc2574321dc", size = 285510, upload-time = "2026-09-21T09:08:31.561Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "watchman"
|
||||
version = "0.1.0"
|
||||
source = { editable = "services/watchman" }
|
||||
dependencies = [
|
||||
{ name = "alembic" },
|
||||
{ name = "celery" },
|
||||
{ name = "fastapi" },
|
||||
{ name = "psycopg", extra = ["binary"] },
|
||||
{ name = "pydantic" },
|
||||
{ name = "pydantic-settings" },
|
||||
{ name = "pyjwt", extra = ["crypto"] },
|
||||
{ name = "python-dotenv" },
|
||||
{ name = "sqlalchemy" },
|
||||
{ name = "uvicorn", extra = ["standard"] },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "alembic", specifier = ">=1.14,<2" },
|
||||
{ name = "celery", specifier = ">=5.4,<6" },
|
||||
{ name = "fastapi", specifier = ">=0.115,<1" },
|
||||
{ name = "psycopg", extras = ["binary"], specifier = ">=3.2,<4" },
|
||||
{ name = "pydantic", specifier = ">=2.10,<3" },
|
||||
{ name = "pydantic-settings", specifier = ">=2.6,<3" },
|
||||
{ name = "pyjwt", extras = ["crypto"], specifier = ">=2.10,<3" },
|
||||
{ name = "python-dotenv", specifier = ">=1.0,<2" },
|
||||
{ name = "sqlalchemy", specifier = ">=2.0.36,<2.1" },
|
||||
{ name = "uvicorn", extras = ["standard"], specifier = ">=0.32,<1" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "watchman-workspace"
|
||||
version = "0.1.0"
|
||||
source = { virtual = "." }
|
||||
|
||||
[package.dev-dependencies]
|
||||
dev = [
|
||||
{ name = "httpx" },
|
||||
{ name = "pytest" },
|
||||
{ name = "watchman" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
|
||||
[package.metadata.requires-dev]
|
||||
dev = [
|
||||
{ name = "httpx", specifier = ">=0.28,<1" },
|
||||
{ name = "pytest", specifier = ">=8.3,<9" },
|
||||
{ name = "watchman", editable = "services/watchman" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wcwidth"
|
||||
version = "0.9.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/ea/01/e5ac23733628a6bbb91913a765fcf55ee8070d8d991bc88fdaaf805052c7/wcwidth-0.9.4.tar.gz", hash = "sha256:fd8d57d3cdfe570e3265c8fab1885c24e34ef40889c0759c0c304a19e9835954", size = 970051, upload-time = "2026-10-24T18:11:44.954Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/bf/b8/d251589a100250b71a7b8e83fedfcabfd8bd60e78cd1e3329372f63bcc93/wcwidth-0.9.4-cp310-abi3-macosx_10_9_x86_64.whl", hash = "sha256:b7969c9aa258d536df54c8ac8af5cad0c74a6268c9972e1fb60a5f29feffb66d", size = 612952, upload-time = "2026-10-24T18:10:55.925Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/04/e9/dfdca30ca36c472de3e260406dee29fc108499ec590c63b3fe279887ee9d/wcwidth-0.9.4-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:f279f32c8e206a9092fa350e53ca0c2bd8072e45b1c9fd31bb6d476b59b591c4", size = 618904, upload-time = "2026-10-24T18:11:02.008Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5d/b6/d7416f38054a107d2fb17c2b73b68723c6c334f69c4e29545fb9e6df81eb/wcwidth-0.9.4-cp310-abi3-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:a1526cd25c6420e5153bb7d764c7509e692215ee3ad9b725db1ad665d47eae09", size = 778780, upload-time = "2026-10-24T18:11:17.299Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7d/5b/42bdf9a4b0e4f9126584af2ec73642de495f3bd8add907430f13c3bb98d2/wcwidth-0.9.4-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:093469e01d881bff3db93ff3f56c364dc87c441ea01f9f41c22de0c0bdf5c6ef", size = 789012, upload-time = "2026-10-24T18:11:07.829Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fa/e8/0485850748dfdba9443f4151c7b2442cfa4987ba6cd871038eb5d6b8eca9/wcwidth-0.9.4-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:b185c8b927b23af2721be1783499d1cfa5c028b098b0858951b4ae224477f1c2", size = 785946, upload-time = "2026-10-24T18:11:18.748Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e9/11/dd3d0379c6094524df6585b76ae3d9727161ff29c003177e3661c36437c1/wcwidth-0.9.4-cp310-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:17619066f95c10f44d7ae08ee456602456bc66cc9d5e91966ec73d799acebc5f", size = 795348, upload-time = "2026-10-24T18:11:09.931Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3c/48/1b5299983d9ec084be897162b7cc6014622dfe62847224fa3272b6d79ea5/wcwidth-0.9.4-cp310-abi3-musllinux_1_2_i686.whl", hash = "sha256:b52f265a694dda6b3ad9050c8bd89158ad519109ef7c5eb110b906cc49f25763", size = 793420, upload-time = "2026-10-24T18:11:20.551Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7a/be/e3097d859b075344a7be57774a58d468eafb0ca88e02aad93eb31d69f6ba/wcwidth-0.9.4-cp310-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:d8905f1390d828d745fdd1904374c90386d902d3cfa9ee88e9875099f75a4e17", size = 796192, upload-time = "2026-10-24T18:11:22.552Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5e/cd/739710c8cf0de461239db5bb6ee678c9a33d30aaa22beff55cc356781818/wcwidth-0.9.4-cp310-abi3-win32.whl", hash = "sha256:4831662c396dd4c59a016ec53c0ac96738006d653a00482777d9a2e2ea323d62", size = 593229, upload-time = "2026-10-24T18:11:35.609Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d6/f1/c123f902bc2ff9e9c2ab66241b8872204df87cbb18ecdf035e120860fedc/wcwidth-0.9.4-cp310-abi3-win_amd64.whl", hash = "sha256:f28d77153303450ee13ebbe888297e75cf532c754555b6cabafc9bdda16c421c", size = 597780, upload-time = "2026-10-24T18:11:36.952Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4b/88/1cb5ddaf5510b918e01aa95fc4b68df91dead784b63e4931037c5673e85f/wcwidth-0.9.4-cp310-abi3-win_arm64.whl", hash = "sha256:2b58fc8cf2de1bf9cdb68b8beaa5be198742414a7c8cd97aa51ec039783ffa49", size = 598786, upload-time = "2026-10-24T18:11:30.886Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/6f/0c/309b1813b230d1dbbd6f2c2ab2bb21ef68992358977605d9ef289bbfedcc/wcwidth-0.9.4-py3-none-any.whl", hash = "sha256:901eace6d2dd25ebb917d0ce5db18e5c537e1504c905cf32f0d006c12098b05d", size = 301806, upload-time = "2026-10-24T18:10:52.651Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "websockets"
|
||||
version = "17.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/75/79/590c5f0cc7d1661195aeefccb0e342b79f4c77d368d526d028821a390332/websockets-17.4.tar.gz", hash = "sha256:09d3939b70df0c8ad2da145ebd50978bccaee1d565e838b0e7921a34d38571eb", size = 191391, upload-time = "2026-10-30T15:10:35.873Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/af/71/b020221345ea6c012dcf7496827a48a744b58696470b2b07fef95a32905a/websockets-17.4-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:3d512e3a6c528c42ce220ed9c3caff83c6fdcd98a1b98249f08ccfc66ad111b1", size = 218779, upload-time = "2026-10-30T15:07:11.522Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8e/84/1c372ae7c032021a84e5c9e9b76b0dddefb354e9b4af783a97efd4d80ab3/websockets-17.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:7390e060f830b3d132f484b21ac2783a2d227b682ef62bb8146e1c1b4ca0e45a", size = 216457, upload-time = "2026-10-30T15:07:13Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/74/b6/cff249107473f149c6c916a49cba967379fa63b0a7d2dce6896d6848f0a3/websockets-17.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:bcad49104711f88b2b7c3ba166de172857d837248205e541b044a552558fecc3", size = 216726, upload-time = "2026-10-30T15:07:14.468Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/77/5d/aff8ecbf1c55c4d96f6dacc46a52102895f58b85bb284c8d325aaf31606a/websockets-17.4-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:cf99debb17227a50620aee16647bb33a0387f5fa5418d628666c0f05745e0d2a", size = 226043, upload-time = "2026-10-30T15:07:15.937Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/cb/18/6229d6583031ca81d092a0cd887a13a57b402fb555acc323d39b45967eb7/websockets-17.4-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:9ae1429ee9e52b139167ed0169757806a27ed7307e942e8c62037a9184e9843b", size = 226321, upload-time = "2026-10-30T15:07:17.563Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b8/61/7aba018fd53873e792a25afe1f4c005518133477b727d7455f2f7550c425/websockets-17.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:51adfc30f467077293a6695d8149bcef501c0728386f3a491054f835dadb60b2", size = 227559, upload-time = "2026-10-30T15:07:18.998Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fb/66/37b207df9cdacaa017aa4487f3a9f2fcd668f6f7cfbafdac5b95ea258ee0/websockets-17.4-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:c564d1e6531611bf87078c28780456ecc75459dcca189629fff2fe7c020d8e67", size = 230386, upload-time = "2026-10-30T15:07:20.431Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ad/f6/87507e11fbae53817a435945273953b5b020589e309fac4fd60527ee5999/websockets-17.4-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4c792e6cce24d08f92199d907785c9e64f74c357deeed3dbaf7d699ed5930b64", size = 228193, upload-time = "2026-10-30T15:07:22.112Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/2f/3d/90a04f0aa989b68fbd2efcd38237420afe2abe5a1cab0b5d7c2aa4f0dbb6/websockets-17.4-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:c44776f82b04e623eb9e1b81fcd17ac6e9808ae1ba5cdf8edce1f7c869a95a9b", size = 226952, upload-time = "2026-10-30T15:07:23.643Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ad/3e/50952af22b8e3e2d03f7e83f0e335851c6b484c3fd88586626fb1c2a34b3/websockets-17.4-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:4d2636a5b61c69e32db0e74b57073dd4a66f1ad195e9398c5f01bba41090deea", size = 224183, upload-time = "2026-10-30T15:07:25.507Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c4/73/2a4a5d9c6bca1127f24af7bf08f406a69052d7f341bc81f08d9e8eb446b4/websockets-17.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:cfbbba4597f19ad717f79fd3f2a67ae7efae647bd6a61e14554e1b5ad242a5bf", size = 226991, upload-time = "2026-10-30T15:07:27.355Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/68/de/90d96a579839bfe541ef214315df81d2bd519d952847c303328518ffdd02/websockets-17.4-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:c7b996c02de5e032cb63dc65482b73693b7ecaa586654126be2749ddea239c40", size = 225600, upload-time = "2026-10-30T15:07:28.973Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/91/17/12c15ed446d842e40918cd16e79b56ee4422d6fbf210258cb8882f50bbd5/websockets-17.4-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:a920e99155d75d1b1c08172da8aaa7200e7b30871fb628d1631d7891a333e30e", size = 226366, upload-time = "2026-10-30T15:07:30.472Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/9d/73/cb4c927e806a73a0377696e031ef3c0db409028cdb2373f96ee863e8df8e/websockets-17.4-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:8c00c5c49f80a588a2c4f99d519d2abed4ce26cdca11273041bc8b7e60af60de", size = 227470, upload-time = "2026-10-30T15:07:32.122Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/33/b3/e682b3ea069933044f4bf4809eea0cd83e3a5bdbdff601d1777a9ae90795/websockets-17.4-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:52c31d123f5adf14dec694c2a4036bf42c523df7cefc641d31cd05653de56e49", size = 225026, upload-time = "2026-10-30T15:07:33.544Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/2d/e9/d039757260705e5a265a31c9fff36b0d4567b842ce2b54e5d14369f200bd/websockets-17.4-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:d0acd8191c0e5a61d1c27bfa33b6ec8431982299f5d71c02129aa4f16f182ad0", size = 226007, upload-time = "2026-10-30T15:07:34.954Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/db/e7/cb9907fac6f9b28f93beded6efda2953960cd02b633d432acf3451590859/websockets-17.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:2a9cb5bbfc33b4ebd3c8d3714d6e09805437f60a14977774e4bd11b5ace46c23", size = 226286, upload-time = "2026-10-30T15:07:36.292Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/39/99/85f6f4dd104a5d9a33a1ef272f501d0f2e8527ddf66be1b383d51f90ce56/websockets-17.4-cp312-cp312-win32.whl", hash = "sha256:c63c0d7832956d5f3bb77888b93c854569d13f806289ff75c43926d25c6e5fd2", size = 219256, upload-time = "2026-10-30T15:07:37.686Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/59/31/d1636ba67ee9232a60033d90483e48686aa3856014e59110f29015f97bd2/websockets-17.4-cp312-cp312-win_amd64.whl", hash = "sha256:dde9cd67f18803949ebf96de8aba12b8ec5ee3115e34c75a2db85a3b0a6c20d5", size = 219561, upload-time = "2026-10-30T15:07:39.19Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/23/aa/e3859d52188f041a5a05c9f3ac005a9c829723f521f0fe60e2c5f9c93bb9/websockets-17.4-cp312-cp312-win_arm64.whl", hash = "sha256:c634053459278cf31fb404ddb5ecd38124e4609e8b609166da621edc2d5796db", size = 219487, upload-time = "2026-10-30T15:07:41.161Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e9/a3/d8fbc72c5c0e78905caf2d6dcf806e532451e3f48e2a09a8ebe1de9ad412/websockets-17.4-pp312-pypy312_pp80-macosx_10_15_x86_64.whl", hash = "sha256:c7f66a53e9b7ec831abb15e3d9b6cee8f52d6a24cd0a374786bf46c3ec218bc6", size = 216397, upload-time = "2026-10-30T15:10:25.255Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d3/de/1bf313cd0f4662df4884a7602932cd13347090e59dd6047865eee2bb5aa5/websockets-17.4-pp312-pypy312_pp80-macosx_11_0_arm64.whl", hash = "sha256:4fb2db1f649b6464711846b5bb9c1611bd906ce939d9460cbd1fa419552cd6c3", size = 216664, upload-time = "2026-10-30T15:10:27.016Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/30/e2/7912bd417511b54907853bd495aef2daee111062dbafd43d133a3f7253a7/websockets-17.4-pp312-pypy312_pp80-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:32110d954d9d0e51f36edb0396673bf4d35193a0a80ba7013bf7f7d58a33ca07", size = 217603, upload-time = "2026-10-30T15:10:28.475Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/56/6f/2e8d5610f6184a2e1720bf8ce256402ed99ad30ea87c461fba5bc4d651d9/websockets-17.4-pp312-pypy312_pp80-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:88ba8a439b2bad97bb69c38db5bf0ec16a061ee834cf0f244089186ee803e899", size = 217489, upload-time = "2026-10-30T15:10:29.999Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/29/3a/a05bc57eadcd7e8e072d917888128e6d22e1203984afb21a8da3198982fe/websockets-17.4-pp312-pypy312_pp80-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:868744c68e9342768888c7326604da2228c19bb6946aa46b5f9e1ac32ea8d40b", size = 218356, upload-time = "2026-10-30T15:10:31.432Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b2/49/eed86bfb8863093a82cbaa52c9159be1ce2374d5ace6fe1f8e8031567e7d/websockets-17.4-pp312-pypy312_pp80-win_amd64.whl", hash = "sha256:829bcaa90be8737c132d9515d6a466e8528e3b3d050d3f3466f36ea94d3beb48", size = 306838, upload-time = "2026-10-30T15:10:32.954Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/eb/27/9db924cb0dbf22eade78d98fbae77790f9bf6bc729e6ab29aef9d68e4156/websockets-17.4-py3-none-any.whl", hash = "sha256:c6bd2c9781915592b209160d0f017d4c7c82ad53075e6b0c24d2a89299e7f9e9", size = 212900, upload-time = "2026-10-30T15:10:34.482Z" },
|
||||
]
|
||||
@@ -0,0 +1,109 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const evidenceDir = path.resolve(
|
||||
path.dirname(fileURLToPath(import.meta.url)),
|
||||
"../../../../docs/evidence/M01/ui",
|
||||
);
|
||||
|
||||
async function signedInAdmin(page: import("@playwright/test").Page) {
|
||||
await page.route("**/auth/me", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({
|
||||
success: true,
|
||||
data: { subject: "admin-1", display_name: "Admin", roles: ["watchman-admin"] },
|
||||
request_id: "pw-me",
|
||||
}),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
test.describe("health three states", () => {
|
||||
test("loading then success", async ({ page }) => {
|
||||
await signedInAdmin(page);
|
||||
await page.route("**/health", async (route) => {
|
||||
await new Promise((resolve) => setTimeout(resolve, 800));
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({
|
||||
success: true,
|
||||
data: { status: "ok", app: "watchman", version: "0.1.0" },
|
||||
request_id: "pw-success",
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
await page.goto("/");
|
||||
await expect(page.getByTestId("health-loading")).toBeVisible();
|
||||
await page.screenshot({
|
||||
path: path.join(evidenceDir, "health-loading.png"),
|
||||
fullPage: true,
|
||||
});
|
||||
|
||||
await expect(page.getByTestId("health-success")).toBeVisible();
|
||||
await expect(page.getByTestId("health-tag")).toContainText("健康检查成功");
|
||||
await page.screenshot({
|
||||
path: path.join(evidenceDir, "health-success.png"),
|
||||
fullPage: true,
|
||||
});
|
||||
});
|
||||
|
||||
test("failure state", async ({ page }) => {
|
||||
await signedInAdmin(page);
|
||||
await page.route("**/health", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 500,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({
|
||||
success: false,
|
||||
error: {
|
||||
code: 50000,
|
||||
message: "Internal server error",
|
||||
details: {},
|
||||
retryable: true,
|
||||
},
|
||||
request_id: "pw-fail",
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
await page.goto("/");
|
||||
await expect(page.getByTestId("health-failure")).toBeVisible();
|
||||
await expect(page.getByTestId("health-tag")).toContainText("健康检查失败");
|
||||
await expect(page.getByTestId("health-failure")).toContainText("50000");
|
||||
await page.screenshot({
|
||||
path: path.join(evidenceDir, "health-failure.png"),
|
||||
fullPage: true,
|
||||
});
|
||||
});
|
||||
|
||||
test("english locale via query override is readable", async ({ page }) => {
|
||||
await signedInAdmin(page);
|
||||
await page.addInitScript(() => {
|
||||
window.localStorage.setItem("watchman.lang", "en");
|
||||
});
|
||||
await page.route("**/health", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({
|
||||
success: true,
|
||||
data: { status: "ok", app: "watchman", version: "0.1.0" },
|
||||
request_id: "pw-en",
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
await page.goto("/?lang=en");
|
||||
await expect(page.getByTestId("health-tag")).toContainText("Health check succeeded");
|
||||
await expect(page.getByTestId("health-success")).toBeVisible();
|
||||
await page.screenshot({
|
||||
path: path.join(evidenceDir, "health-success-en.png"),
|
||||
fullPage: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,124 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const evidenceDir = path.resolve(
|
||||
path.dirname(fileURLToPath(import.meta.url)),
|
||||
"../../../../docs/evidence/M02/ui",
|
||||
);
|
||||
|
||||
function envelope(data: unknown) {
|
||||
return JSON.stringify({ success: true, data, request_id: "pw-login" });
|
||||
}
|
||||
|
||||
test.describe("login shell", () => {
|
||||
test("sign in as an admin, see the shell, then sign out", async ({ page }) => {
|
||||
await page.route("**/auth/me", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 401,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({
|
||||
success: false,
|
||||
error: { code: 41000, message: "Unauthorized", details: {}, retryable: false },
|
||||
request_id: "pw-anon",
|
||||
}),
|
||||
});
|
||||
});
|
||||
await page.route("**/auth/login", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: envelope({
|
||||
subject: "casdoor-subject-1",
|
||||
display_name: "高昊宇",
|
||||
roles: ["watchman-admin"],
|
||||
}),
|
||||
});
|
||||
});
|
||||
await page.route("**/health", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: envelope({ status: "ok", app: "watchman", version: "0.1.0" }),
|
||||
});
|
||||
});
|
||||
await page.route("**/auth/logout", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: envelope({ logged_out: true }),
|
||||
});
|
||||
});
|
||||
|
||||
await page.goto("/");
|
||||
await expect(page.getByTestId("login-submit")).toBeVisible();
|
||||
await page.getByTestId("login-username").locator("input").fill("26110002");
|
||||
await page.getByTestId("login-password").locator("input").fill("simulated-password");
|
||||
await page.getByTestId("login-submit").click();
|
||||
|
||||
await expect(page.getByTestId("shell-welcome")).toContainText("已登录:高昊宇");
|
||||
await expect(page.getByTestId("health-success")).toBeVisible();
|
||||
await expect(page.getByTestId("health-tag")).toContainText("健康检查成功");
|
||||
await page.screenshot({ path: path.join(evidenceDir, "login-success.png"), fullPage: true });
|
||||
|
||||
await page.getByTestId("logout").click();
|
||||
await expect(page.getByTestId("login-submit")).toBeVisible();
|
||||
await expect(page.getByTestId("shell-welcome")).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("failed sign-in stays on the form", async ({ page }) => {
|
||||
await page.route("**/auth/me", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 401,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({
|
||||
success: false,
|
||||
error: { code: 41000, message: "Unauthorized", details: {}, retryable: false },
|
||||
request_id: "pw-anon",
|
||||
}),
|
||||
});
|
||||
});
|
||||
await page.route("**/auth/login", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 401,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({
|
||||
success: false,
|
||||
error: { code: 41000, message: "Invalid username or password", details: {}, retryable: false },
|
||||
request_id: "pw-bad",
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
await page.goto("/");
|
||||
await expect(page.getByTestId("login-submit")).toBeVisible();
|
||||
await page.getByTestId("login-username").locator("input").fill("26110002");
|
||||
await page.getByTestId("login-password").locator("input").fill("wrong-password");
|
||||
await page.getByTestId("login-submit").click();
|
||||
await expect(page.getByTestId("login-error")).toContainText("登录失败");
|
||||
await page.screenshot({ path: path.join(evidenceDir, "login-failed.png"), fullPage: true });
|
||||
});
|
||||
|
||||
test("a session without a Watchman role can sign out", async ({ page }) => {
|
||||
await page.route("**/auth/me", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: envelope({ subject: "user-1", display_name: "No Role", roles: [] }),
|
||||
});
|
||||
});
|
||||
await page.route("**/auth/logout", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: envelope({ logged_out: true }),
|
||||
});
|
||||
});
|
||||
|
||||
await page.goto("/");
|
||||
await expect(page.getByTestId("forbidden")).toBeVisible();
|
||||
await page.screenshot({ path: path.join(evidenceDir, "login-forbidden.png"), fullPage: true });
|
||||
await page.getByTestId("logout").click();
|
||||
await expect(page.getByTestId("login-submit")).toBeVisible();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Watchman</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"appName": "Watchman",
|
||||
"login": {
|
||||
"title": "Sign in to Watchman",
|
||||
"subtitle": "Use your company account to open the alert platform",
|
||||
"eyebrow": "WATCHMAN · EARLY WARNING",
|
||||
"heroEm": "visible",
|
||||
"heroBefore": "Make exceptions ",
|
||||
"submitting": "Signing in",
|
||||
"account": "Account",
|
||||
"accountPlaceholder": "Employee ID",
|
||||
"passwordPlaceholder": "Password",
|
||||
"cardTitle": "Sign in",
|
||||
"theme": "Toggle theme",
|
||||
"footer": "© 2026 和信精密 · HEXIN PRECISION",
|
||||
"username": "Username",
|
||||
"password": "Password",
|
||||
"submit": "Sign in",
|
||||
"failed": "Sign-in failed. Check the account and password.",
|
||||
"unavailable": "Sign-in is temporarily unavailable. Try again shortly.",
|
||||
"logout": "Sign out",
|
||||
"forbiddenTitle": "No access",
|
||||
"forbiddenBody": "This account is signed in, but it does not have a Watchman view, operate, or admin role.",
|
||||
"fixture": "Local identity mode. This is not a production sign-in."
|
||||
},
|
||||
"shell": {
|
||||
"welcome": "Signed in: {name}"
|
||||
},
|
||||
"health": {
|
||||
"loading": "Checking health",
|
||||
"success": "Health check succeeded",
|
||||
"failure": "Health check failed",
|
||||
"successDetail": "Service available: {detail}",
|
||||
"failureDetail": "Service unavailable: {detail}"
|
||||
}
|
||||
}
|
||||