Skip to content

Turn any AI agent into an AI Scientist. The #1 Agent Skills library for science, used by 250,000+ scientists worldwide. 177 ready-to-use validated skills plus 100+ scientific databases covering biology, chemistry, medicine, and drug discovery. Compatible with Cursor, Claude Code, Codex, Pi, Antigravity, and the open Agent Skills standard.

market-research-reports: fix ledger validator crash on publication_date=not-stated

Timothy Kassis95d3adda6dd1
diff --git a/skills/market-research-reports/SKILL.md b/skills/market-research-reports/SKILL.md
index 03cb8bf1..207fa982 100644
--- a/skills/market-research-reports/SKILL.md
+++ b/skills/market-research-reports/SKILL.md
@@ -4,7 +4,7 @@ description: Build evidence-traceable market research reports and assumption-dri
license: MIT
compatibility: Python 3.11+ standard library for optional offline CLIs. The optional LaTeX template uses XeLaTeX or LuaLaTeX. Online research requires user-approved network access and source-specific terms; bundled scripts make no network, LLM, or image calls.
metadata:
- version: "1.1"
+ version: "1.2"
skill-author: "K-Dense Inc."
---
diff --git a/skills/market-research-reports/scripts/validate_evidence_ledger.py b/skills/market-research-reports/scripts/validate_evidence_ledger.py
index fe666804..d5c9d2ac 100644
--- a/skills/market-research-reports/scripts/validate_evidence_ledger.py
+++ b/skills/market-research-reports/scripts/validate_evidence_ledger.py
@@ -177,14 +177,14 @@ def validate_records(records: list[dict[str, Any]]) -> dict[str, Any]:
retrieval = parse_iso_date(
record["retrieval_date"], f"{context}.retrieval_date"
)
- if len(publication) == 10 and date.fromisoformat(retrieval) < date.fromisoformat(
- publication
- ):
+ if publication == "not-stated":
+ warnings.append(f"{source_id}: publication date is not stated")
+ elif len(publication) == 10 and date.fromisoformat(
+ retrieval
+ ) < date.fromisoformat(publication):
raise ValidationError(
f"{context}.retrieval_date precedes publication_date"
)
- if publication == "not-stated":
- warnings.append(f"{source_id}: publication date is not stated")
require_text(record["geography"], f"{context}.geography")
currency = parse_currency(
diff --git a/tests/market-research-reports/test_scripts.py b/tests/market-research-reports/test_scripts.py
index 78e64142..35c1353e 100644
--- a/tests/market-research-reports/test_scripts.py
+++ b/tests/market-research-reports/test_scripts.py
@@ -59,6 +59,27 @@ class EvidenceLedgerTests(unittest.TestCase):
self.assertFalse(report["valid"])
self.assertTrue(any("duplicate" in error for error in report["errors"]))
+ def test_not_stated_publication_date_warns_without_crashing(self) -> None:
+ records = _load_records(ASSETS / "source_ledger_template.csv")
+ records[0]["publication_date"] = "not-stated"
+ report = validate_records(records)
+ self.assertTrue(report["valid"], report["errors"])
+ self.assertTrue(
+ any("publication date is not stated" in warning
+ for warning in report["warnings"])
+ )
+
+ def test_retrieval_before_publication_fails(self) -> None:
+ records = _load_records(ASSETS / "source_ledger_template.csv")
+ records[0]["publication_date"] = "2026-07-30"
+ records[0]["retrieval_date"] = "2026-07-01"
+ report = validate_records(records)
+ self.assertFalse(report["valid"])
+ self.assertTrue(
+ any("retrieval_date precedes publication_date" in error
+ for error in report["errors"])
+ )
+
class MarketSizingTests(unittest.TestCase):
def test_synthetic_sizing_reconciles_and_returns_scenarios(self) -> None: