Skip to content

fix(import): only count new page components against free slots - #3100

Open
chrisblaschke wants to merge 1 commit into
openstatusHQ:mainfrom
chrisblaschke:fix/import-component-limit
Open

chrisblaschke wants to merge 1 commit into
openstatusHQ:mainfrom
chrisblaschke:fix/import-component-limit

Conversation

@chrisblaschke

@chrisblaschke chrisblaschke commented Nov 18, 2026 •

Copy link
Copy Markdown

A repeat import can skip new components even when there's room. The import trims the list to the number of free slots before checking which components already exist.

Only spend a slot after inserting a new component. The regression test re-imports a page with one slot left, then checks that a full workspace still marks the component phase as skipped.

Found and fixed with AI agents (GPT-6.2 Sol in Pi). The test was re-run on your current main before opening this.

View guided diff

@vercel

vercel Bot commented Nov 18, 2026

Copy link
Copy Markdown

@chrisblaschke is attempting to deploy a commit to the OpenStatus Team on Vercel.

A member of the Team first needs to authorize it.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/services/src/import/phase-writers.ts">

<violation number="1" location="packages/services/src/import/phase-writers.ts:300">
P1: This early return bypasses idempotency resolution when the workspace is full, so existing components never enter `componentIdMap`. A full-workspace re-import can therefore create or reconcile incidents, maintenances, or subscribers without their component links; resolve existing components before applying the capacity skip.</violation>
</file>

Reply to a comment to ask cubic a question or push back. It learns from your replies.

View guided diff | Re-trigger cubic

.where(eq(pageComponent.workspaceId, workspaceId));
const maxComponents = ctx.workspace.limits["page-components"];
let remaining = maxComponents - (existingCount?.count ?? 0);
if (remaining <= 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1: This early return bypasses idempotency resolution when the workspace is full, so existing components never enter componentIdMap. A full-workspace re-import can therefore create or reconcile incidents, maintenances, or subscribers without their component links; resolve existing components before applying the capacity skip.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/services/src/import/phase-writers.ts, line 300:

<comment>This early return bypasses idempotency resolution when the workspace is full, so existing components never enter `componentIdMap`. A full-workspace re-import can therefore create or reconcile incidents, maintenances, or subscribers without their component links; resolve existing components before applying the capacity skip.</comment>

<file context>
@@ -287,6 +287,24 @@ export async function writeComponentsPhase(
+    .where(eq(pageComponent.workspaceId, workspaceId));
+  const maxComponents = ctx.workspace.limits["page-components"];
+  let remaining = maxComponents - (existingCount?.count ?? 0);
+  if (remaining <= 0) {
+    for (const resource of phase.resources) {
+      resource.status = "skipped";
</file context>

This branch has not been deployed

No deployments
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