Skip to content

feat(intelligence): monorepo manifest 探索と manifest_path 永続化(ADR-0016 D9)#417

Merged
yusuke0610 merged 2 commits into
mainfrom
feat/github-skill-manifest-path
Jun 27, 2026
Merged

feat(intelligence): monorepo manifest 探索と manifest_path 永続化(ADR-0016 D9)#417
yusuke0610 merged 2 commits into
mainfrom
feat/github-skill-manifest-path

Conversation

@yusuke0610

@yusuke0610 yusuke0610 commented Jun 27, 2026

Copy link
Copy Markdown
Owner

概要

ADR-0016 の D9(monorepo サブツリー manifest 探索) を実装し、backend/requirements.txtweb/package.json のようにサブツリーへ分散する構成でも依存を拾えるようにする。あわせて、検出した manifest の相対パスと部分スキャンフラグを github_skill_evidence に永続化し、証跡性を強化する。

補足: 本 PR は GitHub 連携スキル推論(github_skill)の language / package 検出軸の拡張です。「IaC(.tf)から具体的なクラウドリソースを抽出する kind=infra 検出軸」は ADR-0016 の将来課題であり本 PR の対象外です。

変更内容

  • github_collector: recursive Trees API でのパス列挙、除外セグメント(node_modules / vendor / .venv 等)、深さ(D9c)・件数キャップ、partial フラグ伝播
  • api_client: fetch_manifest_paths(truncated 判定込み)/ fetch_repo_file
  • skills: PackageDeclaration.source_path / EvidenceRecord.manifest_path / partial_scan を types・aggregator へ伝播
  • models / schema: github_skill_evidencemanifest_path / partial_scan を追加(migration 0046)。OpenAPI 型を再生成(web/src/api/generated.ts
  • tests: api_client / collector / aggregator のテストを追加

確認事項

  • make ci green(backend lint/test・web lint/test 388 pass・web build)
  • make codegen-types 再生成済み・ドリフトなし
  • 新規 migration 0046 は ADD COLUMN(libSQL 対応)。pytest はマイグレーションを通らないため、実適用は CI smoke-backend で検証される

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added more detailed evidence information for detected skills, including where manifest-based evidence came from and whether results came from a partial scan.
    • Improved repository scanning so nested manifest files are discovered more reliably in larger projects.
  • Bug Fixes

    • Skill evidence now preserves these new details consistently across the API, storage, and web client.

recursive Trees API でサブツリーの manifest を探索し、backend/requirements.txt
や web/package.json のような分散構成でも依存を拾えるようにする。検出した
manifest の相対パスと部分スキャンフラグを github_skill_evidence に永続化する。

- github_collector: recursive Trees API でのパス列挙・除外セグメント
  (node_modules / vendor 等)・深さ/件数キャップ・partial フラグ伝播
- api_client: fetch_manifest_paths(truncated 判定込み)/ fetch_repo_file
- skills: PackageDeclaration.source_path / EvidenceRecord.manifest_path /
  partial_scan を types・aggregator に伝播
- models / schema: github_skill_evidence に manifest_path・partial_scan を追加
  (migration 0046)。OpenAPI 型を再生成
- tests: api_client / collector / aggregator のテストを追加

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@yusuke0610, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 49 minutes and 48 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ad1d05d2-105f-4072-a5c6-02199aba9b1c

📥 Commits

Reviewing files that changed from the base of the PR and between b98a2e5 and 92cd265.

📒 Files selected for processing (2)
  • backend/app/services/intelligence/github/api_client.py
  • backend/tests/test_github_api_client.py
📝 Walkthrough

Walkthrough

Adds manifest_path and partial_scan to GitHub skill evidence, switches manifest discovery to recursive GitHub tree scanning, and threads the new fields through aggregation, persistence, API responses, tests, and ADR notes.

Changes

GitHub skill manifest provenance

Layer / File(s) Summary
Evidence contracts
backend/alembic_migrations/versions/0046_add_manifest_path_to_github_skill_evidence.py, backend/app/models/skill.py, backend/app/schemas/github_skill.py, web/src/api/generated.ts
manifest_path and partial_scan are added to the GitHub skill evidence table, ORM model, API schema, and generated frontend schema.
Manifest discovery
backend/app/services/intelligence/github/api_client.py, backend/app/services/intelligence/github_collector.py, backend/app/services/intelligence/skills/types.py, backend/tests/test_github_api_client.py, backend/tests/test_github_collector_extended.py
Manifest discovery now uses the GitHub Trees API, filters candidate paths with depth and exclusion rules, records source_path, and returns partial-scan state; tests cover path filtering and truncation behavior.
Evidence propagation
backend/app/services/intelligence/skills/aggregator.py, backend/app/services/intelligence/github_link_service.py, backend/app/repositories/skill.py, backend/app/routers/github_link.py, backend/tests/test_skill_aggregator.py, backend/tests/test_github_skills_api.py
manifest_scan_partial is carried into skill aggregation and persistence, and the API response includes manifest_path and partial_scan; tests cover package and language evidence round-tripping.
ADR update
docs/adr/0016-github-skill-inference.md
The ADR adds future IaC scope notes, references, and revision history entries.

Sequence Diagram(s)

sequenceDiagram
  participant CollectManifests as github_collector._collect_manifests
  participant FetchManifestPaths as fetch_manifest_paths
  participant TreesAPI as GitHub Trees API
  participant FetchRepoFile as fetch_repo_file
  participant CollectRepos as github_collector.collect_repos

  CollectManifests->>FetchManifestPaths: owner, repo, default_branch, manifest_filenames
  FetchManifestPaths->>TreesAPI: GET /git/trees/{branch}?recursive=1
  TreesAPI-->>FetchManifestPaths: tree entries, truncated
  FetchManifestPaths-->>CollectManifests: manifest paths, truncated
  CollectManifests->>FetchRepoFile: selected manifest path
  FetchRepoFile-->>CollectManifests: manifest contents
  CollectManifests-->>CollectRepos: declarations, partial flag
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • yusuke0610/devforge#408: Extends the GitHub skill evidence and persistence flow introduced there with manifest provenance fields.

Poem

I hopped through the trees with a manifest map,
and tucked partial_scan in my carrot sack.
A manifest_path breadcrumb, neat and small,
now trails each skill through the burrow hall.
🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title clearly summarizes recursive manifest discovery and manifest_path persistence, matching the main changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/github-skill-manifest-path

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
docs/adr/0016-github-skill-inference.md (2)

172-173: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Confirm .terraform exclusion aligns with existing vendor.yml patterns.

The IaC reuse section proposes adding .terraform to path exclusions. Consider referencing the existing vendor.yml link (line 194) more explicitly here, since .terraform is analogous to node_modules / .venv in D9(b). This would strengthen the "reuse D9 discovery" claim by showing the exclusion pattern is already established.

As per path instructions, cross-referencing configuration values across files for logical correctness.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/adr/0016-github-skill-inference.md` around lines 172 - 173, In the IaC
reuse section, make the `.terraform` path exclusion explicitly align with the
existing D9 exclusion pattern by cross-referencing the established
`vendor.yml`/`node_modules`/`.venv` style instead of mentioning `.terraform`
only in isolation. Update the wording around the D9 reuse claim so the
`manifest`/`*.tf` discovery logic and its exclusion set clearly reuse the same
path-segmentation approach already described elsewhere in the document, using
the relevant D9 and vendor-policy references to anchor the comparison.

Source: Path instructions


153-186: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Clarify the infra_declared signal_source value in the context of existing schema constraints.

The proposed infra_declared value for signal_source (line 168) is consistent with the existing value space (language_bytes, manifest_declared, actual_import) shown in backend/app/schemas/github_skill.py. However, the ADR should explicitly note that this is a value extension (not requiring a schema migration) since signal_source is defined as a plain str in both the ORM model and Pydantic schema, not an enum or constrained set. This is a minor clarity improvement for readers who might assume enum constraints exist.

As per the existing schema in backend/app/schemas/github_skill.py:8-32 and model in backend/app/models/skill.py:87-132, signal_source is String(30) / str without check constraints.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/adr/0016-github-skill-inference.md` around lines 153 - 186, Clarify in
this ADR section that `infra_declared` is only an added `signal_source` value,
not a schema change, by explicitly noting it fits the existing open-ended
`signal_source` field used in `Skill` / `github_skill` and does not require a
migration. Update the `3 層モデル` / `Layer 2 Evidence` wording so readers
understand `infra_declared` is a value-space extension alongside
`language_bytes`, `manifest_declared`, and `actual_import`, and point to the
existing schema/model design when describing it.
backend/app/services/intelligence/github_collector.py (1)

161-161: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Stale docstring after recursive change. collect_repos now scans subtrees recursively, but the docstring still says 直下 manifest を解析して (parses root-level manifests only). Update to reflect subtree discovery (D9) to avoid misleading future readers.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/app/services/intelligence/github_collector.py` at line 161, The
docstring for collect_repos is stale after the recursive manifest scan change
and still describes only direct child manifests. Update the wording in
collect_repos to reflect that manifest discovery now walks subtrees recursively
and fills package_declarations from all discovered manifests, so the description
matches the current D9 behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@backend/app/services/intelligence/github/api_client.py`:
- Around line 193-208: fetch_manifest_paths() currently swallows non-200 and
httpx.HTTPError cases by returning an empty path list with a false partial flag,
which makes _collect_manifests() treat a failed tree lookup as a clean
no-manifest result. Update fetch_manifest_paths() to thread an explicit
failure/partial signal through those error paths, and make sure
_collect_manifests() uses that signal so manifest_scan_partial is set true
whenever the tree fetch does not complete successfully.

---

Nitpick comments:
In `@backend/app/services/intelligence/github_collector.py`:
- Line 161: The docstring for collect_repos is stale after the recursive
manifest scan change and still describes only direct child manifests. Update the
wording in collect_repos to reflect that manifest discovery now walks subtrees
recursively and fills package_declarations from all discovered manifests, so the
description matches the current D9 behavior.

In `@docs/adr/0016-github-skill-inference.md`:
- Around line 172-173: In the IaC reuse section, make the `.terraform` path
exclusion explicitly align with the existing D9 exclusion pattern by
cross-referencing the established `vendor.yml`/`node_modules`/`.venv` style
instead of mentioning `.terraform` only in isolation. Update the wording around
the D9 reuse claim so the `manifest`/`*.tf` discovery logic and its exclusion
set clearly reuse the same path-segmentation approach already described
elsewhere in the document, using the relevant D9 and vendor-policy references to
anchor the comparison.
- Around line 153-186: Clarify in this ADR section that `infra_declared` is only
an added `signal_source` value, not a schema change, by explicitly noting it
fits the existing open-ended `signal_source` field used in `Skill` /
`github_skill` and does not require a migration. Update the `3 層モデル` / `Layer 2
Evidence` wording so readers understand `infra_declared` is a value-space
extension alongside `language_bytes`, `manifest_declared`, and `actual_import`,
and point to the existing schema/model design when describing it.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e0cd4150-2129-4390-96cb-25f5f3353ebe

📥 Commits

Reviewing files that changed from the base of the PR and between c9b2e46 and b98a2e5.

📒 Files selected for processing (16)
  • backend/alembic_migrations/versions/0046_add_manifest_path_to_github_skill_evidence.py
  • backend/app/models/skill.py
  • backend/app/repositories/skill.py
  • backend/app/routers/github_link.py
  • backend/app/schemas/github_skill.py
  • backend/app/services/intelligence/github/api_client.py
  • backend/app/services/intelligence/github_collector.py
  • backend/app/services/intelligence/github_link_service.py
  • backend/app/services/intelligence/skills/aggregator.py
  • backend/app/services/intelligence/skills/types.py
  • backend/tests/test_github_api_client.py
  • backend/tests/test_github_collector_extended.py
  • backend/tests/test_github_skills_api.py
  • backend/tests/test_skill_aggregator.py
  • docs/adr/0016-github-skill-inference.md
  • web/src/api/generated.ts

Comment thread backend/app/services/intelligence/github/api_client.py
fetch_manifest_paths が非200 / 不正レスポンス / httpx.HTTPError 時に
([], False) を返していたため、_collect_manifests が「取得失敗」と
「manifest が本当に無い」を区別できず manifest_scan_partial を立てられて
いなかった。失敗時は partial=True を返し、依存ゼロの過信を防ぐ(D9(d))。
不正 owner/repo は走査対象ですらないため ([], False) を維持。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant