Skip to content

feat(#4286): add connector __schemaVersion leaf and migration - #4315

Open
fullsend-ai-coder[bot] wants to merge 3 commits into
mainfrom
agent/4286-connector-schema-versioning
Open

feat(#4286): add connector __schemaVersion leaf and migration#4315
fullsend-ai-coder[bot] wants to merge 3 commits into
mainfrom
agent/4286-connector-schema-versioning

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

Register per-connector boost.connectors.<id>.__schemaVersion metadata leaves for jira, github, and gitlab with configScope db-only so they survive the validateStoredValues() startup sweep without being stripped.

Add CONNECTOR_SCHEMA_VERSION constant (v1), CONNECTOR_IDS array, and ConnectorId type to schemas.ts. Export these along with ConnectorMigrationFn and ConnectorMigrationRegistry types from the config barrel.

Implement RuntimeConfigResolver.migrateConnectorSchemas() which iterates known connectors on startup, stamps missing versions as v1, and applies sequentially-keyed migration functions when the stored version is behind CONNECTOR_SCHEMA_VERSION. No actual data migrations exist yet (v1 is the initial version); the hook infrastructure is ready for future v1→v2 field changes.

Add TypeScript declarations in config.d.ts for the new field.

Tests cover: leaf registration and db-only scope, Zod validation (positive int, rejects zero/negative/non-integer), survival through validateStoredValues(), migration stamping for missing versions, skip when current, per-connector independence, and cache invalidation after migration.


Closes #4286

Post-script verification

  • Branch is not main/master (agent/4286-connector-schema-versioning)
  • Secret scan passed (gitleaks — e6c850f7dd03d646d614fb0c74f80e7e4b9d0026..HEAD)
  • Pre-commit hooks passed (authoritative run on runner)
  • Tests ran inside sandbox

@fullsend-ai-coder
fullsend-ai-coder Bot requested a review from durandom as a code owner August 14, 2026 12:14
@fullsend-ai-coder fullsend-ai-coder Bot added the ready-for-review Agent PR ready for human review label Aug 14, 2026
@rhdh-gh-app

rhdh-gh-app Bot commented Aug 14, 2026

Copy link
Copy Markdown

Important

This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior.

Changed Packages

Package Name Package Path Changeset Bump Current Version
@red-hat-developer-hub/backstage-plugin-boost-backend workspaces/boost/plugins/boost-backend minor v0.4.0

@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.69231% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.36%. Comparing base (887e675) to head (91fd159).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4315      +/-   ##
==========================================
- Coverage   61.36%   61.36%   -0.01%     
==========================================
  Files        2520     2520              
  Lines      100978   101004      +26     
  Branches    28295    28312      +17     
==========================================
+ Hits        61965    61980      +15     
- Misses      38462    38473      +11     
  Partials      551      551              
Flag Coverage Δ *Carryforward flag
adoption-insights 84.55% <ø> (ø) Carriedforward from 887e675
ai-integrations 73.13% <ø> (ø) Carriedforward from 887e675
app-defaults 69.79% <ø> (ø) Carriedforward from 887e675
augment 46.67% <ø> (ø) Carriedforward from 887e675
boost 78.13% <57.69%> (-0.15%) ⬇️
bulk-import 72.79% <ø> (ø) Carriedforward from 887e675
cost-management 13.55% <ø> (ø) Carriedforward from 887e675
dcm 67.21% <ø> (ø) Carriedforward from 887e675
e2e-adoption-insights 60.00% <ø> (ø) Carriedforward from 887e675
e2e-extensions 62.13% <ø> (ø) Carriedforward from 887e675
e2e-global-header 49.45% <ø> (ø) Carriedforward from 887e675
e2e-homepage 43.49% <ø> (ø) Carriedforward from 887e675
e2e-intelligent-assistant 46.68% <ø> (ø) Carriedforward from 887e675
e2e-orchestrator 50.42% <ø> (ø) Carriedforward from 887e675
e2e-quickstart 55.21% <ø> (ø) Carriedforward from 887e675
e2e-scorecard 50.21% <ø> (ø) Carriedforward from 887e675
e2e-theme 16.36% <ø> (ø) Carriedforward from 887e675
extensions 56.59% <ø> (ø) Carriedforward from 887e675
global-floating-action-button 71.18% <ø> (ø) Carriedforward from 887e675
global-header 66.50% <ø> (ø) Carriedforward from 887e675
homepage 47.59% <ø> (ø) Carriedforward from 887e675
install-dynamic-plugins 59.95% <ø> (ø) Carriedforward from 887e675
intelligent-assistant 75.42% <ø> (ø) Carriedforward from 887e675
konflux 91.98% <ø> (ø) Carriedforward from 887e675
lightspeed 69.02% <ø> (ø) Carriedforward from 887e675
mcp-integrations 83.40% <ø> (ø) Carriedforward from 887e675
orchestrator 70.87% <ø> (ø) Carriedforward from 887e675
quickstart 63.74% <ø> (ø) Carriedforward from 887e675
sandbox 79.56% <ø> (ø) Carriedforward from 887e675
scorecard 87.36% <ø> (ø) Carriedforward from 887e675
theme 88.91% <ø> (ø) Carriedforward from 887e675
translations 5.12% <ø> (ø) Carriedforward from 887e675
x2a 79.20% <ø> (ø) Carriedforward from 887e675

*This pull request uses carry forward flags. Click here to find out more.


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 887e675...91fd159. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mareklibra

Copy link
Copy Markdown
Member

/fs-fix changeset and all known issues so far (like CI)

@fullsend-ai-coder

fullsend-ai-coder Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Finished Fix · ✅ Success · Started 6:51 AM UTC · Completed 7:07 AM UTC

Commit: 7f412b3 · View workflow run →

fullsend-ai-coder Bot added a commit that referenced this pull request Aug 17, 2026
Add changeset for connector schema versioning feature. Export
CONNECTOR_SCHEMA_VERSION, CONNECTOR_IDS, ConnectorId,
ConnectorMigrationFn, and ConnectorMigrationRegistry from the
package entry point to fix ae-forgotten-export API report warnings.
Regenerate API reports for boost-backend and boost packages.

Addresses review feedback on #4315
@fullsend-ai-coder

Copy link
Copy Markdown
Contributor Author

🔧 Fix agent — iteration 1 (human-triggered)

Addressed all 3 known issues: added missing changeset, exported new types from package entry point, and regenerated API reports. All 455 tests pass, prettier check passes, and API reports pass CI validation.

Fixed (3):

  1. missing changeset for boost-backend (workspaces/boost/.changeset/connector-schema-versioning.md): Added minor changeset for @red-hat-developer-hub/backstage-plugin-boost-backend covering the new connector __schemaVersion leaf and migration infrastructure
  2. CI failure: API report has ae-forgotten-export warning for ConnectorMigrationRegistry (workspaces/boost/plugins/boost-backend/src/index.ts): Exported CONNECTOR_SCHEMA_VERSION, CONNECTOR_IDS, ConnectorId, ConnectorMigrationFn, and ConnectorMigrationRegistry from the package entry point to resolve ae-forgotten-export API extractor warnings
  3. CI failure: stale API reports after new exports added (workspaces/boost/plugins/boost-backend/report.api.md): Regenerated API reports for boost-backend and boost packages to include the new connector schema versioning types and constants

Tests: passed

Updated by fullsend fix agent

@mareklibra

Copy link
Copy Markdown
Member

/fs-fix rebase and make sure the CI passes

@fullsend-ai-coder

fullsend-ai-coder Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Finished Fix · ❌ Failure · Started 7:33 AM UTC · Completed 7:47 AM UTC

Commit: cf26102 · View workflow run →

Register per-connector `boost.connectors.<id>.__schemaVersion`
metadata leaves for jira, github, and gitlab with configScope
`db-only` so they survive the `validateStoredValues()` startup
sweep without being stripped.

Add `CONNECTOR_SCHEMA_VERSION` constant (v1), `CONNECTOR_IDS`
array, and `ConnectorId` type to schemas.ts. Export these along
with `ConnectorMigrationFn` and `ConnectorMigrationRegistry`
types from the config barrel.

Implement `RuntimeConfigResolver.migrateConnectorSchemas()` which
iterates known connectors on startup, stamps missing versions as
v1, and applies sequentially-keyed migration functions when the
stored version is behind `CONNECTOR_SCHEMA_VERSION`. No actual
data migrations exist yet (v1 is the initial version); the hook
infrastructure is ready for future v1→v2 field changes.

Add TypeScript declarations in config.d.ts for the new field.

Tests cover: leaf registration and db-only scope, Zod validation
(positive int, rejects zero/negative/non-integer), survival
through validateStoredValues(), migration stamping for missing
versions, skip when current, per-connector independence, and
cache invalidation after migration.

Closes #4286
Add changeset for connector schema versioning feature. Export
CONNECTOR_SCHEMA_VERSION, CONNECTOR_IDS, ConnectorId,
ConnectorMigrationFn, and ConnectorMigrationRegistry from the
package entry point to fix ae-forgotten-export API report warnings.
Regenerate API reports for boost-backend and boost packages.

Addresses review feedback on #4315
@mareklibra
mareklibra force-pushed the agent/4286-connector-schema-versioning branch from cf26102 to 84f0837 Compare August 17, 2026 08:37
@mareklibra

Copy link
Copy Markdown
Member

Rebased manually

@mareklibra
mareklibra force-pushed the agent/4286-connector-schema-versioning branch from bee573b to 91fd159 Compare August 17, 2026 09:15
@sonarqubecloud

Copy link
Copy Markdown

@mareklibra

Copy link
Copy Markdown
Member

/fs-review

@fullsend-ai-review

fullsend-ai-review Bot commented Aug 17, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 9:29 AM UTC · Completed 9:49 AM UTC

Commit: 91fd159 · View workflow run →

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

Medium

  • [logic-error] workspaces/boost/plugins/boost-backend/src/config/RuntimeConfigResolver.ts:497 — When storedVersion is undefined (no __schemaVersion in DB), the code stamps CONNECTOR_SCHEMA_VERSION directly and continues without running any migrations. The comment says "treating as v1" but the behavior is "stamp as current version." When CONNECTOR_SCHEMA_VERSION is bumped above 1, a connector from a pre-versioning deployment (with existing DB overrides but no stored version) will be stamped at the new version without running the v1→v2→...→vN migrations on its existing data.
    Remediation: When storedVersion is undefined, set effectiveVersion = 1 and fall through to the migration loop (so intermediate migrations run) instead of using continue.

  • [test-inadequate] workspaces/boost/plugins/boost-backend/src/config/RuntimeConfigResolver.test.ts — The migration tests cannot exercise the actual migration code path. Since CONNECTOR_SCHEMA_VERSION = 1 and the Zod schema rejects values below 1 (z.number().int().positive()), no stored version can be less than the current version — the for (fromVersion = storedVersion; fromVersion < CONNECTOR_SCHEMA_VERSION; ...) loop is unreachable. Multiple test comments acknowledge this (e.g., "Since CONNECTOR_SCHEMA_VERSION is 1 and stored is 1, no migration runs"). When CONNECTOR_SCHEMA_VERSION is bumped to 2, the migration loop will run for the first time in production with zero test coverage.
    Remediation: Add at least one test that overrides CONNECTOR_SCHEMA_VERSION (e.g., via jest.mock or by extracting a parameter) to verify the migration loop, sequential application, and version stamping.

  • [stale-doc] workspaces/boost/openspec/changes/connector-config-hot-reload/specs/config-schemas/spec.md:16 — The Jira/GitHub/GitLab connector config schema scenarios list fields exhaustively and assert "all fields are configScope: db-overridable." This PR adds __schemaVersion with configScope: db-only, making both the field lists and the scope assertion incorrect. Line 85 of the same file already described __schemaVersion with db-only scope, creating an internal inconsistency.
    Remediation: Add __schemaVersion to each connector's field list and qualify the scope assertion (e.g., "all user-facing fields are configScope: db-overridable; __schemaVersion is configScope: db-only").

Low

  • [edge-case] workspaces/boost/plugins/boost-backend/src/config/RuntimeConfigResolver.ts:523 — The migration loop has no error handling around individual migrationFn calls. If a migration function throws, partially-applied changes remain in the DB but the version is not stamped. On next startup, earlier successful migrations would re-run.
    Remediation: Either stamp the version after each successful migration step, or document that all migration functions must be idempotent.

  • [edge-case] workspaces/boost/plugins/boost-backend/src/config/RuntimeConfigResolver.ts:510 — The storedVersion >= CONNECTOR_SCHEMA_VERSION guard silently treats a stored version higher than current as current (no warning). After a rollback/downgrade, data written by a newer schema version would be consumed without any alert.
    Remediation: Log a warning when storedVersion > CONNECTOR_SCHEMA_VERSION.

  • [pattern-inconsistency] workspaces/boost/plugins/boost-backend/src/config/schemas.ts:462 — The three __schemaVersion field definitions are identical except for the connector label. The existing codebase uses factory functions (connectorEnabled, connectorEndpoint, connectorIntervalMs, connectorBatchSize) for per-connector field duplication.
    Remediation: Extract a connectorSchemaVersion(label) factory function.

  • [code-organization] workspaces/boost/plugins/boost-backend/config.d.ts:178__schemaVersion is placed as the first property in each connector block (before enabled). The existing convention orders user-facing fields first; internal db-only metadata should go last.

  • [code-organization] workspaces/boost/plugins/boost-backend/src/config/schemas.ts:462 — The three __schemaVersion entries are grouped in a dedicated block rather than placed within each connector's existing section comment block (// -- Connector config: Jira -- etc.), splitting connector config across two locations.

  • [naming-convention] workspaces/boost/plugins/boost-backend/src/config/schemas.ts:190CONNECTOR_SCHEMA_VERSION omits the BOOST_ prefix used by BOOST_CONFIG_SCHEMA_VERSION. Other public exports from this module use the boost/Boost namespace prefix.

  • [scope-vs-checklist] workspaces/boost/plugins/boost-backend/src/config/schemas.ts:182 — AGENTS.md step 3 requires bumping BOOST_CONFIG_SCHEMA_VERSION when adding new boost.* config keys. The PR does not bump it. The __schemaVersion fields are internal metadata that are part of the versioning infrastructure itself, so an exemption is reasonable but should be documented.

  • [scope-boundary] workspaces/boost/plugins/boost-backend/src/config/RuntimeConfigResolver.ts:167migrateConnectorSchemas() is public and exported from the package entry point but has no caller in this PR. The public API commitment is intentional per the issue scope.

  • [incomplete-doc] workspaces/boost/openspec/changes/connector-config-hot-reload/tasks.md:89 — Documentation task 8.2 lists configScope values as yaml-only and db-overridable, omitting db-only which is now used by __schemaVersion fields.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the review comment for full details.


Note: The following inline comments could not be posted on the diff (GitHub returned 422) and are included here instead:

  • workspaces/boost/plugins/boost-backend/src/config/RuntimeConfigResolver.ts (file-level): Line 497 · [medium] logic-error

When storedVersion is undefined (no __schemaVersion in DB), the code stamps CONNECTOR_SCHEMA_VERSION directly and continues without running any migrations. The comment says 'treating as v1' but the behavior is 'stamp as current version.' When CONNECTOR_SCHEMA_VERSION is bumped above 1, a connector from a pre-versioning deployment will be stamped at the new version without running intermediate migrations on its existing data.

Suggested fix: When storedVersion is undefined, set effectiveVersion = 1 and fall through to the migration loop instead of using continue.

  • workspaces/boost/plugins/boost-backend/src/config/RuntimeConfigResolver.ts (file-level): Line 523 · [low] edge-case

The migration loop has no error handling around individual migrationFn calls. If a migration function throws, partially-applied changes remain in the DB but the version is not stamped. On next startup, earlier successful migrations would re-run.

Suggested fix: Either stamp the version after each successful migration step, or document that all migration functions must be idempotent.

  • workspaces/boost/plugins/boost-backend/src/config/RuntimeConfigResolver.ts (file-level): Line 510 · [low] edge-case

The storedVersion >= CONNECTOR_SCHEMA_VERSION guard silently treats a stored version higher than current as current. After a rollback, data from a newer schema is consumed without warning.

Suggested fix: Log a warning when storedVersion > CONNECTOR_SCHEMA_VERSION.

  • workspaces/boost/plugins/boost-backend/src/config/schemas.ts:462: [low] pattern-inconsistency

The three __schemaVersion field definitions are identical except for the connector label. The existing codebase uses factory functions for per-connector field duplication.

Suggested fix: Extract a connectorSchemaVersion(label) factory function following the pattern of connectorEnabled() etc.

  • workspaces/boost/plugins/boost-backend/config.d.ts:178: [low] code-organization

__schemaVersion is placed as the first property in each connector block (before enabled). Existing convention orders user-facing fields first; internal db-only metadata should go last.

Suggested fix: Move __schemaVersion to the end of each connector's property block.

  • workspaces/boost/plugins/boost-backend/src/config/schemas.ts:462: [low] code-organization

The three __schemaVersion entries are in a dedicated block rather than within each connector's existing section comment block, splitting connector config across two locations.

Suggested fix: Place each __schemaVersion entry within its connector's existing section comment block.

  • workspaces/boost/plugins/boost-backend/src/config/schemas.ts:190: [low] naming-convention

CONNECTOR_SCHEMA_VERSION omits the BOOST_ prefix used by BOOST_CONFIG_SCHEMA_VERSION. Other public exports from this module use the boost/Boost namespace prefix.

Suggested fix: Rename to BOOST_CONNECTOR_SCHEMA_VERSION.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Agent PR ready for human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Connector Config — Schema versioning leaf and migration (boost.connectors.__schemaVersion)

1 participant