@@ -1096,6 +1096,109 @@ TEST(config_yaml_edit_bom_before_our_own_section_stays_single_issue1656) {
10961096 PASS ();
10971097}
10981098
1099+ /* ── #1924: block/flow indicators are indicators only where a value begins ──
1100+ *
1101+ * The sequence-document scan (the pre_llm_hook_install path) refused `>`,
1102+ * `|`, `[` and `]` at ANY position of a plain scalar, so a Hermes persona
1103+ * such as `probe: kaomoji face >w< here` made the hook op fail while the
1104+ * mcp_servers op on the same file succeeded (bisected to two persona strings
1105+ * by @ukind). YAML reads them as indicators only where a value begins — the
1106+ * rule the `*`/`&` fix and the quote fix (#1631) already apply. Both real
1107+ * Hermes ops run here; our blocks append, so the original document must
1108+ * survive as an untouched prefix. */
1109+
1110+ TEST (config_yaml_edit_hermes_accepts_interior_gt_in_plain_scalar_issue1924 ) {
1111+ const char * initial = "agent:\n"
1112+ " personalities:\n"
1113+ " probe: kaomoji face >w< here\n" ;
1114+ yaml_fixture_t fixture ;
1115+ ASSERT_EQ (yaml_fixture_init (& fixture , initial ), 0 );
1116+ ASSERT_EQ (yaml_hermes_upsert (& fixture ), CBM_YAML_IDENTITY_EDIT_OK );
1117+ ASSERT_EQ (yaml_hermes_hook_upsert (& fixture ), CBM_YAML_IDENTITY_EDIT_OK );
1118+ char * after = yaml_read_alloc (fixture .path );
1119+ ASSERT_NOT_NULL (after );
1120+ ASSERT_EQ (strncmp (after , initial , strlen (initial )), 0 );
1121+ ASSERT_NOT_NULL (strstr (after , "cbm-context" ));
1122+ free (after );
1123+ th_cleanup (fixture .dir );
1124+ PASS ();
1125+ }
1126+
1127+ TEST (config_yaml_edit_hermes_accepts_interior_pipe_in_plain_scalar_issue1924 ) {
1128+ const char * initial = "agent:\n"
1129+ " personalities:\n"
1130+ " probe: pipe char | mid value\n" ;
1131+ yaml_fixture_t fixture ;
1132+ ASSERT_EQ (yaml_fixture_init (& fixture , initial ), 0 );
1133+ ASSERT_EQ (yaml_hermes_upsert (& fixture ), CBM_YAML_IDENTITY_EDIT_OK );
1134+ ASSERT_EQ (yaml_hermes_hook_upsert (& fixture ), CBM_YAML_IDENTITY_EDIT_OK );
1135+ char * after = yaml_read_alloc (fixture .path );
1136+ ASSERT_NOT_NULL (after );
1137+ ASSERT_EQ (strncmp (after , initial , strlen (initial )), 0 );
1138+ ASSERT_NOT_NULL (strstr (after , "cbm-context" ));
1139+ free (after );
1140+ th_cleanup (fixture .dir );
1141+ PASS ();
1142+ }
1143+
1144+ TEST (config_yaml_edit_hermes_accepts_interior_brackets_in_plain_scalar_issue1924 ) {
1145+ /* In block context `[`/`]` inside a plain scalar are ordinary text; only
1146+ * a value-start `[` opens a flow sequence. */
1147+ const char * initial = "agent:\n"
1148+ " personalities:\n"
1149+ " probe: see docs[1] and args[] here\n" ;
1150+ yaml_fixture_t fixture ;
1151+ ASSERT_EQ (yaml_fixture_init (& fixture , initial ), 0 );
1152+ ASSERT_EQ (yaml_hermes_upsert (& fixture ), CBM_YAML_IDENTITY_EDIT_OK );
1153+ ASSERT_EQ (yaml_hermes_hook_upsert (& fixture ), CBM_YAML_IDENTITY_EDIT_OK );
1154+ char * after = yaml_read_alloc (fixture .path );
1155+ ASSERT_NOT_NULL (after );
1156+ ASSERT_EQ (strncmp (after , initial , strlen (initial )), 0 );
1157+ ASSERT_NOT_NULL (strstr (after , "cbm-context" ));
1158+ free (after );
1159+ th_cleanup (fixture .dir );
1160+ PASS ();
1161+ }
1162+
1163+ TEST (config_yaml_edit_hermes_hook_still_refuses_block_scalar_value_issue1924 ) {
1164+ /* A `>` or `|` that BEGINS a value is a real block scalar whose
1165+ * indentation contract this editor does not model: the fail-closed
1166+ * refusal stays, and the file stays byte-identical. */
1167+ static const char * const initials [] = {
1168+ "agent:\n personalities:\n probe: >\n folded face\n" ,
1169+ "agent:\n personalities:\n probe: |\n literal face\n" ,
1170+ "agent:\n personalities:\n probe: >-\n chomped face\n" ,
1171+ };
1172+ for (size_t i = 0U ; i < sizeof (initials ) / sizeof (initials [0 ]); i ++ ) {
1173+ yaml_fixture_t fixture ;
1174+ ASSERT_EQ (yaml_fixture_init (& fixture , initials [i ]), 0 );
1175+ ASSERT_EQ (yaml_hermes_hook_upsert (& fixture ), CBM_YAML_IDENTITY_EDIT_ERROR );
1176+ char * after = yaml_read_alloc (fixture .path );
1177+ ASSERT_NOT_NULL (after );
1178+ ASSERT_STR_EQ (after , initials [i ]);
1179+ free (after );
1180+ th_cleanup (fixture .dir );
1181+ }
1182+ PASS ();
1183+ }
1184+
1185+ TEST (config_yaml_edit_hermes_hook_still_refuses_nonempty_flow_sequence_value_issue1924 ) {
1186+ /* Pins the #1631 line: exact `[]` is accepted, a non-empty flow sequence
1187+ * value is still unsupported in the sequence-document scan. */
1188+ const char * initial = "agent:\n"
1189+ " personalities:\n"
1190+ " probe: [a, b]\n" ;
1191+ yaml_fixture_t fixture ;
1192+ ASSERT_EQ (yaml_fixture_init (& fixture , initial ), 0 );
1193+ ASSERT_EQ (yaml_hermes_hook_upsert (& fixture ), CBM_YAML_IDENTITY_EDIT_ERROR );
1194+ char * after = yaml_read_alloc (fixture .path );
1195+ ASSERT_NOT_NULL (after );
1196+ ASSERT_STR_EQ (after , initial );
1197+ free (after );
1198+ th_cleanup (fixture .dir );
1199+ PASS ();
1200+ }
1201+
10991202/* ── Owned-entry repair (#1631 galaxy + goose upgrades) ──────────────────────
11001203 *
11011204 * Byte-identity alone freezes users on any OLD canonical our past writers
@@ -1989,6 +2092,11 @@ SUITE(config_yaml_edit) {
19892092 RUN_TEST (config_yaml_edit_hermes_accepts_interior_apostrophe_and_plain_wrap_issue1631 );
19902093 RUN_TEST (config_yaml_edit_accepts_utf8_bom_issue1656 );
19912094 RUN_TEST (config_yaml_edit_bom_before_our_own_section_stays_single_issue1656 );
2095+ RUN_TEST (config_yaml_edit_hermes_accepts_interior_gt_in_plain_scalar_issue1924 );
2096+ RUN_TEST (config_yaml_edit_hermes_accepts_interior_pipe_in_plain_scalar_issue1924 );
2097+ RUN_TEST (config_yaml_edit_hermes_accepts_interior_brackets_in_plain_scalar_issue1924 );
2098+ RUN_TEST (config_yaml_edit_hermes_hook_still_refuses_block_scalar_value_issue1924 );
2099+ RUN_TEST (config_yaml_edit_hermes_hook_still_refuses_nonempty_flow_sequence_value_issue1924 );
19922100 RUN_TEST (config_yaml_edit_repairs_prior_unquoted_command_entry_issue1631 );
19932101 RUN_TEST (config_yaml_edit_repairs_prior_goose_block_without_name );
19942102 RUN_TEST (config_yaml_edit_still_refuses_truly_foreign_entry_under_our_key );
0 commit comments