Skip to content

Inspect App - #116

Merged
PaulWinterstein merged 36 commits into
mainfrom
inspect-app-concept
Jul 24, 2026
Merged

Inspect App#116
PaulWinterstein merged 36 commits into
mainfrom
inspect-app-concept

Conversation

@JonasScholl

@JonasScholl JonasScholl commented Jul 9, 2026

Copy link
Copy Markdown
Member

This PR adds app.inspect, a new read/write interface to VideoIPath's Inspect surface (verified against 2025.4+). It is purely additive, app.topology and app.inventory are unchanged.

Inspect lets you:

  • Read the live topology (devices, ports, edges, services) via a lazy, skeleton-first internal view
  • Write topology changes through a commit-style model (single-shot helpers or batched transactions)
  • Onboard devices into the topology (add_devices_to_topology, sync_devices, get_sync_info)
# Read (skeleton loads fast; ports hydrate on first access)
device_a = app.inspect.get_device("device-a")
device_b = app.inspect.get_device("device-b")

vertex_in = device_a.find_vertex_by_factory_label("port-in-1", vertex_type="In")
vertex_out = device_b.find_vertex_by_factory_label("port-out-1", vertex_type="Out")

for port in device_a.ports:
    print(port.label, port.edges)

# Setters stage edits locally; update() flushes them (auto-commit)
device_a.description = "Rack A leaf"
vertex_out.use_as_endpoint = True
app.inspect.update([device_a, vertex_out])

# Direct helpers for placement / edges
app.inspect.place_device(device_a.id, x=100, y=200)
app.inspect.connect(vertex_in.id, vertex_out.id, bidirectional=True)

# Batch setter edits + graph ops in one atomic transaction
with app.inspect.transaction() as tx:
    device_b.description = "Rack B spine"
    tx.update(device_b)  # stage setter edits into tx

    tx.place_device(device_b.id, x=400, y=200)
    tx.connect(vertex_in.id, vertex_out.id, bidirectional=True)

    tx.commit()

Key design choices

Topic Approach
Loading Skeleton-first snapshot; per-device detail hydrates on demand (ADR-0007)
API surface Collector endpoints only: no legacy nGraphElements / edgesByDevice (ADR-0008)
Writes Staged change sets committed atomically (ADR-0006)
Concurrency Compare-and-commit conflict detection before POST; rebase() to retry (ADR-0009)
Post-commit state Targeted refresh of touched entities only (ADR-0010)

The snapshot is an internal implementation detail. Users interact only through app.inspect, not a snapshot object.

What's included

Application code

  • New package: src/videoipath_automation_tool/apps/inspect/
    • InspectApp (read / write / actions mixins)
    • InspectAPI + typed Pydantic models
    • InspectSnapshot with lazy hydration and in-memory indexes
    • InspectTransaction with compare-and-commit conflict detection
    • Domain views: InspectDevice, InspectModule, InspectPort, InspectVertex, InspectEdge, InspectService
  • Wired into VideoIPathApp as a lazy app.inspect property (also exposed as _inspect_api in DEV mode)

Tests

  • Unit tests (tests/inspect/): Offline, fixture-driven coverage for snapshot loading, queries, transactions, conflict handling, and API parsing (anonymized 2025.4.9 fixtures)
  • E2E tests (tests/e2e/): Developer-run locally only against a real instance; focused app suites under apps/ (including Inspect) and ordered cross-app workflows under workflows/. Artifacts are E2E- namespaced and cleaned by a session-start sweep
  • New Poetry scripts: poetry run test-unit, poetry run test-e2e, poetry run test
  • CI now runs test-unit (e2e excluded by default via pytest marker)

Documentation

Tooling / housekeeping

  • .env.template replaces .env.example (e2e connection vars documented there)
  • AGENTS.md and path-scoped Python agent rules (.claude/rules/, .cursor/rules/ symlinks)
  • Minor REST connector tweak for Inspect collector calls

@JonasScholl
JonasScholl marked this pull request as ready for review July 9, 2026 13:06
@JonasScholl
JonasScholl marked this pull request as draft July 9, 2026 13:07
Comment thread src/videoipath_automation_tool/apps/inspect/__init__.py Fixed
Comment thread src/videoipath_automation_tool/apps/__init__.py Fixed
@JonasScholl JonasScholl changed the title Inspect app concept Inspect App Implementation Jul 9, 2026
@JonasScholl JonasScholl changed the title Inspect App Implementation Inspect App Jul 9, 2026
@JonasScholl JonasScholl self-assigned this Jul 9, 2026
@JonasScholl JonasScholl added the enhancement New feature or request label Jul 9, 2026
@JonasScholl JonasScholl added this to the Inspect App milestone Jul 9, 2026
@JonasScholl JonasScholl linked an issue Jul 9, 2026 that may be closed by this pull request
Comment thread src/videoipath_automation_tool/apps/inspect/domain/device.py
Comment thread src/videoipath_automation_tool/apps/inspect/domain/device.py Outdated
Comment thread src/videoipath_automation_tool/apps/inspect/domain/port.py
Comment thread src/videoipath_automation_tool/apps/inspect/domain/device.py
@JonasScholl
JonasScholl marked this pull request as ready for review July 16, 2026 14:21
Comment thread tests/inspect/test_exports.py Fixed
JonasScholl and others added 3 commits July 16, 2026 16:22
…rt' and 'import from''

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Comment thread src/videoipath_automation_tool/apps/inspect/model/common.py Fixed
Comment thread src/videoipath_automation_tool/apps/inspect/app/write.py Fixed
Comment thread src/videoipath_automation_tool/apps/inspect/app/write.py Fixed
Comment thread src/videoipath_automation_tool/apps/inspect/app/write.py Fixed
Comment thread src/videoipath_automation_tool/apps/inspect/app/write.py Fixed
Comment thread tests/e2e/apps/test_profile.py Fixed
@JonasScholl

Copy link
Copy Markdown
Member Author

I have finished all my tasks and incorporated the feedback. From my end, it is ready to be merged.

Comment thread docs/architecture/inspect-app/concepts.md
@PaulWinterstein

Copy link
Copy Markdown
Collaborator

@JonasScholl
LGTM! Great work, Jonas. Thank you for the thorough implementation and documentation.

@PaulWinterstein
PaulWinterstein merged commit 2773911 into main Jul 24, 2026
8 checks passed
@PaulWinterstein
PaulWinterstein deleted the inspect-app-concept branch July 24, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Inspect App support

2 participants