[Duplicate Code] NVX artifact manifest fixture duplicated across artifact-manifest and preflight tests

Open Beginner friendly
#12,345 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
testing

Research direction

Read src/nvx/artifact-manifest.test.ts and src/nvx/preflight.test.ts at the listed fixture locations, then inspect how each test uses its manifest and digest values. Extract a shared object-building fixture that supports the differing digest needs, with preflight serializing it as JSON. Done when both tests use the shared fixture and continue to receive their required manifest data.

Written by the indexing model from the issue text.

Description

code-quality refactoring

Duplicate Code Opportunity

Summary
  • Pattern: The NVX artifact-manifest fixture (schemaVersion 2 release/upstream/artifacts object, including the signer-workflow and release-tag constants) is hand-built in two test files.
  • Locations: src/nvx/artifact-manifest.test.ts lines 18-33; src/nvx/preflight.test.ts lines 27-42
  • Impact: About 16 duplicated lines (jscpd). A manifest schema bump or signer-identity change must be applied to both fixtures, or they drift silently.
Evidence

src/nvx/artifact-manifest.test.ts lines 18-33:

function manifest() {
  return {
    schemaVersion: 2,
    release: {
      repository: NVX_ARTIFACT_REPOSITORY,
      workflow: NVX_ARTIFACT_SIGNER_WORKFLOW,
      tag: NVX_ARTIFACT_RELEASE_TAG,
      sourceCommit: 'a'.repeat(40),
    },
    upstream: {
      releaseTag: NVX_RELEASE_TAG,
      nvxCommit: NVX_COMMIT,
      openvmmCommit: NVX_OPENVMM_COMMIT,
    },
    architecture: 'x86_64',
    artifacts: {
      openvmm: { file: 'openvmm', sizeBytes: 100, sha256: '2'.repeat(64) },

src/nvx/preflight.test.ts lines 27-42:

function manifest() {
  return JSON.stringify({
    schemaVersion: 2,
    release: {
      repository: NVX_ARTIFACT_REPOSITORY,
      workflow: NVX_ARTIFACT_SIGNER_WORKFLOW,
      tag: NVX_ARTIFACT_RELEASE_TAG,
      sourceCommit: 'a'.repeat(40),
    },
    upstream: {
      releaseTag: NVX_RELEASE_TAG,
      nvxCommit: NVX_COMMIT,
      openvmmCommit: NVX_OPENVMM_COMMIT,
    },
    architecture: 'x86_64',
    artifacts: {
      openvmm: { file: 'openvmm', sizeBytes: 100, sha256: DIGESTS.openvmm },

The two fixtures differ only in return form (object vs. JSON.stringify) and in the openvmm digest source.

Suggested Refactoring
  • Extract a shared buildNvxArtifactManifest(overrides?) test helper (for example src/nvx/test-fixtures.ts) that returns the object form. preflight.test.ts wraps it with JSON.stringify and passes its digest override.
  • Keep the signer-workflow and release-tag constants in one place so the fixtures cannot diverge.
Affected Files
  • src/nvx/artifact-manifest.test.ts — lines 18-33
  • src/nvx/preflight.test.ts — lines 27-42
Effort Estimate

Low

Score: 4 (borderline). Signer-identity relevance is the only factor that clears the threshold. No production-code duplication reached it in this run.


Detected by Duplicate Code Detector workflow. Run date: 2026-11-29

Generated by Duplicate Code Detector · copilot · routed: haiku55 xhigh · ~3 AIC · ⊞ 18.3K · history

  • expires on Dec 29, 2026, 9:57 PM UTC
Dominant language
TypeScript
Stars
169
Forks
89
Avg merge
5h 18m
Merged PRs (30d)
450

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/gh-aw-firewall

All issues in github/gh-aw-firewall

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.