Skip to content

feat(io): import handler warnings for unregistered platforms (#182)#422

Merged
IanMayo merged 10 commits intomainfrom
claude/implement-speckit-182-qIh5P
Apr 13, 2026
Merged

feat(io): import handler warnings for unregistered platforms (#182)#422
IanMayo merged 10 commits intomainfrom
claude/implement-speckit-182-qIh5P

Conversation

@IanMayo
Copy link
Copy Markdown
Member

@IanMayo IanMayo commented Apr 13, 2026

Summary

  • Add post-parse validation to the import pipeline that checks extracted platform_id values against the platform registry (Add Tool Library Migration SRD for legacy Java tool discovery #180) and emits deduplicated UNREGISTERED_PLATFORM warnings
  • Import always succeeds regardless of registry coverage — warnings are advisory only
  • Graceful fallback when registry is unavailable: single REGISTRY_UNAVAILABLE warning, validation skipped
  • Part of E10 (NL-Assisted Catalog Discovery), item 3 of 11

Changes

Phase 1: Setup

  • Added debrief-data dependency to services/io/pyproject.toml

Phase 2: Foundation — Validation Function

  • Implemented _validate_platform_ids() in services/io/src/debrief_io/import_catalog.py
  • Extracts unique non-empty platform_id values from parsed features
  • Resolves each against the registry (case-sensitive, matching existing behaviour)
  • Emits one ImportWarning per unregistered platform per source file
  • 9 unit tests in services/io/tests/test_platform_validation.py

Phase 3-5: Pipeline Integration

  • Registry loaded once at start of import_legacy_data() with try/except fallback
  • Validation called after each file parse (after schema validation, before catalog write)
  • 8 integration tests covering REP, DPF, registry unavailable, deduplication, file attribution

Evidence

Test Results

Metric Value
Total Tests 17
Passed 17
Failed 0
Regression 344 existing tests unaffected

Key scenarios verified:

  • Unregistered platform IDs produce UNREGISTERED_PLATFORM warnings with correct file attribution
  • Imports always succeed regardless of registry coverage (US2)
  • Multiple position records for one platform produce exactly one warning per source file (US3)
  • Batch import warnings reference the correct source file (US4)
  • Registry load failure produces REGISTRY_UNAVAILABLE warning; validation skipped
  • Case-sensitive lookup: "nelson" != "NELSON"
  • Empty/whitespace IDs and features without platform_id handled gracefully

Usage Example

from pathlib import Path
from debrief_io.import_catalog import import_legacy_data

result = import_legacy_data(
    source_dir=Path("sample_data"),
    catalog_path=Path("local-store"),
)

# Check for unregistered platform warnings
for w in result.warnings:
    if w.code == "UNREGISTERED_PLATFORM":
        print(f"  [{w.file}] {w.message}")
# Output:
#   [exercise1.rep] Platform 'PHANTOM' is not registered in the platform registry

Sample Warning Output

Click to expand
{
  "warnings": [
    {
      "file": "exercise1.rep",
      "code": "UNREGISTERED_PLATFORM",
      "message": "Platform 'CONTACT_BRAVO' is not registered in the platform registry"
    },
    {
      "file": "exercise1.rep",
      "code": "UNREGISTERED_PLATFORM",
      "message": "Platform 'PHANTOM' is not registered in the platform registry"
    }
  ]
}

Test Plan

  • All registered platforms — no UNREGISTERED_PLATFORM warnings
  • Unregistered platform — correct warning code, file, message
  • Empty/whitespace platform IDs — skipped without warning
  • Duplicate IDs — deduplicated to one warning per platform per file
  • Case-sensitive lookup — "nelson" vs "NELSON"
  • Features without platform_id — skipped gracefully
  • REP file integration — warnings emitted, import succeeds
  • DPF file integration — warnings emitted, import succeeds
  • Registry unavailable — REGISTRY_UNAVAILABLE warning, import succeeds
  • All-unregistered file — import succeeds with all tracks present
  • Many positions, one platform — exactly one warning
  • Batch import — file attribution correct per source file
  • 344 existing tests pass (regression check)
  • ruff lint clean, pyright typecheck clean

Related

https://claude.ai/code/session_01EYVqLiYdMg7FVjjUfLysJq

claude added 7 commits April 13, 2026 21:04
Add debrief-data dependency to services/io for platform registry access.

https://claude.ai/code/session_01EYVqLiYdMg7FVjjUfLysJq
Implement the core validation function that checks extracted platform IDs
against the platform registry and emits UNREGISTERED_PLATFORM warnings.
9 unit tests cover: registered/unregistered, deduplication, case sensitivity,
empty IDs, and missing properties.

https://claude.ai/code/session_01EYVqLiYdMg7FVjjUfLysJq
Load platform registry at import start with graceful fallback. Validate
platform IDs after each file parse, emitting UNREGISTERED_PLATFORM warnings.
8 integration tests cover: registered/unregistered platforms (REP + DPF),
registry unavailable, deduplication, file attribution. All 344 tests pass.

https://claude.ai/code/session_01EYVqLiYdMg7FVjjUfLysJq
Capture test-summary.md (17 pass, 0 fail), usage-example.md,
sample-warnings.json. Create shipped blog post and LinkedIn summary.
Fix lint issues (import sorting, type annotations).

https://claude.ai/code/session_01EYVqLiYdMg7FVjjUfLysJq
@IanMayo IanMayo had a problem deploying to debrief-preview-pr-422 April 13, 2026 21:15 Failure
@IanMayo IanMayo temporarily deployed to debrief-preview-pr-422 April 13, 2026 21:15 Inactive
…kit-182-qIh5P

# Conflicts:
#	BACKLOG.md
#	docs/CHANGELOG.md
#	docs/evidence-index.md
@IanMayo IanMayo had a problem deploying to debrief-preview-pr-422 April 13, 2026 21:18 Failure
@IanMayo IanMayo temporarily deployed to debrief-preview-pr-422 April 13, 2026 21:19 Inactive
@IanMayo IanMayo merged commit 362365c into main Apr 13, 2026
5 checks passed
@IanMayo IanMayo deleted the claude/implement-speckit-182-qIh5P branch April 13, 2026 21:34
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.

2 participants