Skip to content

[codex] Fix autoscan plugin bindings and poll status - #75

Merged
Quick104 merged 2 commits into
mainfrom
codex/autoscan-plugin-id-status
Jun 7, 2026
Merged

Quick104 merged 2 commits into
mainfrom
codex/autoscan-plugin-id-status

Conversation

@Quick104

@Quick104 Quick104 commented Jun 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Replace autoscan durable source/event binding from installation IDs to plugin_id + capability_id.
  • Resolve scan-source plugins through the current installed plugin by plugin_id, while keeping installation IDs internal to pluginhost.
  • Add explicit running poll status to the autoscan status API and admin Activity page.

Why

Autoscan sources could become orphaned after uninstall/reinstall because they were durably bound to installation_id. The old event placeholder also displayed poll started but did not finish while a poll was merely still running, which made live CephFS polls look failed.

Validation

  • go test ./cmd/silo ./internal/autoscan ./internal/api ./internal/plugins
  • cd web && pnpm run lint (passes with existing warnings)
  • cd web && pnpm exec tsc -b --pretty false
  • cd web && pnpm exec prettier --check src/pages/admin/autoscan/ActivityPanel.tsx src/api/types.ts src/hooks/queries/useAutoscan.ts
  • make migrate-validate
  • make verify-local-paths

Notes

  • Repo-wide cd web && pnpm run format:check still fails on 17 pre-existing unrelated files; touched frontend files pass Prettier directly.

AI Use

Implemented with OpenAI Codex.

Summary by CodeRabbit

  • New Features

    • Track and display actively running autoscan polls with elapsed time in the status endpoint and activity panel.
    • Event status filter now supports "Running" status to identify in-progress polls.
  • Enhancement

    • Autoscan source identification now uses plugin IDs instead of installation IDs, improving clarity in API requests, responses, and UI displays.

@coderabbitai

coderabbitai Bot commented Jun 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e16ef02b-a01f-4412-ac8b-6e8de92f5c12

📥 Commits

Reviewing files that changed from the base of the PR and between a3fb758 and 9692527.

📒 Files selected for processing (4)
  • internal/autoscan/errors.go
  • internal/autoscan/repository.go
  • internal/autoscan/service.go
  • internal/autoscan/service_test.go
✅ Files skipped from review due to trivial changes (1)
  • internal/autoscan/errors.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/autoscan/repository.go

📝 Walkthrough

Walkthrough

This PR migrates autoscan identity from installation-ID integers to plugin-ID strings across the full stack and adds running-event state with status reporting and UI for live polls.

Changes

Autoscan plugin-ID binding and running polls

Layer / File(s) Summary
Domain types and frontend DTOs
internal/autoscan/types.go, internal/autoscan/discovery.go, web/src/api/types.ts
Replace installation_id with plugin_id across Source/Event/EventCreate/Scan types; add "running" status and AutoscanRunningPoll/running_polls in API types.
Frontend label utils and cache invalidation
web/src/lib/autoscanLabels.ts, web/src/lib/autoscanLabels.test.ts, web/src/hooks/queries/useAutoscan.ts
Key display-name lookups by (plugin_id, capability_id); update label composition/tests; invalidate status/events queries after trigger.
Database migrations
migrations/sql/20260607201204_autoscan_plugin_id_binding.sql, migrations/sql/20260607204951_autoscan_running_polls.sql
Add/backfill plugin_id for autoscan_sources/events, create plugin-capability indexes, remove installation_id, and allow running in status constraint (Down converts running→error).
Repository persistence and event lifecycle
internal/autoscan/repository.go
Persist and scan plugin_id; CreateEvent inserts running events with advisory-lock guarding for per-source concurrency; add MarkInterruptedEvents() and ListRunningEvents(); LatestEventAt ignores running rows.
Provider and service logic
internal/autoscan/provider.go, internal/autoscan/service.go
Provider/resolver APIs take pluginID strings; PollOnce uses src.PluginID, createEvent returns (id, started) and treats ErrPollAlreadyRunning as skip; orphan-pruning removed.
Plugin service resolver and wiring
internal/plugins/service.go, internal/api/autoscan_wiring.go
Add Service.ScanSourceClientByPluginID to resolve the enabled installation for a (pluginID, capabilityID); autoscan wiring and lister emit PluginID.
API handlers and status endpoint
internal/api/handlers/autoscan.go
Handlers use plugin_id in payloads/responses, validate (plugin_id, capability_id) pairs, allow running filter, and include running_polls with elapsed ms in status responses (store interface adds ListRunningEvents).
Startup recovery
cmd/silo/main.go
Call MarkInterruptedEvents at autoscan task startup to mark previously-running polls as errored.
Backend tests and new test coverage
internal/api/handlers/autoscan_test.go, internal/autoscan/*_test.go, internal/plugins/service_scan_source_test.go
Update fixtures/assertions to plugin_id, add fake store ListRunningEvents hook, add PollOnce skip-on-running test and resolution-failure recording test, add plugin-resolution tests.
Frontend UI: Activity & Sources panels
web/src/pages/admin/autoscan/ActivityPanel.tsx, web/src/pages/admin/autoscan/SourcesPanel.tsx
Render running polls with running-aware timestamp and elapsed duration; source naming and AddSource flow use plugin_id:capability_id keys and send plugin_id in create mutation.

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly Related PRs

  • Silo-Server/silo-server#48: Modifies autoscan task wiring in cmd/silo/main.go; related to startup wiring changes here.
  • Silo-Server/silo-server#44: Prior autoscan v2 and poll-loop wiring work; this PR continues migrating identity and wiring to plugin-based resolution.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.88% 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 The PR title directly summarizes the main change: transitioning autoscan plugin bindings from installation IDs to plugin IDs, and adding poll status tracking.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/autoscan-plugin-id-status

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

@Quick104
Quick104 marked this pull request as ready for review June 7, 2026 21:07
@Quick104
Quick104 merged commit 8cd29e8 into main Jun 7, 2026
1 check passed
@Quick104
Quick104 deleted the codex/autoscan-plugin-id-status branch June 7, 2026 21:18
Quick104 added a commit that referenced this pull request Jun 7, 2026
* fix(autoscan): bind sources by plugin id

* fix(autoscan): skip overlapping source polls
Quick104 added a commit that referenced this pull request Jun 17, 2026
* fix(autoscan): bind sources by plugin id

* fix(autoscan): skip overlapping source polls
Quick104 added a commit to Rhainland/silo-server that referenced this pull request Nov 17, 2026
Main moved to translations release 2026.11.17-41be401. Re-synced the web
catalog with --local from Silo-Server/silo-translations#75 merged with that
catalog's main, so keys.ts carries both. Re-sync with --version once Silo-Server#75
merges and a release includes its strings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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