docs(spec): 规格 §9 对齐 pglite::Error 与 state.rs;release 去掉 panic=abort
- §9 crud.rs 三个签名统一成 `pglite::Error`(原写的 `DbError` 未定义) - §9 lib.rs 清单补 `pub mod state;`(Ruling P14:AppState 归 state.rs,Task 4 是 lib.rs 唯一写入者) - 根 Cargo.toml 去掉 `[profile.release] panic = "abort"`: 规格 §6.5 要求 panic ⇒ HTTP 200 + code=400,而 abort 下 catch_unwind 抓不到 panic(进程直接死 ⇒ 客户端连接重置)。catch-all 中间件依赖默认 unwind。 Co-Authored-By: Claude Code <[email protected]>
This commit is contained in:
1 parent
f40b0b7f97
commit
349aeef06f
2 files changed
+8
-5
No files matched your search
+3
-1
@@ -40,5 +40,7 @@ chrono = "0.4"
|
||||
opt-level = 2
|
||||
lto = "thin"
|
||||
strip = "symbols"
|
||||
panic = "abort"
|
||||
# 🔴 不要设 `panic = "abort"`:规格 §6.5 要求 panic ⇒ HTTP 200 + code=400,
|
||||
# 而 abort 下 `catch_unwind` 抓不到 panic(进程直接死 ⇒ 客户端连接重置)。
|
||||
# catch-all 中间件依赖默认的 `panic = "unwind"`(Ruling P19)。
|
||||
codegen-units = 16
|
||||
+5
-4
@@ -723,6 +723,7 @@ SELECT row_to_json(q)::text AS _row FROM (<sql>) AS q
|
||||
|
||||
```rust
|
||||
// ---- lib.rs ----
|
||||
pub mod auth;
|
||||
pub mod cipher;
|
||||
pub mod config;
|
||||
pub mod crud;
|
||||
@@ -734,8 +735,8 @@ pub mod permission;
|
||||
pub mod routes;
|
||||
pub mod seed;
|
||||
pub mod session;
|
||||
pub mod state; // 🔴 由 Task 4 追加(全仓只有 Task 4 能改 lib.rs)
|
||||
pub mod sys;
|
||||
pub mod auth;
|
||||
```
|
||||
|
||||
### ids.rs
|
||||
@@ -829,9 +830,9 @@ pub fn find_spec(app_code: &str, entity: &str) -> Option<&'static EntitySpec>;
|
||||
|
||||
### crud.rs(spec 驱动的通用 CRUD)
|
||||
```rust
|
||||
pub async fn list(db: &Db, spec: &EntitySpec) -> Result<Vec<Value>, DbError>;
|
||||
pub async fn save(db: &Db, spec: &EntitySpec, body: &Value) -> Result<Value, DbError>;
|
||||
pub async fn remove(db: &Db, spec: &EntitySpec, id: &str) -> Result<(), DbError>;
|
||||
pub async fn list(db: &Db, spec: &EntitySpec) -> Result<Vec<Value>, pglite::Error>;
|
||||
pub async fn save(db: &Db, spec: &EntitySpec, body: &Value) -> Result<Value, pglite::Error>;
|
||||
pub async fn remove(db: &Db, spec: &EntitySpec, id: &str) -> Result<(), pglite::Error>;
|
||||
```
|
||||
|
||||
### routes.rs
|
||||
|
||||
Reference in new issue
Block a user