Skip to content

Add coverage for loadManifest's source preference order and its remote path #7

Closed

Description

@Oyinkans0la12

loadManifest in packages/cli/src/manifest.ts documents a four-step preference order:

  1. explicit --manifest <path>
  2. manifests/ in a local checkout passed via --repo
  3. manifests/cycle-<id>.json fetched from GitHub at --ref
  4. manifests/cycle-<id>.json in the current working directory

No test in packages/cli/test/ touches this function (nothing references loadManifest, fetchImpl or FetchTextLike), even though claim, status and report all depend on it and it is the single point where a wrong manifest becomes a wrong payout.

Please add unit tests (a stubbed fetchImpl plus temp directories, following test/fixtures.ts):

  • each of the four sources resolves, and a higher-precedence source wins over a lower one;
  • candidateLocalPaths order (manifests/cycle-N.json, manifests/N.json, cycle-N.json);
  • remote non-200 (404 → ManifestNotFoundError, message names --repo/--ref/--manifest);
  • remote body that is valid JSON but not a valid manifest → ManifestParseError that names the URL;
  • the LoadedManifest.json field is the raw text that was parsed (this is what catches the double-text() bug in the remote branch).

The stub should be strict — rejecting a second text() call — so it behaves like real fetch.

Activity

  1. added
    enhancement
    help wanted
    good first issue
    on Sep 14, 2026
  2. Oyinkans0la12 commented on Sep 14, 2026

    @Oyinkans0la12
    CollaboratorAuthor

    Covered by #13, merged as 7cda63e.

    packages/cli/test/manifest.test.ts now exercises everything this issue listed:

    • the four-step preference order (explicit path → local checkout via --repo → remote at --ref → working directory), including that a higher-precedence source wins and that the lower one is never called;
    • candidateLocalPaths order;
    • the remote URL shape (raw.githubusercontent.com/<repo>/<ref>/manifests/cycle-<id>.json);
    • 404 → ManifestNotFoundError naming --repo/--ref/--manifest; invalid JSON and valid-JSON-but-not-a-manifest → ManifestParseError naming the URL; and a transport failure;
    • LoadedManifest.json being the exact text that was parsed.

    The fetch stub rejects a second text() call, like real fetch, which is how the suite caught the double-read bug fixed in the same PR (#2). The CLI suite is 90 tests, up from 77, and npm run typecheck is clean.

    Record correction: #13's description and commit trailer said "Part of #8" — that was a typo for this issue (#7). #8 is the percent/XLM formatting dedup, which is untouched.

  3. removed
    enhancement
    help wanted
    good first issue
    on Sep 15, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions