feat(usable): integrate current dbtool implementation snapshot
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -106,6 +106,7 @@
|
||||
|
||||
```bash
|
||||
export DBTOOL_PASSWORD=dbtool
|
||||
export DBTOOL_POSTGRES_ADMIN_PASSWORD=dbtoolroot
|
||||
```
|
||||
|
||||
5. 拉起 PostgreSQL / MySQL:
|
||||
@@ -121,6 +122,64 @@ docker compose -f docker-compose.demo.yml up -d postgres mysql
|
||||
./examples/scripts/bootstrap-mysql.sh
|
||||
```
|
||||
|
||||
如果本机 PostgreSQL demo 容器早于本轮权限修正创建,先清旧卷再重建:
|
||||
|
||||
```bash
|
||||
docker compose -f docker-compose.demo.yml down -v
|
||||
docker compose -f docker-compose.demo.yml up -d postgres mysql
|
||||
./examples/scripts/bootstrap-postgres.sh
|
||||
./examples/scripts/bootstrap-mysql.sh
|
||||
```
|
||||
|
||||
PostgreSQL demo 当前权限边界:
|
||||
|
||||
- `postgres` / `dbtoolroot`:只用于 seed、restricted probe 建立与清理
|
||||
- `dbtool` / `dbtool`:QA 与 TUI/CLI live 路径使用的非超级用户
|
||||
|
||||
可先验证 `dbtool` 不再是超级用户:
|
||||
|
||||
```bash
|
||||
PGPASSWORD="$DBTOOL_POSTGRES_ADMIN_PASSWORD" \
|
||||
psql -h 127.0.0.1 -p 55432 -U postgres -d dbtool_demo \
|
||||
-c "select rolname, rolsuper, rolcreaterole, rolcreatedb from pg_roles where rolname='dbtool';"
|
||||
```
|
||||
|
||||
PostgreSQL restricted-schema 最小复验步骤:
|
||||
|
||||
```bash
|
||||
PGPASSWORD="$DBTOOL_POSTGRES_ADMIN_PASSWORD" \
|
||||
psql -h 127.0.0.1 -p 55432 -U postgres -d dbtool_demo <<'SQL'
|
||||
drop schema if exists restricted_probe cascade;
|
||||
create schema restricted_probe;
|
||||
create table restricted_probe.audit_log (
|
||||
id bigint primary key,
|
||||
note text not null
|
||||
);
|
||||
insert into restricted_probe.audit_log values (1, 'hidden from dbtool');
|
||||
revoke all on schema restricted_probe from public;
|
||||
revoke all on all tables in schema restricted_probe from public;
|
||||
revoke all on schema restricted_probe from dbtool;
|
||||
revoke all on all tables in schema restricted_probe from dbtool;
|
||||
SQL
|
||||
|
||||
export DBTOOL_PASSWORD=dbtool
|
||||
cargo run -p dbtool-cli -- inspect --driver postgres --host 127.0.0.1 --port 55432 --database dbtool_demo --username dbtool --password-env DBTOOL_PASSWORD
|
||||
cargo run -p dbtool-cli -- inspect --driver postgres --host 127.0.0.1 --port 55432 --database dbtool_demo --username dbtool --password-env DBTOOL_PASSWORD --schema restricted_probe
|
||||
```
|
||||
|
||||
预期:
|
||||
|
||||
- root inspect 出现 `restricted_probe [restricted]`
|
||||
- 显式 `--schema restricted_probe` 返回 restricted inspect error,而不是 empty tables
|
||||
|
||||
清理:
|
||||
|
||||
```bash
|
||||
PGPASSWORD="$DBTOOL_POSTGRES_ADMIN_PASSWORD" \
|
||||
psql -h 127.0.0.1 -p 55432 -U postgres -d dbtool_demo \
|
||||
-c "drop schema if exists restricted_probe cascade;"
|
||||
```
|
||||
|
||||
7. 按 `SMOKE_RUNBOOK.md` 执行 PostgreSQL / MySQL 的 happy-path;按 `HOST_FAILURE_PATH_CHECKLIST.md` 执行 failure-path
|
||||
8. 将结果回填到 `ACCEPTANCE_CHECKLIST.md`、`TEST_STRATEGY.md`、`PRE_RELEASE_CHECKLIST.md`
|
||||
9. 清理环境:
|
||||
@@ -134,6 +193,18 @@ docker compose -f docker-compose.demo.yml down -v
|
||||
- PostgreSQL / MySQL happy-path 继续使用 `SMOKE_RUNBOOK.md`
|
||||
- PostgreSQL / MySQL failure-path 统一使用 `HOST_FAILURE_PATH_CHECKLIST.md`
|
||||
- 证据记录格式继续以 `FAILURE_PATH_EVIDENCE_TEMPLATE.md` 为准
|
||||
- 在发起宿主机或 sidecar live 执行前,先跑离线夹具收敛 helper / wrapper 契约:
|
||||
|
||||
```bash
|
||||
scripts/qa/test-failure-path-fixtures.sh
|
||||
```
|
||||
|
||||
- 若只想检查单一路径,可改跑:
|
||||
|
||||
```bash
|
||||
scripts/qa/test-failure-path-fixtures.sh format
|
||||
scripts/qa/test-failure-path-fixtures.sh sidecar
|
||||
```
|
||||
|
||||
## 2026-03-28 当前容器化 runner 观察
|
||||
|
||||
@@ -143,7 +214,7 @@ docker compose -f docker-compose.demo.yml down -v
|
||||
1. 复用已运行的 `dbtool-cli-v1-postgres-1` / `dbtool-cli-v1-mysql-1`
|
||||
2. 用 `docker exec` 直接导入 PostgreSQL / MySQL demo 数据
|
||||
3. 创建 sidecar container 并加入 `dbtool-cli-v1_default` 网络
|
||||
4. 在 sidecar container 内执行 `dbtool`,主机名使用 `postgres` / `mysql`
|
||||
4. 在 sidecar container 内执行 `dbtool`,默认主机名跟随 `QA_POSTGRES_CONTAINER` / `QA_MYSQL_CONTAINER`(当前默认是 `dbtool-cli-v1-postgres-1` / `dbtool-cli-v1-mysql-1`)
|
||||
|
||||
这条 sidecar network execution 路径在 2026-03-28 当前 heartbeat 已被直接验证,可用于继续补 PostgreSQL / MySQL failure-path 证据。
|
||||
|
||||
@@ -159,6 +230,7 @@ scripts/qa/run-failure-path-evidence-sidecar.sh ./target/release/dbtool ./tmp/fa
|
||||
- sidecar container 创建与清理
|
||||
- sidecar 内 failure-path helper 执行
|
||||
- 证据文件回传到本地输出目录
|
||||
- 当前 PostgreSQL sidecar 重导入默认使用 `postgres` / `dbtoolroot`;若宿主机 demo 管理员身份被改写,可改传 `QA_POSTGRES_ADMIN_USER` / `QA_POSTGRES_ADMIN_PASSWORD`
|
||||
|
||||
## 团队职责
|
||||
|
||||
|
||||
Reference in New Issue
Block a user