@furongjun1999/dsh-memory 0.9.21 → 0.9.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1221) hide show
  1. package/CHANGELOG.md +404 -358
  2. package/LICENSE +21 -21
  3. package/README.md +32 -0
  4. package/codebuddy/mcp.json +27 -27
  5. package/docs/README.md +1 -0
  6. package/docs/mdcg/cogmap_ops.md +13 -13
  7. package/docs/mdcg//344/270/226/347/225/214/346/250/241/345/236/213/345/212/237/350/203/275/347/253/257_/344/275/277/347/224/250/344/270/216/350/277/220/347/273/264_v1.0.md +384 -384
  8. package/docs//350/247/204/350/214/203/AI/347/274/226/347/250/213/351/200/232/347/224/250/350/247/204/350/214/203_/347/201/265/346/236/242/351/200/202/351/205/215.md +45 -45
  9. package/dsh/dsh-web-start.bat +17 -17
  10. package/dsh/hive-mcp-probe.mjs +94 -94
  11. package/dsh/update-lingshu.bat +11 -11
  12. package/dsh/update-lingshu.ps1 +337 -337
  13. package/hive/README.md +705 -705
  14. package/hive/id_charset_blocks.txt +147 -147
  15. package/lib/tools.d.ts +2 -2
  16. package/md_cg/__init__.py +7 -7
  17. package/md_cg/auditview.py +248 -248
  18. package/md_cg/backfill.py +1328 -1328
  19. package/md_cg/backfill_bigdomain.py +34 -34
  20. package/md_cg/backfill_bucket_zh.py +35 -35
  21. package/md_cg/bench6_arms.py +414 -414
  22. package/md_cg/bench6_common.py +230 -230
  23. package/md_cg/bench6_competitors.py +212 -212
  24. package/md_cg/bench_axis_domain.py +257 -257
  25. package/md_cg/bench_blind_comp.py +308 -308
  26. package/md_cg/bench_e2e_judge.py +534 -534
  27. package/md_cg/bench_e2e_locomo_qa.py +375 -375
  28. package/md_cg/bench_e2e_qa.py +256 -256
  29. package/md_cg/bench_en_atoms_public.py +230 -230
  30. package/md_cg/bench_governance.py +351 -351
  31. package/md_cg/bench_lme_zh.py +410 -410
  32. package/md_cg/bench_locomo.py +121 -121
  33. package/md_cg/bench_locomo_zh.py +460 -460
  34. package/md_cg/bench_locomo_zh_public.py +147 -147
  35. package/md_cg/bench_longmem.py +112 -112
  36. package/md_cg/bench_membench.py +632 -632
  37. package/md_cg/bench_p0.py +149 -149
  38. package/md_cg/bench_progressive.py +287 -287
  39. package/md_cg/bench_role_views.py +238 -238
  40. package/md_cg/bench_task_ab.py +243 -243
  41. package/md_cg/bench_task_ab_llm.py +408 -408
  42. package/md_cg/bench_unified_en.py +204 -204
  43. package/md_cg/bench_zh_mad.py +611 -611
  44. package/md_cg/blindspot_tickets.py +123 -123
  45. package/md_cg/census.py +133 -133
  46. package/md_cg/codeindex.py +531 -531
  47. package/md_cg/comment_gate.py +337 -337
  48. package/md_cg/cond_compose.py +190 -190
  49. package/md_cg/cond_facts.py +154 -154
  50. package/md_cg/cond_template.json +106 -106
  51. package/md_cg/condition_anchor.py +142 -142
  52. package/md_cg/corpus.py +110 -110
  53. package/md_cg/crosscheck.py +1098 -1098
  54. package/md_cg/d_meta.py +310 -310
  55. package/md_cg/evolution.py +493 -493
  56. package/md_cg/generation.py +409 -409
  57. package/md_cg/ghostref.py +130 -130
  58. package/md_cg/lexicon/RULES.md +32 -32
  59. package/md_cg/lexicon/build_cedict_en_zh.py +329 -329
  60. package/md_cg/lexicon/build_standard_en.py +171 -171
  61. package/md_cg/lexicon/cedict_en_zh.json +28322 -28322
  62. package/md_cg/lexicon/char_atoms_clean.json +43813 -43813
  63. package/md_cg/lexicon/expand_en_zh.py +211 -211
  64. package/md_cg/lexicon/standard_en.json +1262 -1262
  65. package/md_cg/linkref.py +280 -280
  66. package/md_cg/mcp_server.py +4 -0
  67. package/md_cg/md_whitebox.py +345 -345
  68. package/md_cg/mdcg.py +5 -0
  69. package/md_cg/mdcos.py +5 -0
  70. package/md_cg/migrate.py +119 -119
  71. package/md_cg/migrate_aeis.py +221 -221
  72. package/md_cg/migrate_roleplay.py +293 -293
  73. package/md_cg/migrate_wisdom_graph.py +360 -360
  74. package/md_cg/mreview/__init__.py +25 -25
  75. package/md_cg/mreview/__main__.py +110 -110
  76. package/md_cg/mreview/bundle.py +178 -178
  77. package/md_cg/mreview/candidates.py +262 -262
  78. package/md_cg/mreview/govern.py +694 -694
  79. package/md_cg/mreview/locate.py +939 -939
  80. package/md_cg/mreview/pipeline.py +742 -742
  81. package/md_cg/mreview/rules/duplication.json +21 -21
  82. package/md_cg/mreview/rules/field_coverage.json +54 -54
  83. package/md_cg/mreview/rules/source_license.json +21 -21
  84. package/md_cg/mreview/rules/template_flow.json +21 -21
  85. package/md_cg/mreview/ruleset.py +252 -252
  86. package/md_cg/op_table.py +4 -0
  87. package/md_cg/progressive.py +123 -123
  88. package/md_cg/protocol/md_cg_gate.proto +33 -33
  89. package/md_cg/qmd_llm.py +334 -334
  90. package/md_cg/roleviews.py +89 -89
  91. package/md_cg/selfreport.py +161 -161
  92. package/md_cg/semantic/REPRODUCE.md +170 -170
  93. package/md_cg/semantic/SCHEMA.md +33 -33
  94. package/md_cg/semantic/__init__.py +10 -10
  95. package/md_cg/semantic/atoms.json +7348 -7348
  96. package/md_cg/semantic/en_normalizer.py +364 -364
  97. package/md_cg/semantic/search_index.json +6199 -6199
  98. package/md_cg/session5.py +198 -0
  99. package/md_cg/srcindex.py +352 -352
  100. package/md_cg/statushdr.py +179 -179
  101. package/md_cg/test_access_hints.py +147 -147
  102. package/md_cg/test_audit_rotate.py +270 -270
  103. package/md_cg/test_auditview.py +277 -277
  104. package/md_cg/test_autonomy.py +143 -143
  105. package/md_cg/test_autonomy_admission.py +1098 -1098
  106. package/md_cg/test_b1_auto_id_multiproc.py +284 -284
  107. package/md_cg/test_b1_foreign_read.py +244 -244
  108. package/md_cg/test_b1b2_write_face.py +424 -424
  109. package/md_cg/test_b2_sensitivity_landing.py +223 -223
  110. package/md_cg/test_b3_merge_keeps_content.py +583 -583
  111. package/md_cg/test_bench_governance.py +102 -102
  112. package/md_cg/test_blindspot_tickets.py +166 -166
  113. package/md_cg/test_boundary_hit.py +410 -410
  114. package/md_cg/test_branch_discard_tombstone.py +136 -136
  115. package/md_cg/test_ccg_perturb.py +184 -184
  116. package/md_cg/test_ccgc.py +458 -458
  117. package/md_cg/test_census_prune.py +81 -81
  118. package/md_cg/test_chain_read_isolate.py +168 -168
  119. package/md_cg/test_codeindex.py +338 -338
  120. package/md_cg/test_coldverify_drain.py +127 -127
  121. package/md_cg/test_comment_gate.py +187 -187
  122. package/md_cg/test_cond_compose_anchors.py +76 -76
  123. package/md_cg/test_cond_match.py +165 -165
  124. package/md_cg/test_condition_anchor.py +81 -81
  125. package/md_cg/test_config_registry.py +55 -55
  126. package/md_cg/test_cons200_scan_selection.py +793 -793
  127. package/md_cg/test_corrupt_utf8_read_surfaces.py +451 -451
  128. package/md_cg/test_crypto_rotate.py +256 -256
  129. package/md_cg/test_csre_index_import_guard.py +161 -161
  130. package/md_cg/test_curiosity_budget.py +468 -468
  131. package/md_cg/test_d17_autostart_toolface.py +453 -453
  132. package/md_cg/test_d_meta.py +412 -412
  133. package/md_cg/test_datapath_root.py +199 -199
  134. package/md_cg/test_emit_negtail_cache.py +156 -156
  135. package/md_cg/test_export_default_collision.py +138 -138
  136. package/md_cg/test_gain_gate.py +223 -223
  137. package/md_cg/test_ghostref.py +182 -182
  138. package/md_cg/test_goal_gen.py +355 -355
  139. package/md_cg/test_govern_directread.py +434 -434
  140. package/md_cg/test_health_scale.py +173 -173
  141. package/md_cg/test_heartbeat_ledger.py +563 -563
  142. package/md_cg/test_hive_ingest.py +285 -285
  143. package/md_cg/test_hot_cold.py +215 -215
  144. package/md_cg/test_hyperedge.py +245 -245
  145. package/md_cg/test_i50a_half_dup_defer.py +408 -408
  146. package/md_cg/test_i50b_defer_to_review_queue.py +545 -545
  147. package/md_cg/test_i50d_importance_source.py +531 -531
  148. package/md_cg/test_identity_contract.py +329 -329
  149. package/md_cg/test_index_crossprocess_reload.py +316 -316
  150. package/md_cg/test_issue376_heartbeat_failed.py +29 -4
  151. package/md_cg/test_issue39_utf8_stdio.py +572 -572
  152. package/md_cg/test_issue52_scan_condition_first.py +677 -677
  153. package/md_cg/test_issue53_cipher_health_hash.py +385 -385
  154. package/md_cg/test_issue66_scrub_semantics.py +107 -107
  155. package/md_cg/test_issue67_scrub_control_pool.py +233 -233
  156. package/md_cg/test_issue69_audit_boundary.py +129 -129
  157. package/md_cg/test_issue73_doc_chapter_refs.py +326 -326
  158. package/md_cg/test_issue78_export_concurrency.py +334 -334
  159. package/md_cg/test_issue80_residual_flush.py +169 -169
  160. package/md_cg/test_issue84_portability.py +95 -95
  161. package/md_cg/test_issue85_export_overwrite.py +113 -113
  162. package/md_cg/test_issue86_runtime_revoke.py +110 -110
  163. package/md_cg/test_issue87_default_sensitivity_single.py +201 -201
  164. package/md_cg/test_issue88_conclusion_face.py +280 -280
  165. package/md_cg/test_issue89_zero_score.py +169 -169
  166. package/md_cg/test_issue91_verifier_timeout.py +528 -528
  167. package/md_cg/test_issue96_key_fallback.py +102 -102
  168. package/md_cg/test_issue98_tenant_root.py +104 -104
  169. package/md_cg/test_legacy_p3_node_id_type.py +375 -375
  170. package/md_cg/test_lifecycle.py +309 -309
  171. package/md_cg/test_lifecycle_retire_leak.py +498 -498
  172. package/md_cg/test_linkref.py +320 -320
  173. package/md_cg/test_links_concurrent_write.py +188 -188
  174. package/md_cg/test_lock.py +52 -52
  175. package/md_cg/test_m3_h9_bucket_health_protect_mark.py +301 -301
  176. package/md_cg/test_m3_h9_semantic_guard.py +525 -525
  177. package/md_cg/test_md_writepath.py +345 -345
  178. package/md_cg/test_merge_upsert.py +168 -168
  179. package/md_cg/test_mr_m3.py +710 -710
  180. package/md_cg/test_mr_m4.py +485 -485
  181. package/md_cg/test_n131_merge_gate.py +205 -205
  182. package/md_cg/test_n139_dek_provision_failclosed.py +185 -185
  183. package/md_cg/test_n176_link_trust.py +221 -221
  184. package/md_cg/test_n178_units_jobid_gate.py +212 -212
  185. package/md_cg/test_n184_keys_concurrent_provision.py +307 -307
  186. package/md_cg/test_n195_writepath_reload.py +283 -283
  187. package/md_cg/test_n196_stale_gate_skip.py +169 -169
  188. package/md_cg/test_n197_n208_write_face_gates.py +471 -471
  189. package/md_cg/test_n198_tokens_corrupt_failclosed.py +225 -225
  190. package/md_cg/test_n199_tokens_concurrent_write.py +378 -378
  191. package/md_cg/test_n201_proposal_visibility.py +382 -382
  192. package/md_cg/test_n202_session_notes_visibility.py +461 -461
  193. package/md_cg/test_n204_n205_n226_n227_n228_n229_exit_gates.py +542 -542
  194. package/md_cg/test_n206_stdio_jsonrpc_type.py +403 -403
  195. package/md_cg/test_n212_n213_n224_generation_gates.py +519 -519
  196. package/md_cg/test_n214_n215_n221_n222_write_face_gates.py +570 -570
  197. package/md_cg/test_n225_nonobject_load.py +1110 -1110
  198. package/md_cg/test_n238_body_text_parity.py +156 -156
  199. package/md_cg/test_n276_probe_hoist.py +199 -199
  200. package/md_cg/test_neg_condition_hits.py +333 -333
  201. package/md_cg/test_neg_coverage_budget.py +500 -500
  202. package/md_cg/test_none_id_write_guard.py +166 -166
  203. package/md_cg/test_opt_batch1_md_cg.py +451 -451
  204. package/md_cg/test_p0.py +264 -264
  205. package/md_cg/test_p1.py +316 -316
  206. package/md_cg/test_p10_identity.py +173 -173
  207. package/md_cg/test_p11_consistency.py +382 -382
  208. package/md_cg/test_p12_metacognition.py +212 -212
  209. package/md_cg/test_p13_encryption.py +241 -241
  210. package/md_cg/test_p14_root_fallback.py +373 -373
  211. package/md_cg/test_p14_sustain.py +249 -249
  212. package/md_cg/test_p15_scrub.py +280 -280
  213. package/md_cg/test_p16_self_state.py +301 -301
  214. package/md_cg/test_p17_predict.py +354 -354
  215. package/md_cg/test_p18_whitebox.py +171 -171
  216. package/md_cg/test_p19_migrate_roleplay.py +149 -149
  217. package/md_cg/test_p1x_ref_root.py +197 -197
  218. package/md_cg/test_p2.py +216 -216
  219. package/md_cg/test_p20_evolution.py +315 -315
  220. package/md_cg/test_p22_theory.py +175 -175
  221. package/md_cg/test_p23_links.py +311 -311
  222. package/md_cg/test_p25_weights.py +156 -156
  223. package/md_cg/test_p26_refindex.py +433 -433
  224. package/md_cg/test_p29_session_ingest_export.py +360 -360
  225. package/md_cg/test_p30_maintain.py +361 -361
  226. package/md_cg/test_p31_insight.py +535 -535
  227. package/md_cg/test_p34_crosscheck.py +331 -331
  228. package/md_cg/test_p35_conditioned_claim.py +252 -252
  229. package/md_cg/test_p36_kp_align.py +230 -230
  230. package/md_cg/test_p37_condition_space.py +248 -248
  231. package/md_cg/test_p38_contextualize.py +273 -273
  232. package/md_cg/test_p39_vision_evidence.py +369 -369
  233. package/md_cg/test_p41_evolve_patrol.py +224 -224
  234. package/md_cg/test_p42_provenance.py +269 -269
  235. package/md_cg/test_p44_md_whitebox.py +231 -231
  236. package/md_cg/test_p46_unit_scope.py +272 -272
  237. package/md_cg/test_p4_fuzzy.py +223 -223
  238. package/md_cg/test_p5_semantic.py +226 -226
  239. package/md_cg/test_p6_consolidate.py +822 -822
  240. package/md_cg/test_p7_goals_recent.py +202 -202
  241. package/md_cg/test_p83_jsonrpc_parse_error.py +124 -124
  242. package/md_cg/test_p8_subgraph_chain.py +213 -213
  243. package/md_cg/test_p9_forget_protect.py +238 -238
  244. package/md_cg/test_preflight_failclosed.py +100 -100
  245. package/md_cg/test_progressive.py +146 -146
  246. package/md_cg/test_propose_tail_index.py +157 -157
  247. package/md_cg/test_protocol.py +272 -272
  248. package/md_cg/test_rank_parity_score_mode.py +522 -522
  249. package/md_cg/test_reach_keys.py +201 -201
  250. package/md_cg/test_read_clip.py +141 -141
  251. package/md_cg/test_read_face_input_gates.py +363 -363
  252. package/md_cg/test_read_face_semantics.py +492 -492
  253. package/md_cg/test_read_scope_b27.py +277 -277
  254. package/md_cg/test_readcache_default_on.py +168 -168
  255. package/md_cg/test_readcache_precise_inval.py +270 -270
  256. package/md_cg/test_recall_metadata.py +422 -422
  257. package/md_cg/test_reconcile_v0.py +294 -294
  258. package/md_cg/test_retr_s1.py +344 -344
  259. package/md_cg/test_retr_s1b.py +276 -276
  260. package/md_cg/test_retr_s3.py +194 -194
  261. package/md_cg/test_retr_s4.py +163 -163
  262. package/md_cg/test_retr_s6.py +157 -157
  263. package/md_cg/test_retr_s7.py +392 -392
  264. package/md_cg/test_retr_s8_time.py +369 -369
  265. package/md_cg/test_retr_s9_edges.py +286 -286
  266. package/md_cg/test_retr_score_once.py +220 -220
  267. package/md_cg/test_review_cli_attribution.py +181 -181
  268. package/md_cg/test_review_cli_visibility.py +235 -235
  269. package/md_cg/test_review_conformance.py +385 -385
  270. package/md_cg/test_review_onepass.py +170 -170
  271. package/md_cg/test_review_queue_batch.py +123 -123
  272. package/md_cg/test_review_queue_index.py +130 -130
  273. package/md_cg/test_role_views.py +354 -354
  274. package/md_cg/test_rrf_graph_seed_cache.py +154 -154
  275. package/md_cg/test_security_audit_v21.py +249 -249
  276. package/md_cg/test_sem_noise.py +242 -242
  277. package/md_cg/test_server_version.py +67 -67
  278. package/md_cg/test_session5_identity.py +93 -93
  279. package/md_cg/test_session5_resolve.py +247 -0
  280. package/md_cg/test_session_attribution_consistency.py +813 -813
  281. package/md_cg/test_session_identity_tristate.py +486 -486
  282. package/md_cg/test_session_isolation.py +168 -168
  283. package/md_cg/test_sleep.py +668 -668
  284. package/md_cg/test_sleep_gitlock.py +134 -134
  285. package/md_cg/test_snapshot_autoclose.py +187 -187
  286. package/md_cg/test_spatial_coords3d.py +292 -292
  287. package/md_cg/test_srcindex.py +171 -171
  288. package/md_cg/test_state_events.py +178 -178
  289. package/md_cg/test_state_slots.py +691 -691
  290. package/md_cg/test_subproc_encoding.py +192 -192
  291. package/md_cg/test_sustain_mutual.py +153 -153
  292. package/md_cg/test_tail_watermark_race.py +208 -208
  293. package/md_cg/test_tasks.py +409 -409
  294. package/md_cg/test_tenant_env_override_warn.py +152 -152
  295. package/md_cg/test_tenant_registry_corrupt_warn.py +151 -151
  296. package/md_cg/test_token_lowercase_form.py +315 -315
  297. package/md_cg/test_transfer.py +180 -180
  298. package/md_cg/test_trust.py +361 -361
  299. package/md_cg/test_twophase.py +286 -286
  300. package/md_cg/test_unify_default_off.py +701 -701
  301. package/md_cg/test_unify_scope.py +182 -182
  302. package/md_cg/test_units_poll.py +71 -71
  303. package/md_cg/test_v21r1_package_version.py +310 -310
  304. package/md_cg/test_validity_filter.py +280 -280
  305. package/md_cg/test_verify_answer.py +138 -138
  306. package/md_cg/test_verify_dirty_reconcile.py +157 -157
  307. package/md_cg/test_w5_path_fingerprint.py +381 -381
  308. package/md_cg/test_wisdom_md_store.py +292 -292
  309. package/md_cg/test_writelimit.py +224 -224
  310. package/md_cg/units.py +869 -869
  311. package/md_cg/vision_evidence.py +667 -667
  312. package/md_cg/whitebox_kb/__init__.py +37 -37
  313. package/md_cg/whitebox_kb/aeis_core/__init__.py +42 -42
  314. package/md_cg/whitebox_kb/aeis_core/api.py +1047 -1047
  315. package/md_cg/whitebox_kb/aeis_core/semantic.py +280 -280
  316. package/md_cg/whitebox_kb/aeis_core/textutil.py +13 -13
  317. package/md_cg/whitebox_kb/aeis_core/time_core.py +51 -51
  318. package/md_cg/whitebox_kb/engine.py +310 -310
  319. package/md_cg/whitebox_kb/seed_knowledge/__init__.py +2 -2
  320. package/md_cg/whitebox_kb/seed_knowledge/guardrail-charter.md +164 -164
  321. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//344/270/255/345/233/275/345/217/244/344/273/243/346/226/207/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +113 -113
  322. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//344/270/255/345/233/275/347/216/260/344/273/243/346/226/207/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +89 -89
  323. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//344/272/272/345/267/245/346/231/272/350/203/275/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +121 -121
  324. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//344/272/272/347/261/273/350/247/202/345/257/237/350/200/205/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +161 -161
  325. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//344/274/232/350/256/241/345/255/246/345/216/237/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +89 -89
  326. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//344/277/241/346/201/257/350/256/272/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +90 -90
  327. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/206/345/255/220/347/224/237/347/211/251/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +113 -113
  328. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/206/346/236/220/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +113 -113
  329. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/235/344/270/255/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +241 -241
  330. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/235/344/270/255/345/216/206/345/217/262/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +117 -117
  331. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/235/344/270/255/345/234/260/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +109 -109
  332. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/235/344/270/255/346/225/260/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +241 -241
  333. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/235/344/270/255/347/211/251/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +317 -317
  334. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/235/344/270/255/347/224/237/347/211/251/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +261 -261
  335. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/235/344/270/255/350/213/261/350/257/255/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +113 -113
  336. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/235/344/270/255/350/257/255/346/226/207/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +113 -113
  337. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/210/235/344/270/255/351/201/223/345/276/267/344/270/216/346/263/225/346/262/273/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +105 -105
  338. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/212/250/347/211/251/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  339. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +1194 -1194
  340. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/214/226/345/267/245/345/216/237/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +113 -113
  341. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/214/273/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +111 -111
  342. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/216/206/345/217/262/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +278 -278
  343. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/216/237/345/255/220/347/211/251/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +97 -97
  344. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/217/244/344/273/243/346/261/211/350/257/255/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +97 -97
  345. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/223/262/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +111 -111
  346. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/233/272/344/275/223/347/211/251/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +133 -133
  347. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/234/237/346/234/250/345/267/245/347/250/213/345/237/272/347/241/200/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +89 -89
  348. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/234/260/347/220/206/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +154 -154
  349. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/244/215/345/217/230/345/207/275/346/225/260/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +129 -129
  350. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/244/226/345/233/275/346/226/207/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +85 -85
  351. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/244/247/345/255/246/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +169 -169
  352. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/244/247/345/255/246/346/200/235/346/224/277/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +117 -117
  353. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/244/247/345/255/246/347/211/251/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +201 -201
  354. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/244/247/345/255/246/350/213/261/350/257/255/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +93 -93
  355. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/244/251/344/275/223/347/211/251/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +89 -89
  356. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/244/251/346/226/207/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +131 -131
  357. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/256/217/350/247/202/347/273/217/346/265/216/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +105 -105
  358. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/256/236/345/217/230/345/207/275/346/225/260/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +129 -129
  359. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/260/217/345/255/246/346/225/260/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +333 -333
  360. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/260/217/345/255/246/347/247/221/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +1124 -1124
  361. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/260/217/345/255/246/350/213/261/350/257/255/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +105 -105
  362. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/260/217/345/255/246/350/257/255/346/226/207/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +117 -117
  363. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/260/217/345/255/246/351/201/223/345/276/267/344/270/216/346/263/225/346/262/273/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +105 -105
  364. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/267/245/347/250/213/345/210/266/345/233/276/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +85 -85
  365. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/267/245/347/250/213/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +362 -362
  366. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/270/202/345/234/272/350/220/245/351/224/200/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +81 -81
  367. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/270/270/345/276/256/345/210/206/346/226/271/347/250/213/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +153 -153
  368. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/276/256/345/210/206/345/207/240/344/275/225/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  369. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/276/256/347/224/237/347/211/251/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +97 -97
  370. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/276/256/350/247/202/347/273/217/346/265/216/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  371. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//345/277/203/347/220/206/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +119 -119
  372. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/203/205/346/204/237/346/203/205/347/273/252/344/273/277/347/234/237/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +186 -186
  373. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/212/275/350/261/241/344/273/243/346/225/260/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +109 -109
  374. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/213/223/346/211/221/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +97 -97
  375. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/223/215/344/275/234/347/263/273/347/273/237/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +109 -109
  376. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/224/277/346/262/273/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +234 -234
  377. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/225/260/345/200/274/345/210/206/346/236/220/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +133 -133
  378. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/225/260/345/255/227/347/224/265/350/267/257/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  379. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/225/260/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +1166 -1166
  380. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/225/260/345/255/246/345/210/206/346/236/220/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +217 -217
  381. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/225/260/345/255/246/347/211/251/347/220/206/346/226/271/346/263/225/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +105 -105
  382. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/225/260/346/215/256/345/272/223/347/263/273/347/273/237/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  383. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/225/260/346/215/256/347/273/223/346/236/204/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +117 -117
  384. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/226/207/345/255/246/347/220/206/350/256/272/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +89 -89
  385. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/227/240/346/234/272/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +141 -141
  386. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/227/266/347/251/272/350/256/260/345/277/206/345/233/276/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +214 -214
  387. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/231/272/350/203/275/350/256/272/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +350 -350
  388. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/234/211/346/234/272/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +129 -129
  389. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/235/220/346/226/231/345/212/233/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  390. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/235/241/344/273/266/350/256/272/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +350 -350
  391. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/244/215/347/211/251/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +89 -89
  392. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/246/202/347/216/207/350/256/272/344/270/216/346/225/260/347/220/206/347/273/237/350/256/241/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +149 -149
  393. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/250/241/346/213/237/347/224/265/345/255/220/346/212/200/346/234/257/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  394. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//346/263/233/345/207/275/345/210/206/346/236/220/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +125 -125
  395. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/203/255/345/212/233/345/255/246/344/270/216/347/273/237/350/256/241/347/211/251/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +125 -125
  396. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/211/251/347/220/206/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +129 -129
  397. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/211/251/347/220/206/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +1302 -1302
  398. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/216/260/344/273/243/346/261/211/350/257/255/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +89 -89
  399. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/220/206/350/256/272/345/212/233/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +137 -137
  400. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/224/237/346/200/201/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +93 -93
  401. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/224/237/347/211/251/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +137 -137
  402. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/224/237/347/211/251/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +1018 -1018
  403. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/224/237/347/220/206/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +93 -93
  404. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/224/265/345/212/250/345/212/233/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +125 -125
  405. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/224/265/350/267/257/345/216/237/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  406. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/244/276/344/274/232/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +111 -111
  407. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/250/213/345/272/217/350/256/276/350/256/241/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  408. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/256/227/346/263/225/350/256/276/350/256/241/344/270/216/345/210/206/346/236/220/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +105 -105
  409. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/256/241/347/220/206/345/255/246/345/216/237/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +89 -89
  410. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/272/277/346/200/247/344/273/243/346/225/260/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +133 -133
  411. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/273/206/350/203/236/347/224/237/347/211/251/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +121 -121
  412. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/273/217/346/265/216/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +169 -169
  413. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/273/223/346/236/204/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +105 -105
  414. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/273/274/345/220/210/302/267/347/273/264/345/237/272/347/273/274/350/277/260.md +184 -184
  415. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//347/274/226/350/257/221/345/216/237/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  416. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//350/207/252/346/210/221/346/204/217/350/257/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +270 -270
  417. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//350/256/241/347/256/227/346/234/272/347/247/221/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +698 -698
  418. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//350/256/241/347/256/227/346/234/272/347/273/204/346/210/220/345/216/237/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +109 -109
  419. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//350/256/241/347/256/227/346/234/272/347/275/221/347/273/234/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +109 -109
  420. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//350/257/255/350/250/200/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +226 -226
  421. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//350/275/257/344/273/266/345/267/245/347/250/213/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +97 -97
  422. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/201/227/344/274/240/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +113 -113
  423. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/207/217/345/255/220/345/212/233/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +137 -137
  424. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/207/221/350/236/215/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +89 -89
  425. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/344/270/255/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +341 -341
  426. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/344/270/255/345/216/206/345/217/262/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  427. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/344/270/255/345/234/260/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +97 -97
  428. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/344/270/255/346/200/235/346/203/263/346/224/277/346/262/273/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +117 -117
  429. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/344/270/255/346/225/260/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +341 -341
  430. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/344/270/255/347/211/251/347/220/206/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +365 -365
  431. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/344/270/255/347/224/237/347/211/251/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +269 -269
  432. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/344/270/255/350/213/261/350/257/255/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +113 -113
  433. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/344/270/255/350/257/255/346/226/207/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +105 -105
  434. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/345/210/206/345/255/220/345/214/226/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +101 -101
  435. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/347/255/211/344/273/243/346/225/260/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +157 -157
  436. package/md_cg/whitebox_kb/seed_knowledge/wisdom_cards//351/253/230/347/255/211/346/225/260/345/255/246/302/267/347/237/245/350/257/206/347/273/274/350/277/260.md +237 -237
  437. package/md_cg/whitebox_kb/seed_knowledge//346/231/272/350/203/275/350/256/2723.4.md +5260 -5260
  438. package/md_cg/whitebox_kb/wisdom/__init__.py +6 -6
  439. package/md_cg/whitebox_kb/wisdom/answer_spec_anchor.py +87 -87
  440. package/md_cg/whitebox_kb/wisdom/browser_units.py +2631 -2631
  441. package/md_cg/whitebox_kb/wisdom/card_validator.py +223 -223
  442. package/md_cg/whitebox_kb/wisdom/causal_discover.py +432 -432
  443. package/md_cg/whitebox_kb/wisdom/chat.html +185 -185
  444. package/md_cg/whitebox_kb/wisdom/code_qa.py +119 -119
  445. package/md_cg/whitebox_kb/wisdom/code_route_bridge.py +90 -90
  446. package/md_cg/whitebox_kb/wisdom/code_test_runner.py +217 -217
  447. package/md_cg/whitebox_kb/wisdom/codegraph_white.py +312 -312
  448. package/md_cg/whitebox_kb/wisdom/compiler_compose.py +160 -160
  449. package/md_cg/whitebox_kb/wisdom/condition_algebra.py +112 -112
  450. package/md_cg/whitebox_kb/wisdom/condition_frame.py +315 -315
  451. package/md_cg/whitebox_kb/wisdom/condition_kb.py +108 -108
  452. package/md_cg/whitebox_kb/wisdom/condition_vm.py +264 -264
  453. package/md_cg/whitebox_kb/wisdom/conflict_map.json +4445 -4445
  454. package/md_cg/whitebox_kb/wisdom/core/compiler.py +301 -301
  455. package/md_cg/whitebox_kb/wisdom/core/lexer.py +512 -512
  456. package/md_cg/whitebox_kb/wisdom/core/name_checker.py +1023 -1023
  457. package/md_cg/whitebox_kb/wisdom/cspmn.py +258 -258
  458. package/md_cg/whitebox_kb/wisdom/danmaku_audit.py +252 -252
  459. package/md_cg/whitebox_kb/wisdom/danmaku_bridge.py +141 -141
  460. package/md_cg/whitebox_kb/wisdom/distilled_condition_units.json +6417 -6417
  461. package/md_cg/whitebox_kb/wisdom/docs/WB-EVAL-20260902b.json +1950 -1950
  462. package/md_cg/whitebox_kb/wisdom/docs/WB-EVAL-20260902c.json +1296 -1296
  463. package/md_cg/whitebox_kb/wisdom/docs/codegraph_ref_rating.md +52 -52
  464. package/md_cg/whitebox_kb/wisdom/docs/daoti_absorb_analysis.md +54 -54
  465. package/md_cg/whitebox_kb/wisdom/docs/dsh_memory_v030_stable.md +34 -34
  466. package/md_cg/whitebox_kb/wisdom/docs/github_absorb_analysis.md +71 -71
  467. package/md_cg/whitebox_kb/wisdom/docs/gliding_horse_absorb_analysis.md +47 -47
  468. package/md_cg/whitebox_kb/wisdom/docs/whitebox_capability_graph.md +61 -61
  469. package/md_cg/whitebox_kb/wisdom/docs/whitebox_capability_graph_demo.json +59 -59
  470. package/md_cg/whitebox_kb/wisdom/docs/whitebox_code_rating_202609.md +43 -43
  471. package/md_cg/whitebox_kb/wisdom/docs//344/273/243/347/240/201/346/235/241/344/273/266/350/267/257/347/224/261/345/233/276_CCG/350/256/276/350/256/241.md +150 -150
  472. package/md_cg/whitebox_kb/wisdom/docs//344/273/243/347/240/201/350/257/255/344/271/211/346/235/241/344/273/266/345/215/217/350/256/256.md +650 -650
  473. package/md_cg/whitebox_kb/wisdom/docs//345/261/200/351/203/250/346/234/200/344/274/230/344/270/216/346/203/205/347/273/252/345/201/217/345/245/275_/347/220/206/350/256/272/345/267/245/347/250/213.md +97 -97
  474. package/md_cg/whitebox_kb/wisdom/docs//346/226/271/345/220/221/346/200/247/346/212/211/346/213/251_/350/207/252/344/270/276vs/350/207/252/350/277/255/344/273/243.md +81 -81
  475. package/md_cg/whitebox_kb/wisdom/docs//347/201/265/346/236/242AGI/346/236/266/346/236/204/346/216/242/347/264/242_/346/226/207/346/241/243/350/247/204/345/210/222.md +51 -51
  476. package/md_cg/whitebox_kb/wisdom/docs//347/201/265/346/236/242/346/217/222/344/273/266/345/210/206/347/261/273/345/210/206/346/236/220.md +67 -67
  477. package/md_cg/whitebox_kb/wisdom/docs//347/231/275/347/256/261/346/234/254/345/234/260/346/240/241/351/252/214/345/231/250_ZeroLLM_Verifier.md +276 -276
  478. package/md_cg/whitebox_kb/wisdom/docs//347/231/275/347/256/261/350/207/252/344/270/276/347/254/254/345/205/255/351/230/266/346/256/265_/346/224/266/345/256/230/346/200/273/347/273/223.md +1207 -1207
  479. package/md_cg/whitebox_kb/wisdom/ds_compose.py +177 -177
  480. package/md_cg/whitebox_kb/wisdom/graph_db_units.py +3089 -3089
  481. package/md_cg/whitebox_kb/wisdom/graph_qa.py +123 -123
  482. package/md_cg/whitebox_kb/wisdom/human_observer_knowledge.json +43 -43
  483. package/md_cg/whitebox_kb/wisdom/knowledge_points.py +318 -318
  484. package/md_cg/whitebox_kb/wisdom/md_store.py +276 -276
  485. package/md_cg/whitebox_kb/wisdom/merge_subgraph.py +178 -178
  486. package/md_cg/whitebox_kb/wisdom/neural_retrieve.py +314 -314
  487. package/md_cg/whitebox_kb/wisdom/os_units.py +2735 -2735
  488. package/md_cg/whitebox_kb/wisdom/pattern_separation.py +376 -376
  489. package/md_cg/whitebox_kb/wisdom/prereq_map.json +364 -364
  490. package/md_cg/whitebox_kb/wisdom/python_code_units.py +2766 -2766
  491. package/md_cg/whitebox_kb/wisdom/role_compose.py +268 -268
  492. package/md_cg/whitebox_kb/wisdom/role_solidified.json +7 -7
  493. package/md_cg/whitebox_kb/wisdom/route_memory.py +244 -244
  494. package/md_cg/whitebox_kb/wisdom/scene_reconstruction.py +148 -148
  495. package/md_cg/whitebox_kb/wisdom/se_compose.py +137 -137
  496. package/md_cg/whitebox_kb/wisdom/snr_dashboard.py +219 -219
  497. package/md_cg/whitebox_kb/wisdom/snr_report.json +40 -40
  498. package/md_cg/whitebox_kb/wisdom/spatial_closure.py +96 -96
  499. package/md_cg/whitebox_kb/wisdom/spatial_qa.py +182 -182
  500. package/md_cg/whitebox_kb/wisdom/status_terms.json +21 -21
  501. package/md_cg/whitebox_kb/wisdom/task_discipline.json +43 -43
  502. package/md_cg/whitebox_kb/wisdom/test_code_compose_domains.py +7541 -7541
  503. package/md_cg/whitebox_kb/wisdom/test_compiler_self_bootstrap.py +354 -354
  504. package/md_cg/whitebox_kb/wisdom/test_ecosystem_demos.py +193 -193
  505. package/md_cg/whitebox_kb/wisdom/test_graph_db.py +292 -292
  506. package/md_cg/whitebox_kb/wisdom/test_navigate_self_bootstrap.py +69 -69
  507. package/md_cg/whitebox_kb/wisdom/test_python_self_bootstrap.py +160 -160
  508. package/md_cg/whitebox_kb/wisdom/trigger_words_index.json +4366 -4366
  509. package/md_cg/whitebox_kb/wisdom/verify_answer.py +116 -116
  510. package/md_cg/whitebox_kb/wisdom/wisdom_book.py +2759 -2759
  511. package/md_cg/whitebox_kb/wisdom/wisdom_cloud.py +479 -479
  512. package/md_cg/whitebox_kb/wisdom/wisdom_ui.html +863 -863
  513. package/md_cg/writepipe.py +11 -1
  514. package/package.json +134 -134
  515. package/skills/README.md +121 -121
  516. package/skills/plugin.json +54 -54
  517. package/skills/skills/designer-perspective/SKILL.md +158 -158
  518. package/skills/skills/designer-perspective/references/01-observation-position.md +66 -66
  519. package/skills/skills/designer-perspective/references/02-structure-recognition.md +62 -62
  520. package/skills/skills/designer-perspective/references/03-direction-judgment.md +55 -55
  521. package/skills/skills/designer-perspective/references/04-qualification-verdict.md +72 -72
  522. package/skills/skills/designer-perspective/references/05-condition-attribution.md +74 -74
  523. package/skills/skills/designer-perspective/scripts/designer.py +545 -545
  524. package/skills/skills/designer-perspective/tests/cases.jsonl +17 -17
  525. package/skills/skills/designer-perspective/tests/selftest.py +61 -61
  526. package/skills/skills/lingshu-browser/SKILL.md +60 -60
  527. package/skills/skills/lingshu-browser/units/browser-02898b15/SKILL.md +45 -45
  528. package/skills/skills/lingshu-browser/units/browser-03b04f98/SKILL.md +45 -45
  529. package/skills/skills/lingshu-browser/units/browser-0754386d/SKILL.md +45 -45
  530. package/skills/skills/lingshu-browser/units/browser-093c03ab/SKILL.md +45 -45
  531. package/skills/skills/lingshu-browser/units/browser-09e60b35/SKILL.md +45 -45
  532. package/skills/skills/lingshu-browser/units/browser-0ab4f2db/SKILL.md +45 -45
  533. package/skills/skills/lingshu-browser/units/browser-0c7f88d6/SKILL.md +45 -45
  534. package/skills/skills/lingshu-browser/units/browser-0f598430/SKILL.md +45 -45
  535. package/skills/skills/lingshu-browser/units/browser-0fd64fa5/SKILL.md +45 -45
  536. package/skills/skills/lingshu-browser/units/browser-17906c62/SKILL.md +45 -45
  537. package/skills/skills/lingshu-browser/units/browser-18f823e2/SKILL.md +45 -45
  538. package/skills/skills/lingshu-browser/units/browser-1bafe81c/SKILL.md +45 -45
  539. package/skills/skills/lingshu-browser/units/browser-1f9ab1f0/SKILL.md +45 -45
  540. package/skills/skills/lingshu-browser/units/browser-1fdb5852/SKILL.md +45 -45
  541. package/skills/skills/lingshu-browser/units/browser-21b0359c/SKILL.md +45 -45
  542. package/skills/skills/lingshu-browser/units/browser-22e8de36/SKILL.md +45 -45
  543. package/skills/skills/lingshu-browser/units/browser-24163519/SKILL.md +45 -45
  544. package/skills/skills/lingshu-browser/units/browser-2471a991/SKILL.md +45 -45
  545. package/skills/skills/lingshu-browser/units/browser-25afee4d/SKILL.md +45 -45
  546. package/skills/skills/lingshu-browser/units/browser-283a91bd/SKILL.md +45 -45
  547. package/skills/skills/lingshu-browser/units/browser-2895ff52/SKILL.md +45 -45
  548. package/skills/skills/lingshu-browser/units/browser-2cc1da58/SKILL.md +45 -45
  549. package/skills/skills/lingshu-browser/units/browser-3189fe6f/SKILL.md +45 -45
  550. package/skills/skills/lingshu-browser/units/browser-31f2b08f/SKILL.md +45 -45
  551. package/skills/skills/lingshu-browser/units/browser-37b8339e/SKILL.md +45 -45
  552. package/skills/skills/lingshu-browser/units/browser-396ec3a6/SKILL.md +45 -45
  553. package/skills/skills/lingshu-browser/units/browser-3df2f904/SKILL.md +45 -45
  554. package/skills/skills/lingshu-browser/units/browser-43154cec/SKILL.md +45 -45
  555. package/skills/skills/lingshu-browser/units/browser-434b74b8/SKILL.md +45 -45
  556. package/skills/skills/lingshu-browser/units/browser-440d4398/SKILL.md +45 -45
  557. package/skills/skills/lingshu-browser/units/browser-44d7f183/SKILL.md +45 -45
  558. package/skills/skills/lingshu-browser/units/browser-4d6c0788/SKILL.md +45 -45
  559. package/skills/skills/lingshu-browser/units/browser-50fecd89/SKILL.md +45 -45
  560. package/skills/skills/lingshu-browser/units/browser-555c0626/SKILL.md +45 -45
  561. package/skills/skills/lingshu-browser/units/browser-57312d24/SKILL.md +45 -45
  562. package/skills/skills/lingshu-browser/units/browser-59a0ada4/SKILL.md +45 -45
  563. package/skills/skills/lingshu-browser/units/browser-5a455aeb/SKILL.md +45 -45
  564. package/skills/skills/lingshu-browser/units/browser-5ae7623a/SKILL.md +45 -45
  565. package/skills/skills/lingshu-browser/units/browser-5dac60b6/SKILL.md +45 -45
  566. package/skills/skills/lingshu-browser/units/browser-5e5f1396/SKILL.md +45 -45
  567. package/skills/skills/lingshu-browser/units/browser-5ebb01dd/SKILL.md +45 -45
  568. package/skills/skills/lingshu-browser/units/browser-5f5453f9/SKILL.md +45 -45
  569. package/skills/skills/lingshu-browser/units/browser-5f90f58c/SKILL.md +45 -45
  570. package/skills/skills/lingshu-browser/units/browser-609362ee/SKILL.md +45 -45
  571. package/skills/skills/lingshu-browser/units/browser-60aefeeb/SKILL.md +45 -45
  572. package/skills/skills/lingshu-browser/units/browser-6636d49c/SKILL.md +45 -45
  573. package/skills/skills/lingshu-browser/units/browser-6cfcb6db/SKILL.md +45 -45
  574. package/skills/skills/lingshu-browser/units/browser-6e1c1158/SKILL.md +45 -45
  575. package/skills/skills/lingshu-browser/units/browser-7008e942/SKILL.md +45 -45
  576. package/skills/skills/lingshu-browser/units/browser-716cd26c/SKILL.md +45 -45
  577. package/skills/skills/lingshu-browser/units/browser-720ce1a1/SKILL.md +45 -45
  578. package/skills/skills/lingshu-browser/units/browser-77a97b43/SKILL.md +45 -45
  579. package/skills/skills/lingshu-browser/units/browser-7bb4871d/SKILL.md +45 -45
  580. package/skills/skills/lingshu-browser/units/browser-7be57bbe/SKILL.md +45 -45
  581. package/skills/skills/lingshu-browser/units/browser-7da433f3/SKILL.md +45 -45
  582. package/skills/skills/lingshu-browser/units/browser-7e96fe1d/SKILL.md +45 -45
  583. package/skills/skills/lingshu-browser/units/browser-7f9cefec/SKILL.md +45 -45
  584. package/skills/skills/lingshu-browser/units/browser-80224e71/SKILL.md +45 -45
  585. package/skills/skills/lingshu-browser/units/browser-81345ecd/SKILL.md +45 -45
  586. package/skills/skills/lingshu-browser/units/browser-822cfa44/SKILL.md +45 -45
  587. package/skills/skills/lingshu-browser/units/browser-853690c0/SKILL.md +45 -45
  588. package/skills/skills/lingshu-browser/units/browser-85553126/SKILL.md +45 -45
  589. package/skills/skills/lingshu-browser/units/browser-87b0ce80/SKILL.md +45 -45
  590. package/skills/skills/lingshu-browser/units/browser-900c4484/SKILL.md +45 -45
  591. package/skills/skills/lingshu-browser/units/browser-910405c4/SKILL.md +45 -45
  592. package/skills/skills/lingshu-browser/units/browser-95fd3c86/SKILL.md +45 -45
  593. package/skills/skills/lingshu-browser/units/browser-97a14ca3/SKILL.md +45 -45
  594. package/skills/skills/lingshu-browser/units/browser-9de10895/SKILL.md +45 -45
  595. package/skills/skills/lingshu-browser/units/browser-9e4914a7/SKILL.md +45 -45
  596. package/skills/skills/lingshu-browser/units/browser-a280ec64/SKILL.md +45 -45
  597. package/skills/skills/lingshu-browser/units/browser-a2d9b0b0/SKILL.md +45 -45
  598. package/skills/skills/lingshu-browser/units/browser-a372edeb/SKILL.md +45 -45
  599. package/skills/skills/lingshu-browser/units/browser-a4c793a4/SKILL.md +45 -45
  600. package/skills/skills/lingshu-browser/units/browser-a681d0c2/SKILL.md +45 -45
  601. package/skills/skills/lingshu-browser/units/browser-a7a2b0c1/SKILL.md +45 -45
  602. package/skills/skills/lingshu-browser/units/browser-a990e68e/SKILL.md +45 -45
  603. package/skills/skills/lingshu-browser/units/browser-aaac4eec/SKILL.md +45 -45
  604. package/skills/skills/lingshu-browser/units/browser-ae6586bb/SKILL.md +45 -45
  605. package/skills/skills/lingshu-browser/units/browser-afa4091f/SKILL.md +45 -45
  606. package/skills/skills/lingshu-browser/units/browser-b4c8cf65/SKILL.md +45 -45
  607. package/skills/skills/lingshu-browser/units/browser-b501767c/SKILL.md +45 -45
  608. package/skills/skills/lingshu-browser/units/browser-bcd4288d/SKILL.md +45 -45
  609. package/skills/skills/lingshu-browser/units/browser-bfad66a5/SKILL.md +45 -45
  610. package/skills/skills/lingshu-browser/units/browser-c45cbfe9/SKILL.md +45 -45
  611. package/skills/skills/lingshu-browser/units/browser-c4dd6078/SKILL.md +45 -45
  612. package/skills/skills/lingshu-browser/units/browser-c879eb0b/SKILL.md +45 -45
  613. package/skills/skills/lingshu-browser/units/browser-c92ac01b/SKILL.md +45 -45
  614. package/skills/skills/lingshu-browser/units/browser-cb179242/SKILL.md +45 -45
  615. package/skills/skills/lingshu-browser/units/browser-cc7d3d6d/SKILL.md +45 -45
  616. package/skills/skills/lingshu-browser/units/browser-cf3c47f0/SKILL.md +45 -45
  617. package/skills/skills/lingshu-browser/units/browser-cf9f812e/SKILL.md +45 -45
  618. package/skills/skills/lingshu-browser/units/browser-d462581c/SKILL.md +45 -45
  619. package/skills/skills/lingshu-browser/units/browser-d5fa0b7f/SKILL.md +45 -45
  620. package/skills/skills/lingshu-browser/units/browser-d72e225b/SKILL.md +45 -45
  621. package/skills/skills/lingshu-browser/units/browser-df1a919e/SKILL.md +45 -45
  622. package/skills/skills/lingshu-browser/units/browser-e84565c1/SKILL.md +45 -45
  623. package/skills/skills/lingshu-browser/units/browser-e947a564/SKILL.md +45 -45
  624. package/skills/skills/lingshu-browser/units/browser-ea9b2b8e/SKILL.md +45 -45
  625. package/skills/skills/lingshu-browser/units/browser-f5ffc6d9/SKILL.md +45 -45
  626. package/skills/skills/lingshu-browser/units/browser-f75a4418/SKILL.md +45 -45
  627. package/skills/skills/lingshu-browser/units/browser-f8f2966e/SKILL.md +45 -45
  628. package/skills/skills/lingshu-browser/units/browser-fa65fa2d/SKILL.md +45 -45
  629. package/skills/skills/lingshu-browser/units/browser-faac8812/SKILL.md +45 -45
  630. package/skills/skills/lingshu-browser/units/browser-ff94a671/SKILL.md +45 -45
  631. package/skills/skills/lingshu-compiler/SKILL.md +56 -56
  632. package/skills/skills/lingshu-compiler/units/analyze-type-infer/SKILL.md +45 -45
  633. package/skills/skills/lingshu-compiler/units/check-name-real/SKILL.md +45 -45
  634. package/skills/skills/lingshu-compiler/units/compile-assign/SKILL.md +45 -45
  635. package/skills/skills/lingshu-compiler/units/compile-expr-tree/SKILL.md +45 -45
  636. package/skills/skills/lingshu-compiler/units/compile-full-pipeline/SKILL.md +45 -45
  637. package/skills/skills/lingshu-compiler/units/compile-func-def/SKILL.md +45 -45
  638. package/skills/skills/lingshu-compiler/units/compile-if-then/SKILL.md +45 -45
  639. package/skills/skills/lingshu-compiler/units/compile-logic-expr/SKILL.md +45 -45
  640. package/skills/skills/lingshu-compiler/units/compile-recursive/SKILL.md +45 -45
  641. package/skills/skills/lingshu-compiler/units/compile-scope/SKILL.md +45 -45
  642. package/skills/skills/lingshu-compiler/units/compile-type-check/SKILL.md +45 -45
  643. package/skills/skills/lingshu-compiler/units/compile-while/SKILL.md +45 -45
  644. package/skills/skills/lingshu-compiler/units/compiler-0010c4bf/SKILL.md +45 -45
  645. package/skills/skills/lingshu-compiler/units/compiler-0355bffb/SKILL.md +45 -45
  646. package/skills/skills/lingshu-compiler/units/compiler-0361708a/SKILL.md +45 -45
  647. package/skills/skills/lingshu-compiler/units/compiler-054a0414/SKILL.md +45 -45
  648. package/skills/skills/lingshu-compiler/units/compiler-05a1691a/SKILL.md +45 -45
  649. package/skills/skills/lingshu-compiler/units/compiler-05eeed1e/SKILL.md +45 -45
  650. package/skills/skills/lingshu-compiler/units/compiler-0622a1f6/SKILL.md +45 -45
  651. package/skills/skills/lingshu-compiler/units/compiler-08b54217/SKILL.md +45 -45
  652. package/skills/skills/lingshu-compiler/units/compiler-0a62b70c/SKILL.md +45 -45
  653. package/skills/skills/lingshu-compiler/units/compiler-0ab24d00/SKILL.md +45 -45
  654. package/skills/skills/lingshu-compiler/units/compiler-0e093688/SKILL.md +45 -45
  655. package/skills/skills/lingshu-compiler/units/compiler-0e82b966/SKILL.md +45 -45
  656. package/skills/skills/lingshu-compiler/units/compiler-0ee9b9b9/SKILL.md +45 -45
  657. package/skills/skills/lingshu-compiler/units/compiler-0f3787e6/SKILL.md +45 -45
  658. package/skills/skills/lingshu-compiler/units/compiler-1028685f/SKILL.md +45 -45
  659. package/skills/skills/lingshu-compiler/units/compiler-11897630/SKILL.md +45 -45
  660. package/skills/skills/lingshu-compiler/units/compiler-16661b9b/SKILL.md +45 -45
  661. package/skills/skills/lingshu-compiler/units/compiler-1f722303/SKILL.md +45 -45
  662. package/skills/skills/lingshu-compiler/units/compiler-25be1262/SKILL.md +45 -45
  663. package/skills/skills/lingshu-compiler/units/compiler-2a76ba07/SKILL.md +45 -45
  664. package/skills/skills/lingshu-compiler/units/compiler-2dbea54a/SKILL.md +45 -45
  665. package/skills/skills/lingshu-compiler/units/compiler-2df52f16/SKILL.md +45 -45
  666. package/skills/skills/lingshu-compiler/units/compiler-2ec2c9d2/SKILL.md +45 -45
  667. package/skills/skills/lingshu-compiler/units/compiler-2f8c8f39/SKILL.md +45 -45
  668. package/skills/skills/lingshu-compiler/units/compiler-38378ac7/SKILL.md +45 -45
  669. package/skills/skills/lingshu-compiler/units/compiler-39457d2e/SKILL.md +45 -45
  670. package/skills/skills/lingshu-compiler/units/compiler-39fb5926/SKILL.md +45 -45
  671. package/skills/skills/lingshu-compiler/units/compiler-47f4fbfa/SKILL.md +45 -45
  672. package/skills/skills/lingshu-compiler/units/compiler-4a8cd1f1/SKILL.md +45 -45
  673. package/skills/skills/lingshu-compiler/units/compiler-4b230b6b/SKILL.md +45 -45
  674. package/skills/skills/lingshu-compiler/units/compiler-4cbbda95/SKILL.md +45 -45
  675. package/skills/skills/lingshu-compiler/units/compiler-4d5a68ff/SKILL.md +45 -45
  676. package/skills/skills/lingshu-compiler/units/compiler-56dc9bdd/SKILL.md +45 -45
  677. package/skills/skills/lingshu-compiler/units/compiler-57e76ebe/SKILL.md +45 -45
  678. package/skills/skills/lingshu-compiler/units/compiler-61ff016b/SKILL.md +45 -45
  679. package/skills/skills/lingshu-compiler/units/compiler-63eae588/SKILL.md +45 -45
  680. package/skills/skills/lingshu-compiler/units/compiler-64c4224b/SKILL.md +45 -45
  681. package/skills/skills/lingshu-compiler/units/compiler-66377955/SKILL.md +45 -45
  682. package/skills/skills/lingshu-compiler/units/compiler-674ab4f6/SKILL.md +45 -45
  683. package/skills/skills/lingshu-compiler/units/compiler-6af76fd6/SKILL.md +45 -45
  684. package/skills/skills/lingshu-compiler/units/compiler-6d979db2/SKILL.md +45 -45
  685. package/skills/skills/lingshu-compiler/units/compiler-6de326c0/SKILL.md +45 -45
  686. package/skills/skills/lingshu-compiler/units/compiler-6f1c0eea/SKILL.md +45 -45
  687. package/skills/skills/lingshu-compiler/units/compiler-724d6c9b/SKILL.md +45 -45
  688. package/skills/skills/lingshu-compiler/units/compiler-7690177f/SKILL.md +45 -45
  689. package/skills/skills/lingshu-compiler/units/compiler-7b229a7d/SKILL.md +45 -45
  690. package/skills/skills/lingshu-compiler/units/compiler-7f471b3a/SKILL.md +45 -45
  691. package/skills/skills/lingshu-compiler/units/compiler-815cad08/SKILL.md +45 -45
  692. package/skills/skills/lingshu-compiler/units/compiler-83c61634/SKILL.md +45 -45
  693. package/skills/skills/lingshu-compiler/units/compiler-8c798c81/SKILL.md +45 -45
  694. package/skills/skills/lingshu-compiler/units/compiler-8dd747ac/SKILL.md +45 -45
  695. package/skills/skills/lingshu-compiler/units/compiler-90324d0a/SKILL.md +45 -45
  696. package/skills/skills/lingshu-compiler/units/compiler-94b8d72d/SKILL.md +45 -45
  697. package/skills/skills/lingshu-compiler/units/compiler-94f12231/SKILL.md +45 -45
  698. package/skills/skills/lingshu-compiler/units/compiler-95937c16/SKILL.md +45 -45
  699. package/skills/skills/lingshu-compiler/units/compiler-98a5625b/SKILL.md +45 -45
  700. package/skills/skills/lingshu-compiler/units/compiler-98b4c42f/SKILL.md +45 -45
  701. package/skills/skills/lingshu-compiler/units/compiler-98e3894a/SKILL.md +45 -45
  702. package/skills/skills/lingshu-compiler/units/compiler-9bdfe4b8/SKILL.md +45 -45
  703. package/skills/skills/lingshu-compiler/units/compiler-9d9b4e83/SKILL.md +45 -45
  704. package/skills/skills/lingshu-compiler/units/compiler-9f7be5ad/SKILL.md +45 -45
  705. package/skills/skills/lingshu-compiler/units/compiler-a6daf076/SKILL.md +45 -45
  706. package/skills/skills/lingshu-compiler/units/compiler-a7995a0c/SKILL.md +45 -45
  707. package/skills/skills/lingshu-compiler/units/compiler-a8399248/SKILL.md +45 -45
  708. package/skills/skills/lingshu-compiler/units/compiler-aabbd099/SKILL.md +45 -45
  709. package/skills/skills/lingshu-compiler/units/compiler-afe169d8/SKILL.md +45 -45
  710. package/skills/skills/lingshu-compiler/units/compiler-b0678bda/SKILL.md +45 -45
  711. package/skills/skills/lingshu-compiler/units/compiler-b09bd196/SKILL.md +45 -45
  712. package/skills/skills/lingshu-compiler/units/compiler-b1396e23/SKILL.md +45 -45
  713. package/skills/skills/lingshu-compiler/units/compiler-b9b31ce0/SKILL.md +45 -45
  714. package/skills/skills/lingshu-compiler/units/compiler-c10264a7/SKILL.md +45 -45
  715. package/skills/skills/lingshu-compiler/units/compiler-cb1e8e4b/SKILL.md +45 -45
  716. package/skills/skills/lingshu-compiler/units/compiler-ccafd438/SKILL.md +45 -45
  717. package/skills/skills/lingshu-compiler/units/compiler-cda9c262/SKILL.md +45 -45
  718. package/skills/skills/lingshu-compiler/units/compiler-ce648068/SKILL.md +45 -45
  719. package/skills/skills/lingshu-compiler/units/compiler-cf5776a4/SKILL.md +45 -45
  720. package/skills/skills/lingshu-compiler/units/compiler-d974e5d3/SKILL.md +45 -45
  721. package/skills/skills/lingshu-compiler/units/compiler-e3979fd3/SKILL.md +45 -45
  722. package/skills/skills/lingshu-compiler/units/compiler-eb1cf2b5/SKILL.md +45 -45
  723. package/skills/skills/lingshu-compiler/units/compiler-ecb30d5b/SKILL.md +45 -45
  724. package/skills/skills/lingshu-compiler/units/compiler-f8c8b24b/SKILL.md +45 -45
  725. package/skills/skills/lingshu-compiler/units/compiler-f99fedbe/SKILL.md +45 -45
  726. package/skills/skills/lingshu-compiler/units/compiler-fa8ff5f7/SKILL.md +45 -45
  727. package/skills/skills/lingshu-compiler/units/compiler-fe1b058d/SKILL.md +45 -45
  728. package/skills/skills/lingshu-compiler/units/lex-chinese-program/SKILL.md +45 -45
  729. package/skills/skills/lingshu-compiler/units/lex-dao-de-jing/SKILL.md +45 -45
  730. package/skills/skills/lingshu-compiler/units/lex-nine-chapters/SKILL.md +45 -45
  731. package/skills/skills/lingshu-compiler/units/vm-arithmetic/SKILL.md +45 -45
  732. package/skills/skills/lingshu-compiler/units/vm-array-ops/SKILL.md +45 -45
  733. package/skills/skills/lingshu-compiler/units/vm-closure-call/SKILL.md +45 -45
  734. package/skills/skills/lingshu-compiler/units/vm-closure-create/SKILL.md +45 -45
  735. package/skills/skills/lingshu-compiler/units/vm-compare/SKILL.md +45 -45
  736. package/skills/skills/lingshu-compiler/units/vm-cond-jump/SKILL.md +45 -45
  737. package/skills/skills/lingshu-compiler/units/vm-cond-space/SKILL.md +45 -45
  738. package/skills/skills/lingshu-compiler/units/vm-exception/SKILL.md +45 -45
  739. package/skills/skills/lingshu-compiler/units/vm-func-call/SKILL.md +45 -45
  740. package/skills/skills/lingshu-compiler/units/vm-loop-run/SKILL.md +45 -45
  741. package/skills/skills/lingshu-compiler/units/vm-profiling/SKILL.md +45 -45
  742. package/skills/skills/lingshu-compiler/units/vm-refcount/SKILL.md +45 -45
  743. package/skills/skills/lingshu-compiler/units/vm-run-loop/SKILL.md +45 -45
  744. package/skills/skills/lingshu-compiler/units/vm-short-circuit/SKILL.md +45 -45
  745. package/skills/skills/lingshu-compiler/units/vm-stack-guard/SKILL.md +45 -45
  746. package/skills/skills/lingshu-compiler/units/vm-stack-ops/SKILL.md +45 -45
  747. package/skills/skills/lingshu-compiler/units/vm-trust-accum/SKILL.md +45 -45
  748. package/skills/skills/lingshu-graph/SKILL.md +63 -63
  749. package/skills/skills/lingshu-graph/units/graph-04cd431b/SKILL.md +45 -45
  750. package/skills/skills/lingshu-graph/units/graph-06e2b1f2/SKILL.md +45 -45
  751. package/skills/skills/lingshu-graph/units/graph-0de12477/SKILL.md +45 -45
  752. package/skills/skills/lingshu-graph/units/graph-0e564e68/SKILL.md +45 -45
  753. package/skills/skills/lingshu-graph/units/graph-10d58a7b/SKILL.md +45 -45
  754. package/skills/skills/lingshu-graph/units/graph-12cd830a/SKILL.md +45 -45
  755. package/skills/skills/lingshu-graph/units/graph-185f2cd2/SKILL.md +45 -45
  756. package/skills/skills/lingshu-graph/units/graph-19a6a301/SKILL.md +45 -45
  757. package/skills/skills/lingshu-graph/units/graph-1b266557/SKILL.md +45 -45
  758. package/skills/skills/lingshu-graph/units/graph-1b707621/SKILL.md +45 -45
  759. package/skills/skills/lingshu-graph/units/graph-1d73b597/SKILL.md +45 -45
  760. package/skills/skills/lingshu-graph/units/graph-2041fa98/SKILL.md +45 -45
  761. package/skills/skills/lingshu-graph/units/graph-2461bc41/SKILL.md +45 -45
  762. package/skills/skills/lingshu-graph/units/graph-2465dff8/SKILL.md +45 -45
  763. package/skills/skills/lingshu-graph/units/graph-2508389f/SKILL.md +45 -45
  764. package/skills/skills/lingshu-graph/units/graph-276d554d/SKILL.md +45 -45
  765. package/skills/skills/lingshu-graph/units/graph-299f4a32/SKILL.md +45 -45
  766. package/skills/skills/lingshu-graph/units/graph-2d455cd8/SKILL.md +45 -45
  767. package/skills/skills/lingshu-graph/units/graph-2fddf701/SKILL.md +45 -45
  768. package/skills/skills/lingshu-graph/units/graph-33385442/SKILL.md +45 -45
  769. package/skills/skills/lingshu-graph/units/graph-34a1dba7/SKILL.md +45 -45
  770. package/skills/skills/lingshu-graph/units/graph-3721be1c/SKILL.md +45 -45
  771. package/skills/skills/lingshu-graph/units/graph-3755dbc9/SKILL.md +45 -45
  772. package/skills/skills/lingshu-graph/units/graph-37a45d4b/SKILL.md +45 -45
  773. package/skills/skills/lingshu-graph/units/graph-3a4a984c/SKILL.md +45 -45
  774. package/skills/skills/lingshu-graph/units/graph-3aa4c941/SKILL.md +45 -45
  775. package/skills/skills/lingshu-graph/units/graph-3b69a528/SKILL.md +45 -45
  776. package/skills/skills/lingshu-graph/units/graph-3bc2eb69/SKILL.md +45 -45
  777. package/skills/skills/lingshu-graph/units/graph-3d255ed4/SKILL.md +45 -45
  778. package/skills/skills/lingshu-graph/units/graph-3d34961d/SKILL.md +45 -45
  779. package/skills/skills/lingshu-graph/units/graph-3e18a380/SKILL.md +45 -45
  780. package/skills/skills/lingshu-graph/units/graph-3f920bf3/SKILL.md +45 -45
  781. package/skills/skills/lingshu-graph/units/graph-40b7bf61/SKILL.md +45 -45
  782. package/skills/skills/lingshu-graph/units/graph-42187d5d/SKILL.md +45 -45
  783. package/skills/skills/lingshu-graph/units/graph-4361c60e/SKILL.md +45 -45
  784. package/skills/skills/lingshu-graph/units/graph-44e56113/SKILL.md +45 -45
  785. package/skills/skills/lingshu-graph/units/graph-4b363727/SKILL.md +45 -45
  786. package/skills/skills/lingshu-graph/units/graph-52e6e216/SKILL.md +45 -45
  787. package/skills/skills/lingshu-graph/units/graph-53fbfef5/SKILL.md +45 -45
  788. package/skills/skills/lingshu-graph/units/graph-54ac2988/SKILL.md +45 -45
  789. package/skills/skills/lingshu-graph/units/graph-580dadcd/SKILL.md +45 -45
  790. package/skills/skills/lingshu-graph/units/graph-5ca34baa/SKILL.md +45 -45
  791. package/skills/skills/lingshu-graph/units/graph-5cb7fbdf/SKILL.md +45 -45
  792. package/skills/skills/lingshu-graph/units/graph-5f894c05/SKILL.md +45 -45
  793. package/skills/skills/lingshu-graph/units/graph-656e7bd4/SKILL.md +45 -45
  794. package/skills/skills/lingshu-graph/units/graph-6dc48231/SKILL.md +45 -45
  795. package/skills/skills/lingshu-graph/units/graph-7186924a/SKILL.md +45 -45
  796. package/skills/skills/lingshu-graph/units/graph-72ce5342/SKILL.md +45 -45
  797. package/skills/skills/lingshu-graph/units/graph-7376a24e/SKILL.md +45 -45
  798. package/skills/skills/lingshu-graph/units/graph-7412a7cb/SKILL.md +45 -45
  799. package/skills/skills/lingshu-graph/units/graph-7becedf0/SKILL.md +45 -45
  800. package/skills/skills/lingshu-graph/units/graph-7c38fbf3/SKILL.md +45 -45
  801. package/skills/skills/lingshu-graph/units/graph-7dc36de7/SKILL.md +45 -45
  802. package/skills/skills/lingshu-graph/units/graph-7fe49de7/SKILL.md +45 -45
  803. package/skills/skills/lingshu-graph/units/graph-80d82194/SKILL.md +45 -45
  804. package/skills/skills/lingshu-graph/units/graph-85bf101e/SKILL.md +45 -45
  805. package/skills/skills/lingshu-graph/units/graph-8650548b/SKILL.md +45 -45
  806. package/skills/skills/lingshu-graph/units/graph-86583b09/SKILL.md +45 -45
  807. package/skills/skills/lingshu-graph/units/graph-8727827c/SKILL.md +45 -45
  808. package/skills/skills/lingshu-graph/units/graph-873fb505/SKILL.md +45 -45
  809. package/skills/skills/lingshu-graph/units/graph-89b11de0/SKILL.md +45 -45
  810. package/skills/skills/lingshu-graph/units/graph-8d7b569b/SKILL.md +45 -45
  811. package/skills/skills/lingshu-graph/units/graph-8e920d5d/SKILL.md +45 -45
  812. package/skills/skills/lingshu-graph/units/graph-8eb38e3d/SKILL.md +45 -45
  813. package/skills/skills/lingshu-graph/units/graph-94582f69/SKILL.md +45 -45
  814. package/skills/skills/lingshu-graph/units/graph-947355f7/SKILL.md +45 -45
  815. package/skills/skills/lingshu-graph/units/graph-9507aff7/SKILL.md +45 -45
  816. package/skills/skills/lingshu-graph/units/graph-95b86a8b/SKILL.md +45 -45
  817. package/skills/skills/lingshu-graph/units/graph-96b85e1f/SKILL.md +45 -45
  818. package/skills/skills/lingshu-graph/units/graph-97b22f09/SKILL.md +45 -45
  819. package/skills/skills/lingshu-graph/units/graph-9833cfda/SKILL.md +45 -45
  820. package/skills/skills/lingshu-graph/units/graph-9aa8a3f4/SKILL.md +45 -45
  821. package/skills/skills/lingshu-graph/units/graph-9f6665c0/SKILL.md +45 -45
  822. package/skills/skills/lingshu-graph/units/graph-a125d282/SKILL.md +45 -45
  823. package/skills/skills/lingshu-graph/units/graph-a49ef4f0/SKILL.md +45 -45
  824. package/skills/skills/lingshu-graph/units/graph-a5cd04ae/SKILL.md +45 -45
  825. package/skills/skills/lingshu-graph/units/graph-add9a63b/SKILL.md +45 -45
  826. package/skills/skills/lingshu-graph/units/graph-b00e3dc7/SKILL.md +45 -45
  827. package/skills/skills/lingshu-graph/units/graph-b33a7662/SKILL.md +45 -45
  828. package/skills/skills/lingshu-graph/units/graph-b76d15ee/SKILL.md +45 -45
  829. package/skills/skills/lingshu-graph/units/graph-b77fa05a/SKILL.md +45 -45
  830. package/skills/skills/lingshu-graph/units/graph-b912fc3b/SKILL.md +45 -45
  831. package/skills/skills/lingshu-graph/units/graph-baf61b7c/SKILL.md +45 -45
  832. package/skills/skills/lingshu-graph/units/graph-c1d5687b/SKILL.md +45 -45
  833. package/skills/skills/lingshu-graph/units/graph-c407bbed/SKILL.md +45 -45
  834. package/skills/skills/lingshu-graph/units/graph-c4676460/SKILL.md +45 -45
  835. package/skills/skills/lingshu-graph/units/graph-c4a59d80/SKILL.md +45 -45
  836. package/skills/skills/lingshu-graph/units/graph-c5815621/SKILL.md +45 -45
  837. package/skills/skills/lingshu-graph/units/graph-ccad55f1/SKILL.md +45 -45
  838. package/skills/skills/lingshu-graph/units/graph-d0677ce1/SKILL.md +45 -45
  839. package/skills/skills/lingshu-graph/units/graph-d1289b39/SKILL.md +45 -45
  840. package/skills/skills/lingshu-graph/units/graph-d15f39b1/SKILL.md +45 -45
  841. package/skills/skills/lingshu-graph/units/graph-d40691ca/SKILL.md +45 -45
  842. package/skills/skills/lingshu-graph/units/graph-d43b387a/SKILL.md +45 -45
  843. package/skills/skills/lingshu-graph/units/graph-d4dd02f4/SKILL.md +45 -45
  844. package/skills/skills/lingshu-graph/units/graph-d724ea18/SKILL.md +45 -45
  845. package/skills/skills/lingshu-graph/units/graph-d74d36fd/SKILL.md +45 -45
  846. package/skills/skills/lingshu-graph/units/graph-d9d3934c/SKILL.md +45 -45
  847. package/skills/skills/lingshu-graph/units/graph-ddf563ff/SKILL.md +45 -45
  848. package/skills/skills/lingshu-graph/units/graph-de00894f/SKILL.md +45 -45
  849. package/skills/skills/lingshu-graph/units/graph-df1ebb63/SKILL.md +45 -45
  850. package/skills/skills/lingshu-graph/units/graph-e2905c20/SKILL.md +45 -45
  851. package/skills/skills/lingshu-graph/units/graph-e4f8cefd/SKILL.md +45 -45
  852. package/skills/skills/lingshu-graph/units/graph-ea3150e7/SKILL.md +45 -45
  853. package/skills/skills/lingshu-graph/units/graph-eb4ac7dd/SKILL.md +45 -45
  854. package/skills/skills/lingshu-graph/units/graph-ee9f6dfa/SKILL.md +45 -45
  855. package/skills/skills/lingshu-graph/units/graph-f055b2ea/SKILL.md +45 -45
  856. package/skills/skills/lingshu-graph/units/graph-f1891287/SKILL.md +45 -45
  857. package/skills/skills/lingshu-graph/units/graph-f1bb5aa1/SKILL.md +45 -45
  858. package/skills/skills/lingshu-graph/units/graph-f56fa220/SKILL.md +45 -45
  859. package/skills/skills/lingshu-graph/units/graph-f729034f/SKILL.md +45 -45
  860. package/skills/skills/lingshu-graph/units/graph-f748a63f/SKILL.md +45 -45
  861. package/skills/skills/lingshu-graph/units/graph-f8c4a59e/SKILL.md +45 -45
  862. package/skills/skills/lingshu-graph/units/graph-fca3d129/SKILL.md +45 -45
  863. package/skills/skills/lingshu-graph/units/graph-fd02d934/SKILL.md +45 -45
  864. package/skills/skills/lingshu-graph/units/graph-fd51ece9/SKILL.md +45 -45
  865. package/skills/skills/lingshu-graph/units/graph-fd6a81ab/SKILL.md +45 -45
  866. package/skills/skills/lingshu-net/SKILL.md +48 -48
  867. package/skills/skills/lingshu-net/units/net-02090d29/SKILL.md +45 -45
  868. package/skills/skills/lingshu-net/units/net-05937712/SKILL.md +45 -45
  869. package/skills/skills/lingshu-net/units/net-059d072f/SKILL.md +45 -45
  870. package/skills/skills/lingshu-net/units/net-080f6012/SKILL.md +45 -45
  871. package/skills/skills/lingshu-net/units/net-08a2fc88/SKILL.md +45 -45
  872. package/skills/skills/lingshu-net/units/net-0935edf1/SKILL.md +45 -45
  873. package/skills/skills/lingshu-net/units/net-0e7f91e4/SKILL.md +45 -45
  874. package/skills/skills/lingshu-net/units/net-0f2850e0/SKILL.md +45 -45
  875. package/skills/skills/lingshu-net/units/net-107ab486/SKILL.md +45 -45
  876. package/skills/skills/lingshu-net/units/net-111e79b0/SKILL.md +45 -45
  877. package/skills/skills/lingshu-net/units/net-126876c1/SKILL.md +45 -45
  878. package/skills/skills/lingshu-net/units/net-13eeb575/SKILL.md +45 -45
  879. package/skills/skills/lingshu-net/units/net-14102d54/SKILL.md +45 -45
  880. package/skills/skills/lingshu-net/units/net-14e9ad0d/SKILL.md +45 -45
  881. package/skills/skills/lingshu-net/units/net-184175d3/SKILL.md +45 -45
  882. package/skills/skills/lingshu-net/units/net-1da1c695/SKILL.md +45 -45
  883. package/skills/skills/lingshu-net/units/net-240a14ec/SKILL.md +45 -45
  884. package/skills/skills/lingshu-net/units/net-2784f98b/SKILL.md +45 -45
  885. package/skills/skills/lingshu-net/units/net-292ef917/SKILL.md +45 -45
  886. package/skills/skills/lingshu-net/units/net-3434e92f/SKILL.md +45 -45
  887. package/skills/skills/lingshu-net/units/net-35019e6b/SKILL.md +45 -45
  888. package/skills/skills/lingshu-net/units/net-3bbc6afb/SKILL.md +45 -45
  889. package/skills/skills/lingshu-net/units/net-3bdf9d9d/SKILL.md +45 -45
  890. package/skills/skills/lingshu-net/units/net-3dcb84d3/SKILL.md +45 -45
  891. package/skills/skills/lingshu-net/units/net-431cccf9/SKILL.md +45 -45
  892. package/skills/skills/lingshu-net/units/net-435a9f7f/SKILL.md +45 -45
  893. package/skills/skills/lingshu-net/units/net-4508101f/SKILL.md +45 -45
  894. package/skills/skills/lingshu-net/units/net-4585c9e7/SKILL.md +45 -45
  895. package/skills/skills/lingshu-net/units/net-479612a0/SKILL.md +45 -45
  896. package/skills/skills/lingshu-net/units/net-47a19838/SKILL.md +45 -45
  897. package/skills/skills/lingshu-net/units/net-4e36e1e3/SKILL.md +45 -45
  898. package/skills/skills/lingshu-net/units/net-509b8001/SKILL.md +45 -45
  899. package/skills/skills/lingshu-net/units/net-51930c5e/SKILL.md +45 -45
  900. package/skills/skills/lingshu-net/units/net-56dbd63f/SKILL.md +45 -45
  901. package/skills/skills/lingshu-net/units/net-57387462/SKILL.md +45 -45
  902. package/skills/skills/lingshu-net/units/net-5c115606/SKILL.md +45 -45
  903. package/skills/skills/lingshu-net/units/net-5d27f392/SKILL.md +45 -45
  904. package/skills/skills/lingshu-net/units/net-5f69c938/SKILL.md +45 -45
  905. package/skills/skills/lingshu-net/units/net-5fa6c13b/SKILL.md +45 -45
  906. package/skills/skills/lingshu-net/units/net-61580202/SKILL.md +45 -45
  907. package/skills/skills/lingshu-net/units/net-61926703/SKILL.md +45 -45
  908. package/skills/skills/lingshu-net/units/net-61f64fbc/SKILL.md +45 -45
  909. package/skills/skills/lingshu-net/units/net-6200f3b2/SKILL.md +45 -45
  910. package/skills/skills/lingshu-net/units/net-63c3eda3/SKILL.md +45 -45
  911. package/skills/skills/lingshu-net/units/net-66e6119b/SKILL.md +45 -45
  912. package/skills/skills/lingshu-net/units/net-68643014/SKILL.md +45 -45
  913. package/skills/skills/lingshu-net/units/net-686632aa/SKILL.md +45 -45
  914. package/skills/skills/lingshu-net/units/net-6967ff14/SKILL.md +45 -45
  915. package/skills/skills/lingshu-net/units/net-6996f499/SKILL.md +45 -45
  916. package/skills/skills/lingshu-net/units/net-6c3b02c2/SKILL.md +45 -45
  917. package/skills/skills/lingshu-net/units/net-6eb37f63/SKILL.md +45 -45
  918. package/skills/skills/lingshu-net/units/net-6f96c190/SKILL.md +45 -45
  919. package/skills/skills/lingshu-net/units/net-6fb27488/SKILL.md +45 -45
  920. package/skills/skills/lingshu-net/units/net-703559d0/SKILL.md +45 -45
  921. package/skills/skills/lingshu-net/units/net-706d2692/SKILL.md +45 -45
  922. package/skills/skills/lingshu-net/units/net-70a20e04/SKILL.md +45 -45
  923. package/skills/skills/lingshu-net/units/net-7376158c/SKILL.md +45 -45
  924. package/skills/skills/lingshu-net/units/net-74d647cb/SKILL.md +45 -45
  925. package/skills/skills/lingshu-net/units/net-74e8a576/SKILL.md +45 -45
  926. package/skills/skills/lingshu-net/units/net-7801c2c0/SKILL.md +45 -45
  927. package/skills/skills/lingshu-net/units/net-78cae54d/SKILL.md +45 -45
  928. package/skills/skills/lingshu-net/units/net-78ec0324/SKILL.md +45 -45
  929. package/skills/skills/lingshu-net/units/net-7998097c/SKILL.md +45 -45
  930. package/skills/skills/lingshu-net/units/net-7d81ae06/SKILL.md +45 -45
  931. package/skills/skills/lingshu-net/units/net-7eabbbc8/SKILL.md +45 -45
  932. package/skills/skills/lingshu-net/units/net-7ed4f2c5/SKILL.md +45 -45
  933. package/skills/skills/lingshu-net/units/net-80b56cd6/SKILL.md +45 -45
  934. package/skills/skills/lingshu-net/units/net-83447546/SKILL.md +45 -45
  935. package/skills/skills/lingshu-net/units/net-8361fe5b/SKILL.md +45 -45
  936. package/skills/skills/lingshu-net/units/net-85e3996c/SKILL.md +45 -45
  937. package/skills/skills/lingshu-net/units/net-8897d5cc/SKILL.md +45 -45
  938. package/skills/skills/lingshu-net/units/net-88ad93a6/SKILL.md +45 -45
  939. package/skills/skills/lingshu-net/units/net-8e6f359e/SKILL.md +45 -45
  940. package/skills/skills/lingshu-net/units/net-8edc4cdb/SKILL.md +45 -45
  941. package/skills/skills/lingshu-net/units/net-8f6169e9/SKILL.md +45 -45
  942. package/skills/skills/lingshu-net/units/net-91e00638/SKILL.md +45 -45
  943. package/skills/skills/lingshu-net/units/net-96c61a3c/SKILL.md +45 -45
  944. package/skills/skills/lingshu-net/units/net-99076a29/SKILL.md +45 -45
  945. package/skills/skills/lingshu-net/units/net-998f3641/SKILL.md +45 -45
  946. package/skills/skills/lingshu-net/units/net-a1d7228a/SKILL.md +45 -45
  947. package/skills/skills/lingshu-net/units/net-a74da501/SKILL.md +45 -45
  948. package/skills/skills/lingshu-net/units/net-ac57deb7/SKILL.md +45 -45
  949. package/skills/skills/lingshu-net/units/net-b22d2f2b/SKILL.md +45 -45
  950. package/skills/skills/lingshu-net/units/net-b2b29d8d/SKILL.md +45 -45
  951. package/skills/skills/lingshu-net/units/net-b2ddce5d/SKILL.md +45 -45
  952. package/skills/skills/lingshu-net/units/net-b4151e9a/SKILL.md +45 -45
  953. package/skills/skills/lingshu-net/units/net-b873d6f7/SKILL.md +45 -45
  954. package/skills/skills/lingshu-net/units/net-bd3d2d55/SKILL.md +45 -45
  955. package/skills/skills/lingshu-net/units/net-c2a3f019/SKILL.md +45 -45
  956. package/skills/skills/lingshu-net/units/net-c685b788/SKILL.md +45 -45
  957. package/skills/skills/lingshu-net/units/net-c6c1fd79/SKILL.md +45 -45
  958. package/skills/skills/lingshu-net/units/net-c74a1b5d/SKILL.md +45 -45
  959. package/skills/skills/lingshu-net/units/net-cdac702d/SKILL.md +45 -45
  960. package/skills/skills/lingshu-net/units/net-d12dff5c/SKILL.md +45 -45
  961. package/skills/skills/lingshu-net/units/net-d3747882/SKILL.md +45 -45
  962. package/skills/skills/lingshu-net/units/net-d5fefa59/SKILL.md +45 -45
  963. package/skills/skills/lingshu-net/units/net-d67ec725/SKILL.md +45 -45
  964. package/skills/skills/lingshu-net/units/net-d80c1c4c/SKILL.md +45 -45
  965. package/skills/skills/lingshu-net/units/net-d9cb43b0/SKILL.md +45 -45
  966. package/skills/skills/lingshu-net/units/net-da559517/SKILL.md +45 -45
  967. package/skills/skills/lingshu-net/units/net-db4f414e/SKILL.md +45 -45
  968. package/skills/skills/lingshu-net/units/net-dc09d67c/SKILL.md +45 -45
  969. package/skills/skills/lingshu-net/units/net-e2d185de/SKILL.md +45 -45
  970. package/skills/skills/lingshu-net/units/net-e2fc73f8/SKILL.md +45 -45
  971. package/skills/skills/lingshu-net/units/net-e33ef0c2/SKILL.md +45 -45
  972. package/skills/skills/lingshu-net/units/net-e346863c/SKILL.md +45 -45
  973. package/skills/skills/lingshu-net/units/net-e6b3389a/SKILL.md +45 -45
  974. package/skills/skills/lingshu-net/units/net-e9758fc0/SKILL.md +45 -45
  975. package/skills/skills/lingshu-net/units/net-e9a9747a/SKILL.md +45 -45
  976. package/skills/skills/lingshu-net/units/net-ea14aab8/SKILL.md +45 -45
  977. package/skills/skills/lingshu-net/units/net-eba92ac1/SKILL.md +45 -45
  978. package/skills/skills/lingshu-net/units/net-f29d91d2/SKILL.md +45 -45
  979. package/skills/skills/lingshu-net/units/net-f314dd0d/SKILL.md +45 -45
  980. package/skills/skills/lingshu-net/units/net-f332b629/SKILL.md +45 -45
  981. package/skills/skills/lingshu-net/units/net-f7df127c/SKILL.md +45 -45
  982. package/skills/skills/lingshu-net/units/net-fb9d8f5d/SKILL.md +45 -45
  983. package/skills/skills/lingshu-net/units/net-fdec2c86/SKILL.md +45 -45
  984. package/skills/skills/lingshu-os/SKILL.md +64 -64
  985. package/skills/skills/lingshu-os/units/os-0205cf9b/SKILL.md +45 -45
  986. package/skills/skills/lingshu-os/units/os-027dc9be/SKILL.md +45 -45
  987. package/skills/skills/lingshu-os/units/os-03c0d7d6/SKILL.md +45 -45
  988. package/skills/skills/lingshu-os/units/os-040b5505/SKILL.md +45 -45
  989. package/skills/skills/lingshu-os/units/os-06fa98ed/SKILL.md +45 -45
  990. package/skills/skills/lingshu-os/units/os-0854291c/SKILL.md +45 -45
  991. package/skills/skills/lingshu-os/units/os-0c7f14cb/SKILL.md +45 -45
  992. package/skills/skills/lingshu-os/units/os-0d855af2/SKILL.md +45 -45
  993. package/skills/skills/lingshu-os/units/os-0e87e997/SKILL.md +45 -45
  994. package/skills/skills/lingshu-os/units/os-0f8ed882/SKILL.md +45 -45
  995. package/skills/skills/lingshu-os/units/os-111ce1de/SKILL.md +45 -45
  996. package/skills/skills/lingshu-os/units/os-1234eb00/SKILL.md +45 -45
  997. package/skills/skills/lingshu-os/units/os-128f3820/SKILL.md +45 -45
  998. package/skills/skills/lingshu-os/units/os-15796db5/SKILL.md +45 -45
  999. package/skills/skills/lingshu-os/units/os-1898928a/SKILL.md +45 -45
  1000. package/skills/skills/lingshu-os/units/os-192b8ca9/SKILL.md +45 -45
  1001. package/skills/skills/lingshu-os/units/os-1d3bcf28/SKILL.md +45 -45
  1002. package/skills/skills/lingshu-os/units/os-1f224514/SKILL.md +45 -45
  1003. package/skills/skills/lingshu-os/units/os-26a4f86a/SKILL.md +45 -45
  1004. package/skills/skills/lingshu-os/units/os-29c96147/SKILL.md +45 -45
  1005. package/skills/skills/lingshu-os/units/os-2ea9a5ff/SKILL.md +45 -45
  1006. package/skills/skills/lingshu-os/units/os-300ef22c/SKILL.md +45 -45
  1007. package/skills/skills/lingshu-os/units/os-310dda5b/SKILL.md +45 -45
  1008. package/skills/skills/lingshu-os/units/os-313ef4ed/SKILL.md +45 -45
  1009. package/skills/skills/lingshu-os/units/os-329a2147/SKILL.md +45 -45
  1010. package/skills/skills/lingshu-os/units/os-34ad4b62/SKILL.md +45 -45
  1011. package/skills/skills/lingshu-os/units/os-350bc623/SKILL.md +45 -45
  1012. package/skills/skills/lingshu-os/units/os-35ee1a30/SKILL.md +45 -45
  1013. package/skills/skills/lingshu-os/units/os-3cd28220/SKILL.md +45 -45
  1014. package/skills/skills/lingshu-os/units/os-3d84e0c9/SKILL.md +45 -45
  1015. package/skills/skills/lingshu-os/units/os-3db42aac/SKILL.md +45 -45
  1016. package/skills/skills/lingshu-os/units/os-3e0aff42/SKILL.md +45 -45
  1017. package/skills/skills/lingshu-os/units/os-3e9405d2/SKILL.md +45 -45
  1018. package/skills/skills/lingshu-os/units/os-41d14544/SKILL.md +45 -45
  1019. package/skills/skills/lingshu-os/units/os-462f3ed4/SKILL.md +45 -45
  1020. package/skills/skills/lingshu-os/units/os-485833fa/SKILL.md +45 -45
  1021. package/skills/skills/lingshu-os/units/os-4a1cf781/SKILL.md +45 -45
  1022. package/skills/skills/lingshu-os/units/os-4bf77933/SKILL.md +45 -45
  1023. package/skills/skills/lingshu-os/units/os-4c14cec2/SKILL.md +45 -45
  1024. package/skills/skills/lingshu-os/units/os-4f05d577/SKILL.md +45 -45
  1025. package/skills/skills/lingshu-os/units/os-4f50ad0b/SKILL.md +45 -45
  1026. package/skills/skills/lingshu-os/units/os-509a4596/SKILL.md +45 -45
  1027. package/skills/skills/lingshu-os/units/os-512b1b6c/SKILL.md +45 -45
  1028. package/skills/skills/lingshu-os/units/os-5192621b/SKILL.md +45 -45
  1029. package/skills/skills/lingshu-os/units/os-55672763/SKILL.md +45 -45
  1030. package/skills/skills/lingshu-os/units/os-5582bce6/SKILL.md +45 -45
  1031. package/skills/skills/lingshu-os/units/os-5a096a1f/SKILL.md +45 -45
  1032. package/skills/skills/lingshu-os/units/os-5ca15108/SKILL.md +45 -45
  1033. package/skills/skills/lingshu-os/units/os-601663e1/SKILL.md +45 -45
  1034. package/skills/skills/lingshu-os/units/os-607f1963/SKILL.md +45 -45
  1035. package/skills/skills/lingshu-os/units/os-6158581b/SKILL.md +45 -45
  1036. package/skills/skills/lingshu-os/units/os-62f9278b/SKILL.md +45 -45
  1037. package/skills/skills/lingshu-os/units/os-63797b86/SKILL.md +45 -45
  1038. package/skills/skills/lingshu-os/units/os-6a1fe224/SKILL.md +45 -45
  1039. package/skills/skills/lingshu-os/units/os-6b0a68bf/SKILL.md +45 -45
  1040. package/skills/skills/lingshu-os/units/os-6e5cee67/SKILL.md +45 -45
  1041. package/skills/skills/lingshu-os/units/os-6fb1ff58/SKILL.md +45 -45
  1042. package/skills/skills/lingshu-os/units/os-71389592/SKILL.md +45 -45
  1043. package/skills/skills/lingshu-os/units/os-72e879a3/SKILL.md +45 -45
  1044. package/skills/skills/lingshu-os/units/os-7598748a/SKILL.md +45 -45
  1045. package/skills/skills/lingshu-os/units/os-80cc3283/SKILL.md +45 -45
  1046. package/skills/skills/lingshu-os/units/os-819f3093/SKILL.md +45 -45
  1047. package/skills/skills/lingshu-os/units/os-83670c2b/SKILL.md +45 -45
  1048. package/skills/skills/lingshu-os/units/os-878c18b3/SKILL.md +45 -45
  1049. package/skills/skills/lingshu-os/units/os-89ed7af1/SKILL.md +45 -45
  1050. package/skills/skills/lingshu-os/units/os-8cb7279d/SKILL.md +45 -45
  1051. package/skills/skills/lingshu-os/units/os-92276145/SKILL.md +45 -45
  1052. package/skills/skills/lingshu-os/units/os-955c4d66/SKILL.md +45 -45
  1053. package/skills/skills/lingshu-os/units/os-97aacf40/SKILL.md +45 -45
  1054. package/skills/skills/lingshu-os/units/os-9b6ed02c/SKILL.md +45 -45
  1055. package/skills/skills/lingshu-os/units/os-9c86a7a2/SKILL.md +45 -45
  1056. package/skills/skills/lingshu-os/units/os-a13ce4aa/SKILL.md +45 -45
  1057. package/skills/skills/lingshu-os/units/os-a568affe/SKILL.md +45 -45
  1058. package/skills/skills/lingshu-os/units/os-abd48f17/SKILL.md +45 -45
  1059. package/skills/skills/lingshu-os/units/os-b0416edc/SKILL.md +45 -45
  1060. package/skills/skills/lingshu-os/units/os-b6509cac/SKILL.md +45 -45
  1061. package/skills/skills/lingshu-os/units/os-b718657b/SKILL.md +45 -45
  1062. package/skills/skills/lingshu-os/units/os-b776ade1/SKILL.md +45 -45
  1063. package/skills/skills/lingshu-os/units/os-ba24fa08/SKILL.md +45 -45
  1064. package/skills/skills/lingshu-os/units/os-bd1fc177/SKILL.md +45 -45
  1065. package/skills/skills/lingshu-os/units/os-bda92711/SKILL.md +45 -45
  1066. package/skills/skills/lingshu-os/units/os-c0fa71bd/SKILL.md +45 -45
  1067. package/skills/skills/lingshu-os/units/os-c3d5cd44/SKILL.md +45 -45
  1068. package/skills/skills/lingshu-os/units/os-c6b6a763/SKILL.md +45 -45
  1069. package/skills/skills/lingshu-os/units/os-c7661eb1/SKILL.md +45 -45
  1070. package/skills/skills/lingshu-os/units/os-c76b5a43/SKILL.md +45 -45
  1071. package/skills/skills/lingshu-os/units/os-c7d35a30/SKILL.md +45 -45
  1072. package/skills/skills/lingshu-os/units/os-c980a25d/SKILL.md +45 -45
  1073. package/skills/skills/lingshu-os/units/os-c9f8df6e/SKILL.md +45 -45
  1074. package/skills/skills/lingshu-os/units/os-cc49ef2f/SKILL.md +45 -45
  1075. package/skills/skills/lingshu-os/units/os-cd9e686a/SKILL.md +45 -45
  1076. package/skills/skills/lingshu-os/units/os-cfa66a1b/SKILL.md +45 -45
  1077. package/skills/skills/lingshu-os/units/os-d237e500/SKILL.md +45 -45
  1078. package/skills/skills/lingshu-os/units/os-d39ef086/SKILL.md +45 -45
  1079. package/skills/skills/lingshu-os/units/os-d4f9e813/SKILL.md +45 -45
  1080. package/skills/skills/lingshu-os/units/os-d97915c0/SKILL.md +45 -45
  1081. package/skills/skills/lingshu-os/units/os-da0aadde/SKILL.md +45 -45
  1082. package/skills/skills/lingshu-os/units/os-da482caf/SKILL.md +45 -45
  1083. package/skills/skills/lingshu-os/units/os-dd4ff45e/SKILL.md +45 -45
  1084. package/skills/skills/lingshu-os/units/os-de0556c5/SKILL.md +45 -45
  1085. package/skills/skills/lingshu-os/units/os-e0ad3364/SKILL.md +45 -45
  1086. package/skills/skills/lingshu-os/units/os-e7612c68/SKILL.md +45 -45
  1087. package/skills/skills/lingshu-os/units/os-ea444e45/SKILL.md +45 -45
  1088. package/skills/skills/lingshu-os/units/os-ea6e7e0b/SKILL.md +45 -45
  1089. package/skills/skills/lingshu-os/units/os-ebc34d83/SKILL.md +45 -45
  1090. package/skills/skills/lingshu-os/units/os-ecbebbe3/SKILL.md +45 -45
  1091. package/skills/skills/lingshu-os/units/os-ecfceae7/SKILL.md +45 -45
  1092. package/skills/skills/lingshu-os/units/os-ed8de3a3/SKILL.md +45 -45
  1093. package/skills/skills/lingshu-os/units/os-f69c0b08/SKILL.md +45 -45
  1094. package/skills/skills/lingshu-os/units/os-f6ae6205/SKILL.md +45 -45
  1095. package/skills/skills/lingshu-os/units/os-f9bf8dd4/SKILL.md +45 -45
  1096. package/skills/skills/lingshu-os/units/os-fcdd828d/SKILL.md +45 -45
  1097. package/skills/skills/lingshu-pylang/SKILL.md +71 -71
  1098. package/skills/skills/lingshu-pylang/units/pylang-01b23f80/SKILL.md +45 -45
  1099. package/skills/skills/lingshu-pylang/units/pylang-074fd698/SKILL.md +45 -45
  1100. package/skills/skills/lingshu-pylang/units/pylang-0b490bb2/SKILL.md +45 -45
  1101. package/skills/skills/lingshu-pylang/units/pylang-0ca7f08b/SKILL.md +45 -45
  1102. package/skills/skills/lingshu-pylang/units/pylang-10ce3e91/SKILL.md +45 -45
  1103. package/skills/skills/lingshu-pylang/units/pylang-15f76c64/SKILL.md +45 -45
  1104. package/skills/skills/lingshu-pylang/units/pylang-1703046f/SKILL.md +45 -45
  1105. package/skills/skills/lingshu-pylang/units/pylang-1aa3e939/SKILL.md +45 -45
  1106. package/skills/skills/lingshu-pylang/units/pylang-1bed54cf/SKILL.md +45 -45
  1107. package/skills/skills/lingshu-pylang/units/pylang-1dd35612/SKILL.md +45 -45
  1108. package/skills/skills/lingshu-pylang/units/pylang-24273d7b/SKILL.md +45 -45
  1109. package/skills/skills/lingshu-pylang/units/pylang-2853f59f/SKILL.md +45 -45
  1110. package/skills/skills/lingshu-pylang/units/pylang-2a6bc16e/SKILL.md +45 -45
  1111. package/skills/skills/lingshu-pylang/units/pylang-2ae78997/SKILL.md +45 -45
  1112. package/skills/skills/lingshu-pylang/units/pylang-2bc88f4c/SKILL.md +45 -45
  1113. package/skills/skills/lingshu-pylang/units/pylang-31f5b8db/SKILL.md +45 -45
  1114. package/skills/skills/lingshu-pylang/units/pylang-36d178bc/SKILL.md +45 -45
  1115. package/skills/skills/lingshu-pylang/units/pylang-38600583/SKILL.md +45 -45
  1116. package/skills/skills/lingshu-pylang/units/pylang-38e8f9ff/SKILL.md +45 -45
  1117. package/skills/skills/lingshu-pylang/units/pylang-395085ca/SKILL.md +45 -45
  1118. package/skills/skills/lingshu-pylang/units/pylang-399b317e/SKILL.md +45 -45
  1119. package/skills/skills/lingshu-pylang/units/pylang-39c72c78/SKILL.md +45 -45
  1120. package/skills/skills/lingshu-pylang/units/pylang-3a659480/SKILL.md +45 -45
  1121. package/skills/skills/lingshu-pylang/units/pylang-482be62b/SKILL.md +45 -45
  1122. package/skills/skills/lingshu-pylang/units/pylang-486a1e94/SKILL.md +45 -45
  1123. package/skills/skills/lingshu-pylang/units/pylang-49026041/SKILL.md +45 -45
  1124. package/skills/skills/lingshu-pylang/units/pylang-4963b28a/SKILL.md +45 -45
  1125. package/skills/skills/lingshu-pylang/units/pylang-4af9140e/SKILL.md +45 -45
  1126. package/skills/skills/lingshu-pylang/units/pylang-4ca283f2/SKILL.md +45 -45
  1127. package/skills/skills/lingshu-pylang/units/pylang-4ddf31f3/SKILL.md +45 -45
  1128. package/skills/skills/lingshu-pylang/units/pylang-50614726/SKILL.md +45 -45
  1129. package/skills/skills/lingshu-pylang/units/pylang-5102c069/SKILL.md +45 -45
  1130. package/skills/skills/lingshu-pylang/units/pylang-521b1bf8/SKILL.md +45 -45
  1131. package/skills/skills/lingshu-pylang/units/pylang-5880b7a1/SKILL.md +45 -45
  1132. package/skills/skills/lingshu-pylang/units/pylang-61a9102d/SKILL.md +45 -45
  1133. package/skills/skills/lingshu-pylang/units/pylang-621123dd/SKILL.md +45 -45
  1134. package/skills/skills/lingshu-pylang/units/pylang-642cd625/SKILL.md +45 -45
  1135. package/skills/skills/lingshu-pylang/units/pylang-65ca79b7/SKILL.md +45 -45
  1136. package/skills/skills/lingshu-pylang/units/pylang-672df225/SKILL.md +45 -45
  1137. package/skills/skills/lingshu-pylang/units/pylang-67d3368e/SKILL.md +45 -45
  1138. package/skills/skills/lingshu-pylang/units/pylang-6be54340/SKILL.md +45 -45
  1139. package/skills/skills/lingshu-pylang/units/pylang-70b2006f/SKILL.md +45 -45
  1140. package/skills/skills/lingshu-pylang/units/pylang-70b215f1/SKILL.md +45 -45
  1141. package/skills/skills/lingshu-pylang/units/pylang-730c3fe4/SKILL.md +45 -45
  1142. package/skills/skills/lingshu-pylang/units/pylang-733c1286/SKILL.md +45 -45
  1143. package/skills/skills/lingshu-pylang/units/pylang-79845f4d/SKILL.md +45 -45
  1144. package/skills/skills/lingshu-pylang/units/pylang-7c4cc6f8/SKILL.md +45 -45
  1145. package/skills/skills/lingshu-pylang/units/pylang-7c7193ad/SKILL.md +45 -45
  1146. package/skills/skills/lingshu-pylang/units/pylang-7d86ab5d/SKILL.md +45 -45
  1147. package/skills/skills/lingshu-pylang/units/pylang-7df8ca78/SKILL.md +45 -45
  1148. package/skills/skills/lingshu-pylang/units/pylang-8182681d/SKILL.md +45 -45
  1149. package/skills/skills/lingshu-pylang/units/pylang-81ad40ee/SKILL.md +45 -45
  1150. package/skills/skills/lingshu-pylang/units/pylang-8283d7c0/SKILL.md +45 -45
  1151. package/skills/skills/lingshu-pylang/units/pylang-82b73f3d/SKILL.md +45 -45
  1152. package/skills/skills/lingshu-pylang/units/pylang-8404bbde/SKILL.md +45 -45
  1153. package/skills/skills/lingshu-pylang/units/pylang-8584040d/SKILL.md +45 -45
  1154. package/skills/skills/lingshu-pylang/units/pylang-85d8617b/SKILL.md +45 -45
  1155. package/skills/skills/lingshu-pylang/units/pylang-886935a3/SKILL.md +45 -45
  1156. package/skills/skills/lingshu-pylang/units/pylang-88ab2f96/SKILL.md +45 -45
  1157. package/skills/skills/lingshu-pylang/units/pylang-8b6f071e/SKILL.md +45 -45
  1158. package/skills/skills/lingshu-pylang/units/pylang-8d6ec58a/SKILL.md +45 -45
  1159. package/skills/skills/lingshu-pylang/units/pylang-8fe98252/SKILL.md +45 -45
  1160. package/skills/skills/lingshu-pylang/units/pylang-9018c39a/SKILL.md +45 -45
  1161. package/skills/skills/lingshu-pylang/units/pylang-91277748/SKILL.md +45 -45
  1162. package/skills/skills/lingshu-pylang/units/pylang-943b9dcb/SKILL.md +45 -45
  1163. package/skills/skills/lingshu-pylang/units/pylang-961e9e43/SKILL.md +45 -45
  1164. package/skills/skills/lingshu-pylang/units/pylang-962954d9/SKILL.md +45 -45
  1165. package/skills/skills/lingshu-pylang/units/pylang-9dbd8e2b/SKILL.md +45 -45
  1166. package/skills/skills/lingshu-pylang/units/pylang-a02eac31/SKILL.md +45 -45
  1167. package/skills/skills/lingshu-pylang/units/pylang-a4d3d7b1/SKILL.md +45 -45
  1168. package/skills/skills/lingshu-pylang/units/pylang-a7c3d0e2/SKILL.md +45 -45
  1169. package/skills/skills/lingshu-pylang/units/pylang-a88db70d/SKILL.md +45 -45
  1170. package/skills/skills/lingshu-pylang/units/pylang-ab7dddc2/SKILL.md +45 -45
  1171. package/skills/skills/lingshu-pylang/units/pylang-ac2a4b38/SKILL.md +45 -45
  1172. package/skills/skills/lingshu-pylang/units/pylang-afaf67c0/SKILL.md +45 -45
  1173. package/skills/skills/lingshu-pylang/units/pylang-b00660e6/SKILL.md +45 -45
  1174. package/skills/skills/lingshu-pylang/units/pylang-b4d7616d/SKILL.md +45 -45
  1175. package/skills/skills/lingshu-pylang/units/pylang-b67b1878/SKILL.md +45 -45
  1176. package/skills/skills/lingshu-pylang/units/pylang-b8040e1c/SKILL.md +45 -45
  1177. package/skills/skills/lingshu-pylang/units/pylang-b880c6c6/SKILL.md +45 -45
  1178. package/skills/skills/lingshu-pylang/units/pylang-b8d45f76/SKILL.md +45 -45
  1179. package/skills/skills/lingshu-pylang/units/pylang-ba956e52/SKILL.md +45 -45
  1180. package/skills/skills/lingshu-pylang/units/pylang-bb18b1f9/SKILL.md +45 -45
  1181. package/skills/skills/lingshu-pylang/units/pylang-bb46f3f2/SKILL.md +45 -45
  1182. package/skills/skills/lingshu-pylang/units/pylang-be55a094/SKILL.md +45 -45
  1183. package/skills/skills/lingshu-pylang/units/pylang-beb47b63/SKILL.md +45 -45
  1184. package/skills/skills/lingshu-pylang/units/pylang-c017681a/SKILL.md +45 -45
  1185. package/skills/skills/lingshu-pylang/units/pylang-c1317cd9/SKILL.md +45 -45
  1186. package/skills/skills/lingshu-pylang/units/pylang-c36fabf7/SKILL.md +45 -45
  1187. package/skills/skills/lingshu-pylang/units/pylang-c42465ec/SKILL.md +45 -45
  1188. package/skills/skills/lingshu-pylang/units/pylang-c5c76a12/SKILL.md +45 -45
  1189. package/skills/skills/lingshu-pylang/units/pylang-c910ad31/SKILL.md +45 -45
  1190. package/skills/skills/lingshu-pylang/units/pylang-ca9332cf/SKILL.md +45 -45
  1191. package/skills/skills/lingshu-pylang/units/pylang-cce90fa0/SKILL.md +45 -45
  1192. package/skills/skills/lingshu-pylang/units/pylang-cd4234a5/SKILL.md +45 -45
  1193. package/skills/skills/lingshu-pylang/units/pylang-cf0fca1c/SKILL.md +45 -45
  1194. package/skills/skills/lingshu-pylang/units/pylang-d2001e1f/SKILL.md +45 -45
  1195. package/skills/skills/lingshu-pylang/units/pylang-d616eb28/SKILL.md +45 -45
  1196. package/skills/skills/lingshu-pylang/units/pylang-d8962e66/SKILL.md +45 -45
  1197. package/skills/skills/lingshu-pylang/units/pylang-db6214cd/SKILL.md +45 -45
  1198. package/skills/skills/lingshu-pylang/units/pylang-dcde3040/SKILL.md +45 -45
  1199. package/skills/skills/lingshu-pylang/units/pylang-dfad3dba/SKILL.md +45 -45
  1200. package/skills/skills/lingshu-pylang/units/pylang-dfd5aac2/SKILL.md +45 -45
  1201. package/skills/skills/lingshu-pylang/units/pylang-e1aa3818/SKILL.md +45 -45
  1202. package/skills/skills/lingshu-pylang/units/pylang-e476915b/SKILL.md +45 -45
  1203. package/skills/skills/lingshu-pylang/units/pylang-e88e31fd/SKILL.md +45 -45
  1204. package/skills/skills/lingshu-pylang/units/pylang-ecd569d2/SKILL.md +45 -45
  1205. package/skills/skills/lingshu-pylang/units/pylang-ecf27e0c/SKILL.md +45 -45
  1206. package/skills/skills/lingshu-pylang/units/pylang-f124f0e6/SKILL.md +45 -45
  1207. package/skills/skills/lingshu-pylang/units/pylang-f127a8d1/SKILL.md +45 -45
  1208. package/skills/skills/lingshu-pylang/units/pylang-f2d6ec27/SKILL.md +45 -45
  1209. package/skills/skills/lingshu-pylang/units/pylang-f2f40090/SKILL.md +45 -45
  1210. package/skills/skills/lingshu-pylang/units/pylang-f4aa9e65/SKILL.md +45 -45
  1211. package/skills/skills/lingshu-pylang/units/pylang-f4f820d4/SKILL.md +45 -45
  1212. package/skills/skills/lingshu-pylang/units/pylang-f5b34833/SKILL.md +45 -45
  1213. package/skills/skills/lingshu-pylang/units/pylang-f6ebb66e/SKILL.md +45 -45
  1214. package/skills/skills/lingshu-pylang/units/pylang-f78bdcd7/SKILL.md +45 -45
  1215. package/skills/skills/lingshu-pylang/units/pylang-f92bc49b/SKILL.md +45 -45
  1216. package/skills/skills/lingshu-pylang/units/pylang-fd7595f0/SKILL.md +45 -45
  1217. package/skills/skills/lingshu-pylang/units/pylang-fda87aa1/SKILL.md +45 -45
  1218. package/src/lib/python_path.ts +71 -71
  1219. package/src/lib/session_state.ts +127 -127
  1220. package/src/lib/whitebox_llm.ts +311 -311
  1221. package/utf8_boot.py +237 -237
@@ -1,1110 +1,1110 @@
1
- # -*- coding: utf-8 -*-
2
- """md_cg · 非对象形态索引 / 日志守卫(N225:一行 `null` / `[]` / `123` / `"abc"`
3
- 崩掉整条装载链)+ **补强批**(深度 2 同族面:排序键坏型 / 载荷坏型)
4
-
5
- 缺陷(修复前,本守卫红态实抓):
6
- ``json.loads`` 的产物不必是对象——``null`` / ``[]`` / ``123`` / ``"abc"`` 都是
7
- **合法 JSON**。三处裸调 ``.get`` 的判据面因此全线逃逸 AttributeError(而 except
8
- 元组只收 ValueError/OSError):
9
-
10
- · ``mdcg.MdCG._load_index``(mdcg.py:1050 旧行)``d.get("schema")`` ⇒
11
- **构造即失败**:常驻 MCP 服务的记忆面整个起不来(rc=1),一次性脚本
12
- (review_cli 等)全崩;而盘上 ``.md`` 真源完好无损——丢的只是派生索引
13
- 这一条腿。实测四形态全部 ``AttributeError: '<type>' object has no
14
- attribute 'get'``。
15
- · ``mdcg.MdCG.compact_index``(mdcg.py:1235 旧行)同款 ⇒ 存活实例运行中
16
- 快照被外部写坏一次,``close`` 自动 compact 的收尾路径就再也落不成快照。
17
- · ``fsutil.ShardedLog.read_all``(fsutil.py:386 旧行)``r.get("_t", 0)`` ⇒
18
- 分片日志里一行非对象记录即让**排序键**抛异常,索引装载与 compact 双断。
19
-
20
- 深度 2 补充(N225 v1.0 报告 §0「已知缺口」点名的同族面——**行是 dict 不等于
21
- 字段可用**,本次补强批收口):
22
- · ① **排序键坏型**:``_t`` / ``_s`` 被写成 ``"abc"`` / ``[]`` / ``null`` /
23
- ``NaN`` ⇒ 旧键 ``(r.get("_t", 0), r.get("_s", 0))`` 在 sort 里抛
24
- TypeError(``'<' not supported between instances of 'str' and 'float'``,
25
- 实测见 F 组),而 except 面只有 ValueError/OSError ⇒ 与原始缺陷同一条
26
- 断链。收口:单槽归一(数值且非 NaN 原样、其余记 0,与「缺键取 0」同口径),
27
- 记录**不丢**,坏型槽进记账面(``note_bad_sortkey_rows``)。
28
- · ② **载荷坏型**:分片记录 ``e`` 非 dict 且非 None(``[]`` / ``123`` /
29
- ``"abc"``)⇒ 旧写法直接 ``nodes[nid] = e``,下游 ``_count_buckets`` 对
30
- 元素裸调 ``.get`` 抛 AttributeError。收口:装载重放与 compact 重放**共用
31
- 同一实现**(``MdCG._apply_log``)——坏载荷跳过 + 记账(与①同一记账面),
32
- ``e is None`` 的 tombstone 语义一字不改;``_count_buckets`` **不加**类型闸
33
- (防在上游,不新增第三套判据)。
34
-
35
- 修复口径(有界,不新增第三套判据):
36
- ① 装载面:顶层非对象与 ValueError/OSError **同一降级口径**——视同损坏 ⇒
37
- 走 ``_load_index`` / ``compact_index`` **既有**的「回退全库扫描」路径
38
- (宁重扫勿清池)。``_maybe_reload_index`` 经 ``_load_index`` 收口后不再
39
- 抛,故未加宽其 except 面(A 组第 5 条钉这一点)。
40
- ② 日志面:``read_all`` 逐行分流——dict 进回放,非对象行进记账面
41
- (``note_nonobject_rows``:模块级计数 + 有界样本 + stderr 告警);
42
- 排序键坏型同面记账(``note_bad_sortkey_rows``)。**容忍 ≠ 静默**。
43
- ③ 不动 ``read_jsonl`` 的通用契约(其它消费面不在本次范围);不动 tombstone
44
- 语义(``e is None`` 的删除重放保持原行为)。
45
-
46
- 守卫构成(A 装载面 / B compact 面 / C 分片日志面 / D stdio 端到端 /
47
- E 载荷坏型收口 / F 排序键健壮化 / G tombstone 语义 / H read_jsonl 通用面):
48
- A 四形态 × 5 条(20):构造不抛 · 确有全库扫描 · 既有节点一个不丢 · 不得退化
49
- 成空池 · 探活重载(``_maybe_reload_index``)不抛且节点仍全
50
- B 四形态 × 4 条(16):compact 不抛 · 落盘快照恢复为可再装载 dict · 不清池
51
- (账本对得上盘面)· 返回值含既有节点
52
- C 9 条:read_all 不抛 / 只收 dict / 坏行计数可断言 / stderr 告警可观测 /
53
- tombstone 记录保留在返回列表(e=None 不得当坏行丢掉)/ 排序不崩;重放面:
54
- 构造不抛 / 合法新记录生效
55
- D 5 条:非对象快照 + 坏分片的临时库上起 ``md_cg.mcp_server`` stdio 主循环 ⇒
56
- rc=0 · initialize 应答 · tools/list 应答 · 非对象行仍回 -32600 · 攻击行之后
57
- 仍应答(**不是 rc=1 / 进程即死**)
58
- E 6 条(载荷坏型收口,契约②):装载不抛 / 坏载荷不进 nodes / 合法 upsert 仍
59
- 生效 / 记账可断言且不静默 / compact 面不抛且快照无坏载荷 id / **两面对同一
60
- 分片的 nodes 逐键相等**(同口径)
61
- F 5 条(排序键健壮化,契约①):read_all 不抛**且**旧键直排在同一批记录上必抛
62
- (fixture 有判别力)/ 合法记录与旧键 oracle **逐位一致(序与内容)** /
63
- 记录一个不丢且按键单调不减 / 坏型键计数可断言 / 不静默
64
- G 2 条(tombstone 语义):装载面 e is None ⇒ pop;compact 面同款(删除不复活)
65
- H 2 条(read_jsonl 通用面):非对象行仍**原样产出**(类型序列逐位一致)· 产出
66
- 对象与 json.loads 结果同值(不做类型改造)
67
-
68
- **上一轮 E 组 5 条「源文本在场」断言已整组删除**(`'isinstance(d, dict) and
69
- d.get("schema") == SCHEMA' in win_load` 这类源码文本级自证:整组换成空组后
70
- ``--branch-baseline`` 仍 PASS,零判别力)。其判据面改由行为断言承担,一一对应:
71
- 旧 E1(装载面类型闸在场)→ A 组(行为,变异①钉死)
72
- 旧 E2(compact 面非对象分支在场)→ B 组(行为,变异②钉死)
73
- 旧 E3(read_all 过滤与记账成对在场)→ C 组(行为,变异③钉死)
74
- 旧 E4(read_jsonl 通用契约未改)→ H 组(行为,变异⑧钉死)
75
- 旧 E5(tombstone 语义两处仍在)→ G 组(行为,变异⑤/⑦从两侧钉死)
76
-
77
- ``--branch-baseline`` 定点变异自证(与 ``test_neg_condition_hits`` 同口径):
78
- 逐个关掉一处判据,守卫**必须转红**且红项**恰好**落在该判据负责的组、数量等于
79
- 该组断言数(多一项少一项都报红);锚点漂移报 ``ANCHOR-MISS`` 并以**退出码 2**
80
- fail-closed 停手。基线源是**工作区源码**(``inspect.getsource`` 取自当前已加载
81
- 模块),绝不绑 git HEAD——本仓批次 80/81 两次教训:基线绑提交那一刻即失效。
82
-
83
- **组与判据一一对应**(这样「恰好等于该组断言数」才可成立):每组只放该判据
84
- 自己的断言,fixture 只放该判据自己的病理(各组互不交叉),故每处变异只红一组
85
- (装载面/日志面两处变异另红端到端 D 组——D 组的两个病理本就是「非对象快照」与
86
- 「非对象行」)。变异表里同一组出现两次(G 组被⑧… 被⑤与⑦从两侧钉死)是刻意的:
87
- 口径「过窄」与「过宽」都必须转红。
88
-
89
- 隔离纪律(与 ``test_n206_stdio_jsonrpc_type`` / ``test_issue39_utf8_stdio`` 同款):
90
- env 剔净全部 MDCG_*/HIVE_* 注入面,只注入指向临时目录的
91
- ``MDCG_ROOT``/``MDCG_AUX_ROOT``/``MDCG_STATE_ROOT``/``MDCG_DATA_ROOT``/
92
- ``MDCG_TENANT_REGISTRY``(指向不存在的临时路径=空表回落)/``MDCG_SUSTAIN=0``
93
- (关常驻循环)/``MDCG_LEGACY_ENV_AUTH=1``(既有豁免面,零令牌、不回落真实
94
- `~/.mdcg`);全部合成库落在 ``tempfile.mkdtemp`` 下,跑完 rmtree。**绝不触在役
95
- 活库、真实令牌库与真实 serve。**
96
-
97
- 运行:
98
- python -X utf8 -m md_cg.test_n225_nonobject_load
99
- python -X utf8 -m md_cg.test_n225_nonobject_load --branch-baseline
100
- """
101
- from __future__ import annotations
102
-
103
- import contextlib
104
- import inspect
105
- import io
106
- import json
107
- import os
108
- import shutil
109
- import subprocess
110
- import sys
111
- import tempfile
112
- import textwrap
113
- from contextlib import redirect_stderr, redirect_stdout
114
-
115
- try:
116
- sys.stdout.reconfigure(encoding="utf-8", errors="replace")
117
- except AttributeError:
118
- pass
119
-
120
- from . import fsutil as F # noqa: E402
121
- from . import mdcg as M # noqa: E402
122
- from .mdcg import MdCG # noqa: E402
123
-
124
- # 四种「合法 JSON 但非对象」形态(N225 的攻击面全谱)
125
- BODIES = (("null", "null"), ("empty_array", "[]"),
126
- ("bare_int", "123"), ("bare_str", '"abc"'))
127
-
128
- PASS, FAIL = 0, 0
129
- FAILS = []
130
- _CURRENT = ["?"]
131
- _GROUP_FAILS = {}
132
- _TMP_ROOTS = []
133
- _LIVE = []
134
-
135
-
136
- # 生效条件:把 PASS/FAIL/失败名单/分组失败数全部清零并解除当前组名(每次完整跑套件前调用;--branch-baseline 每个变异轮都要一次干净基线)。
137
- def _reset_counters():
138
- global PASS, FAIL
139
- PASS = FAIL = 0
140
- del FAILS[:]
141
- _GROUP_FAILS.clear()
142
- _CURRENT[0] = "?"
143
-
144
-
145
- # 生效条件:group 为非空字符串时设为当前组名并在 _GROUP_FAILS 里开出该组条目(未开则记 0);重复调用同名组只是切换当前组,不清零已有计数。
146
- def begin(group: str):
147
- _CURRENT[0] = group
148
- _GROUP_FAILS.setdefault(group, 0)
149
-
150
-
151
- # 生效条件:cond 为真记一条通过并打印;为假把 FAIL 与当前组失败数各 +1、把 name 追加进 FAILS 并打印 detail(detail 为空则只打印名字)。
152
- def check(name, cond, detail=""):
153
- global PASS, FAIL
154
- if cond:
155
- PASS += 1
156
- print(" [ok] %s" % name)
157
- return True
158
- FAIL += 1
159
- _GROUP_FAILS[_CURRENT[0]] = _GROUP_FAILS.get(_CURRENT[0], 0) + 1
160
- FAILS.append(name)
161
- print(" [FAIL] %s %s" % (name, detail))
162
- return False
163
-
164
-
165
- # 生效条件:fn 为无参回调时调用它取条件值——回调抛异常即判红并把异常类型与消息写进 detail(**不中断整组**,保证「变异下红项数 == 该组断言数」这一精确口径成立);fn 正常返回则按返回值真假记账;detail 传 callable 时在同一保护下求值(detail 自身抛异常也只判红、不外逸)。
166
- def check_fn(name, fn, detail=""):
167
- if callable(detail):
168
- try:
169
- detail = detail()
170
- except Exception as exc: # noqa: BLE001
171
- detail = "detail 求值抛 %s: %s" % (type(exc).__name__, exc)
172
- try:
173
- cond = bool(fn())
174
- extra = detail
175
- except Exception as exc: # noqa: BLE001 —— 红态正是抛异常
176
- cond = False
177
- extra = "回调抛 %s: %s(%s)" % (type(exc).__name__, exc, detail)
178
- return check(name, cond, extra)
179
-
180
-
181
- # 生效条件:新建系统临时目录(prefix 前缀)并把路径登记进 _TMP_ROOTS,供本次运行收尾统一 rmtree;返回该路径。
182
- def _tmpdir(prefix: str) -> str:
183
- p = tempfile.mkdtemp(prefix=prefix)
184
- _TMP_ROOTS.append(p)
185
- return p
186
-
187
-
188
- # 生效条件:无入参,对 _TMP_ROOTS 里每个目录 rmtree(ignore_errors=True) 并清空清单、对 _LIVE 里每个认知图实例尝试 close()(异常吞掉,收尾不该再抛);收尾是幂等的。
189
- def _cleanup():
190
- for cg in _LIVE:
191
- try:
192
- cg.close()
193
- except Exception: # noqa: BLE001 —— 收尾路径不再抛
194
- pass
195
- del _LIVE[:]
196
- for p in _TMP_ROOTS:
197
- shutil.rmtree(p, ignore_errors=True)
198
- del _TMP_ROOTS[:]
199
-
200
-
201
- # 生效条件:root 为库根时构造 MdCG(root, autoflush=1)、按 ids 逐条 add 最小节点(layer=knowledge)后 close()(close 落合法快照,使盘面 .md 与快照同源);返回 root。
202
- def _build_lib(root: str, ids=("n1", "n2")):
203
- cg = MdCG(root, autoflush=1)
204
- for nid in ids:
205
- cg.add(nid, "# 功能名:节点%s\n# 正文:合成节点 %s" % (nid, nid),
206
- layer="knowledge")
207
- cg.close()
208
- return root
209
-
210
-
211
- # 生效条件:root 下 _index_log/ 已建成目录时,写入一份固定的坏分片 9000-c0ffee00.log——entry 非 None 时首行是一条合法 id=c_new 记录,随后固定四行非对象(null/[]/123/"abc"),末行是 id=n2 的 tombstone(e=None);返回该分片路径。
212
- def _write_bad_shard(root: str, entry=None) -> str:
213
- d = os.path.join(root, "_index_log")
214
- os.makedirs(d, exist_ok=True)
215
- p = os.path.join(d, "9000-c0ffee00.log")
216
- rows = []
217
- if entry is not None:
218
- rows.append(json.dumps({"id": "c_new", "e": entry,
219
- "_t": 1.0, "_s": 1}, ensure_ascii=False))
220
- rows += ["null", "[]", "123", '"abc"']
221
- rows.append(json.dumps({"id": "n2", "e": None, "_t": 2.0, "_s": 2},
222
- ensure_ascii=False))
223
- with open(p, "w", encoding="utf-8") as f:
224
- f.write("\n".join(rows) + "\n")
225
- return p
226
-
227
-
228
- # 生效条件:root 下 _index_log/ 已建成目录时,写入坏**载荷**分片 9001-bad0payl.log——三行 e 非 dict 且非 None([]/123/"abc",id 为 p_arr/p_int/p_str)+ 一行合法 upsert(id=n1,载荷带 bucket=n225pay,用于证明合法记录未被坏载荷牵连);该分片**不含**非对象行、不含 e is None 行(组间隔离:另两类病理归 C/G 组);返回该分片路径。
229
- def _write_payload_shard(root: str) -> str:
230
- d = os.path.join(root, "_index_log")
231
- os.makedirs(d, exist_ok=True)
232
- p = os.path.join(d, "9001-bad0payl.log")
233
- rows = [
234
- json.dumps({"id": "p_arr", "e": [], "_t": 1.0, "_s": 1},
235
- ensure_ascii=False),
236
- json.dumps({"id": "p_int", "e": 123, "_t": 2.0, "_s": 2},
237
- ensure_ascii=False),
238
- json.dumps({"id": "p_str", "e": "abc", "_t": 3.0, "_s": 3},
239
- ensure_ascii=False),
240
- json.dumps({"id": "n1", "e": {"path": "knowledge/n1.md",
241
- "layer": "knowledge",
242
- "bucket": "n225pay"},
243
- "_t": 4.0, "_s": 4}, ensure_ascii=False),
244
- ]
245
- with open(p, "w", encoding="utf-8") as f:
246
- f.write("\n".join(rows) + "\n")
247
- return p
248
-
249
-
250
- # 生效条件:root 下 _index_log/ 已建成目录时,写入 tombstone 分片 9002-tombstn.log——单行 {"id":"n2","e":None,_t=1.0,_s=1}(删除记录);该分片不含非对象行、不含坏载荷行(组间隔离:另两类病理归 C/E 组);返回该分片路径。
251
- def _write_tombstone_shard(root: str) -> str:
252
- d = os.path.join(root, "_index_log")
253
- os.makedirs(d, exist_ok=True)
254
- p = os.path.join(d, "9002-tombstn.log")
255
- with open(p, "w", encoding="utf-8") as f:
256
- f.write(json.dumps({"id": "n2", "e": None, "_t": 1.0, "_s": 1},
257
- ensure_ascii=False) + "\n")
258
- return p
259
-
260
-
261
- # 生效条件:path 指向快照/任意文本文件时以 utf-8 覆盖写入 body(非对象快照的注入点);父目录不存在会抛 OSError。
262
- def _overwrite(path: str, body: str):
263
- with open(path, "w", encoding="utf-8") as f:
264
- f.write(body)
265
-
266
-
267
- # 生效条件:body 为四形态之一的文本时,建库 → 覆盖快照为 body → 带 _scan_nodes 计数桩重开 MdCG,返回上下文 dict(root / cg / scans / error);任何一步抛异常都收进 ctx["error"] 而不外抛(保证后续逐条断言各自判红)。
268
- def _case_load(body: str) -> dict:
269
- root = _tmpdir("mdcg_n225_load_")
270
- ctx = {"root": root, "cg": None, "scans": [0], "error": None}
271
- try:
272
- _build_lib(root)
273
- _overwrite(os.path.join(root, "_index.json"), body)
274
- orig = MdCG._scan_nodes
275
-
276
- def counted(self): # noqa: ANN001 —— 计数桩
277
- ctx["scans"][0] += 1
278
- return orig(self)
279
-
280
- MdCG._scan_nodes = counted
281
- try:
282
- ctx["cg"] = MdCG(root, autoflush=1)
283
- finally:
284
- MdCG._scan_nodes = orig
285
- _LIVE.append(ctx["cg"])
286
- except Exception as exc: # noqa: BLE001
287
- ctx["error"] = exc
288
- return ctx
289
-
290
-
291
- # 生效条件:body 为四形态之一的文本时,建库 → 在**合法快照**上构造存活实例(保证构造面不参与本组)→ 把快照覆盖为 body(模拟运行中被外部写坏)→ 调 compact_index(),返回上下文 dict(root / cg / surf / idx / error);异常收进 ctx["error"]。
292
- def _case_compact(body: str) -> dict:
293
- root = _tmpdir("mdcg_n225_compact_")
294
- ctx = {"root": root, "cg": None, "surf": None, "idx": None,
295
- "error": None}
296
- try:
297
- _build_lib(root)
298
- cg = MdCG(root, autoflush=1)
299
- ctx["cg"] = cg
300
- _LIVE.append(cg)
301
- ctx["surf"] = cg._count_md_files()
302
- _overwrite(os.path.join(root, "_index.json"), body)
303
- ctx["idx"] = cg.compact_index()
304
- except Exception as exc: # noqa: BLE001
305
- ctx["error"] = exc
306
- return ctx
307
-
308
-
309
- # 生效条件:无入参时建库 → 写坏分片(含合法 c_new 记录 + 四行非对象 + n2 的 tombstone)→ 先重置记账、以 redirect_stderr 捕获 read_all 的告警输出直接调 ShardedLog.read_all,再重开 MdCG 走索引重放;返回上下文 dict(root / recs / stats / stderr / cg / nodes / stats_after / 各阶段 error)。
310
- def _case_shard() -> dict:
311
- root = _tmpdir("mdcg_n225_shard_")
312
- ctx = {"root": root, "recs": None, "stats": None, "stderr": "",
313
- "cg": None, "nodes": None, "stats_after": None,
314
- "error": None, "error_replay": None, "error0": None}
315
- try:
316
- _build_lib(root)
317
- entry = {"path": "knowledge/c_new.md", "layer": "knowledge",
318
- "bucket": "n225"}
319
- _write_bad_shard(root, entry)
320
- # ---- ① 分片日志读面(不构造 MdCG,与装载面解耦)----
321
- F.reset_nonobject_row_stats()
322
- buf = io.StringIO()
323
- try:
324
- with redirect_stderr(buf):
325
- ctx["recs"] = F.ShardedLog.read_all(
326
- os.path.join(root, "_index_log"))
327
- except Exception as exc: # noqa: BLE001
328
- ctx["error"] = exc
329
- ctx["stderr"] = buf.getvalue()
330
- ctx["stats"] = F.nonobject_row_stats()
331
- # ---- ② 索引重放面(合法快照 + 坏分片)----
332
- try:
333
- cg = MdCG(root, autoflush=1)
334
- ctx["cg"] = cg
335
- _LIVE.append(cg)
336
- ctx["nodes"] = set(cg.index["nodes"])
337
- except Exception as exc: # noqa: BLE001
338
- ctx["error_replay"] = exc
339
- ctx["stats_after"] = F.nonobject_row_stats()
340
- except Exception as exc: # noqa: BLE001
341
- ctx["error0"] = exc
342
- return ctx
343
-
344
-
345
- # 生效条件:无入参时建库 → 写坏**载荷**分片 → 重置记账 → 构造 MdCG(合法快照基底 + 坏载荷重放)→ 再调同一个实例的 compact_index()(同一批坏载荷走第二次重放);返回上下文 dict(root / cg / nodes / nodes_after_compact / payload_before / payload_after / stderr / err / err_compact / idx)。
346
- def _case_payload() -> dict:
347
- root = _tmpdir("mdcg_n225_payload_")
348
- ctx = {"root": root, "cg": None, "nodes": None, "idx": None,
349
- "payload_before": None, "payload_after": None, "total_after": None,
350
- "stderr": "", "err": None, "err_compact": None, "err0": None}
351
- try:
352
- _build_lib(root)
353
- _write_payload_shard(root)
354
- F.reset_nonobject_row_stats()
355
- buf = io.StringIO()
356
- try:
357
- with redirect_stderr(buf):
358
- cg = MdCG(root, autoflush=1)
359
- ctx["cg"] = cg
360
- _LIVE.append(cg)
361
- ctx["nodes"] = cg.index["nodes"]
362
- ctx["payload_before"] = F.bad_payload_row_stats()[0]
363
- try:
364
- ctx["idx"] = cg.compact_index()
365
- except Exception as exc: # noqa: BLE001
366
- ctx["err_compact"] = exc
367
- ctx["payload_after"] = F.bad_payload_row_stats()[0]
368
- ctx["total_after"] = F.nonobject_row_stats()[0]
369
- except Exception as exc: # noqa: BLE001
370
- ctx["err"] = exc
371
- ctx["stderr"] = buf.getvalue()
372
- except Exception as exc: # noqa: BLE001
373
- ctx["err0"] = exc
374
- return ctx
375
-
376
-
377
- # 生效条件:legal(v) 为真当且仅当 v 为 int/float 且 v == v(非 NaN)——即排序键的「合法槽」口径。
378
- def _legal_slot(v) -> bool:
379
- return isinstance(v, (int, float)) and v == v
380
-
381
-
382
- # 生效条件:r 为记录时,返回其排序键「坏型槽记 0、合法槽原样」二元组——与实现口径同源的断言侧表达(F3 的单调性判据用;合法记录的**次序证明**不靠它,靠 F2 的旧键 oracle 逐位对照)。
383
- def _norm_key(r):
384
- return tuple(v if _legal_slot(v) else 0
385
- for v in (r.get("_t", 0), r.get("_s", 0)))
386
-
387
-
388
- # 生效条件:rows 为记录列表时,取其中 _t 与 _s 两槽都合法的记录,按**改前旧键** (r.get("_t", 0), r.get("_s", 0)) 排序后返回——改前行为的独立 oracle(不调用被测实现,只用 Python 内建 sorted)。
389
- def _oracle_legal(rows):
390
- keep = [r for r in rows
391
- if _legal_slot(r.get("_t", 0)) and _legal_slot(r.get("_s", 0))]
392
- return sorted(keep, key=lambda r: (r.get("_t", 0), r.get("_s", 0)))
393
-
394
-
395
- # 生效条件:d 为分片目录时,按 read_all 的收集序(分片名序 + 文件行序)经 F.read_jsonl 取全部 dict 行返回——oracle 的输入面(不调用 read_all)。
396
- def _collect_rows(d: str):
397
- out = []
398
- for fn in sorted(os.listdir(d)):
399
- if not fn.endswith(".log"):
400
- continue
401
- for rec in F.read_jsonl(os.path.join(d, fn)):
402
- if isinstance(rec, dict):
403
- out.append(rec)
404
- return out
405
-
406
-
407
- # 生效条件:无入参时在临时目录下用**生产写点**(ShardedLog.append,两个写者实例=两个分片,含并列 _t、跨写者重叠 _s、乱序写入)造真实分片记录,再手写一份坏型排序键分片(str/list/None/NaN 四形态 + 一行缺 _t 的合法行)→ 重置记账 → 以 redirect_stderr 捕获告警后调 read_all;返回上下文 dict(root / d / rows / oracle / old_raises / recs / got_legal / sortkey_before / stderr / err)。
408
- def _case_sortkey() -> dict:
409
- root = _tmpdir("mdcg_n225_sortkey_")
410
- ctx = {"root": root, "d": os.path.join(root, "shards"), "rows": None,
411
- "oracle": None, "old_raises": None, "recs": None,
412
- "got_legal": None, "sortkey_before": None, "stderr": "",
413
- "err": None, "err0": None}
414
- try:
415
- d = ctx["d"]
416
- os.makedirs(d, exist_ok=True)
417
- # 写者 A / B(各占一个分片):真实写点产出的记录(_t 为 time.time 形态、
418
- # _s 为分片内序号,两个写者的 _s 故意重叠 ⇒ 跨分片合并必须靠 (t, s) 定序)
419
- lg_a = F.ShardedLog(d)
420
- for t, s, nid in ((1000.0, 1, "a"), (1000.0, 2, "b"), (999.0, 3, "c"),
421
- (1000.0, 4, "d"), (1002.0, 5, "e")):
422
- lg_a.append({"id": nid, "e": {"path": "knowledge/%s.md" % nid,
423
- "bucket": "k"}, "_t": t, "_s": s})
424
- lg_a.close()
425
- lg_b = F.ShardedLog(d)
426
- for t, s, nid in ((1000.0, 1, "f"), (997.5, 2, "g"), (1000.0, 3, "h")):
427
- lg_b.append({"id": nid, "e": {"path": "knowledge/%s.md" % nid,
428
- "bucket": "k"}, "_t": t, "_s": s})
429
- lg_b.close()
430
- rows = [
431
- {"id": "s1", "e": {"path": "knowledge/s1.md"}, "_t": "abc",
432
- "_s": 9}, # str 槽
433
- {"id": "s2", "e": {"path": "knowledge/s2.md"}, "_t": 5.0,
434
- "_s": []}, # list 槽
435
- {"id": "s3", "e": {"path": "knowledge/s3.md"}, "_s": 11}, # 缺 _t(合法)
436
- {"id": "s4", "e": {"path": "knowledge/s4.md"}, "_t": None,
437
- "_s": None}, # None 槽
438
- {"id": "s5", "e": {"path": "knowledge/s5.md"},
439
- "_t": float("nan"), "_s": 1}, # NaN 槽
440
- ]
441
- with open(os.path.join(d, "9999-badkey.log"), "w",
442
- encoding="utf-8") as f:
443
- f.write("\n".join(json.dumps(r, ensure_ascii=False)
444
- for r in rows) + "\n")
445
- ctx["rows"] = _collect_rows(d)
446
- try:
447
- sorted(ctx["rows"], key=lambda r: (r.get("_t", 0), r.get("_s", 0)))
448
- ctx["old_raises"] = False
449
- except TypeError as exc:
450
- ctx["old_raises"] = "%s: %s" % (type(exc).__name__, exc)
451
- ctx["oracle"] = _oracle_legal(ctx["rows"])
452
- F.reset_nonobject_row_stats()
453
- buf = io.StringIO()
454
- try:
455
- with redirect_stderr(buf):
456
- ctx["recs"] = F.ShardedLog.read_all(d)
457
- except Exception as exc: # noqa: BLE001
458
- ctx["err"] = exc
459
- ctx["stderr"] = buf.getvalue()
460
- if isinstance(ctx["recs"], list):
461
- ctx["got_legal"] = [r for r in ctx["recs"]
462
- if _legal_slot(r.get("_t", 0))
463
- and _legal_slot(r.get("_s", 0))]
464
- ctx["sortkey_before"] = F.bad_sortkey_row_stats()[0]
465
- except Exception as exc: # noqa: BLE001
466
- ctx["err0"] = exc
467
- return ctx
468
-
469
-
470
- # 生效条件:无入参时建库 → 写 tombstone 分片(n2 的删除记录)→ 构造 MdCG(合法快照基底 + tombstone 重放)→ 再调同一实例的 compact_index();返回上下文 dict(root / cg / nodes / idx / err / err_compact / err0)。
471
- def _case_tombstone() -> dict:
472
- root = _tmpdir("mdcg_n225_tomb_")
473
- ctx = {"root": root, "cg": None, "nodes": None, "idx": None,
474
- "err": None, "err_compact": None, "err0": None}
475
- try:
476
- _build_lib(root)
477
- _write_tombstone_shard(root)
478
- cg = MdCG(root, autoflush=1)
479
- ctx["cg"] = cg
480
- _LIVE.append(cg)
481
- ctx["nodes"] = set(cg.index["nodes"])
482
- try:
483
- ctx["idx"] = cg.compact_index()
484
- except Exception as exc: # noqa: BLE001
485
- ctx["err_compact"] = exc
486
- except Exception as exc: # noqa: BLE001
487
- ctx["err"] = exc
488
- return ctx
489
-
490
-
491
- # 生效条件:无入参时在临时目录写一份 jsonl(两条合法 dict 行 + 四行非对象行,非对象行夹在中间),直接调 F.read_jsonl 取产出序列;返回上下文 dict(path / got / error)。
492
- def _case_jsonl() -> dict:
493
- root = _tmpdir("mdcg_n225_jsonl_")
494
- p = os.path.join(root, "x.jsonl")
495
- with open(p, "w", encoding="utf-8") as f:
496
- f.write('{"a":1}\nnull\n[]\n123\n"abc"\n{"a":2}\n')
497
- ctx = {"path": p, "got": None, "error": None}
498
- try:
499
- ctx["got"] = list(F.read_jsonl(p))
500
- except Exception as exc: # noqa: BLE001
501
- ctx["error"] = exc
502
- return ctx
503
-
504
-
505
- # 模拟宿主前先把「身份/路径/编码」注入面清干净——子进程只吃临时目录(与 N206 同款)
506
- _DIRTY_KEYS = (
507
- "MDCG_TOKEN", "MDCG_TOKEN_FILE", "MDCG_MASTER_KEY", "MDCG_CLEARANCE",
508
- "MDCG_TENANT", "MDCG_TENANT_REGISTRY",
509
- "MDCG_CAN_ADMIN", "MDCG_CAN_WRITE", "MDCG_LEGACY_ENV_AUTH",
510
- "MDCG_LEGACY_ENV_ADMIN", "MDCG_SESSION", "DSH_SESSION_ID",
511
- "MDCG_HARNESS", "MDCG_UNIT", "MDCG_ROOT", "MDCG_STATE_ROOT",
512
- "MDCG_DATA_ROOT", "MDCG_AUX_ROOT", "MDCG_SUSTAIN", "MDCG_SUSTAIN_NAME",
513
- "MDCG_MCP_SURFACE", "MDCG_TOOL_FACE", "MDCG_ACTOR",
514
- "MDCG_VERIFIER_MODULES", "MDCG_HIVE_JOBS",
515
- "PYTHONUTF8", "PYTHONIOENCODING", "PYTHONLEGACYWINDOWSSTDIO",
516
- )
517
-
518
-
519
- # 生效条件:tmp 为本次隔离根时,返回剔净 _DIRTY_KEYS 后的 os.environ 副本再注入九个指向 tmp 的覆盖键(MDCG_ROOT / MDCG_TENANT_REGISTRY / MDCG_STATE_ROOT / MDCG_DATA_ROOT / MDCG_AUX_ROOT / MDCG_SUSTAIN / MDCG_LEGACY_ENV_AUTH / MDCG_ACTOR,外加指向临时路径的 MDCG_TOKEN_FILE 与哑主密钥 MDCG_MASTER_KEY)——子进程绝不读真实 ~/.mdcg、真实令牌库与真实密钥面。
520
- def _env(tmp: str) -> dict:
521
- env = {k: v for k, v in os.environ.items() if k not in _DIRTY_KEYS}
522
- env["MDCG_ROOT"] = os.path.join(tmp, "cgroot")
523
- # 登记表指向**不存在**的临时路径 → 空表回落,绝不读真实 ~/.mdcg
524
- env["MDCG_TENANT_REGISTRY"] = os.path.join(tmp, "_tenants_absent.json")
525
- env["MDCG_STATE_ROOT"] = os.path.join(tmp, "state")
526
- env["MDCG_DATA_ROOT"] = os.path.join(tmp, "data")
527
- # 子目录名不可取 "aux"(Windows 保留设备名,见 test_issue39 头注)
528
- env["MDCG_AUX_ROOT"] = os.path.join(tmp, "auxroot")
529
- env["MDCG_TOKEN_FILE"] = os.path.join(tmp, "tokens.json") # 临时令牌库
530
- env["MDCG_MASTER_KEY"] = "00" * 32 # 哑主密钥
531
- env["MDCG_SUSTAIN"] = "0" # 关常驻循环(线程面归零)
532
- env["MDCG_LEGACY_ENV_AUTH"] = "1" # 既有豁免面:零令牌、无二次开关
533
- env["MDCG_ACTOR"] = "n225-guard"
534
- return env
535
-
536
-
537
- # 当前生效的变异(仅 --branch-baseline 期间非 None):内存 patch 不跨进程,
538
- # D 组走独立子进程 ⇒ 靠 sitecustomize 把同一处定点变异注入子进程,端到端面
539
- # 才有真正的判别力。注入以 stderr 标记自证,标记缺失即 D 组判红(fail-closed)。
540
- _MUTATION = [None]
541
-
542
- _SITECUSTOMIZE_SRC = '''# N225 守卫跨进程变异注入(临时件,随 tmp 目录一并回收)
543
- import os
544
- import sys
545
- import textwrap
546
- import inspect
547
- _repo = os.environ.get("N225_REPO") or ""
548
- if _repo and _repo not in sys.path:
549
- sys.path.insert(0, _repo)
550
- try:
551
- from md_cg import mdcg as _M, fsutil as _F
552
- _which = os.environ["N225_MUT_WHICH"]
553
- _fname = os.environ["N225_MUT_FUNC"]
554
- _old = os.environ["N225_MUT_OLD"]
555
- _new = os.environ["N225_MUT_NEW"]
556
- if _which == "mdcg":
557
- _holder, _raw = _M.MdCG, _M.MdCG.__dict__[_fname]
558
- elif _which == "fsutil":
559
- _holder, _raw = _F.ShardedLog, _F.ShardedLog.__dict__[_fname]
560
- else: # fsutil_mod:模块级函数
561
- _holder, _raw = _F, _F.__dict__[_fname]
562
- _src = inspect.getsource(getattr(_raw, "__func__", _raw))
563
- _src = textwrap.dedent(_src[_src.index("def %s(" % _fname):])
564
- _ns = dict(vars(_M if _which == "mdcg" else _F))
565
- _ns.setdefault("__name__", "n225_mut")
566
- exec(compile(_src.replace(_old, _new), "n225_mut.py", "exec"), _ns)
567
- if _which == "fsutil":
568
- setattr(_holder, _fname, staticmethod(_ns[_fname]))
569
- else:
570
- setattr(_holder, _fname, _ns[_fname])
571
- sys.stderr.write("[n225-mut] injected %s.%s\\n" % (_which, _fname))
572
- except Exception as _e:
573
- sys.stderr.write("[n225-mut] inject FAILED: %r\\n" % (_e,))
574
- '''
575
-
576
-
577
- # 生效条件:lines 为待喂给 stdin 的字符串序列、tmp 为隔离根时,spawn `python -X utf8 -m md_cg.mcp_server`(cwd=仓根、env=_env(tmp))一次喂完并 communicate;超时则 kill 后取残余输出;随后删掉**本子进程自己**的自报戳;返回 (returncode, stdout, stderr)。
578
- def _talk(lines, tmp: str, timeout: int = 180):
579
- env = _env(tmp)
580
- mut = _MUTATION[0]
581
- if mut is not None:
582
- # 跨进程注入:sitecustomize 是 Python 启动时自动 import 的官方钩子,
583
- # 放到 PYTHONPATH 上即被本子进程吃到——生产启动形态(-m)保持不变。
584
- sc_dir = os.path.join(tmp, "_mutpath")
585
- os.makedirs(sc_dir, exist_ok=True)
586
- with open(os.path.join(sc_dir, "sitecustomize.py"), "w",
587
- encoding="utf-8") as f:
588
- f.write(_SITECUSTOMIZE_SRC)
589
- env["PYTHONPATH"] = sc_dir + os.pathsep + env.get("PYTHONPATH", "")
590
- env["N225_REPO"] = os.path.dirname(os.path.dirname(
591
- os.path.abspath(__file__)))
592
- env["N225_MUT_WHICH"] = mut["which"]
593
- env["N225_MUT_FUNC"] = mut["func"]
594
- env["N225_MUT_OLD"] = mut["old"]
595
- env["N225_MUT_NEW"] = mut["new"]
596
- proc = subprocess.Popen(
597
- [sys.executable, "-X", "utf8", "-m", "md_cg.mcp_server"],
598
- cwd=os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
599
- env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
600
- stderr=subprocess.PIPE, text=True, encoding="utf-8", errors="replace")
601
- try:
602
- out, err = proc.communicate("\n".join(lines) + "\n", timeout=timeout)
603
- except subprocess.TimeoutExpired:
604
- proc.kill()
605
- out, err = proc.communicate()
606
- try:
607
- os.remove(os.path.join(tempfile.gettempdir(), "md_cg_servers",
608
- "%d.json" % proc.pid))
609
- except OSError:
610
- pass
611
- return proc.returncode, out or "", err or ""
612
-
613
-
614
- # 生效条件:rid/method 给定、params 为 None 时省略该键,否则原样写入;返回一行紧凑 JSON-RPC 请求文本。
615
- def _rpc(rid, method, params=None) -> str:
616
- msg = {"jsonrpc": "2.0", "id": rid, "method": method}
617
- if params is not None:
618
- msg["params"] = params
619
- return json.dumps(msg, ensure_ascii=False)
620
-
621
-
622
- # 生效条件:out 为 stdout 文本时逐行 strip、空行跳过,返回 [(原始行, 解析结果或 None)](解析失败记 None,供「全行合法」类断言消费)。
623
- def _resp_lines(out: str):
624
- got = []
625
- for ln in out.splitlines():
626
- ln = ln.strip()
627
- if not ln:
628
- continue
629
- try:
630
- got.append((ln, json.loads(ln)))
631
- except ValueError:
632
- got.append((ln, None))
633
- return got
634
-
635
-
636
- # 生效条件:obj 为 dict 时返回其 error.code,否则返回 None。
637
- def _err_code(obj):
638
- return (obj.get("error") or {}).get("code") if isinstance(obj, dict) else None
639
-
640
-
641
- # 生效条件:端到端场景——建库 → 把快照覆盖为非对象 `[]` → 写坏分片 → 起 stdio 主循环喂 [initialize, tools/list, "[]", tools/list, shutdown],返回上下文 dict(tmp / rc / out / err / objs / by_id / error)。
642
- def _case_stdio() -> dict:
643
- tmp = _tmpdir("mdcg_n225_stdio_")
644
- ctx = {"tmp": tmp, "rc": None, "out": "", "err": "", "objs": [],
645
- "by_id": {}, "error": None, "inject_ok": True}
646
- try:
647
- root = os.path.join(tmp, "cgroot")
648
- _build_lib(root)
649
- _overwrite(os.path.join(root, "_index.json"), "[]")
650
- _write_bad_shard(root, {"path": "knowledge/c_new.md",
651
- "layer": "knowledge", "bucket": "n225"})
652
- lines = [_rpc(1, "initialize"), _rpc(2, "tools/list"),
653
- "[]", _rpc(3, "tools/list"), _rpc(4, "shutdown")]
654
- ctx["rc"], ctx["out"], ctx["err"] = _talk(lines, tmp)
655
- # 注入自证:变异轮里子进程必须报告「已注入」,否则 D 组判红(fail-closed,
656
- # 避免「注入失效」被误读成「端到端面无判别力」)。
657
- ctx["inject_ok"] = ("[n225-mut] injected" in ctx["err"]
658
- if _MUTATION[0] is not None else True)
659
- objs = [o for _raw, o in _resp_lines(ctx["out"])]
660
- ctx["objs"] = objs
661
- ctx["by_id"] = {o.get("id"): o for o in objs if isinstance(o, dict)}
662
- except Exception as exc: # noqa: BLE001
663
- ctx["error"] = exc
664
- return ctx
665
-
666
-
667
- # ---------------- A 装载面:四种非对象形态 ----------------
668
-
669
- # 生效条件:逐形态跑 A 组 5 条断言(构造不抛 / 确有全库扫描 / 既有节点一个不丢 / 不退化成空池 / 探活重载不抛且节点仍全);ctx 由 _case_load 产出,构造失败时五条各自判红。
670
- def g_a():
671
- begin("A")
672
- for tag, body in BODIES:
673
- print("[A·%s] %s" % (tag, json.dumps(body)))
674
- ctx = _case_load(body)
675
- cg = ctx["cg"]
676
- check_fn("A·%s·构造不抛(非对象快照视同损坏,走既有降级路径)" % tag,
677
- lambda c=ctx: c["error"] is None,
678
- "err=%r" % (ctx["error"],))
679
- check_fn("A·%s·确有全库扫描(_scan_nodes 被调用,非快照路径)" % tag,
680
- lambda c=ctx: c["scans"][0] >= 1,
681
- "scans=%d" % ctx["scans"][0])
682
- check_fn("A·%s·既有节点一个不丢({n1,n2} ⊆ nodes)" % tag,
683
- lambda c=cg: {"n1", "n2"} <= set(c.index["nodes"]),
684
- "nodes=%s" % (sorted(cg.index["nodes"]) if cg else None))
685
- check_fn("A·%s·不得退化成空池(len(nodes) 与盘面 .md 数一致且 ≥2)"
686
- % tag,
687
- lambda c=cg: (c is not None
688
- and len(c.index["nodes"]) == c._count_md_files()
689
- and len(c.index["nodes"]) >= 2),
690
- "nodes=%s surf=%s" % (
691
- len(cg.index["nodes"]) if cg else None,
692
- cg._count_md_files() if cg else None))
693
-
694
- def _probe(c=cg, t=tag):
695
- # 存活实例 + 外部再写一次非对象快照(签名变化)→ 探活必须重载成功。
696
- # 这一条钉住「_maybe_reload_index 不得因非对象而抛」。
697
- other = [b for n, b in BODIES if n != t][0]
698
- if c is None:
699
- return False
700
- _overwrite(os.path.join(c.root, "_index.json"), other)
701
- fired = c._maybe_reload_index()
702
- return fired is True and {"n1", "n2"} <= set(c.index["nodes"])
703
-
704
- check_fn("A·%s·探活重载不抛且节点仍全(_maybe_reload_index 收口)"
705
- % tag, _probe)
706
- try:
707
- if cg is not None:
708
- cg.close()
709
- except Exception: # noqa: BLE001
710
- pass
711
-
712
-
713
- # ---------------- B compact 面:四种非对象形态 ----------------
714
-
715
- # 生效条件:逐形态跑 B 组 4 条断言(compact 不抛 / 落盘快照恢复为可再装载 dict / 不清池,账本对得上盘面 / 返回值含既有节点);ctx 由 _case_compact 产出。
716
- def g_b():
717
- begin("B")
718
- for tag, body in BODIES:
719
- print("[B·%s] %s" % (tag, json.dumps(body)))
720
- ctx = _case_compact(body)
721
- snap_path = os.path.join(ctx["root"], "_index.json")
722
-
723
- def _snap():
724
- with open(snap_path, encoding="utf-8") as f:
725
- return json.load(f)
726
-
727
- check_fn("B·%s·compact_index 不抛(非对象视同损坏走 scan_fallback)"
728
- % tag, lambda c=ctx: c["error"] is None,
729
- "err=%r" % (ctx["error"],))
730
- check_fn("B·%s·落盘快照恢复为可再装载 dict(schema 正确)" % tag,
731
- lambda: isinstance(_snap(), dict)
732
- and _snap().get("schema") == M.SCHEMA)
733
- check_fn("B·%s·不清池(快照 nodes 数 == 盘面 .md 数)" % tag,
734
- lambda: len((_snap().get("nodes") or {})) == ctx["surf"]
735
- and ctx["surf"] >= 2,
736
- lambda: "snap_nodes=%s surf=%s" % (
737
- len((_snap().get("nodes") or {}))
738
- if isinstance(_snap(), dict) else None, ctx["surf"]))
739
- check_fn("B·%s·compact 返回值含既有节点" % tag,
740
- lambda c=ctx: isinstance(c["idx"], dict)
741
- and {"n1", "n2"} <= set(c["idx"].get("nodes") or {}))
742
-
743
-
744
- # ---------------- C 分片日志面:非对象行 ----------------
745
-
746
- # 生效条件:跑 C 组 9 条断言(read_all 不抛 / 只返回 dict 且条数正确 / 逐条是 dict / 坏行计数可断言 / stderr 告警可观测 / tombstone 记录保留在返回列表 / 排序有效;重放面:构造不抛 / 合法新记录生效);ctx 由 _case_shard 产出。
747
- def g_c():
748
- begin("C")
749
- ctx = _case_shard()
750
- recs = ctx["recs"]
751
- stats = ctx["stats"] or (None, ())
752
-
753
- check_fn("C1·read_all 不崩(非对象行不参与排序键)",
754
- lambda c=ctx: c["error"] is None and c["error0"] is None,
755
- "err=%r err0=%r" % (ctx["error"], ctx["error0"]))
756
- check_fn("C2·只返回 dict 记录且条数正确(合法 1 条 + tombstone 1 条 = 2)",
757
- lambda: isinstance(recs, list) and len(recs) == 2,
758
- "recs=%r" % (recs,))
759
- check_fn("C3·返回记录逐条是 dict(非对象行未混入)",
760
- lambda: isinstance(recs, list) and all(isinstance(r, dict)
761
- for r in recs),
762
- "types=%s" % ([type(r).__name__ for r in recs]
763
- if isinstance(recs, list) else None))
764
- check_fn("C4·坏行计数可断言(本片 4 条非对象行全部记账)",
765
- lambda: stats[0] == 4, "skips=%s" % (stats[0],))
766
- check_fn("C5·stderr 告警可观测(不静默:含分片名与条数)",
767
- lambda: "ShardedLog.read_all" in ctx["stderr"]
768
- and "4 条非对象" in ctx["stderr"],
769
- "stderr=%r" % (ctx["stderr"][:200],))
770
- check_fn("C6·tombstone 记录仍保留在返回列表(e=None 不得当坏行丢掉)",
771
- lambda: any(r.get("id") == "n2" and r.get("e") is None
772
- for r in recs),
773
- "recs=%r" % (recs,))
774
- check_fn("C7·排序有效(按 (_t,_s) 单调不减,非对象行未污染次序)",
775
- lambda: all((recs[i].get("_t", 0), recs[i].get("_s", 0))
776
- <= (recs[i + 1].get("_t", 0), recs[i + 1].get("_s", 0))
777
- for i in range(len(recs) - 1)),
778
- "recs=%r" % (recs,))
779
- check_fn("C8·重放面:合法快照 + 坏分片下 MdCG 构造不抛",
780
- lambda c=ctx: c["error_replay"] is None,
781
- "err=%r" % (ctx["error_replay"],))
782
- check_fn("C9·重放面:坏分片里的合法新记录生效(c_new 可见)",
783
- lambda c=ctx: c["nodes"] is not None and "c_new" in c["nodes"],
784
- "nodes=%s" % (sorted(ctx["nodes"]) if ctx["nodes"] else None))
785
-
786
-
787
- # ---------------- D stdio 端到端 ----------------
788
-
789
- # 生效条件:跑 D 组 5 条断言(rc=0 / initialize 应答 / tools/list 应答 / 非对象行仍回 -32600 / 攻击行之后仍应答);ctx 由 _case_stdio 产出,spawn 失败或进程即死时五条各自判红。
790
- def g_d():
791
- begin("D")
792
- ctx = _case_stdio()
793
- by_id = ctx["by_id"]
794
-
795
- def _init():
796
- return ((by_id.get(1) or {}).get("result") or {}) \
797
- .get("serverInfo", {}).get("name")
798
-
799
- def _tools(rid):
800
- return ((by_id.get(rid) or {}).get("result") or {}).get("tools")
801
-
802
- check_fn("D1·非对象快照 + 坏分片下 stdio 主循环仍存活(rc=0)",
803
- lambda c=ctx: c["rc"] == 0 and c["inject_ok"],
804
- "rc=%r inject=%s stderr_tail=%r"
805
- % (ctx["rc"], ctx["inject_ok"], ctx["err"][-300:]))
806
- check_fn("D2·initialize 应答(serverInfo=mdcg-mcp)",
807
- lambda: _init() == "mdcg-mcp" and ctx["inject_ok"],
808
- "by_id[1]=%s" % (str(by_id.get(1))[:200],))
809
- check_fn("D3·tools/list 应答且工具表非空",
810
- lambda: isinstance(_tools(2), list) and len(_tools(2)) > 0
811
- and ctx["inject_ok"],
812
- "by_id[2]=%s" % (str(by_id.get(2))[:200],))
813
- check_fn("D4·非对象行仍回 id=null 的 -32600(入口闸未因坏数据失能)",
814
- lambda: ctx["inject_ok"] and any(
815
- isinstance(o, dict) and o.get("id") is None
816
- and _err_code(o) == -32600 for o in ctx["objs"]),
817
- "objs=%s" % (json.dumps(ctx["objs"], ensure_ascii=False)[:300],))
818
- check_fn("D5·攻击行之后的 tools/list 仍应答(不是半途死)",
819
- lambda: isinstance(_tools(3), list) and len(_tools(3)) > 0
820
- and ctx["inject_ok"],
821
- "by_id[3]=%s" % (str(by_id.get(3))[:200],))
822
-
823
-
824
- # ---------------- E 载荷坏型收口(契约②) ----------------
825
-
826
- # 生效条件:跑 E 组 6 条断言(装载不抛 / 坏载荷不进 nodes / 合法 upsert 仍生效 / 记账可断言且不静默 / compact 面不抛且快照无坏载荷 id / 两面对同一分片的 nodes 逐键相等);ctx 由 _case_payload 产出,装载即失败时六条各自判红。
827
- def g_e():
828
- begin("E")
829
- ctx = _case_payload()
830
- bad_ids = {"p_arr", "p_int", "p_str"}
831
- nodes = ctx["nodes"] or {}
832
-
833
- check_fn("E1·装载面:坏载荷分片下 MdCG 构造不抛(e 非 dict 不进 _count_buckets)",
834
- lambda c=ctx: c["err"] is None and c["err0"] is None and c["cg"] is not None,
835
- "err=%r err0=%r" % (ctx["err"], ctx["err0"]))
836
- check_fn("E2·装载面:三条坏载荷 id 一个都不进 nodes(跳过而非覆盖)",
837
- lambda c=ctx: c["err"] is None and not (bad_ids & set(c["nodes"] or {})),
838
- "nodes=%s" % (sorted(nodes) if nodes else None))
839
- check_fn("E3·装载面:同批里的合法 upsert 仍生效(n1.bucket=n225pay)",
840
- lambda: isinstance(nodes.get("n1"), dict)
841
- and nodes["n1"].get("bucket") == "n225pay",
842
- "n1=%r" % (nodes.get("n1"),))
843
- check_fn("E4·装载面:坏载荷行计入记账面(子面 3 条)且不静默(stderr 含条数)",
844
- lambda c=ctx: c["payload_before"] == 3
845
- and "载荷坏型记录" in c["stderr"] and "3 条" in c["stderr"],
846
- "payload=%r stderr=%r" % (ctx["payload_before"],
847
- ctx["stderr"][:160]))
848
- check_fn("E5·compact 面:不抛且落盘/返回索引里坏载荷 id 全不在(同一分片第二次重放)",
849
- lambda c=ctx: c["err_compact"] is None
850
- and isinstance(c["idx"], dict)
851
- and not (bad_ids & set(c["idx"]["nodes"])),
852
- "err=%r nodes=%s" % (ctx["err_compact"],
853
- sorted(ctx["idx"]["nodes"])
854
- if isinstance(ctx["idx"], dict) else None))
855
- check_fn("E6·两面同口径:compact 后 nodes 与装载面逐键相等,且同批坏载荷同样记账(子面共 6 条)",
856
- lambda c=ctx: isinstance(c["idx"], dict)
857
- and c["idx"]["nodes"] == nodes
858
- and c["payload_after"] == 6 and c["total_after"] == 6,
859
- "equal=%s payload=%r total=%r" % (
860
- (isinstance(ctx["idx"], dict) and ctx["idx"]["nodes"] == nodes),
861
- ctx["payload_after"], ctx["total_after"]))
862
-
863
-
864
- # ---------------- F 排序键健壮化(契约①) ----------------
865
-
866
- # 生效条件:跑 F 组 5 条断言(read_all 不抛且旧键直排在同一批记录上必抛 / 合法记录与旧键 oracle 逐位一致 / 记录一个不丢且按键单调不减 / 坏型键计数可断言 / 不静默);ctx 由 _case_sortkey 产出,read_all 抛异常时五条各自判红。
867
- def g_f():
868
- begin("F")
869
- ctx = _case_sortkey()
870
- recs = ctx["recs"]
871
- oracle = ctx["oracle"] or []
872
- got = ctx["got_legal"]
873
-
874
- check_fn("F1·read_all 不抛**且**旧键直排在同一批记录上必抛(fixture 有判别力)",
875
- lambda c=ctx: c["err"] is None and c["err0"] is None
876
- and c["old_raises"] is not False
877
- and c["old_raises"] is not None,
878
- "err=%r old=%r" % (ctx["err"], ctx["old_raises"]))
879
- check_fn("F2·合法记录相对次序与改前逐位一致(与旧键 oracle 的序与内容全等)",
880
- lambda: got is not None and oracle == got,
881
- "oracle=%s got=%s" % ([r.get("id") for r in oracle],
882
- [r.get("id") for r in got]
883
- if got is not None else None))
884
- check_fn("F3·记录一个不丢且返回列表按键单调不减(坏型槽记 0 参与排序)",
885
- lambda c=ctx: isinstance(recs, list)
886
- and len(recs) == len(ctx["rows"] or [])
887
- and all(_norm_key(recs[i]) <= _norm_key(recs[i + 1])
888
- for i in range(len(recs) - 1)),
889
- "n=%s keys=%s" % (len(recs) if isinstance(recs, list) else None,
890
- [_norm_key(r) for r in recs]
891
- if isinstance(recs, list) else None))
892
- check_fn("F4·坏型排序键计数可断言(str/list/None/NaN 四形态各 1 条 = 4)",
893
- lambda c=ctx: c["sortkey_before"] == 4,
894
- "n=%r samples=%s" % (ctx["sortkey_before"],
895
- F.bad_sortkey_row_stats()[1][:2]))
896
- check_fn("F5·不静默(stderr 含条数、分片名与两个槽类型)",
897
- lambda c=ctx: "排序键坏型 4 条" in c["stderr"]
898
- and "9999-badkey.log" in c["stderr"] and "_t=str" in c["stderr"],
899
- "stderr=%r" % (ctx["stderr"][:200],))
900
-
901
-
902
- # ---------------- G tombstone 语义(e is None ⇒ pop) ----------------
903
-
904
- # 生效条件:跑 G 组 2 条断言(装载面 tombstone 重放生效、compact 面同款);ctx 由 _case_tombstone 产出,构造失败时两条各自判红。
905
- def g_g():
906
- begin("G")
907
- ctx = _case_tombstone()
908
- nodes = ctx["nodes"]
909
-
910
- check_fn("G1·装载面:e is None ⇒ pop 该 nid(删除可重放,节点不复活)",
911
- lambda c=ctx: c["err"] is None and c["nodes"] is not None
912
- and "n2" not in c["nodes"] and "n1" in c["nodes"],
913
- "err=%r nodes=%s" % (ctx["err"],
914
- sorted(nodes) if nodes else None))
915
- check_fn("G2·compact 面:快照与返回值同样 pop 该 nid(与装载面同口径)",
916
- lambda c=ctx: c["err_compact"] is None
917
- and isinstance(c["idx"], dict)
918
- and "n2" not in c["idx"]["nodes"] and "n1" in c["idx"]["nodes"],
919
- "err=%r nodes=%s" % (
920
- ctx["err_compact"],
921
- sorted(ctx["idx"]["nodes"])
922
- if isinstance(ctx["idx"], dict) else None))
923
-
924
-
925
- # ---------------- H read_jsonl 通用面(非对象行原样产出) ----------------
926
-
927
- # 生效条件:跑 H 组 2 条断言(产出类型序列逐位一致、产出对象与 json.loads 同值——即只在 read_all 层过滤,read_jsonl 通用契约未改);ctx 由 _case_jsonl 产出。
928
- def g_h():
929
- begin("H")
930
- ctx = _case_jsonl()
931
- got = ctx["got"]
932
-
933
- check_fn("H1·read_jsonl 原样产出非对象行(类型序列逐位一致)",
934
- lambda c=ctx: c["error"] is None and isinstance(c["got"], list)
935
- and [type(x).__name__ for x in c["got"]]
936
- == ["dict", "NoneType", "list", "int", "str", "dict"],
937
- "err=%r types=%s" % (ctx["error"],
938
- [type(x).__name__ for x in got]
939
- if isinstance(got, list) else None))
940
- check_fn("H2·read_jsonl 不做类型改造(产出对象与 json.loads 结果同值)",
941
- lambda c=ctx: isinstance(c["got"], list) and len(c["got"]) == 6
942
- and c["got"][1] is None and c["got"][2] == [] and c["got"][3] == 123
943
- and c["got"][4] == "abc",
944
- "got=%r" % (got,))
945
-
946
-
947
- _GROUPS = (("A", g_a), ("B", g_b), ("C", g_c), ("D", g_d), ("E", g_e),
948
- ("F", g_f), ("G", g_g), ("H", g_h))
949
-
950
-
951
- # 生效条件:重算计数器后依次跑 A–H 八组(静默与否由 print 决定),返回 (总失败数, {组名: 失败数} 的副本);供正常模式与 --branch-baseline 的变异核验共用。
952
- def _run_groups():
953
- _reset_counters()
954
- for _name, fn in _GROUPS:
955
- fn()
956
- return FAIL, dict(_GROUP_FAILS)
957
-
958
-
959
- # ---------------- 定点变异自证(--branch-baseline) ----------------
960
-
961
- # 变异表:逐处关掉一个判据,守卫**必须转红**,且红项**恰好**落在该判据负责的
962
- # 组、数量等于该组断言数(多一项少一项都报红)。基线源=**工作区源码**
963
- # (inspect.getsource 取自当前已加载模块),绝不绑 git HEAD——本仓批次 80/81
964
- # 两次教训:基线绑提交那一刻即失效。
965
- #
966
- # 组/判据一一对应(见模块头注「组与判据一一对应」):①装载面类型闸(A 20 +
967
- # 端到端 D 5,D 的病理本就是非对象快照)②compact 面类型闸(B 16)③日志面非对象
968
- # 行过滤(C 9 + D 5,D 的另一个病理是非对象行)④载荷坏型闸(E 6)⑤载荷闸口径
969
- # 过宽(G 2——把 e is None 的 tombstone 也当坏载荷)⑥排序键归一(F 5)⑦tombstone
970
- # 重放(G 2——与⑤从「过窄/过宽」两侧把同一口径钉死)⑧read_jsonl 原样产出(H 2)。
971
- _MUTATIONS = (
972
- ("装载面类型闸(_load_index 非对象视同损坏)",
973
- "mdcg", "_load_index",
974
- 'if isinstance(d, dict) and d.get("schema") == SCHEMA:',
975
- 'if d.get("schema") == SCHEMA:',
976
- {"A": 20, "D": 5}),
977
- ("compact 面类型闸(非对象走 scan_fallback)",
978
- "mdcg", "compact_index",
979
- "if not isinstance(d, dict):", "if False:",
980
- {"B": 16}),
981
- ("分片日志非对象行过滤(read_all 跳过 + 记账)",
982
- "fsutil", "read_all",
983
- "if not isinstance(rec, dict):", "if False:",
984
- {"C": 9, "D": 5}),
985
- ("载荷坏型闸(_apply_log 跳过 e 非 dict 且非 None + 记账)",
986
- "mdcg", "_apply_log",
987
- "if e is not None and not isinstance(e, dict):", "if False:",
988
- {"E": 6}),
989
- ("载荷闸口径过宽(把 e is None 的 tombstone 也当坏载荷跳过)",
990
- "mdcg", "_apply_log",
991
- "if e is not None and not isinstance(e, dict):",
992
- "if not isinstance(e, dict):",
993
- {"G": 2}),
994
- ("排序键归一(read_all:坏型槽记 0 而非直排)",
995
- "fsutil", "read_all",
996
- "isinstance(v, (int, float)) and v == v", "True",
997
- {"F": 5}),
998
- ("tombstone 重放(_apply_log:e is None ⇒ pop 该 nid)",
999
- "mdcg", "_apply_log",
1000
- "nodes.pop(nid, None)", "pass",
1001
- {"G": 2}),
1002
- ("read_jsonl 通用面(非对象行原样产出)",
1003
- "fsutil_mod", "read_jsonl",
1004
- "yield json.loads(line)",
1005
- '_o = json.loads(line)\n yield _o if isinstance(_o, dict) else None',
1006
- {"H": 2}),
1007
- )
1008
-
1009
-
1010
- # 生效条件:which 为 "mdcg" 时从 MdCG 类、为 "fsutil" 时从 ShardedLog 类、为 "fsutil_mod" 时从 fsutil 模块取 func_name 的源码文本;**从 `def <name>(` 行起截断再 dedent**——inspect.getsource 对本仓「顶格 `# 生效条件:` 注释 + 类内缩进 def」的排版会把注释/装饰器一并带来,直接 dedent 会因公共前缀为 0 而留下缩进(实测 IndentationError);函数缺失或无法取源时返回 None。
1011
- def _func_src(which: str, func_name: str):
1012
- try:
1013
- if which == "mdcg":
1014
- raw = MdCG.__dict__[func_name]
1015
- elif which == "fsutil":
1016
- raw = F.ShardedLog.__dict__[func_name]
1017
- else: # fsutil_mod:模块级函数
1018
- raw = F.__dict__[func_name]
1019
- fn = getattr(raw, "__func__", raw)
1020
- src = inspect.getsource(fn)
1021
- return textwrap.dedent(src[src.index("def %s(" % func_name):])
1022
- except Exception: # noqa: BLE001 —— 取源失败按锚点漂移处理
1023
- return None
1024
-
1025
-
1026
- # 生效条件:which 为 "mdcg"/"fsutil"/"fsutil_mod"、old 在 func_name 源码中时,编译替换后的源码 exec 进对应模块命名空间并挂回目标(类属性或模块级名字;原为 staticmethod 者仍包 staticmethod),返回还原回调;old 不在源码中返回 None(调用方按 ANCHOR-MISS 处置,退出码 2)。
1027
- def _patch(which: str, func_name: str, old: str, new: str):
1028
- src = _func_src(which, func_name)
1029
- if src is None or old not in src:
1030
- return None
1031
- ns = dict(vars(M if which == "mdcg" else F))
1032
- ns.setdefault("__name__", "n225_mut")
1033
- exec(compile(src.replace(old, new), "n225_mut.py", "exec"), ns)
1034
- holder = MdCG if which == "mdcg" else (F.ShardedLog if which == "fsutil"
1035
- else F)
1036
- orig = holder.__dict__[func_name]
1037
- if isinstance(orig, staticmethod):
1038
- setattr(holder, func_name, staticmethod(ns[func_name]))
1039
- else:
1040
- setattr(holder, func_name, ns[func_name])
1041
-
1042
- def _restore():
1043
- setattr(holder, func_name, orig)
1044
-
1045
- return _restore
1046
-
1047
-
1048
- # 生效条件:无入参,跑定点变异自证——先跑未变异基线(必须零失败),再逐个应用 _MUTATIONS:锚点缺失立即打印 ANCHOR-MISS 并返回 2(fail-closed,不再继续);变异后红项组与数量必须与预期完全一致,否则计入 bad;全部通过返回 0,存在不符返回 1。
1049
- def _branch_baseline() -> int:
1050
- print("!! 定点变异模式:逐处关掉判据,守卫应当转红且**恰好**命中预期组/项数\n")
1051
- with contextlib.redirect_stdout(io.StringIO()):
1052
- clean_fail, _clean_groups = _run_groups()
1053
- print(" 未变异基线:失败=%d" % clean_fail)
1054
- if clean_fail:
1055
- print(" 基线即失败 → 定点变异自证无意义(先修基线)")
1056
- return 1
1057
- bad = []
1058
- for label, which, fname, old, new, expect in _MUTATIONS:
1059
- restore = _patch(which, fname, old, new)
1060
- if restore is None:
1061
- print(" ANCHOR-MISS %s —— 变异锚点漂移(实现改了却没同步本表;"
1062
- "基线源=%s.%s)" % (label, which, fname))
1063
- return 2 # fail-closed:锚点漂移不静默失效
1064
- _MUTATION[0] = {"which": which, "func": fname, "old": old, "new": new}
1065
- try:
1066
- with contextlib.redirect_stdout(io.StringIO()):
1067
- got_fail, got_groups = _run_groups()
1068
- finally:
1069
- _MUTATION[0] = None
1070
- restore()
1071
- _cleanup() # 每轮清干净:临时根与活实例不跨轮累积
1072
- hit = {g: n for g, n in got_groups.items() if n}
1073
- if hit == expect and got_fail == sum(expect.values()):
1074
- print(" 关掉「%s」→ 红项=%d,命中组=%s %s"
1075
- % (label, got_fail, dict(sorted(hit.items())),
1076
- "(恰好命中预期)"))
1077
- else:
1078
- print(" 关掉「%s」→ 红项=%d,命中组=%s 期望=%s "
1079
- "**红基线失效(判别力面不符)**"
1080
- % (label, got_fail, dict(sorted(hit.items())),
1081
- dict(sorted(expect.items()))))
1082
- bad.append(label)
1083
- print("\n定点变异自证:%s" % ("PASS(每处判据都有断言把它钉死)"
1084
- if not bad else "FAIL —— " + "、".join(bad)))
1085
- return 0 if not bad else 1
1086
-
1087
-
1088
- # 生效条件:命令行含 --branch-baseline 时走定点变异自证(退出码 0/1/2);否则依次跑 A–H 八组打印逐条结果与汇总,全部通过返回 0、存在失败返回 1。
1089
- def main() -> int:
1090
- if "--branch-baseline" in sys.argv:
1091
- try:
1092
- return _branch_baseline()
1093
- finally:
1094
- _cleanup()
1095
- try:
1096
- _reset_counters()
1097
- for _name, fn in _GROUPS:
1098
- fn()
1099
- finally:
1100
- _cleanup()
1101
- print("\n" + "=" * 64)
1102
- print("非对象形态索引/日志守卫(N225):%d 通过,%d 失败" % (PASS, FAIL))
1103
- if FAILS:
1104
- for f in FAILS:
1105
- print(" - %s" % f)
1106
- return 0 if not FAILS else 1
1107
-
1108
-
1109
- if __name__ == "__main__":
1110
- sys.exit(main())
1
+ # -*- coding: utf-8 -*-
2
+ """md_cg · 非对象形态索引 / 日志守卫(N225:一行 `null` / `[]` / `123` / `"abc"`
3
+ 崩掉整条装载链)+ **补强批**(深度 2 同族面:排序键坏型 / 载荷坏型)
4
+
5
+ 缺陷(修复前,本守卫红态实抓):
6
+ ``json.loads`` 的产物不必是对象——``null`` / ``[]`` / ``123`` / ``"abc"`` 都是
7
+ **合法 JSON**。三处裸调 ``.get`` 的判据面因此全线逃逸 AttributeError(而 except
8
+ 元组只收 ValueError/OSError):
9
+
10
+ · ``mdcg.MdCG._load_index``(mdcg.py:1050 旧行)``d.get("schema")`` ⇒
11
+ **构造即失败**:常驻 MCP 服务的记忆面整个起不来(rc=1),一次性脚本
12
+ (review_cli 等)全崩;而盘上 ``.md`` 真源完好无损——丢的只是派生索引
13
+ 这一条腿。实测四形态全部 ``AttributeError: '<type>' object has no
14
+ attribute 'get'``。
15
+ · ``mdcg.MdCG.compact_index``(mdcg.py:1235 旧行)同款 ⇒ 存活实例运行中
16
+ 快照被外部写坏一次,``close`` 自动 compact 的收尾路径就再也落不成快照。
17
+ · ``fsutil.ShardedLog.read_all``(fsutil.py:386 旧行)``r.get("_t", 0)`` ⇒
18
+ 分片日志里一行非对象记录即让**排序键**抛异常,索引装载与 compact 双断。
19
+
20
+ 深度 2 补充(N225 v1.0 报告 §0「已知缺口」点名的同族面——**行是 dict 不等于
21
+ 字段可用**,本次补强批收口):
22
+ · ① **排序键坏型**:``_t`` / ``_s`` 被写成 ``"abc"`` / ``[]`` / ``null`` /
23
+ ``NaN`` ⇒ 旧键 ``(r.get("_t", 0), r.get("_s", 0))`` 在 sort 里抛
24
+ TypeError(``'<' not supported between instances of 'str' and 'float'``,
25
+ 实测见 F 组),而 except 面只有 ValueError/OSError ⇒ 与原始缺陷同一条
26
+ 断链。收口:单槽归一(数值且非 NaN 原样、其余记 0,与「缺键取 0」同口径),
27
+ 记录**不丢**,坏型槽进记账面(``note_bad_sortkey_rows``)。
28
+ · ② **载荷坏型**:分片记录 ``e`` 非 dict 且非 None(``[]`` / ``123`` /
29
+ ``"abc"``)⇒ 旧写法直接 ``nodes[nid] = e``,下游 ``_count_buckets`` 对
30
+ 元素裸调 ``.get`` 抛 AttributeError。收口:装载重放与 compact 重放**共用
31
+ 同一实现**(``MdCG._apply_log``)——坏载荷跳过 + 记账(与①同一记账面),
32
+ ``e is None`` 的 tombstone 语义一字不改;``_count_buckets`` **不加**类型闸
33
+ (防在上游,不新增第三套判据)。
34
+
35
+ 修复口径(有界,不新增第三套判据):
36
+ ① 装载面:顶层非对象与 ValueError/OSError **同一降级口径**——视同损坏 ⇒
37
+ 走 ``_load_index`` / ``compact_index`` **既有**的「回退全库扫描」路径
38
+ (宁重扫勿清池)。``_maybe_reload_index`` 经 ``_load_index`` 收口后不再
39
+ 抛,故未加宽其 except 面(A 组第 5 条钉这一点)。
40
+ ② 日志面:``read_all`` 逐行分流——dict 进回放,非对象行进记账面
41
+ (``note_nonobject_rows``:模块级计数 + 有界样本 + stderr 告警);
42
+ 排序键坏型同面记账(``note_bad_sortkey_rows``)。**容忍 ≠ 静默**。
43
+ ③ 不动 ``read_jsonl`` 的通用契约(其它消费面不在本次范围);不动 tombstone
44
+ 语义(``e is None`` 的删除重放保持原行为)。
45
+
46
+ 守卫构成(A 装载面 / B compact 面 / C 分片日志面 / D stdio 端到端 /
47
+ E 载荷坏型收口 / F 排序键健壮化 / G tombstone 语义 / H read_jsonl 通用面):
48
+ A 四形态 × 5 条(20):构造不抛 · 确有全库扫描 · 既有节点一个不丢 · 不得退化
49
+ 成空池 · 探活重载(``_maybe_reload_index``)不抛且节点仍全
50
+ B 四形态 × 4 条(16):compact 不抛 · 落盘快照恢复为可再装载 dict · 不清池
51
+ (账本对得上盘面)· 返回值含既有节点
52
+ C 9 条:read_all 不抛 / 只收 dict / 坏行计数可断言 / stderr 告警可观测 /
53
+ tombstone 记录保留在返回列表(e=None 不得当坏行丢掉)/ 排序不崩;重放面:
54
+ 构造不抛 / 合法新记录生效
55
+ D 5 条:非对象快照 + 坏分片的临时库上起 ``md_cg.mcp_server`` stdio 主循环 ⇒
56
+ rc=0 · initialize 应答 · tools/list 应答 · 非对象行仍回 -32600 · 攻击行之后
57
+ 仍应答(**不是 rc=1 / 进程即死**)
58
+ E 6 条(载荷坏型收口,契约②):装载不抛 / 坏载荷不进 nodes / 合法 upsert 仍
59
+ 生效 / 记账可断言且不静默 / compact 面不抛且快照无坏载荷 id / **两面对同一
60
+ 分片的 nodes 逐键相等**(同口径)
61
+ F 5 条(排序键健壮化,契约①):read_all 不抛**且**旧键直排在同一批记录上必抛
62
+ (fixture 有判别力)/ 合法记录与旧键 oracle **逐位一致(序与内容)** /
63
+ 记录一个不丢且按键单调不减 / 坏型键计数可断言 / 不静默
64
+ G 2 条(tombstone 语义):装载面 e is None ⇒ pop;compact 面同款(删除不复活)
65
+ H 2 条(read_jsonl 通用面):非对象行仍**原样产出**(类型序列逐位一致)· 产出
66
+ 对象与 json.loads 结果同值(不做类型改造)
67
+
68
+ **上一轮 E 组 5 条「源文本在场」断言已整组删除**(`'isinstance(d, dict) and
69
+ d.get("schema") == SCHEMA' in win_load` 这类源码文本级自证:整组换成空组后
70
+ ``--branch-baseline`` 仍 PASS,零判别力)。其判据面改由行为断言承担,一一对应:
71
+ 旧 E1(装载面类型闸在场)→ A 组(行为,变异①钉死)
72
+ 旧 E2(compact 面非对象分支在场)→ B 组(行为,变异②钉死)
73
+ 旧 E3(read_all 过滤与记账成对在场)→ C 组(行为,变异③钉死)
74
+ 旧 E4(read_jsonl 通用契约未改)→ H 组(行为,变异⑧钉死)
75
+ 旧 E5(tombstone 语义两处仍在)→ G 组(行为,变异⑤/⑦从两侧钉死)
76
+
77
+ ``--branch-baseline`` 定点变异自证(与 ``test_neg_condition_hits`` 同口径):
78
+ 逐个关掉一处判据,守卫**必须转红**且红项**恰好**落在该判据负责的组、数量等于
79
+ 该组断言数(多一项少一项都报红);锚点漂移报 ``ANCHOR-MISS`` 并以**退出码 2**
80
+ fail-closed 停手。基线源是**工作区源码**(``inspect.getsource`` 取自当前已加载
81
+ 模块),绝不绑 git HEAD——本仓批次 80/81 两次教训:基线绑提交那一刻即失效。
82
+
83
+ **组与判据一一对应**(这样「恰好等于该组断言数」才可成立):每组只放该判据
84
+ 自己的断言,fixture 只放该判据自己的病理(各组互不交叉),故每处变异只红一组
85
+ (装载面/日志面两处变异另红端到端 D 组——D 组的两个病理本就是「非对象快照」与
86
+ 「非对象行」)。变异表里同一组出现两次(G 组被⑧… 被⑤与⑦从两侧钉死)是刻意的:
87
+ 口径「过窄」与「过宽」都必须转红。
88
+
89
+ 隔离纪律(与 ``test_n206_stdio_jsonrpc_type`` / ``test_issue39_utf8_stdio`` 同款):
90
+ env 剔净全部 MDCG_*/HIVE_* 注入面,只注入指向临时目录的
91
+ ``MDCG_ROOT``/``MDCG_AUX_ROOT``/``MDCG_STATE_ROOT``/``MDCG_DATA_ROOT``/
92
+ ``MDCG_TENANT_REGISTRY``(指向不存在的临时路径=空表回落)/``MDCG_SUSTAIN=0``
93
+ (关常驻循环)/``MDCG_LEGACY_ENV_AUTH=1``(既有豁免面,零令牌、不回落真实
94
+ `~/.mdcg`);全部合成库落在 ``tempfile.mkdtemp`` 下,跑完 rmtree。**绝不触在役
95
+ 活库、真实令牌库与真实 serve。**
96
+
97
+ 运行:
98
+ python -X utf8 -m md_cg.test_n225_nonobject_load
99
+ python -X utf8 -m md_cg.test_n225_nonobject_load --branch-baseline
100
+ """
101
+ from __future__ import annotations
102
+
103
+ import contextlib
104
+ import inspect
105
+ import io
106
+ import json
107
+ import os
108
+ import shutil
109
+ import subprocess
110
+ import sys
111
+ import tempfile
112
+ import textwrap
113
+ from contextlib import redirect_stderr, redirect_stdout
114
+
115
+ try:
116
+ sys.stdout.reconfigure(encoding="utf-8", errors="replace")
117
+ except AttributeError:
118
+ pass
119
+
120
+ from . import fsutil as F # noqa: E402
121
+ from . import mdcg as M # noqa: E402
122
+ from .mdcg import MdCG # noqa: E402
123
+
124
+ # 四种「合法 JSON 但非对象」形态(N225 的攻击面全谱)
125
+ BODIES = (("null", "null"), ("empty_array", "[]"),
126
+ ("bare_int", "123"), ("bare_str", '"abc"'))
127
+
128
+ PASS, FAIL = 0, 0
129
+ FAILS = []
130
+ _CURRENT = ["?"]
131
+ _GROUP_FAILS = {}
132
+ _TMP_ROOTS = []
133
+ _LIVE = []
134
+
135
+
136
+ # 生效条件:把 PASS/FAIL/失败名单/分组失败数全部清零并解除当前组名(每次完整跑套件前调用;--branch-baseline 每个变异轮都要一次干净基线)。
137
+ def _reset_counters():
138
+ global PASS, FAIL
139
+ PASS = FAIL = 0
140
+ del FAILS[:]
141
+ _GROUP_FAILS.clear()
142
+ _CURRENT[0] = "?"
143
+
144
+
145
+ # 生效条件:group 为非空字符串时设为当前组名并在 _GROUP_FAILS 里开出该组条目(未开则记 0);重复调用同名组只是切换当前组,不清零已有计数。
146
+ def begin(group: str):
147
+ _CURRENT[0] = group
148
+ _GROUP_FAILS.setdefault(group, 0)
149
+
150
+
151
+ # 生效条件:cond 为真记一条通过并打印;为假把 FAIL 与当前组失败数各 +1、把 name 追加进 FAILS 并打印 detail(detail 为空则只打印名字)。
152
+ def check(name, cond, detail=""):
153
+ global PASS, FAIL
154
+ if cond:
155
+ PASS += 1
156
+ print(" [ok] %s" % name)
157
+ return True
158
+ FAIL += 1
159
+ _GROUP_FAILS[_CURRENT[0]] = _GROUP_FAILS.get(_CURRENT[0], 0) + 1
160
+ FAILS.append(name)
161
+ print(" [FAIL] %s %s" % (name, detail))
162
+ return False
163
+
164
+
165
+ # 生效条件:fn 为无参回调时调用它取条件值——回调抛异常即判红并把异常类型与消息写进 detail(**不中断整组**,保证「变异下红项数 == 该组断言数」这一精确口径成立);fn 正常返回则按返回值真假记账;detail 传 callable 时在同一保护下求值(detail 自身抛异常也只判红、不外逸)。
166
+ def check_fn(name, fn, detail=""):
167
+ if callable(detail):
168
+ try:
169
+ detail = detail()
170
+ except Exception as exc: # noqa: BLE001
171
+ detail = "detail 求值抛 %s: %s" % (type(exc).__name__, exc)
172
+ try:
173
+ cond = bool(fn())
174
+ extra = detail
175
+ except Exception as exc: # noqa: BLE001 —— 红态正是抛异常
176
+ cond = False
177
+ extra = "回调抛 %s: %s(%s)" % (type(exc).__name__, exc, detail)
178
+ return check(name, cond, extra)
179
+
180
+
181
+ # 生效条件:新建系统临时目录(prefix 前缀)并把路径登记进 _TMP_ROOTS,供本次运行收尾统一 rmtree;返回该路径。
182
+ def _tmpdir(prefix: str) -> str:
183
+ p = tempfile.mkdtemp(prefix=prefix)
184
+ _TMP_ROOTS.append(p)
185
+ return p
186
+
187
+
188
+ # 生效条件:无入参,对 _TMP_ROOTS 里每个目录 rmtree(ignore_errors=True) 并清空清单、对 _LIVE 里每个认知图实例尝试 close()(异常吞掉,收尾不该再抛);收尾是幂等的。
189
+ def _cleanup():
190
+ for cg in _LIVE:
191
+ try:
192
+ cg.close()
193
+ except Exception: # noqa: BLE001 —— 收尾路径不再抛
194
+ pass
195
+ del _LIVE[:]
196
+ for p in _TMP_ROOTS:
197
+ shutil.rmtree(p, ignore_errors=True)
198
+ del _TMP_ROOTS[:]
199
+
200
+
201
+ # 生效条件:root 为库根时构造 MdCG(root, autoflush=1)、按 ids 逐条 add 最小节点(layer=knowledge)后 close()(close 落合法快照,使盘面 .md 与快照同源);返回 root。
202
+ def _build_lib(root: str, ids=("n1", "n2")):
203
+ cg = MdCG(root, autoflush=1)
204
+ for nid in ids:
205
+ cg.add(nid, "# 功能名:节点%s\n# 正文:合成节点 %s" % (nid, nid),
206
+ layer="knowledge")
207
+ cg.close()
208
+ return root
209
+
210
+
211
+ # 生效条件:root 下 _index_log/ 已建成目录时,写入一份固定的坏分片 9000-c0ffee00.log——entry 非 None 时首行是一条合法 id=c_new 记录,随后固定四行非对象(null/[]/123/"abc"),末行是 id=n2 的 tombstone(e=None);返回该分片路径。
212
+ def _write_bad_shard(root: str, entry=None) -> str:
213
+ d = os.path.join(root, "_index_log")
214
+ os.makedirs(d, exist_ok=True)
215
+ p = os.path.join(d, "9000-c0ffee00.log")
216
+ rows = []
217
+ if entry is not None:
218
+ rows.append(json.dumps({"id": "c_new", "e": entry,
219
+ "_t": 1.0, "_s": 1}, ensure_ascii=False))
220
+ rows += ["null", "[]", "123", '"abc"']
221
+ rows.append(json.dumps({"id": "n2", "e": None, "_t": 2.0, "_s": 2},
222
+ ensure_ascii=False))
223
+ with open(p, "w", encoding="utf-8") as f:
224
+ f.write("\n".join(rows) + "\n")
225
+ return p
226
+
227
+
228
+ # 生效条件:root 下 _index_log/ 已建成目录时,写入坏**载荷**分片 9001-bad0payl.log——三行 e 非 dict 且非 None([]/123/"abc",id 为 p_arr/p_int/p_str)+ 一行合法 upsert(id=n1,载荷带 bucket=n225pay,用于证明合法记录未被坏载荷牵连);该分片**不含**非对象行、不含 e is None 行(组间隔离:另两类病理归 C/G 组);返回该分片路径。
229
+ def _write_payload_shard(root: str) -> str:
230
+ d = os.path.join(root, "_index_log")
231
+ os.makedirs(d, exist_ok=True)
232
+ p = os.path.join(d, "9001-bad0payl.log")
233
+ rows = [
234
+ json.dumps({"id": "p_arr", "e": [], "_t": 1.0, "_s": 1},
235
+ ensure_ascii=False),
236
+ json.dumps({"id": "p_int", "e": 123, "_t": 2.0, "_s": 2},
237
+ ensure_ascii=False),
238
+ json.dumps({"id": "p_str", "e": "abc", "_t": 3.0, "_s": 3},
239
+ ensure_ascii=False),
240
+ json.dumps({"id": "n1", "e": {"path": "knowledge/n1.md",
241
+ "layer": "knowledge",
242
+ "bucket": "n225pay"},
243
+ "_t": 4.0, "_s": 4}, ensure_ascii=False),
244
+ ]
245
+ with open(p, "w", encoding="utf-8") as f:
246
+ f.write("\n".join(rows) + "\n")
247
+ return p
248
+
249
+
250
+ # 生效条件:root 下 _index_log/ 已建成目录时,写入 tombstone 分片 9002-tombstn.log——单行 {"id":"n2","e":None,_t=1.0,_s=1}(删除记录);该分片不含非对象行、不含坏载荷行(组间隔离:另两类病理归 C/E 组);返回该分片路径。
251
+ def _write_tombstone_shard(root: str) -> str:
252
+ d = os.path.join(root, "_index_log")
253
+ os.makedirs(d, exist_ok=True)
254
+ p = os.path.join(d, "9002-tombstn.log")
255
+ with open(p, "w", encoding="utf-8") as f:
256
+ f.write(json.dumps({"id": "n2", "e": None, "_t": 1.0, "_s": 1},
257
+ ensure_ascii=False) + "\n")
258
+ return p
259
+
260
+
261
+ # 生效条件:path 指向快照/任意文本文件时以 utf-8 覆盖写入 body(非对象快照的注入点);父目录不存在会抛 OSError。
262
+ def _overwrite(path: str, body: str):
263
+ with open(path, "w", encoding="utf-8") as f:
264
+ f.write(body)
265
+
266
+
267
+ # 生效条件:body 为四形态之一的文本时,建库 → 覆盖快照为 body → 带 _scan_nodes 计数桩重开 MdCG,返回上下文 dict(root / cg / scans / error);任何一步抛异常都收进 ctx["error"] 而不外抛(保证后续逐条断言各自判红)。
268
+ def _case_load(body: str) -> dict:
269
+ root = _tmpdir("mdcg_n225_load_")
270
+ ctx = {"root": root, "cg": None, "scans": [0], "error": None}
271
+ try:
272
+ _build_lib(root)
273
+ _overwrite(os.path.join(root, "_index.json"), body)
274
+ orig = MdCG._scan_nodes
275
+
276
+ def counted(self): # noqa: ANN001 —— 计数桩
277
+ ctx["scans"][0] += 1
278
+ return orig(self)
279
+
280
+ MdCG._scan_nodes = counted
281
+ try:
282
+ ctx["cg"] = MdCG(root, autoflush=1)
283
+ finally:
284
+ MdCG._scan_nodes = orig
285
+ _LIVE.append(ctx["cg"])
286
+ except Exception as exc: # noqa: BLE001
287
+ ctx["error"] = exc
288
+ return ctx
289
+
290
+
291
+ # 生效条件:body 为四形态之一的文本时,建库 → 在**合法快照**上构造存活实例(保证构造面不参与本组)→ 把快照覆盖为 body(模拟运行中被外部写坏)→ 调 compact_index(),返回上下文 dict(root / cg / surf / idx / error);异常收进 ctx["error"]。
292
+ def _case_compact(body: str) -> dict:
293
+ root = _tmpdir("mdcg_n225_compact_")
294
+ ctx = {"root": root, "cg": None, "surf": None, "idx": None,
295
+ "error": None}
296
+ try:
297
+ _build_lib(root)
298
+ cg = MdCG(root, autoflush=1)
299
+ ctx["cg"] = cg
300
+ _LIVE.append(cg)
301
+ ctx["surf"] = cg._count_md_files()
302
+ _overwrite(os.path.join(root, "_index.json"), body)
303
+ ctx["idx"] = cg.compact_index()
304
+ except Exception as exc: # noqa: BLE001
305
+ ctx["error"] = exc
306
+ return ctx
307
+
308
+
309
+ # 生效条件:无入参时建库 → 写坏分片(含合法 c_new 记录 + 四行非对象 + n2 的 tombstone)→ 先重置记账、以 redirect_stderr 捕获 read_all 的告警输出直接调 ShardedLog.read_all,再重开 MdCG 走索引重放;返回上下文 dict(root / recs / stats / stderr / cg / nodes / stats_after / 各阶段 error)。
310
+ def _case_shard() -> dict:
311
+ root = _tmpdir("mdcg_n225_shard_")
312
+ ctx = {"root": root, "recs": None, "stats": None, "stderr": "",
313
+ "cg": None, "nodes": None, "stats_after": None,
314
+ "error": None, "error_replay": None, "error0": None}
315
+ try:
316
+ _build_lib(root)
317
+ entry = {"path": "knowledge/c_new.md", "layer": "knowledge",
318
+ "bucket": "n225"}
319
+ _write_bad_shard(root, entry)
320
+ # ---- ① 分片日志读面(不构造 MdCG,与装载面解耦)----
321
+ F.reset_nonobject_row_stats()
322
+ buf = io.StringIO()
323
+ try:
324
+ with redirect_stderr(buf):
325
+ ctx["recs"] = F.ShardedLog.read_all(
326
+ os.path.join(root, "_index_log"))
327
+ except Exception as exc: # noqa: BLE001
328
+ ctx["error"] = exc
329
+ ctx["stderr"] = buf.getvalue()
330
+ ctx["stats"] = F.nonobject_row_stats()
331
+ # ---- ② 索引重放面(合法快照 + 坏分片)----
332
+ try:
333
+ cg = MdCG(root, autoflush=1)
334
+ ctx["cg"] = cg
335
+ _LIVE.append(cg)
336
+ ctx["nodes"] = set(cg.index["nodes"])
337
+ except Exception as exc: # noqa: BLE001
338
+ ctx["error_replay"] = exc
339
+ ctx["stats_after"] = F.nonobject_row_stats()
340
+ except Exception as exc: # noqa: BLE001
341
+ ctx["error0"] = exc
342
+ return ctx
343
+
344
+
345
+ # 生效条件:无入参时建库 → 写坏**载荷**分片 → 重置记账 → 构造 MdCG(合法快照基底 + 坏载荷重放)→ 再调同一个实例的 compact_index()(同一批坏载荷走第二次重放);返回上下文 dict(root / cg / nodes / nodes_after_compact / payload_before / payload_after / stderr / err / err_compact / idx)。
346
+ def _case_payload() -> dict:
347
+ root = _tmpdir("mdcg_n225_payload_")
348
+ ctx = {"root": root, "cg": None, "nodes": None, "idx": None,
349
+ "payload_before": None, "payload_after": None, "total_after": None,
350
+ "stderr": "", "err": None, "err_compact": None, "err0": None}
351
+ try:
352
+ _build_lib(root)
353
+ _write_payload_shard(root)
354
+ F.reset_nonobject_row_stats()
355
+ buf = io.StringIO()
356
+ try:
357
+ with redirect_stderr(buf):
358
+ cg = MdCG(root, autoflush=1)
359
+ ctx["cg"] = cg
360
+ _LIVE.append(cg)
361
+ ctx["nodes"] = cg.index["nodes"]
362
+ ctx["payload_before"] = F.bad_payload_row_stats()[0]
363
+ try:
364
+ ctx["idx"] = cg.compact_index()
365
+ except Exception as exc: # noqa: BLE001
366
+ ctx["err_compact"] = exc
367
+ ctx["payload_after"] = F.bad_payload_row_stats()[0]
368
+ ctx["total_after"] = F.nonobject_row_stats()[0]
369
+ except Exception as exc: # noqa: BLE001
370
+ ctx["err"] = exc
371
+ ctx["stderr"] = buf.getvalue()
372
+ except Exception as exc: # noqa: BLE001
373
+ ctx["err0"] = exc
374
+ return ctx
375
+
376
+
377
+ # 生效条件:legal(v) 为真当且仅当 v 为 int/float 且 v == v(非 NaN)——即排序键的「合法槽」口径。
378
+ def _legal_slot(v) -> bool:
379
+ return isinstance(v, (int, float)) and v == v
380
+
381
+
382
+ # 生效条件:r 为记录时,返回其排序键「坏型槽记 0、合法槽原样」二元组——与实现口径同源的断言侧表达(F3 的单调性判据用;合法记录的**次序证明**不靠它,靠 F2 的旧键 oracle 逐位对照)。
383
+ def _norm_key(r):
384
+ return tuple(v if _legal_slot(v) else 0
385
+ for v in (r.get("_t", 0), r.get("_s", 0)))
386
+
387
+
388
+ # 生效条件:rows 为记录列表时,取其中 _t 与 _s 两槽都合法的记录,按**改前旧键** (r.get("_t", 0), r.get("_s", 0)) 排序后返回——改前行为的独立 oracle(不调用被测实现,只用 Python 内建 sorted)。
389
+ def _oracle_legal(rows):
390
+ keep = [r for r in rows
391
+ if _legal_slot(r.get("_t", 0)) and _legal_slot(r.get("_s", 0))]
392
+ return sorted(keep, key=lambda r: (r.get("_t", 0), r.get("_s", 0)))
393
+
394
+
395
+ # 生效条件:d 为分片目录时,按 read_all 的收集序(分片名序 + 文件行序)经 F.read_jsonl 取全部 dict 行返回——oracle 的输入面(不调用 read_all)。
396
+ def _collect_rows(d: str):
397
+ out = []
398
+ for fn in sorted(os.listdir(d)):
399
+ if not fn.endswith(".log"):
400
+ continue
401
+ for rec in F.read_jsonl(os.path.join(d, fn)):
402
+ if isinstance(rec, dict):
403
+ out.append(rec)
404
+ return out
405
+
406
+
407
+ # 生效条件:无入参时在临时目录下用**生产写点**(ShardedLog.append,两个写者实例=两个分片,含并列 _t、跨写者重叠 _s、乱序写入)造真实分片记录,再手写一份坏型排序键分片(str/list/None/NaN 四形态 + 一行缺 _t 的合法行)→ 重置记账 → 以 redirect_stderr 捕获告警后调 read_all;返回上下文 dict(root / d / rows / oracle / old_raises / recs / got_legal / sortkey_before / stderr / err)。
408
+ def _case_sortkey() -> dict:
409
+ root = _tmpdir("mdcg_n225_sortkey_")
410
+ ctx = {"root": root, "d": os.path.join(root, "shards"), "rows": None,
411
+ "oracle": None, "old_raises": None, "recs": None,
412
+ "got_legal": None, "sortkey_before": None, "stderr": "",
413
+ "err": None, "err0": None}
414
+ try:
415
+ d = ctx["d"]
416
+ os.makedirs(d, exist_ok=True)
417
+ # 写者 A / B(各占一个分片):真实写点产出的记录(_t 为 time.time 形态、
418
+ # _s 为分片内序号,两个写者的 _s 故意重叠 ⇒ 跨分片合并必须靠 (t, s) 定序)
419
+ lg_a = F.ShardedLog(d)
420
+ for t, s, nid in ((1000.0, 1, "a"), (1000.0, 2, "b"), (999.0, 3, "c"),
421
+ (1000.0, 4, "d"), (1002.0, 5, "e")):
422
+ lg_a.append({"id": nid, "e": {"path": "knowledge/%s.md" % nid,
423
+ "bucket": "k"}, "_t": t, "_s": s})
424
+ lg_a.close()
425
+ lg_b = F.ShardedLog(d)
426
+ for t, s, nid in ((1000.0, 1, "f"), (997.5, 2, "g"), (1000.0, 3, "h")):
427
+ lg_b.append({"id": nid, "e": {"path": "knowledge/%s.md" % nid,
428
+ "bucket": "k"}, "_t": t, "_s": s})
429
+ lg_b.close()
430
+ rows = [
431
+ {"id": "s1", "e": {"path": "knowledge/s1.md"}, "_t": "abc",
432
+ "_s": 9}, # str 槽
433
+ {"id": "s2", "e": {"path": "knowledge/s2.md"}, "_t": 5.0,
434
+ "_s": []}, # list 槽
435
+ {"id": "s3", "e": {"path": "knowledge/s3.md"}, "_s": 11}, # 缺 _t(合法)
436
+ {"id": "s4", "e": {"path": "knowledge/s4.md"}, "_t": None,
437
+ "_s": None}, # None 槽
438
+ {"id": "s5", "e": {"path": "knowledge/s5.md"},
439
+ "_t": float("nan"), "_s": 1}, # NaN 槽
440
+ ]
441
+ with open(os.path.join(d, "9999-badkey.log"), "w",
442
+ encoding="utf-8") as f:
443
+ f.write("\n".join(json.dumps(r, ensure_ascii=False)
444
+ for r in rows) + "\n")
445
+ ctx["rows"] = _collect_rows(d)
446
+ try:
447
+ sorted(ctx["rows"], key=lambda r: (r.get("_t", 0), r.get("_s", 0)))
448
+ ctx["old_raises"] = False
449
+ except TypeError as exc:
450
+ ctx["old_raises"] = "%s: %s" % (type(exc).__name__, exc)
451
+ ctx["oracle"] = _oracle_legal(ctx["rows"])
452
+ F.reset_nonobject_row_stats()
453
+ buf = io.StringIO()
454
+ try:
455
+ with redirect_stderr(buf):
456
+ ctx["recs"] = F.ShardedLog.read_all(d)
457
+ except Exception as exc: # noqa: BLE001
458
+ ctx["err"] = exc
459
+ ctx["stderr"] = buf.getvalue()
460
+ if isinstance(ctx["recs"], list):
461
+ ctx["got_legal"] = [r for r in ctx["recs"]
462
+ if _legal_slot(r.get("_t", 0))
463
+ and _legal_slot(r.get("_s", 0))]
464
+ ctx["sortkey_before"] = F.bad_sortkey_row_stats()[0]
465
+ except Exception as exc: # noqa: BLE001
466
+ ctx["err0"] = exc
467
+ return ctx
468
+
469
+
470
+ # 生效条件:无入参时建库 → 写 tombstone 分片(n2 的删除记录)→ 构造 MdCG(合法快照基底 + tombstone 重放)→ 再调同一实例的 compact_index();返回上下文 dict(root / cg / nodes / idx / err / err_compact / err0)。
471
+ def _case_tombstone() -> dict:
472
+ root = _tmpdir("mdcg_n225_tomb_")
473
+ ctx = {"root": root, "cg": None, "nodes": None, "idx": None,
474
+ "err": None, "err_compact": None, "err0": None}
475
+ try:
476
+ _build_lib(root)
477
+ _write_tombstone_shard(root)
478
+ cg = MdCG(root, autoflush=1)
479
+ ctx["cg"] = cg
480
+ _LIVE.append(cg)
481
+ ctx["nodes"] = set(cg.index["nodes"])
482
+ try:
483
+ ctx["idx"] = cg.compact_index()
484
+ except Exception as exc: # noqa: BLE001
485
+ ctx["err_compact"] = exc
486
+ except Exception as exc: # noqa: BLE001
487
+ ctx["err"] = exc
488
+ return ctx
489
+
490
+
491
+ # 生效条件:无入参时在临时目录写一份 jsonl(两条合法 dict 行 + 四行非对象行,非对象行夹在中间),直接调 F.read_jsonl 取产出序列;返回上下文 dict(path / got / error)。
492
+ def _case_jsonl() -> dict:
493
+ root = _tmpdir("mdcg_n225_jsonl_")
494
+ p = os.path.join(root, "x.jsonl")
495
+ with open(p, "w", encoding="utf-8") as f:
496
+ f.write('{"a":1}\nnull\n[]\n123\n"abc"\n{"a":2}\n')
497
+ ctx = {"path": p, "got": None, "error": None}
498
+ try:
499
+ ctx["got"] = list(F.read_jsonl(p))
500
+ except Exception as exc: # noqa: BLE001
501
+ ctx["error"] = exc
502
+ return ctx
503
+
504
+
505
+ # 模拟宿主前先把「身份/路径/编码」注入面清干净——子进程只吃临时目录(与 N206 同款)
506
+ _DIRTY_KEYS = (
507
+ "MDCG_TOKEN", "MDCG_TOKEN_FILE", "MDCG_MASTER_KEY", "MDCG_CLEARANCE",
508
+ "MDCG_TENANT", "MDCG_TENANT_REGISTRY",
509
+ "MDCG_CAN_ADMIN", "MDCG_CAN_WRITE", "MDCG_LEGACY_ENV_AUTH",
510
+ "MDCG_LEGACY_ENV_ADMIN", "MDCG_SESSION", "DSH_SESSION_ID",
511
+ "MDCG_HARNESS", "MDCG_UNIT", "MDCG_ROOT", "MDCG_STATE_ROOT",
512
+ "MDCG_DATA_ROOT", "MDCG_AUX_ROOT", "MDCG_SUSTAIN", "MDCG_SUSTAIN_NAME",
513
+ "MDCG_MCP_SURFACE", "MDCG_TOOL_FACE", "MDCG_ACTOR",
514
+ "MDCG_VERIFIER_MODULES", "MDCG_HIVE_JOBS",
515
+ "PYTHONUTF8", "PYTHONIOENCODING", "PYTHONLEGACYWINDOWSSTDIO",
516
+ )
517
+
518
+
519
+ # 生效条件:tmp 为本次隔离根时,返回剔净 _DIRTY_KEYS 后的 os.environ 副本再注入九个指向 tmp 的覆盖键(MDCG_ROOT / MDCG_TENANT_REGISTRY / MDCG_STATE_ROOT / MDCG_DATA_ROOT / MDCG_AUX_ROOT / MDCG_SUSTAIN / MDCG_LEGACY_ENV_AUTH / MDCG_ACTOR,外加指向临时路径的 MDCG_TOKEN_FILE 与哑主密钥 MDCG_MASTER_KEY)——子进程绝不读真实 ~/.mdcg、真实令牌库与真实密钥面。
520
+ def _env(tmp: str) -> dict:
521
+ env = {k: v for k, v in os.environ.items() if k not in _DIRTY_KEYS}
522
+ env["MDCG_ROOT"] = os.path.join(tmp, "cgroot")
523
+ # 登记表指向**不存在**的临时路径 → 空表回落,绝不读真实 ~/.mdcg
524
+ env["MDCG_TENANT_REGISTRY"] = os.path.join(tmp, "_tenants_absent.json")
525
+ env["MDCG_STATE_ROOT"] = os.path.join(tmp, "state")
526
+ env["MDCG_DATA_ROOT"] = os.path.join(tmp, "data")
527
+ # 子目录名不可取 "aux"(Windows 保留设备名,见 test_issue39 头注)
528
+ env["MDCG_AUX_ROOT"] = os.path.join(tmp, "auxroot")
529
+ env["MDCG_TOKEN_FILE"] = os.path.join(tmp, "tokens.json") # 临时令牌库
530
+ env["MDCG_MASTER_KEY"] = "00" * 32 # 哑主密钥
531
+ env["MDCG_SUSTAIN"] = "0" # 关常驻循环(线程面归零)
532
+ env["MDCG_LEGACY_ENV_AUTH"] = "1" # 既有豁免面:零令牌、无二次开关
533
+ env["MDCG_ACTOR"] = "n225-guard"
534
+ return env
535
+
536
+
537
+ # 当前生效的变异(仅 --branch-baseline 期间非 None):内存 patch 不跨进程,
538
+ # D 组走独立子进程 ⇒ 靠 sitecustomize 把同一处定点变异注入子进程,端到端面
539
+ # 才有真正的判别力。注入以 stderr 标记自证,标记缺失即 D 组判红(fail-closed)。
540
+ _MUTATION = [None]
541
+
542
+ _SITECUSTOMIZE_SRC = '''# N225 守卫跨进程变异注入(临时件,随 tmp 目录一并回收)
543
+ import os
544
+ import sys
545
+ import textwrap
546
+ import inspect
547
+ _repo = os.environ.get("N225_REPO") or ""
548
+ if _repo and _repo not in sys.path:
549
+ sys.path.insert(0, _repo)
550
+ try:
551
+ from md_cg import mdcg as _M, fsutil as _F
552
+ _which = os.environ["N225_MUT_WHICH"]
553
+ _fname = os.environ["N225_MUT_FUNC"]
554
+ _old = os.environ["N225_MUT_OLD"]
555
+ _new = os.environ["N225_MUT_NEW"]
556
+ if _which == "mdcg":
557
+ _holder, _raw = _M.MdCG, _M.MdCG.__dict__[_fname]
558
+ elif _which == "fsutil":
559
+ _holder, _raw = _F.ShardedLog, _F.ShardedLog.__dict__[_fname]
560
+ else: # fsutil_mod:模块级函数
561
+ _holder, _raw = _F, _F.__dict__[_fname]
562
+ _src = inspect.getsource(getattr(_raw, "__func__", _raw))
563
+ _src = textwrap.dedent(_src[_src.index("def %s(" % _fname):])
564
+ _ns = dict(vars(_M if _which == "mdcg" else _F))
565
+ _ns.setdefault("__name__", "n225_mut")
566
+ exec(compile(_src.replace(_old, _new), "n225_mut.py", "exec"), _ns)
567
+ if _which == "fsutil":
568
+ setattr(_holder, _fname, staticmethod(_ns[_fname]))
569
+ else:
570
+ setattr(_holder, _fname, _ns[_fname])
571
+ sys.stderr.write("[n225-mut] injected %s.%s\\n" % (_which, _fname))
572
+ except Exception as _e:
573
+ sys.stderr.write("[n225-mut] inject FAILED: %r\\n" % (_e,))
574
+ '''
575
+
576
+
577
+ # 生效条件:lines 为待喂给 stdin 的字符串序列、tmp 为隔离根时,spawn `python -X utf8 -m md_cg.mcp_server`(cwd=仓根、env=_env(tmp))一次喂完并 communicate;超时则 kill 后取残余输出;随后删掉**本子进程自己**的自报戳;返回 (returncode, stdout, stderr)。
578
+ def _talk(lines, tmp: str, timeout: int = 180):
579
+ env = _env(tmp)
580
+ mut = _MUTATION[0]
581
+ if mut is not None:
582
+ # 跨进程注入:sitecustomize 是 Python 启动时自动 import 的官方钩子,
583
+ # 放到 PYTHONPATH 上即被本子进程吃到——生产启动形态(-m)保持不变。
584
+ sc_dir = os.path.join(tmp, "_mutpath")
585
+ os.makedirs(sc_dir, exist_ok=True)
586
+ with open(os.path.join(sc_dir, "sitecustomize.py"), "w",
587
+ encoding="utf-8") as f:
588
+ f.write(_SITECUSTOMIZE_SRC)
589
+ env["PYTHONPATH"] = sc_dir + os.pathsep + env.get("PYTHONPATH", "")
590
+ env["N225_REPO"] = os.path.dirname(os.path.dirname(
591
+ os.path.abspath(__file__)))
592
+ env["N225_MUT_WHICH"] = mut["which"]
593
+ env["N225_MUT_FUNC"] = mut["func"]
594
+ env["N225_MUT_OLD"] = mut["old"]
595
+ env["N225_MUT_NEW"] = mut["new"]
596
+ proc = subprocess.Popen(
597
+ [sys.executable, "-X", "utf8", "-m", "md_cg.mcp_server"],
598
+ cwd=os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
599
+ env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
600
+ stderr=subprocess.PIPE, text=True, encoding="utf-8", errors="replace")
601
+ try:
602
+ out, err = proc.communicate("\n".join(lines) + "\n", timeout=timeout)
603
+ except subprocess.TimeoutExpired:
604
+ proc.kill()
605
+ out, err = proc.communicate()
606
+ try:
607
+ os.remove(os.path.join(tempfile.gettempdir(), "md_cg_servers",
608
+ "%d.json" % proc.pid))
609
+ except OSError:
610
+ pass
611
+ return proc.returncode, out or "", err or ""
612
+
613
+
614
+ # 生效条件:rid/method 给定、params 为 None 时省略该键,否则原样写入;返回一行紧凑 JSON-RPC 请求文本。
615
+ def _rpc(rid, method, params=None) -> str:
616
+ msg = {"jsonrpc": "2.0", "id": rid, "method": method}
617
+ if params is not None:
618
+ msg["params"] = params
619
+ return json.dumps(msg, ensure_ascii=False)
620
+
621
+
622
+ # 生效条件:out 为 stdout 文本时逐行 strip、空行跳过,返回 [(原始行, 解析结果或 None)](解析失败记 None,供「全行合法」类断言消费)。
623
+ def _resp_lines(out: str):
624
+ got = []
625
+ for ln in out.splitlines():
626
+ ln = ln.strip()
627
+ if not ln:
628
+ continue
629
+ try:
630
+ got.append((ln, json.loads(ln)))
631
+ except ValueError:
632
+ got.append((ln, None))
633
+ return got
634
+
635
+
636
+ # 生效条件:obj 为 dict 时返回其 error.code,否则返回 None。
637
+ def _err_code(obj):
638
+ return (obj.get("error") or {}).get("code") if isinstance(obj, dict) else None
639
+
640
+
641
+ # 生效条件:端到端场景——建库 → 把快照覆盖为非对象 `[]` → 写坏分片 → 起 stdio 主循环喂 [initialize, tools/list, "[]", tools/list, shutdown],返回上下文 dict(tmp / rc / out / err / objs / by_id / error)。
642
+ def _case_stdio() -> dict:
643
+ tmp = _tmpdir("mdcg_n225_stdio_")
644
+ ctx = {"tmp": tmp, "rc": None, "out": "", "err": "", "objs": [],
645
+ "by_id": {}, "error": None, "inject_ok": True}
646
+ try:
647
+ root = os.path.join(tmp, "cgroot")
648
+ _build_lib(root)
649
+ _overwrite(os.path.join(root, "_index.json"), "[]")
650
+ _write_bad_shard(root, {"path": "knowledge/c_new.md",
651
+ "layer": "knowledge", "bucket": "n225"})
652
+ lines = [_rpc(1, "initialize"), _rpc(2, "tools/list"),
653
+ "[]", _rpc(3, "tools/list"), _rpc(4, "shutdown")]
654
+ ctx["rc"], ctx["out"], ctx["err"] = _talk(lines, tmp)
655
+ # 注入自证:变异轮里子进程必须报告「已注入」,否则 D 组判红(fail-closed,
656
+ # 避免「注入失效」被误读成「端到端面无判别力」)。
657
+ ctx["inject_ok"] = ("[n225-mut] injected" in ctx["err"]
658
+ if _MUTATION[0] is not None else True)
659
+ objs = [o for _raw, o in _resp_lines(ctx["out"])]
660
+ ctx["objs"] = objs
661
+ ctx["by_id"] = {o.get("id"): o for o in objs if isinstance(o, dict)}
662
+ except Exception as exc: # noqa: BLE001
663
+ ctx["error"] = exc
664
+ return ctx
665
+
666
+
667
+ # ---------------- A 装载面:四种非对象形态 ----------------
668
+
669
+ # 生效条件:逐形态跑 A 组 5 条断言(构造不抛 / 确有全库扫描 / 既有节点一个不丢 / 不退化成空池 / 探活重载不抛且节点仍全);ctx 由 _case_load 产出,构造失败时五条各自判红。
670
+ def g_a():
671
+ begin("A")
672
+ for tag, body in BODIES:
673
+ print("[A·%s] %s" % (tag, json.dumps(body)))
674
+ ctx = _case_load(body)
675
+ cg = ctx["cg"]
676
+ check_fn("A·%s·构造不抛(非对象快照视同损坏,走既有降级路径)" % tag,
677
+ lambda c=ctx: c["error"] is None,
678
+ "err=%r" % (ctx["error"],))
679
+ check_fn("A·%s·确有全库扫描(_scan_nodes 被调用,非快照路径)" % tag,
680
+ lambda c=ctx: c["scans"][0] >= 1,
681
+ "scans=%d" % ctx["scans"][0])
682
+ check_fn("A·%s·既有节点一个不丢({n1,n2} ⊆ nodes)" % tag,
683
+ lambda c=cg: {"n1", "n2"} <= set(c.index["nodes"]),
684
+ "nodes=%s" % (sorted(cg.index["nodes"]) if cg else None))
685
+ check_fn("A·%s·不得退化成空池(len(nodes) 与盘面 .md 数一致且 ≥2)"
686
+ % tag,
687
+ lambda c=cg: (c is not None
688
+ and len(c.index["nodes"]) == c._count_md_files()
689
+ and len(c.index["nodes"]) >= 2),
690
+ "nodes=%s surf=%s" % (
691
+ len(cg.index["nodes"]) if cg else None,
692
+ cg._count_md_files() if cg else None))
693
+
694
+ def _probe(c=cg, t=tag):
695
+ # 存活实例 + 外部再写一次非对象快照(签名变化)→ 探活必须重载成功。
696
+ # 这一条钉住「_maybe_reload_index 不得因非对象而抛」。
697
+ other = [b for n, b in BODIES if n != t][0]
698
+ if c is None:
699
+ return False
700
+ _overwrite(os.path.join(c.root, "_index.json"), other)
701
+ fired = c._maybe_reload_index()
702
+ return fired is True and {"n1", "n2"} <= set(c.index["nodes"])
703
+
704
+ check_fn("A·%s·探活重载不抛且节点仍全(_maybe_reload_index 收口)"
705
+ % tag, _probe)
706
+ try:
707
+ if cg is not None:
708
+ cg.close()
709
+ except Exception: # noqa: BLE001
710
+ pass
711
+
712
+
713
+ # ---------------- B compact 面:四种非对象形态 ----------------
714
+
715
+ # 生效条件:逐形态跑 B 组 4 条断言(compact 不抛 / 落盘快照恢复为可再装载 dict / 不清池,账本对得上盘面 / 返回值含既有节点);ctx 由 _case_compact 产出。
716
+ def g_b():
717
+ begin("B")
718
+ for tag, body in BODIES:
719
+ print("[B·%s] %s" % (tag, json.dumps(body)))
720
+ ctx = _case_compact(body)
721
+ snap_path = os.path.join(ctx["root"], "_index.json")
722
+
723
+ def _snap():
724
+ with open(snap_path, encoding="utf-8") as f:
725
+ return json.load(f)
726
+
727
+ check_fn("B·%s·compact_index 不抛(非对象视同损坏走 scan_fallback)"
728
+ % tag, lambda c=ctx: c["error"] is None,
729
+ "err=%r" % (ctx["error"],))
730
+ check_fn("B·%s·落盘快照恢复为可再装载 dict(schema 正确)" % tag,
731
+ lambda: isinstance(_snap(), dict)
732
+ and _snap().get("schema") == M.SCHEMA)
733
+ check_fn("B·%s·不清池(快照 nodes 数 == 盘面 .md 数)" % tag,
734
+ lambda: len((_snap().get("nodes") or {})) == ctx["surf"]
735
+ and ctx["surf"] >= 2,
736
+ lambda: "snap_nodes=%s surf=%s" % (
737
+ len((_snap().get("nodes") or {}))
738
+ if isinstance(_snap(), dict) else None, ctx["surf"]))
739
+ check_fn("B·%s·compact 返回值含既有节点" % tag,
740
+ lambda c=ctx: isinstance(c["idx"], dict)
741
+ and {"n1", "n2"} <= set(c["idx"].get("nodes") or {}))
742
+
743
+
744
+ # ---------------- C 分片日志面:非对象行 ----------------
745
+
746
+ # 生效条件:跑 C 组 9 条断言(read_all 不抛 / 只返回 dict 且条数正确 / 逐条是 dict / 坏行计数可断言 / stderr 告警可观测 / tombstone 记录保留在返回列表 / 排序有效;重放面:构造不抛 / 合法新记录生效);ctx 由 _case_shard 产出。
747
+ def g_c():
748
+ begin("C")
749
+ ctx = _case_shard()
750
+ recs = ctx["recs"]
751
+ stats = ctx["stats"] or (None, ())
752
+
753
+ check_fn("C1·read_all 不崩(非对象行不参与排序键)",
754
+ lambda c=ctx: c["error"] is None and c["error0"] is None,
755
+ "err=%r err0=%r" % (ctx["error"], ctx["error0"]))
756
+ check_fn("C2·只返回 dict 记录且条数正确(合法 1 条 + tombstone 1 条 = 2)",
757
+ lambda: isinstance(recs, list) and len(recs) == 2,
758
+ "recs=%r" % (recs,))
759
+ check_fn("C3·返回记录逐条是 dict(非对象行未混入)",
760
+ lambda: isinstance(recs, list) and all(isinstance(r, dict)
761
+ for r in recs),
762
+ "types=%s" % ([type(r).__name__ for r in recs]
763
+ if isinstance(recs, list) else None))
764
+ check_fn("C4·坏行计数可断言(本片 4 条非对象行全部记账)",
765
+ lambda: stats[0] == 4, "skips=%s" % (stats[0],))
766
+ check_fn("C5·stderr 告警可观测(不静默:含分片名与条数)",
767
+ lambda: "ShardedLog.read_all" in ctx["stderr"]
768
+ and "4 条非对象" in ctx["stderr"],
769
+ "stderr=%r" % (ctx["stderr"][:200],))
770
+ check_fn("C6·tombstone 记录仍保留在返回列表(e=None 不得当坏行丢掉)",
771
+ lambda: any(r.get("id") == "n2" and r.get("e") is None
772
+ for r in recs),
773
+ "recs=%r" % (recs,))
774
+ check_fn("C7·排序有效(按 (_t,_s) 单调不减,非对象行未污染次序)",
775
+ lambda: all((recs[i].get("_t", 0), recs[i].get("_s", 0))
776
+ <= (recs[i + 1].get("_t", 0), recs[i + 1].get("_s", 0))
777
+ for i in range(len(recs) - 1)),
778
+ "recs=%r" % (recs,))
779
+ check_fn("C8·重放面:合法快照 + 坏分片下 MdCG 构造不抛",
780
+ lambda c=ctx: c["error_replay"] is None,
781
+ "err=%r" % (ctx["error_replay"],))
782
+ check_fn("C9·重放面:坏分片里的合法新记录生效(c_new 可见)",
783
+ lambda c=ctx: c["nodes"] is not None and "c_new" in c["nodes"],
784
+ "nodes=%s" % (sorted(ctx["nodes"]) if ctx["nodes"] else None))
785
+
786
+
787
+ # ---------------- D stdio 端到端 ----------------
788
+
789
+ # 生效条件:跑 D 组 5 条断言(rc=0 / initialize 应答 / tools/list 应答 / 非对象行仍回 -32600 / 攻击行之后仍应答);ctx 由 _case_stdio 产出,spawn 失败或进程即死时五条各自判红。
790
+ def g_d():
791
+ begin("D")
792
+ ctx = _case_stdio()
793
+ by_id = ctx["by_id"]
794
+
795
+ def _init():
796
+ return ((by_id.get(1) or {}).get("result") or {}) \
797
+ .get("serverInfo", {}).get("name")
798
+
799
+ def _tools(rid):
800
+ return ((by_id.get(rid) or {}).get("result") or {}).get("tools")
801
+
802
+ check_fn("D1·非对象快照 + 坏分片下 stdio 主循环仍存活(rc=0)",
803
+ lambda c=ctx: c["rc"] == 0 and c["inject_ok"],
804
+ "rc=%r inject=%s stderr_tail=%r"
805
+ % (ctx["rc"], ctx["inject_ok"], ctx["err"][-300:]))
806
+ check_fn("D2·initialize 应答(serverInfo=mdcg-mcp)",
807
+ lambda: _init() == "mdcg-mcp" and ctx["inject_ok"],
808
+ "by_id[1]=%s" % (str(by_id.get(1))[:200],))
809
+ check_fn("D3·tools/list 应答且工具表非空",
810
+ lambda: isinstance(_tools(2), list) and len(_tools(2)) > 0
811
+ and ctx["inject_ok"],
812
+ "by_id[2]=%s" % (str(by_id.get(2))[:200],))
813
+ check_fn("D4·非对象行仍回 id=null 的 -32600(入口闸未因坏数据失能)",
814
+ lambda: ctx["inject_ok"] and any(
815
+ isinstance(o, dict) and o.get("id") is None
816
+ and _err_code(o) == -32600 for o in ctx["objs"]),
817
+ "objs=%s" % (json.dumps(ctx["objs"], ensure_ascii=False)[:300],))
818
+ check_fn("D5·攻击行之后的 tools/list 仍应答(不是半途死)",
819
+ lambda: isinstance(_tools(3), list) and len(_tools(3)) > 0
820
+ and ctx["inject_ok"],
821
+ "by_id[3]=%s" % (str(by_id.get(3))[:200],))
822
+
823
+
824
+ # ---------------- E 载荷坏型收口(契约②) ----------------
825
+
826
+ # 生效条件:跑 E 组 6 条断言(装载不抛 / 坏载荷不进 nodes / 合法 upsert 仍生效 / 记账可断言且不静默 / compact 面不抛且快照无坏载荷 id / 两面对同一分片的 nodes 逐键相等);ctx 由 _case_payload 产出,装载即失败时六条各自判红。
827
+ def g_e():
828
+ begin("E")
829
+ ctx = _case_payload()
830
+ bad_ids = {"p_arr", "p_int", "p_str"}
831
+ nodes = ctx["nodes"] or {}
832
+
833
+ check_fn("E1·装载面:坏载荷分片下 MdCG 构造不抛(e 非 dict 不进 _count_buckets)",
834
+ lambda c=ctx: c["err"] is None and c["err0"] is None and c["cg"] is not None,
835
+ "err=%r err0=%r" % (ctx["err"], ctx["err0"]))
836
+ check_fn("E2·装载面:三条坏载荷 id 一个都不进 nodes(跳过而非覆盖)",
837
+ lambda c=ctx: c["err"] is None and not (bad_ids & set(c["nodes"] or {})),
838
+ "nodes=%s" % (sorted(nodes) if nodes else None))
839
+ check_fn("E3·装载面:同批里的合法 upsert 仍生效(n1.bucket=n225pay)",
840
+ lambda: isinstance(nodes.get("n1"), dict)
841
+ and nodes["n1"].get("bucket") == "n225pay",
842
+ "n1=%r" % (nodes.get("n1"),))
843
+ check_fn("E4·装载面:坏载荷行计入记账面(子面 3 条)且不静默(stderr 含条数)",
844
+ lambda c=ctx: c["payload_before"] == 3
845
+ and "载荷坏型记录" in c["stderr"] and "3 条" in c["stderr"],
846
+ "payload=%r stderr=%r" % (ctx["payload_before"],
847
+ ctx["stderr"][:160]))
848
+ check_fn("E5·compact 面:不抛且落盘/返回索引里坏载荷 id 全不在(同一分片第二次重放)",
849
+ lambda c=ctx: c["err_compact"] is None
850
+ and isinstance(c["idx"], dict)
851
+ and not (bad_ids & set(c["idx"]["nodes"])),
852
+ "err=%r nodes=%s" % (ctx["err_compact"],
853
+ sorted(ctx["idx"]["nodes"])
854
+ if isinstance(ctx["idx"], dict) else None))
855
+ check_fn("E6·两面同口径:compact 后 nodes 与装载面逐键相等,且同批坏载荷同样记账(子面共 6 条)",
856
+ lambda c=ctx: isinstance(c["idx"], dict)
857
+ and c["idx"]["nodes"] == nodes
858
+ and c["payload_after"] == 6 and c["total_after"] == 6,
859
+ "equal=%s payload=%r total=%r" % (
860
+ (isinstance(ctx["idx"], dict) and ctx["idx"]["nodes"] == nodes),
861
+ ctx["payload_after"], ctx["total_after"]))
862
+
863
+
864
+ # ---------------- F 排序键健壮化(契约①) ----------------
865
+
866
+ # 生效条件:跑 F 组 5 条断言(read_all 不抛且旧键直排在同一批记录上必抛 / 合法记录与旧键 oracle 逐位一致 / 记录一个不丢且按键单调不减 / 坏型键计数可断言 / 不静默);ctx 由 _case_sortkey 产出,read_all 抛异常时五条各自判红。
867
+ def g_f():
868
+ begin("F")
869
+ ctx = _case_sortkey()
870
+ recs = ctx["recs"]
871
+ oracle = ctx["oracle"] or []
872
+ got = ctx["got_legal"]
873
+
874
+ check_fn("F1·read_all 不抛**且**旧键直排在同一批记录上必抛(fixture 有判别力)",
875
+ lambda c=ctx: c["err"] is None and c["err0"] is None
876
+ and c["old_raises"] is not False
877
+ and c["old_raises"] is not None,
878
+ "err=%r old=%r" % (ctx["err"], ctx["old_raises"]))
879
+ check_fn("F2·合法记录相对次序与改前逐位一致(与旧键 oracle 的序与内容全等)",
880
+ lambda: got is not None and oracle == got,
881
+ "oracle=%s got=%s" % ([r.get("id") for r in oracle],
882
+ [r.get("id") for r in got]
883
+ if got is not None else None))
884
+ check_fn("F3·记录一个不丢且返回列表按键单调不减(坏型槽记 0 参与排序)",
885
+ lambda c=ctx: isinstance(recs, list)
886
+ and len(recs) == len(ctx["rows"] or [])
887
+ and all(_norm_key(recs[i]) <= _norm_key(recs[i + 1])
888
+ for i in range(len(recs) - 1)),
889
+ "n=%s keys=%s" % (len(recs) if isinstance(recs, list) else None,
890
+ [_norm_key(r) for r in recs]
891
+ if isinstance(recs, list) else None))
892
+ check_fn("F4·坏型排序键计数可断言(str/list/None/NaN 四形态各 1 条 = 4)",
893
+ lambda c=ctx: c["sortkey_before"] == 4,
894
+ "n=%r samples=%s" % (ctx["sortkey_before"],
895
+ F.bad_sortkey_row_stats()[1][:2]))
896
+ check_fn("F5·不静默(stderr 含条数、分片名与两个槽类型)",
897
+ lambda c=ctx: "排序键坏型 4 条" in c["stderr"]
898
+ and "9999-badkey.log" in c["stderr"] and "_t=str" in c["stderr"],
899
+ "stderr=%r" % (ctx["stderr"][:200],))
900
+
901
+
902
+ # ---------------- G tombstone 语义(e is None ⇒ pop) ----------------
903
+
904
+ # 生效条件:跑 G 组 2 条断言(装载面 tombstone 重放生效、compact 面同款);ctx 由 _case_tombstone 产出,构造失败时两条各自判红。
905
+ def g_g():
906
+ begin("G")
907
+ ctx = _case_tombstone()
908
+ nodes = ctx["nodes"]
909
+
910
+ check_fn("G1·装载面:e is None ⇒ pop 该 nid(删除可重放,节点不复活)",
911
+ lambda c=ctx: c["err"] is None and c["nodes"] is not None
912
+ and "n2" not in c["nodes"] and "n1" in c["nodes"],
913
+ "err=%r nodes=%s" % (ctx["err"],
914
+ sorted(nodes) if nodes else None))
915
+ check_fn("G2·compact 面:快照与返回值同样 pop 该 nid(与装载面同口径)",
916
+ lambda c=ctx: c["err_compact"] is None
917
+ and isinstance(c["idx"], dict)
918
+ and "n2" not in c["idx"]["nodes"] and "n1" in c["idx"]["nodes"],
919
+ "err=%r nodes=%s" % (
920
+ ctx["err_compact"],
921
+ sorted(ctx["idx"]["nodes"])
922
+ if isinstance(ctx["idx"], dict) else None))
923
+
924
+
925
+ # ---------------- H read_jsonl 通用面(非对象行原样产出) ----------------
926
+
927
+ # 生效条件:跑 H 组 2 条断言(产出类型序列逐位一致、产出对象与 json.loads 同值——即只在 read_all 层过滤,read_jsonl 通用契约未改);ctx 由 _case_jsonl 产出。
928
+ def g_h():
929
+ begin("H")
930
+ ctx = _case_jsonl()
931
+ got = ctx["got"]
932
+
933
+ check_fn("H1·read_jsonl 原样产出非对象行(类型序列逐位一致)",
934
+ lambda c=ctx: c["error"] is None and isinstance(c["got"], list)
935
+ and [type(x).__name__ for x in c["got"]]
936
+ == ["dict", "NoneType", "list", "int", "str", "dict"],
937
+ "err=%r types=%s" % (ctx["error"],
938
+ [type(x).__name__ for x in got]
939
+ if isinstance(got, list) else None))
940
+ check_fn("H2·read_jsonl 不做类型改造(产出对象与 json.loads 结果同值)",
941
+ lambda c=ctx: isinstance(c["got"], list) and len(c["got"]) == 6
942
+ and c["got"][1] is None and c["got"][2] == [] and c["got"][3] == 123
943
+ and c["got"][4] == "abc",
944
+ "got=%r" % (got,))
945
+
946
+
947
+ _GROUPS = (("A", g_a), ("B", g_b), ("C", g_c), ("D", g_d), ("E", g_e),
948
+ ("F", g_f), ("G", g_g), ("H", g_h))
949
+
950
+
951
+ # 生效条件:重算计数器后依次跑 A–H 八组(静默与否由 print 决定),返回 (总失败数, {组名: 失败数} 的副本);供正常模式与 --branch-baseline 的变异核验共用。
952
+ def _run_groups():
953
+ _reset_counters()
954
+ for _name, fn in _GROUPS:
955
+ fn()
956
+ return FAIL, dict(_GROUP_FAILS)
957
+
958
+
959
+ # ---------------- 定点变异自证(--branch-baseline) ----------------
960
+
961
+ # 变异表:逐处关掉一个判据,守卫**必须转红**,且红项**恰好**落在该判据负责的
962
+ # 组、数量等于该组断言数(多一项少一项都报红)。基线源=**工作区源码**
963
+ # (inspect.getsource 取自当前已加载模块),绝不绑 git HEAD——本仓批次 80/81
964
+ # 两次教训:基线绑提交那一刻即失效。
965
+ #
966
+ # 组/判据一一对应(见模块头注「组与判据一一对应」):①装载面类型闸(A 20 +
967
+ # 端到端 D 5,D 的病理本就是非对象快照)②compact 面类型闸(B 16)③日志面非对象
968
+ # 行过滤(C 9 + D 5,D 的另一个病理是非对象行)④载荷坏型闸(E 6)⑤载荷闸口径
969
+ # 过宽(G 2——把 e is None 的 tombstone 也当坏载荷)⑥排序键归一(F 5)⑦tombstone
970
+ # 重放(G 2——与⑤从「过窄/过宽」两侧把同一口径钉死)⑧read_jsonl 原样产出(H 2)。
971
+ _MUTATIONS = (
972
+ ("装载面类型闸(_load_index 非对象视同损坏)",
973
+ "mdcg", "_load_index",
974
+ 'if isinstance(d, dict) and d.get("schema") == SCHEMA:',
975
+ 'if d.get("schema") == SCHEMA:',
976
+ {"A": 20, "D": 5}),
977
+ ("compact 面类型闸(非对象走 scan_fallback)",
978
+ "mdcg", "compact_index",
979
+ "if not isinstance(d, dict):", "if False:",
980
+ {"B": 16}),
981
+ ("分片日志非对象行过滤(read_all 跳过 + 记账)",
982
+ "fsutil", "read_all",
983
+ "if not isinstance(rec, dict):", "if False:",
984
+ {"C": 9, "D": 5}),
985
+ ("载荷坏型闸(_apply_log 跳过 e 非 dict 且非 None + 记账)",
986
+ "mdcg", "_apply_log",
987
+ "if e is not None and not isinstance(e, dict):", "if False:",
988
+ {"E": 6}),
989
+ ("载荷闸口径过宽(把 e is None 的 tombstone 也当坏载荷跳过)",
990
+ "mdcg", "_apply_log",
991
+ "if e is not None and not isinstance(e, dict):",
992
+ "if not isinstance(e, dict):",
993
+ {"G": 2}),
994
+ ("排序键归一(read_all:坏型槽记 0 而非直排)",
995
+ "fsutil", "read_all",
996
+ "isinstance(v, (int, float)) and v == v", "True",
997
+ {"F": 5}),
998
+ ("tombstone 重放(_apply_log:e is None ⇒ pop 该 nid)",
999
+ "mdcg", "_apply_log",
1000
+ "nodes.pop(nid, None)", "pass",
1001
+ {"G": 2}),
1002
+ ("read_jsonl 通用面(非对象行原样产出)",
1003
+ "fsutil_mod", "read_jsonl",
1004
+ "yield json.loads(line)",
1005
+ '_o = json.loads(line)\n yield _o if isinstance(_o, dict) else None',
1006
+ {"H": 2}),
1007
+ )
1008
+
1009
+
1010
+ # 生效条件:which 为 "mdcg" 时从 MdCG 类、为 "fsutil" 时从 ShardedLog 类、为 "fsutil_mod" 时从 fsutil 模块取 func_name 的源码文本;**从 `def <name>(` 行起截断再 dedent**——inspect.getsource 对本仓「顶格 `# 生效条件:` 注释 + 类内缩进 def」的排版会把注释/装饰器一并带来,直接 dedent 会因公共前缀为 0 而留下缩进(实测 IndentationError);函数缺失或无法取源时返回 None。
1011
+ def _func_src(which: str, func_name: str):
1012
+ try:
1013
+ if which == "mdcg":
1014
+ raw = MdCG.__dict__[func_name]
1015
+ elif which == "fsutil":
1016
+ raw = F.ShardedLog.__dict__[func_name]
1017
+ else: # fsutil_mod:模块级函数
1018
+ raw = F.__dict__[func_name]
1019
+ fn = getattr(raw, "__func__", raw)
1020
+ src = inspect.getsource(fn)
1021
+ return textwrap.dedent(src[src.index("def %s(" % func_name):])
1022
+ except Exception: # noqa: BLE001 —— 取源失败按锚点漂移处理
1023
+ return None
1024
+
1025
+
1026
+ # 生效条件:which 为 "mdcg"/"fsutil"/"fsutil_mod"、old 在 func_name 源码中时,编译替换后的源码 exec 进对应模块命名空间并挂回目标(类属性或模块级名字;原为 staticmethod 者仍包 staticmethod),返回还原回调;old 不在源码中返回 None(调用方按 ANCHOR-MISS 处置,退出码 2)。
1027
+ def _patch(which: str, func_name: str, old: str, new: str):
1028
+ src = _func_src(which, func_name)
1029
+ if src is None or old not in src:
1030
+ return None
1031
+ ns = dict(vars(M if which == "mdcg" else F))
1032
+ ns.setdefault("__name__", "n225_mut")
1033
+ exec(compile(src.replace(old, new), "n225_mut.py", "exec"), ns)
1034
+ holder = MdCG if which == "mdcg" else (F.ShardedLog if which == "fsutil"
1035
+ else F)
1036
+ orig = holder.__dict__[func_name]
1037
+ if isinstance(orig, staticmethod):
1038
+ setattr(holder, func_name, staticmethod(ns[func_name]))
1039
+ else:
1040
+ setattr(holder, func_name, ns[func_name])
1041
+
1042
+ def _restore():
1043
+ setattr(holder, func_name, orig)
1044
+
1045
+ return _restore
1046
+
1047
+
1048
+ # 生效条件:无入参,跑定点变异自证——先跑未变异基线(必须零失败),再逐个应用 _MUTATIONS:锚点缺失立即打印 ANCHOR-MISS 并返回 2(fail-closed,不再继续);变异后红项组与数量必须与预期完全一致,否则计入 bad;全部通过返回 0,存在不符返回 1。
1049
+ def _branch_baseline() -> int:
1050
+ print("!! 定点变异模式:逐处关掉判据,守卫应当转红且**恰好**命中预期组/项数\n")
1051
+ with contextlib.redirect_stdout(io.StringIO()):
1052
+ clean_fail, _clean_groups = _run_groups()
1053
+ print(" 未变异基线:失败=%d" % clean_fail)
1054
+ if clean_fail:
1055
+ print(" 基线即失败 → 定点变异自证无意义(先修基线)")
1056
+ return 1
1057
+ bad = []
1058
+ for label, which, fname, old, new, expect in _MUTATIONS:
1059
+ restore = _patch(which, fname, old, new)
1060
+ if restore is None:
1061
+ print(" ANCHOR-MISS %s —— 变异锚点漂移(实现改了却没同步本表;"
1062
+ "基线源=%s.%s)" % (label, which, fname))
1063
+ return 2 # fail-closed:锚点漂移不静默失效
1064
+ _MUTATION[0] = {"which": which, "func": fname, "old": old, "new": new}
1065
+ try:
1066
+ with contextlib.redirect_stdout(io.StringIO()):
1067
+ got_fail, got_groups = _run_groups()
1068
+ finally:
1069
+ _MUTATION[0] = None
1070
+ restore()
1071
+ _cleanup() # 每轮清干净:临时根与活实例不跨轮累积
1072
+ hit = {g: n for g, n in got_groups.items() if n}
1073
+ if hit == expect and got_fail == sum(expect.values()):
1074
+ print(" 关掉「%s」→ 红项=%d,命中组=%s %s"
1075
+ % (label, got_fail, dict(sorted(hit.items())),
1076
+ "(恰好命中预期)"))
1077
+ else:
1078
+ print(" 关掉「%s」→ 红项=%d,命中组=%s 期望=%s "
1079
+ "**红基线失效(判别力面不符)**"
1080
+ % (label, got_fail, dict(sorted(hit.items())),
1081
+ dict(sorted(expect.items()))))
1082
+ bad.append(label)
1083
+ print("\n定点变异自证:%s" % ("PASS(每处判据都有断言把它钉死)"
1084
+ if not bad else "FAIL —— " + "、".join(bad)))
1085
+ return 0 if not bad else 1
1086
+
1087
+
1088
+ # 生效条件:命令行含 --branch-baseline 时走定点变异自证(退出码 0/1/2);否则依次跑 A–H 八组打印逐条结果与汇总,全部通过返回 0、存在失败返回 1。
1089
+ def main() -> int:
1090
+ if "--branch-baseline" in sys.argv:
1091
+ try:
1092
+ return _branch_baseline()
1093
+ finally:
1094
+ _cleanup()
1095
+ try:
1096
+ _reset_counters()
1097
+ for _name, fn in _GROUPS:
1098
+ fn()
1099
+ finally:
1100
+ _cleanup()
1101
+ print("\n" + "=" * 64)
1102
+ print("非对象形态索引/日志守卫(N225):%d 通过,%d 失败" % (PASS, FAIL))
1103
+ if FAILS:
1104
+ for f in FAILS:
1105
+ print(" - %s" % f)
1106
+ return 0 if not FAILS else 1
1107
+
1108
+
1109
+ if __name__ == "__main__":
1110
+ sys.exit(main())