@@ -373,76 +373,20 @@ int fossil_jellyfish_deserialize_from_buffer(fossil_jellyfish_chain_t *chain, co
373373void fossil_jellyfish_init (fossil_jellyfish_chain_t * chain ) {
374374 if (!chain ) return ;
375375
376- chain -> count = 0 ;
377- memset (chain -> device_id , 0 , sizeof (chain -> device_id ));
378- chain -> created_at = 0 ;
379- chain -> updated_at = 0 ;
376+ // Zero out the entire chain structure
377+ memset (chain , 0 , sizeof (* chain ));
378+
379+ // Initialize non-zero or custom default fields for the chain
380+ chain -> attributes .valid = 1 ; // Assume valid until proven otherwise
381+ chain -> attributes .confidence = 1.0f ; // Default to max confidence
380382
381383 for (size_t i = 0 ; i < FOSSIL_JELLYFISH_MAX_MEM ; ++ i ) {
382384 fossil_jellyfish_block_t * b = & chain -> memory [i ];
383385
384- // ---- IO ----
385- memset (& b -> io , 0 , sizeof (b -> io ));
386- b -> io .input_len = 0 ;
387- b -> io .output_len = 0 ;
388- b -> io .input [0 ] = '\0' ;
389- b -> io .output [0 ] = '\0' ;
390- b -> io .input_token_count = 0 ;
391- b -> io .output_token_count = 0 ;
392- b -> io .compressed = 0 ;
393- b -> io .redacted = 0 ;
394- b -> io .reserved = 0 ;
395-
396- // ---- Identity ----
397- memset (& b -> identity , 0 , sizeof (b -> identity ));
398- b -> identity .block_index = 0 ;
399- b -> identity .prev_block_index = 0 ;
400- b -> identity .signature_len = 0 ;
401- b -> identity .reserved = 0 ;
402-
403- // ---- Time ----
404- memset (& b -> time , 0 , sizeof (b -> time ));
405- b -> time .timestamp = 0 ;
406- b -> time .delta_ms = 0 ;
407- b -> time .duration_ms = 0 ;
408- b -> time .updated_at = 0 ;
409- b -> time .expires_at = 0 ;
410- b -> time .validated_at = 0 ;
411-
412- // ---- Attributes ----
413- memset (& b -> attributes , 0 , sizeof (b -> attributes ));
414- b -> attributes .immutable = 0 ;
386+ // Reset block type and classification fields
387+ b -> block_type = JELLY_BLOCK_UNKNOWN ;
415388 b -> attributes .valid = 1 ; // Assume valid until proven otherwise
416389 b -> attributes .confidence = 1.0f ; // Default to max confidence
417- b -> attributes .usage_count = 0 ;
418- b -> attributes .pruned = 0 ;
419- b -> attributes .redacted = 0 ;
420- b -> attributes .deduplicated = 0 ;
421- b -> attributes .compressed = 0 ;
422- b -> attributes .expired = 0 ;
423- b -> attributes .trusted = 0 ;
424- b -> attributes .conflicted = 0 ;
425- b -> attributes .reserved = 0 ;
426-
427- // ---- Block type ----
428- b -> block_type = JELLY_BLOCK_UNKNOWN ;
429-
430- // ---- Classification ----
431- memset (& b -> classify , 0 , sizeof (b -> classify ));
432- b -> classify .derived_from_index = 0 ;
433- memset (b -> classify .cross_refs , 0 , sizeof (b -> classify .cross_refs ));
434- b -> classify .cross_ref_count = 0 ;
435- memset (b -> classify .forward_refs , 0 , sizeof (b -> classify .forward_refs ));
436- b -> classify .forward_ref_count = 0 ;
437- b -> classify .reasoning_depth = 0 ;
438- b -> classify .reserved = 0 ;
439- b -> classify .classification_reason [0 ] = '\0' ;
440- for (size_t t = 0 ; t < FOSSIL_JELLYFISH_MAX_TAGS ; ++ t ) {
441- b -> classify .tags [t ][0 ] = '\0' ;
442- }
443- b -> classify .similarity_score = 0.0f ;
444- b -> classify .is_hallucinated = 0 ;
445- b -> classify .is_contradicted = 0 ;
446390 }
447391}
448392
0 commit comments