Skip to content

test(resources): consolidate 3 promoted QA tests into one shared-instance suite#1884

Open
kriszyp wants to merge 1 commit into
mainfrom
kris/qa-consolidate-resources
Open

test(resources): consolidate 3 promoted QA tests into one shared-instance suite#1884
kriszyp wants to merge 1 commit into
mainfrom
kris/qa-consolidate-resources

Conversation

@kriszyp

@kriszyp kriszyp commented Jul 21, 2026

Copy link
Copy Markdown
Member

What

Merges three promoted resources/ regression anchors that each booted their own Harper instance into a single suite that boots one shared instance:

  • relationship-parent-delete-cascade.test.ts (QA-196)
  • relationship-transaction-atomicity.test.ts (QA-162)
  • resource-status-contract.test.ts (QA-195)

relationship-and-status-contract.test.ts — one outer suite() with a single before/after, three nested suites (one per QA-id) preserving every original test() verbatim, over a merged fixture. 3 Harper boots → 1.

All three used vanilla-default config and their schemas were disjoint/identical, so no namespacing was required.

Why

Each promoted test file pays a full Harper process boot — the dominant integration-test cost. Tests within a file share one instance, so co-locating compatible anchors removes redundant boots without losing coverage. This is the first, exemplar application of the instance-affinity policy just added to the qa-explorer promotion pipeline; it also creates a host suite future promotions can append into rather than minting new files.

Verification

npm run test:integration -- integrationTests/resources/relationship-and-status-contract.test.ts:

tests 16 · pass 16 · fail 0 · duration_ms ~6526 (single boot)

Same assertions and documented findings as the originals (QA-195's 5 documented status-contract findings are unchanged pre-existing behavior, not new failures). oxlint + prettier clean on the new files.

Note: npm run build surfaces a TS2345 in resources/DatabaseTransaction.ts that is pre-existing on main (confirmed via stash) and unrelated to this change; tsc still emits dist.

Scope

First of a possible series. The larger database/ groups (~9-scenario merge) are held pending a review of merged-file size vs. benefit; harper-pro cluster tests net zero and are intentionally excluded.

— KrAIs (Claude Opus 4.8)

🤖 Generated with Claude Code

relationship-parent-delete-cascade, relationship-transaction-atomicity, and
resource-status-contract each booted their own vanilla-default Harper
instance. Their fixtures are schema-compatible (identical Order/OrderItem
schema in the two relationship tests, a disjoint Kv table in the status-
contract test, no route/table name collisions), so merge them into one
relationship-and-status-contract suite that boots a single shared instance,
grouped by originating QA-id with a consolidated fixture (schema.graphql +
resources.js). Cuts the integration-test boot count for this scenario group
from 3 to 1.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@kriszyp
kriszyp requested review from Ethan-Arrowood and heskew July 21, 2026 12:15

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request consolidates three separate integration test suites (QA-196, QA-162, and QA-195) into a single, shared-instance test suite to optimize execution time by reducing redundant database boots. It merges their schemas, configurations, and custom resource handlers while deleting the obsolete individual test directories. The feedback suggests replacing fixed sleeps with converging polls when verifying background operations in the integration tests to prevent race conditions and flakiness.

const delResult = await restDelete(`/Order/${orderId}`);
console.log(`\n[QA-196 P1 engine=${ENGINE}] DELETE /Order/${orderId} → status=${delResult.status}`);

await sleep(400);

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.

medium

When verifying background operations (such as index backfills or database reindexing) in integration tests, wrap the verification checks in a converging poll (retrying until the expected state is reached) instead of using fixed sleeps (e.g., sleep(400)) to prevent race conditions and test flakiness. This pattern is also used on lines 289, 361, 419, 463, 480, 579, 679, and 745.

References
  1. When verifying background operations (such as index backfills or database reindexing) after a service restart in integration tests, wrap the verification checks in a converging poll (retrying until the expected state is reached) to prevent race conditions and test flakiness.

@claude

claude Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Reviewed; no blockers found.

@kriszyp
kriszyp marked this pull request as ready for review July 22, 2026 03:04
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