MCPcopy Create free account
hub / github.com/917Dhj/DeepPaperNote / source_grounding_errors

Function source_grounding_errors

scripts/lint_grounding.py:179–194  ·  view source on GitHub ↗
(source: Any, valid_ids: set[str], max_page: int)

Source from the content-addressed store, hash-verified

177
178
179def source_grounding_errors(source: Any, valid_ids: set[str], max_page: int) -> list[str]:
180 if contains_old_reference(source):
181 return ["old_bundle_reference"]
182 if isinstance(source, str):
183 return [] if valid_section_id(source, valid_ids) else ["source_reference_unresolved"]
184 if not isinstance(source, dict):
185 return ["source_reference_invalid"]
186
187 has_valid_section = valid_section_id(source.get("section_id", ""), valid_ids)
188 has_valid_pages = valid_pages(source.get("pages"), max_page) or valid_pages(
189 source.get("page_range"),
190 max_page,
191 )
192 if has_valid_section or has_valid_pages:
193 return []
194 return ["source_reference_missing_valid_section_or_pages"]
195
196
197def validate_note_plan(

Callers 2

validate_note_planFunction · 0.85
validate_central_claimsFunction · 0.85

Calls 3

contains_old_referenceFunction · 0.85
valid_section_idFunction · 0.85
valid_pagesFunction · 0.85

Tested by

no test coverage detected