Relax hooks.json top-level metadata validation (#30229)

## Summary
- Allow a top-level `description` string in `hooks.json`.
- Continue rejecting unknown top-level keys and root-level hook events;
events must remain under `hooks`.

## Testing
- `just test -p codex-config`
This commit is contained in:
charlesgong-openai authored and GitHub committed 2026-06-26 11:24:12 -04:00
1 parent 914c8eeb4e
commit 2c5bc5e284
2 files changed
+4

No files matched your search

+2
View File
@@ -13,6 +13,7 @@ use super::MatcherGroup;
fn hooks_file_deserializes_existing_json_shape() {
let parsed: HooksFile = serde_json::from_str(
r#"{
"description": "Optional stop-time review gate for Codex Companion.",
"hooks": {
"PreToolUse": [
{
@@ -35,6 +36,7 @@ fn hooks_file_deserializes_existing_json_shape() {
assert_eq!(
parsed,
HooksFile {
description: Some("Optional stop-time review gate for Codex Companion.".to_string()),
hooks: HookEventsToml {
pre_tool_use: vec![MatcherGroup {
matcher: Some("^Bash$".to_string()),