Skip to content

[quality] src/server (GitHub App server) is never executed: entry point at 0 % lines, default background arm unpinned, dist-server bundle never built-and-run by any test #610

Closed

Description

@hivecommons-hive

Finding

#608 added the GitHub App adapter (src/adapters/app/) and its Node server (src/server/), shipped as a separate ncc bundle (dist-server/index.js, built by npm run pack:server and run by the Dockerfile). vitest.e2e-coverage.config.mjs excludes src/adapters/app/** and src/server/** from the bundle-coverage run with the note "unit coverage holds them to 100%". At main@282b8e0 that is not what the unit run reports:

file lines miss
src/server/main.ts 0 % line 3 — the entry point main() call is never executed
src/server/node.ts 94.7 % line 24 — buildReceiver's default background (every test overrides it); branch at line 47, the env.PORT ?? 8080 default
src/adapters/app/webhook.ts 100 % lines, 93.75 % branches line 65 — the String(error) arm when building the platform throws a non-Error

Separately, nothing executes the server as shipped. __tests__/bundle/ runs the committed dist/index.js end to end and selfContained.test.ts checks its require() list, but dist-server/ is gitignored, test.yml builds it (npm run pack) only after test:coverage, and no test reads or boots it. An ncc-specific breakage in the server bundle (a leaked require, a dynamic import ncc cannot follow, a node: prefix issue in hono / @octokit/auth-app) would pass CI and fail at docker run.

Evidence / provenance

  • Unit: npx vitest run --coverage on main@282b8e0, local — All files 99.88 / 99.54 / 99.82 / 99.88; src/server/main.ts 0 % lines; src/server/node.ts 94.73 % lines, 75 % branches; src/adapters/app/webhook.ts 93.75 % branches. The run is green because the floor in vitest.config.mjs is 99.
  • End-to-end (bundle): vitest.e2e-coverage.config.mjs coverage.exclude: ['src/adapters/app/**', 'src/server/**'] — these paths are by design absent from the e2e figure, so there is no e2e evidence to combine; this finding uses unit data only.
  • Shipped bundle: npm run pack:server (14.7 s locally) produced a self-contained bundle that, copied to a directory with no node_modules, answered /healthz 200, a signed ping with pong 200 and an unsigned one with 401 — i.e. it works today, and nothing pins that.

Recommendation

One PR, cluster src/server/** + src/adapters/app/webhook.ts:65:

  • __tests__/server/main.test.ts — mirror of __tests__/main.test.ts: loading the entry point calls main() once with no arguments.
  • __tests__/server/node.test.ts — with buildReceiver's default background, a signed delivery through buildApp is answered 202 while its dispatch is still pending.
  • __tests__/adapters/app/webhookNonErrorThrow.test.ts — receiveWebhook answers 400 unusable delivery and logs the thrown value when appPlatform throws a non-Error.
  • __tests__/server/bundle.test.ts — build src/server/main.ts with ncc into a temp directory outside the repository (so a leaked require cannot resolve), boot it there, and check the require() list, the JSON listening on :<port> line, /healthz, a signed ping and an unsigned rejection. Building inside the test is what makes it run in npm test and test:coverage without reordering test.yml.

Decision taken by hive: the env.PORT ?? 8080 default (node.ts:47) is left unpinned — reaching it means binding port 8080 on the runner, which is not something a unit test should depend on. If the maintainers want the comment in vitest.e2e-coverage.config.mjs to stay true, that arm is the one line that keeps src/server under 100 % branches after the PR.

Priority

  • Impact: medium — a new deployment path (Docker image, beta) with its entry point and shipped artifact never executed by any suite
  • Effort: low

Filed by quality agent (hold-gated mode)


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: d8f3f5b

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

Activity

  1. added
    testingCreated by Hive for agent-filed issue provenance
    agent/qualityCreated by Hive for agent-filed issue provenance
    on Oct 29, 2026
  2. github-actions commented on Oct 29, 2026

    @github-actions
    Contributor

    Please add a kind label with /kind feature, /kind failing-test or /kind cleanup.

  3. hivecommons-hive commented on Oct 29, 2026

    @hivecommons-hive
    ContributorAuthor

    Folded finding. This was filed as a separate issue, but 1 open agent-filed issue (plus 3 closed as completed in the last 14 days) already cite vitest.e2e-coverage.config.mjs, so it was folded into the oldest of them instead of opening another. Treat this issue as the tracker for that component: prefer one structural fix that covers every folded variant over a PR per variant.

    [quality] #614's App cron arms landed below the unit floor (cron.ts:85, node.ts:67/82); the e2e config's 'unit holds app/server at 100%' premise has no gate

    Finding

    vitest.e2e-coverage.config.mjs:45-47 excludes src/adapters/app/** and src/server/** from the bundle-coverage run with the note "unit coverage holds them to 100%". Nothing enforces that premise: vitest.config.mjs:22-27 carries only a global 99 % floor, and the rest of src/ is large enough to absorb whole uncovered arms in the App adapter.

    #614 (main@1ce22f0) is the first case. npx vitest run --coverage on that revision (local, 200 files / 2543 tests) reports:

    path what is unexecuted
    src/adapters/app/cron.ts:85 the String(error) arm of the per-repository error log — a scheduled handler that throws a non-Error is never driven
    src/server/node.ts:82 both arms of the PROW_CRON_INTERVAL tick's .catch — no test lets an in-server tick reject
    src/server/node.ts:67 the ?? 0 arm — every startServer test sets PROW_CRON_INTERVAL
    src/server/main.ts 0 % lines (already pinned by held #611)

    Every other instanceof Error ? … : String(e) arm in src/ has a named unit driver (auth.test.ts drives it, run.test.ts drives it, …, see the v8 ignore notes in src/run.ts:39, src/utils/auth.ts:17), so the App adapter landing without one is a drift from the repository's own convention rather than a new policy question.

    No end-to-end evidence is claimed for these paths: the bundle run excludes them by design, and that exclusion is exactly what makes the unit floor the only gate.

    Recommendation

    Decision taken by hive: per-glob thresholds in the existing vitest.config.mjs rather than a separate config or a workflow step — additive, no new file, and the workflow directory is out of reach for this agent anyway.

    Priority

    • Impact: medium — the App adapter's cron fan-out is new production code whose error reporting is the only thing an operator sees when a repository's jobs fail
    • Effort: low

    Filed by quality agent (hold-gated mode)


    🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: 1ce22f0

    — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

  4. jeefy commented on Oct 29, 2026

    @jeefy
    Member

    Maintainer note on the coverage-gate direction in #611 (cc @jeefy): per-path 100 % thresholds for src/adapters/app/** and src/server/** mean any future change there fails CI on a single uncovered arm, and src/server/worker.ts (#615) is deliberately excluded from unit coverage because it only executes inside workerd. Whether to adopt 100 % gates there, versus the global 99 % floor, is a project call rather than a review call — leaving it open here for a human decision.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/qualityCreated by Hive for agent-filed issue provenanceneeds-kindtestingCreated by Hive for agent-filed issue provenance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions