fix: hook String-args 崩溃修复 + 发布门禁拦截空 slug - #485
Merged
Conversation
宿主传入的 arguments 有时是未 parse 的 JSON 字符串,call.dig(:arguments,...) 第二跳对 String 抛 TypeError,server 日志刷 Hook error 噪音并丢失埋点事件。 新增 Cgc2046HookUse.arguments() 统一收敛(String→JSON.parse→Hash), call 加 is_a?(Hash) 守卫,require "json";三处调用点(tool_used/draft_saved/ 章节抓取)全部走规范化访问器。新增 String-args 回归测试。
slug 一经发布即锁定(#45242d0c),draft 期是唯一可改窗口;但结构门禁 此前不查 slug——空 slug 的课可一路走过评分/review/发布,发布后公开短链 /courses/[slug] 永久缺失,只剩 SQL 直改一条路(2026-09-09 物理课实例)。 PrepGate 新增 check_slug:空/空串 → 违规退回 authoring;非 [a-z0-9-] 单段格式 → 违规。纯函数四态用例覆盖,既有 fixture 补合法 slug。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
两个独立小修复,分两个 commit
1. fix(ext): after_tool_use String-args 崩溃 (e331fc0)
call.dig(:arguments, ...)第二跳对 String 抛 TypeErrorCgc2046HookUse.arguments()统一收敛(String→JSON.parse→Hash),三处调用点全走它;+String-args 回归测试2. fix(curriculum): 发布前置门禁拦截空/非法 slug (bcd77b4)
PrepGate.check新增check_slug(空/空串/非 [a-z0-9-] 格式 → gate_violations 退回 authoring)