feat(catalog): persist & expose upstream health and evaluation#102
Conversation
Carry the upstream catalog index.json health (freshness/popularity/source_trust
signals) and evaluation (6 rubric dimensions + final score + evaluator) blocks
through ingest into capability_items, and expose them on the item detail API.
Previously both blocks were dropped at ingest; only final_score survived as
experience_score.
- models: CapabilityItem +health/+evaluation jsonb columns (auto-migrated)
- ingest: parse health/evaluation as raw JSON (lossless, preserves extra
upstream fields); write on create/update/metadata-only paths; computeMetadataDelta
detects health/eval drift so a backfill re-run is not skipped; non-object
payloads normalize to {}
- handlers: ItemResponse +health/+evaluation (omitempty)
- migrate: extract prepareSchema (single ordered source of truth: pre-migrations
before AutoMigrate); ingest-upstream ensures the two columns via idempotent
additive DDL, skipped under --dry-run
- tests: ingest persistence/backfill/object-contract + detail API output
- experience_score semantics unchanged; all new fields additive & non-breaking
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR adds health and evaluation metadata support to capability items. The data model is extended with two JSONB columns; the catalog ingest pipeline reads and normalizes these blocks from upstream bundles; handlers expose them in item responses; and migrations ensure the schema is prepared with dry-run safety. ChangesHealth and Evaluation Metadata Support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain modules listed in go.work or their selected dependencies" Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
改动内容
把上游 catalog
index.json的 health(freshness / popularity / source_trust 信号)和 evaluation(六个评分维度 + 总分 + 评测模型)两个块,经 ingest 落库到capability_items,并在 item 详情 API 暴露。此前这两块在 ingest 阶段被直接丢弃,只有final_score以experience_score存活。具体变更
CapabilityItem新增health/evaluation两个 jsonb 列(GORM 自动迁移)health.signals.install_popularity);在 create / update / 仅元数据 三条写路径写入;computeMetadataDelta比对 health/eval 漂移,保证回填重跑不被跳过;非 object 负载归一化为{}ItemResponse新增health/evaluation(omitempty)prepareSchema(统一有序入口——pre-migrations 先于 AutoMigrate);ingest-upstream通过幂等增量 DDL 确保两列存在,--dry-run下跳过说明
experience_score语义不变;所有新字段均为增量、非破坏。migrate会自动加列;重跑ingest-upstream回填存量数据。Summary by CodeRabbit
Release Notes
New Features
Tests