Name the SCOPE-block mistake in compose warnings (REUSE-WP-0020-T03)
An index row with no id now says whether it looks like a SCOPE.md capability block, instead of leaving the author to work out why their repo contributes nothing to the federated index. That confusion is invisible without a diagnostic: the row is valid YAML, the file parses, and the member just silently disappears. Swept all 61 federation sources with --refresh: evidence-binder is the only affected member. The other ten zero-count repos are genuine empty scaffolds. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
9d015d4604
commit
0300c5b142
3 changed files with 67 additions and 4 deletions
|
|
@ -183,6 +183,26 @@ def resolve_source_index_path(
|
|||
return _write_remote_cache(source["repo"], url, content, cache_dir), warnings
|
||||
|
||||
|
||||
SCOPE_BLOCK_KEYS = {"type", "title", "description", "keywords"}
|
||||
|
||||
|
||||
def _shape_hint(item: dict[str, Any]) -> str:
|
||||
"""Name the likely mistake when an index row has no id.
|
||||
|
||||
The fenced `capability` blocks in a repo's SCOPE.md use
|
||||
type/title/description/keywords, which is close enough to an index row to
|
||||
be copied into one by mistake — and then the member silently contributes
|
||||
nothing. Say so instead of leaving the author to guess.
|
||||
"""
|
||||
if SCOPE_BLOCK_KEYS & set(item):
|
||||
return (
|
||||
" — looks like a SCOPE.md capability block"
|
||||
" (type/title/description/keywords); an index row needs"
|
||||
" id/name/summary/vector/domain/status/owner/path"
|
||||
)
|
||||
return ""
|
||||
|
||||
|
||||
def _read_index_entries(
|
||||
index_path: Path, repo: str
|
||||
) -> tuple[list[Any], list[str]]:
|
||||
|
|
@ -234,7 +254,10 @@ def compose_federated_index(
|
|||
continue
|
||||
cap_id = item.get("id")
|
||||
if not cap_id:
|
||||
warnings.append(f"{source['repo']}: capability #{position} has no id, skipped")
|
||||
warnings.append(
|
||||
f"{source['repo']}: capability #{position} has no id, skipped"
|
||||
f"{_shape_hint(item)}"
|
||||
)
|
||||
continue
|
||||
if cap_id in seen_ids:
|
||||
warnings.append(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue