Skip to content

Quality Pass 2: Certificates + destination-script harness + backend/admin test coverage - #39

Merged
MichaelLeeHobbs merged 1 commit into
mainfrom
feature/quality-pass-2
Jul 14, 2026
Merged

Quality Pass 2: Certificates + destination-script harness + backend/admin test coverage#39
MichaelLeeHobbs merged 1 commit into
mainfrom
feature/quality-pass-2

Conversation

@MichaelLeeHobbs

Copy link
Copy Markdown
Owner

Pass 2 of the testing-gaps program — closes the highest-value coverage holes.

  • collection.service unit test (mocked DB): the integration-only gap where update() and the not-found/duplicate Result.error branches were never exercised (6 tests).
  • backend patches: data-source create() duplicate-name ALREADY_EXISTS; global-script DB-failure Result.error.
  • destination-script E2E harness (engine): a real TCP/MLLP send boundary proving a destination-level filter (FILTERED, never sent), transformer (rewrites the wire content + stored CT_SENT), and response transformer (raw ACK stored as CT_RESPONSE, prefixed result as CT_RESPONSE_TRANSFORMED) all work end-to-end. Also fixed the stale queueEnabled→queueMode in the existing pipeline harness.
  • Certificates (the only fully-untested UI surface): e2e spec using a real self-signed PEM + a manual checklist (docs/testing/52-certificates.md, with honest caveats where endpoints like CSR-generation do not exist).
  • admin component tests: AlertEditorPage + GlobalScriptsPage.

Server 998, engine 360, web 99; full build + lint clean; e2e specs typecheck.

Generated in parallel and each self-verified, then integrated + full-suite-verified.

🤖 Generated with Claude Code

https://claude.ai/code/session_01F1ad6jb5mCYxzFVXHbksqi

…admin pages

- collection.service unit test (mocked DB): update()/getById/delete NOT_FOUND,
  update+create ALREADY_EXISTS, field-change patch (6 tests) — closes the
  integration-only gap where update() was never exercised
- data-source.service: create() duplicate-name ALREADY_EXISTS case
- global-script.service: DB-failure Result.error case
- engine destination-scripts.e2e: real TCP/MLLP send boundary proving a
  destination-level filter (FILTERED, no send) + transformer (rewrites wire +
  CT_SENT) + responseTransformer (CT_RESPONSE→CT_RESPONSE_TRANSFORMED) all work;
  fixed stale queueEnabled→queueMode in e2e-pipeline.test.ts
- Certificates: e2e/certificates.spec.ts (real self-signed PEM) + manual
  checklist docs/testing/52-certificates.md (the only fully-untested UI surface)
- admin component tests: AlertEditorPage + GlobalScriptsPage

Server 998, engine 360, web 99; build + lint clean; e2e specs typecheck.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F1ad6jb5mCYxzFVXHbksqi
Copilot AI review requested due to automatic review settings July 14, 2026 23:29
@MichaelLeeHobbs
MichaelLeeHobbs merged commit 03ebfa4 into main Jul 14, 2026
1 of 3 checks passed
@MichaelLeeHobbs
MichaelLeeHobbs deleted the feature/quality-pass-2 branch July 14, 2026 23:29

Copilot AI 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.

Pull request overview

This PR is a “testing gaps” quality pass that expands coverage across the server, engine, and web admin UI, including a new destination-scripts end-to-end harness (real TCP/MLLP boundary) and first-pass Certificates UI E2E coverage plus a manual checklist.

Changes:

  • Add new unit/component tests for server services and web admin pages to cover previously untested branches and interactions.
  • Add engine E2E coverage for destination-level filter/transformer/responseTransformer behavior across a real TCP/MLLP send boundary, plus align an existing pipeline harness with queueMode.
  • Add Certificates E2E spec and accompanying manual testing checklist documentation.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/web/src/pages/tests/GlobalScriptsPage.test.tsx Adds component-level behavior coverage for tab switching and dirty/save behavior.
packages/web/src/pages/tests/AlertEditorPage.test.tsx Adds component-level coverage for create-mode rendering and form interactions.
packages/server/src/services/tests/global-script.service.test.ts Adds a unit test for DB failure handling in GlobalScriptService.getAll().
packages/server/src/services/tests/data-source.service.test.ts Adds coverage for duplicate-name create() returning ALREADY_EXISTS.
packages/server/src/services/tests/collection.service.test.ts Adds mocked-DB unit tests covering update/create/get/delete error branches and duplicate-name guards.
packages/engine/src/tests/e2e-pipeline.test.ts Updates pipeline harness destination config to use queueMode.
packages/engine/src/tests/destination-scripts.e2e.test.ts Introduces a full E2E harness validating destination filter/transform/responseTransform with stored content-type assertions.
e2e/certificates.spec.ts Adds Certificates UI E2E coverage (navigate, import PEM, invalid PEM, delete).
docs/testing/52-certificates.md Adds a manual checklist for Certificates behavior and scope notes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +215 to +234
async function sendMllp(port: number, message: string): Promise<string> {
return new Promise<string>((resolve, reject) => {
const client = net.createConnection({ host: '127.0.0.1', port }, () => {
client.write(wrapMllp(message));
});
const parser = new MllpParser();
client.on('data', (chunk: Buffer) => {
const msgs = parser.parse(chunk);
if (msgs.length > 0) {
client.end();
resolve(msgs[0]!);
}
});
client.on('error', reject);
setTimeout(() => {
client.destroy();
reject(new Error('Timeout waiting for MLLP response'));
}, 10_000);
});
}
Comment on lines +203 to +206
if (destServer) {
destServer.close();
destServer = null;
}
Comment on lines +260 to +266
receiver = new TcpMllpReceiver({
host: '127.0.0.1',
port: SOURCE_PORT,
maxConnections: 10,
// PASSTHROUGH so the (response-transformed) pipeline response reaches the source client.
responseMode: MLLP_RESPONSE_MODE.PASSTHROUGH,
} as never);
Comment thread e2e/certificates.spec.ts
Comment on lines +141 to +164
test('delete certificate with confirmation', async ({ page }) => {
await page.goto('/certificates');
await page.waitForTimeout(1_000);

const certRow = page
.locator('table tbody tr')
.filter({ hasText: TEST_CERT_NAME })
.first();

if (await certRow.isVisible()) {
// Row action is an IconButton with aria-label "Delete certificate"
const deleteBtn = certRow.getByRole('button', { name: /delete certificate/i });
if (await deleteBtn.isVisible()) {
await deleteBtn.click();

// Confirm in the ConfirmDialog (its confirm button reads "Delete")
const confirmBtn = page.getByRole('button', { name: /^delete$/i });
await expect(confirmBtn).toBeVisible({ timeout: 10_000 });
await confirmBtn.click();

await expect(page.getByText(TEST_CERT_NAME)).not.toBeVisible({ timeout: 10_000 });
}
}
});
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.

2 participants