fix: handle missing chunks_per_batch attribute in cognify CLI command

Fix AttributeError when args.chunks_per_batch is not present in the
argparse.Namespace object. Use getattr() with default value of None
to safely access the optional chunks_per_batch parameter.

This resolves test failures in test_cli_edge_cases.py where Namespace
objects were created without the chunks_per_batch attribute.

Changes:
- Use getattr(args, 'chunks_per_batch', None) instead of direct access
- Update test assertion to expect chunks_per_batch=None parameter

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
vasilije 2026-01-11 16:15:29 +01:00
parent f2166be823
commit e38c33c1b5
2 changed files with 2 additions and 1 deletions

View file

@ -116,7 +116,7 @@ After successful cognify processing, use `cognee search` to query the knowledge
chunk_size=args.chunk_size,
ontology_file_path=args.ontology_file,
run_in_background=args.background,
chunks_per_batch=args.chunks_per_batch,
chunks_per_batch=getattr(args, 'chunks_per_batch', None),
)
return result
except Exception as e:

View file

@ -373,6 +373,7 @@ class TestCognifyCommandEdgeCases:
ontology_file_path=None,
chunker=TextChunker,
run_in_background=False,
chunks_per_batch=None,
)