fix: report active platform adapters in health endpoint#2
Conversation
The Settings page showed all non-Web adapters as "Not configured" because the health endpoint hardcoded `adapter: 'web'` and the frontend only checked that single string. Changes: - Add `activeAdapters` string array to health endpoint response, built from env-var flags for each configured adapter - Update `registerApiRoutes` signature to accept `activeAdapters` - Update `PlatformConnectionsSection` to use `activeAdapters` array instead of hardcoded `false` values - Add Gitea and GitLab to the Settings platform list - Update all test call sites for new `registerApiRoutes` signature Fixes #1 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🔍 Comprehensive PR ReviewPR: #2 — fix: report active platform adapters in health endpoint SummaryThis PR cleanly extends the health endpoint with Verdict: ✅
🟢 Low Issues (All Optional)1.
|
| # | Issue | Location | Agent |
|---|---|---|---|
| 5 | No startup log for computed activeAdapters list — operators can't verify adapter detection from logs alone |
index.ts:422 |
error-handling |
| 6 | activeAdapters array construction logic not unit-tested (lives in main()) |
index.ts:421-431 |
test-coverage |
| 7 | Health test only exercises activeAdapters: ['web'], not multi-adapter scenarios |
api.health.test.ts |
test-coverage |
| 8 | PlatformConnectionsSection has no React unit tests (no prior tests existed; not a regression) |
SettingsPage.tsx |
test-coverage |
| 9 | ?? [] fallback in PlatformConnectionsSection intentional and safe; parent SettingsPage renders error banner on health failure |
SettingsPage.tsx:538 |
error-handling |
For #6: Optional — extract buildActiveAdapters(env) and add a small unit test for flag permutations.
For #7: Optional addition to api.health.test.ts:
test('returns all active adapters when multiple are configured', async () => {
registerApiRoutes(app, mockWebAdapter, mockLockManager, ['web', 'slack', 'github']);
const body = await app.request('/api/health').then(r => r.json());
expect(body.activeAdapters).toEqual(['web', 'slack', 'github']);
});✅ What's Good
- Scope discipline:
adapter: 'web'backward-compat field preserved exactly as required - Env-var detection rationale documented: Routing-order constraint explained in scope artifact and inline comment
- All 6 test files updated atomically: No leftover callers with the old 3-argument
registerApiRoutessignature - Frontend null-safety:
activeAdapters ?? []correctly handles loading state; parent manages error display - No new abstractions:
string[]used throughout — correctly follows YAGNI (no speculativeAdapterNameunion type) hasSlackconsistency: Mirrors existinghas*flags in naming and computation style exactly- Gitea/GitLab wired through the same
activeAdapterspath: Consistent with all other platform adapters - No
anytypes: Full type safety maintained throughout - Env-var consistency for Slack:
hasSlackuses same vars as the Slack adapter initialization block — no drift risk
📋 Suggested Follow-up Issues (if not fixing in this PR)
| Title | Priority |
|---|---|
Move hasSlack to has* flags group; add Slack to startup warning guard |
P3 |
| Update health endpoint curl example in API docs | P3 |
Add startup log for activeAdapters at server init |
P3 |
Extract buildActiveAdapters() and add unit tests |
P3 |
| Add multi-adapter health endpoint test scenario | P3 |
Next Steps
- ✅ No auto-fixes needed — no CRITICAL or HIGH issues
- 📝 Consider applying issues 1, 2, and 3 above (all simple one-liner fixes) before marking ready
- 🚀 Remove draft flag when ready to merge
⚠️ No CI checks present on this branch — consider adding them
Reviewed by Archon comprehensive-pr-review workflow
Artifacts: /home/staxed/.archon/workspaces/Staxed/Archon/artifacts/runs/1ea595fd66d73460ff18947ab857f502/review/
Fixed: - Move hasSlack to has* flags group at line 239 (was 180+ lines away from peers) - Add hasSlack to no_platform_adapters_configured warning guard (pre-existing bug) - Improve activeAdapters comment to explain why env-var flags are used over instance checks - Add server.adapters_registered startup log for operator visibility - Add multi-adapter health endpoint test (echoes back full adapter list) - Update /api/health example in docs to include activeAdapters field Skipped: - PlatformConnectionsSection React tests (requires RTL setup; not in PR scope) - Health endpoint try/catch around getRunningWorkflows (pre-existing, out of scope) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix Report: PR #2Date: 2026-04-07T00:00:00Z SummaryAll 9 LOW-severity review findings were triaged. 6 were fixed directly (code style, pre-existing bug, comment quality, missing log, missing test, outdated docs). 2 were intentionally skipped as they require architectural/testing setup work outside the PR scope. 1 was confirmed safe/intentional (the Fixes Applied
Tests Added
Docs Updated
Skipped Findings
Blocked (Could Not Fix)(none) Suggested Follow-up Issues(none — all actionable items were addressed or intentionally deferred with reasons above) Validation
|
Summary
activeAdapters: string[]built from env-var flags;PlatformConnectionsSectionuses array membership instead of hardcodedfalse; added Gitea and GitLab to the display listadapter: 'web'field is preserved for backward compatibility; no runtime adapter health-check was addedUX Journey
Before
After
Architecture Diagram
Before
After
Connection inventory:
index.tshas* flagsregisterApiRoutesactiveAdaptersparam addedapi.tshealth handlerHealthResponseschemaactiveAdapters: z.array(z.string())addedapi.tshealth handleractiveAdaptersfield addedapi.tsregisterApiRoutesactiveAdapters: string[]param addedweb/lib/api.tsHealthResponseactiveAdapters: string[]addedSettingsPagePlatformConnectionsSectionadapter: string→activeAdapters: string[]Label Snapshot
risk: lowsize: Sserver,webserver:health,web:settingsChange Metadata
bugmultiLinked Issue
Validation Evidence (required)
bun run validateoutput invalidation.mdartifactSecurity Impact (required)
activeAdaptersexposes only platform names, not tokensCompatibility / Migration
adapter: 'web'field preserved;activeAdaptersis additiveHuman Verification (required)
bun run validate(type-check + lint + format + tests) passed cleanactiveAdapters ?? []to handle old server responses gracefullySide Effects / Blast Radius (required)
GET /api/healthresponse shape (additive), Settings page UIadapterfield untouched; no routing changesRollback Plan (required)
git revertthe single commit; no DB changes to undoRisks and Mitigations