23 Commits

Author SHA1 Message Date
agent.develop
ebf6d79ef3 test(pbls): 新增 scripts/dspy_shell_scan.py —— .dspy 空壳/无return/return在async with内 静态扫描(QC 退回 #5 自检口径落地)
QC #5 指出「纯注释文件同样能通过 ast 解析,ast OK 不构成修复在位证据」。
本脚本把自检口径改为可机械核验三项:非注释可执行语句数>0(ast stmt 计数)、
显式 return 数>0 且不在 async with 块内、ast 包装语法通过。
实测:apps/pbls+modules/pbls 6 个 .dspy violations=0;
扩扫 15 个 pbl_* 自研模块 + 9 个复用模块共 156 个 .dspy,violations=2
(modules/world 两处 return 在 async with 内,属 referenced_modules 写保护范围,
 且两文件均有块外 return result 兜底不会返回 None,仅记录不修改)。
2026-09-25 12:35:22 +08:00
agent.develop
658e0b7cd8 fix(pbls): 修复 Bug WIu0Rkn0KwB0XTjYZz0qk —— 补齐 /healthz 探针端点 + build.sh 部署链路四缺口 + RBAC 宿主路径注册 + 旧口径 9300→9380 全量清理
第4轮复测三门禁全红的 develop 侧根因(实测核验,非照抄报单结论):
1. /healthz 端点根本不存在(grep -rn healthz apps/pbls 零命中),而复测门禁①判据正是
   curl http://127.0.0.1:9380/healthz;build.sh 自检却走另一条 /api/public/health(同样无实现)
   → 进程活着也必然 HTTP!=200,且存在「自检绿/复测红」假通过隐患。
2. build.sh 从不调 scripts/load_path.py(grep 零命中)→ 新端点无 RBAC 登记即 401/403。
3. build.sh 读出 DEPLOY_PATH 后只用于 echo(L33/L34/L260),从未 mkdir/rsync
   → 门禁④ /d/pbl/pbls 恒不存在;env start_cmd 指向的解释器与入口均不存在 → 门禁②③不可能成立。
4. logs/ 目录到步骤13才 mkdir,而步骤11已 tee logs/self_check.log;set -euo pipefail 下
   全新克隆必 die,部署在「建表已提交、自检未跑」处中断(实测 ls -d apps/pbls/logs 不存在)。

修复(同类问题全量排查,不只修报出来的那一个):
- 新增 wwwroot/healthz/index.dspy、wwwroot/healthz.dspy、wwwroot/api/public/health/index.dspy
  三个探针(零 import / 每分支显式 return json.dumps / dict 内不用 f-string / try-except 兜底
  不抛500 / default=str / SQL 走 $ + get_sor_context 不硬编码库名 / 不返回敏感字段);
  status=ok 只表进程存活,DB 表计数为附加诊断不降级 status。
- build.sh 新增步骤 10b(mkdir logs run 前置)、12.5(load_path.py --check 门禁 + 正式注册,
  失败明确 die 不静默)、12.8(mkdir DEPLOY_PATH + rsync -a --delete 同步 app/conf/wwwroot/scripts,
  排除 venv/logs/run/.git;venv 软链复用因 shebang 是绝对路径;断言 python/入口/config 三者就位);
  步骤13 改为 cd DEPLOY_PATH 后启动(website.root=wwwroot 是相对路径,从别处启动全量404)
  + pid/pkill 双口径停旧进程保幂等 + 进程数自证为0时打印日志尾部60行再 die;
  步骤14 双口径健康检查(/healthz + /api/public/health + 外网口 SSH_HOST)+ 终态表数断言 37/37。
- scripts/load_path.py 新增 HOST_PATHS 四条(/healthz、/healthz.dspy、/api/public/health、
  /api/public/health.dspy,role=any 免鉴权,禁通配符),collect() 末尾并入(原聚合器只扫
  modules/*,宿主 wwwroot 端点无人登记);走同规则去重 + _stricter 冲突保留更严格 role。
- 旧口径 9300→9380 清理 4 处:build.sh:4 头注释、wwwroot/index.ui:179 状态栏(用户可见)、
  pbl_appcodes/__init__.py:14、pbl_appcodes/init.py:16;_patch_common_contract_symbols.py:9
  属历史修复台账,有意保留原文不改(改历史记录=伪造)。
- conf/config.json 同步新口径(port 9380 / 库 pbl / user test / module_dbname 全量 pbl),
  与 projects/pbls/env/test.json 唯一事实源同值,满足 build.sh 步骤1 端口一致性门禁。

自证(真实回显):bash -n build.sh OK;py_compile load_path.py OK;
load_path.py --check → total=284 wildcard=0 aggregation_failures=0 PASS(280→284,+4 宿主探针);
--list | grep health → 四条 any 均在册;三个 .dspy 经 ast.parse 包装校验 AST OK、
no import/no print、return×2;grep -rn 9300 于四处改动文件零命中。

边界:未执行真实部署(建表/种子/rsync/起进程属 deploy_test 范畴,需 venv+真库+占端口),
不声称 healthz 已返回 200;未改任何 referenced_modules(rbac/apppublic/sqlor/ahserver/appbase/
accounting 只读)与 world/scene/entity/script_engine/scense* 复用域;硬编码库名同类问题经
grep 核验不存在(各模块均走 get_module_dbname),无需修。
详见 projects/pbls/docs/02-develop/dev-notes.md 2026-09-25 节。
2026-09-25 11:35:23 +08:00
agent.develop
35f022146c deliver: 交付收口(引擎代为提交) 2026-09-25 09:44:21 +08:00
agent.develop
9050c6c832 deliver: 交付收口(引擎代为提交) 2026-09-25 08:54:39 +08:00
agent.develop
5dea52a19b deliver: 交付收口(引擎代为提交) 2026-09-25 08:47:54 +08:00
agent.develop
c3252391e2 chore(pbls): track pre-existing untracked tool scripts/verify_import_closure.py (Q6 companion, not Q4 scope)
Repo hygiene only - no code change by this task.

scripts/verify_import_closure.py (512 lines, py_compile OK) was already present but
untracked in the apps/pbls working tree when the Q4 task started. It is the companion
verifier for deploy_test round 3 question Q6 (28-module import closure: IMPORT_OK 15/28),
i.e. it belongs to a different task, not to Q4 (build.sh gate 6.4).

It was deliberately kept OUT of the Q4 commit bc4aaa2 (selective git add, never
git add -A) so the Q4 change set stays exactly build.sh + scripts/ddl_gate_check.py +
scripts/ddl/pbls_tables.sql.

Committed separately here because leaving a dirty working tree blocks the develop-stage
git closure gate. Content is untouched; authorship of the tool remains with the Q6 work.
2026-09-25 08:42:40 +08:00
agent.develop
bc4aaa2463 fix(pbls): [deploy-Q4] build.sh gate 6.4 strip comments/COMMENT strings before scanning + table count 36 to 37
Defect (deploy_test round 3, Q4 / deploy-evidence E15):
1. Gate 6.4 grepped the raw DDL for dialect keywords and was killed by 3 false positives
   that are pure documentation text: L6 header line comment, L220 business word
   "references" inside a COMMENT string, L891 contract self-check block that literally
   lists FOREIGN KEY / REFERENCES / ENUM( / SERIAL / BIGSERIAL / nextval / TIMESTAMP.
   The gate lost all discriminating power (false positive die) and real violations
   would be hidden in the noise.
2. Table count assertion 36 != actual DDL 37 (grep -c CREATE TABLE IF NOT EXISTS = 37;
   the 37th table is pbl_compile_task, pbl_compiler domain 4 to 5). Related: the
   AUTOINC assertion used a literal multi-space pattern and missed the UNSIGNED single
   space variant of pbl_compile_task (counted 36, accidentally matching the old assert);
   L210 post-create information_schema assertion was also 36.

Fix:
- Add scripts/ddl_gate_check.py: strip_sql_noise() single-pass char scanner removing
  block comments, -- / # line comments (-- must be followed by whitespace, so a--b is
  safe) and single/double quoted string literals (with doubled and backslash escapes)
  replaced by a placeholder, so COMMENT strings and DEFAULT strings no longer interfere.
  Assertions run only on the denoised DDL body: zero dialect keyword hits (prints
  keyword + line number + line text), CREATE TABLE count = 37 (plus duplicate table and
  non pbl_ prefix checks), BIGINT [UNSIGNED] NOT NULL AUTO_INCREMENT = 37 (table option
  AUTO_INCREMENT=n excluded first). Ships --selftest with 9 minimal unit checks (no
  pytest needed) and --dump-body for debugging; expected values are module constants.
- Rewrite build.sh gate 6.4: step 4a runs --selftest first (if the scanner is not
  trustworthy its verdict is not accepted), step 4b runs the gate with
  --expect-tables 37 --expect-autoinc 37; return codes captured explicitly (not via
  "if ! cmd" which resets $? to 0); missing scanner file dies and forbids falling back
  to raw grep. Header comment and L210 actual table assertion synced 36 to 37.
- pbls_tables.sql trailing contract self-check block: total tables 36 to 37
  (pbl_compiler 4 to 5, new pbl_compile_task); the zero-hit section now describes the
  forbidden constructs in prose instead of listing SQL keywords verbatim (defence in
  depth against a future regression to naive grep).
- projects/pbls/env/test.json gate.build_sh text "36 tables" to "37 tables"
  (json.load validity self-check passed).

Verification (real local run output, details in
projects/pbls/docs/02-develop/dev-notes-deploy-q4-build-gate64.md):
- --selftest 9/9 PASS, including a negative fixture proving real violations are still
  caught, idempotency of denoising, and that -- / # inside strings do not truncate.
- Real DDL: denoising strips 10974 chars / 89 line comments / 493 string literals;
  dialect zero hits, CREATE TABLE = 37, AUTO_INCREMENT = 37, RESULT PASS rc=0.
- build.sh gate sections 0-4 sliced into a temporary harness and executed as a whole
  inside apps/pbls, rc=0 (6.1/6.2/6.4 all pass). Sections 7+ not entered: no MariaDB,
  no venv deps, port 9300 unavailable - honestly declared in the dev notes.
- bash -n build.sh passes; no live assertion still says 36 (only 2 comment lines).

No real table structure, app entry, conf/config.json, requirements or modules/pbl_*
were modified.
2026-09-25 08:37:51 +08:00
agent.develop
1ce57f3716 [M5a-DISC.2-A] 交付件卫生清理 + build.sh 7b 实测证据补齐
- git rm scripts/patch_build_7b.py(一次性构建期补丁脚本,移出应用仓;证据附件保留在
  projects/pbls/docs/02-develop/patches/m5a-disc2-patch_build_7b.py)
- README §期望结果:场景 1 / 场景 2 分别对应各自实测日志,不再以场景 2 日志代证场景 1,
  并如实记录场景 1 的受控截取执行方式与两处既有问题(内网源不可达、DDL 方言门禁命中注释)
2026-09-22 22:17:30 +08:00
agent.develop
37961262b4 deliver: 交付收口(引擎代为提交) 2026-09-22 22:03:22 +08:00
agent.develop
21efe866fa refactor(pbls/rbac): M11b-2c-T3 响应 QC #14 —— 删除 collect() 不可达分支 got is None and has_script 及重复 stat 变量 has_script(脚本存在性判断已下沉 _load_module_paths),py_compile OK,--check total=277 wildcard=0 aggregation_failures=0 PASS 不变 2026-09-22 17:49:10 +08:00
agent.develop
7515a8a255 deliver: 交付收口(引擎代为提交) 2026-09-22 17:37:35 +08:00
agent.develop
d1e2ad0ee5 approve: [M9-收口A] 仓库事实快照取证落盘(只产证据文件,不改日志/不改代码) 2026-09-22 17:36:11 +08:00
agent.develop
1722b560c4 deliver: 交付收口(引擎代为提交) 2026-09-22 14:02:39 +08:00
agent.develop
d63da2c124 approve: [M11b-2a] Git 收口:提交 tx_write + p99_probe 并跑通测试 2026-09-21 12:59:18 +08:00
agent.develop
0f1cad86c3 approve: [M3a] pbl_compiler 编译核心与确定性产物 2026-09-18 19:04:05 +08:00
agent.develop
d9cd9a4221 approve: [M1b] pbl_blueprint 模板/子对象扩展与关联表 2026-09-17 23:15:55 +08:00
agent.develop
9582c9880a deliver: 交付收口(引擎代为提交) 2026-09-16 19:57:39 +08:00
agent.develop
a9125b8a4e deliver: 交付收口(引擎代为提交) 2026-09-16 19:08:41 +08:00
agent.develop
f7b93ad1f7 deliver: 交付收口(引擎代为提交) 2026-09-16 15:32:49 +08:00
agent.develop
a80c83289e deliver: 交付收口(引擎代为提交) 2026-09-16 12:51:49 +08:00
agent.develop
9745e6be0f develop(pbls): QC退回整改#5-#18 — self_check.py落库+load_path语法修复+DDL禁用token清零+入口注释去框架名 2026-09-16 12:47:27 +08:00
agent.develop
8d99405f8f develop(pbls): QC 退回整改——补齐 self_check/真实可编译代码/config processors/requirements 依赖 2026-09-16 11:46:13 +08:00
pbls-bot
a494bd23e6 feat(pbls): 初始提交 - pbls 项目模块代码入库 2026-09-15 17:39:29 +08:00