Skip to content

Tests for the v0.4.2 failure paths, and the Firestore emulator in CI - #79

Merged
andreimarinescu merged 2 commits into
mainfrom
p3/r1-coverage
Oct 15, 2026
Merged

andreimarinescu merged 2 commits into
mainfrom
p3/r1-coverage

Conversation

@andreimarinescu

Copy link
Copy Markdown
Collaborator

What

  • CI starts the Firestore emulator (the digest-pinned google-cloud-cli emulators image) before the coverage step and sets FIRESTORE_EMULATOR_HOST for that step only.
    • The existing *_emulator_test.go suites now run in CI instead of skipping.
    • Cost: about 30–60 s per run.
    • This change is its own commit.
  • Tests only; no production code changes. They cover the failure paths of what v0.4.2 added:
    • credit awards (validation, retry bounds, ledger and Firestore failures never mark an uncredited award applied);
    • the article meter;
    • the content-hash index and its backfill;
    • the community receipt journal;
    • moderation reservations;
    • dispatch, logout, approval and account-link failures.

Coverage. On the v0.4.2 patch lines, it rises from 84.5% to 95.3% with the emulator running. Codecov reported 83.79% for #78 without it.

Tests

  • gofmt and vet are clean;
  • go test -race ./... passes, with and without the emulator;
  • the new tests ran 20 times in a row with -race, with no failures;
  • the new tests were mutation-checked: each of 42 deliberate faults in the code they cover makes a test fail.

…and the content index

- Award validation, retry bounds and ledger failures never mark an uncredited award applied.
- The meter answers 500 and charges nothing when the ledger refuses a write.
- Award reads map Firestore failures to unavailable, never to a verdict; a contributor without a string uid is unavailable.
- The content index backfill resumes from its position, reports progress and refuses corrupt input; the variant probe surfaces corrupt entries.
- backfill-content-sha skips a complete index, rescans on request and says how to resume.
- The community receipt keeps its journaled novelty verdict across a cancellation and refuses unjudgeable URLs.
- Moderation reservations fail as errors, not as the ceiling, without a usable counter.
- Dispatch, reward, logout, approval and shared-account link failures leave submissions, sessions and accounts retryable.
@codecov

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@andreimarinescu
andreimarinescu merged commit b9bffa9 into main Oct 15, 2026
6 checks passed
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