Skip to content

Fixture: a second synthetic season so the catch model fits in CI (#153) - #155

Merged
Luen merged 1 commit into
mainfrom
feat/153-model-fixture
Nov 4, 2026
Merged

Luen merged 1 commit into
mainfrom
feat/153-model-fixture

Conversation

@Luen

@Luen Luen commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

The synthetic fixture had 40 gillnet sets in one season. The catch model needs at least 200 sets, nurseries with at least 30 each, and two seasons, so catchModel() returned null in CI. The /drivers model section, the fit diagnostics (#151) and the selection chart with a model (#152) were only ever checked by hand on the private data.

Changes

  • scripts/make-fixture.mjs appends a synthetic 2022-23 season. The values are invented by a seeded generator, with no real records.

    • 200 sets, one a night across the five sites (40 each).
    • Catches are clumped (mostly quiet nights, a few busy ones) and get rarer through the season.
    • Lemons turn up at Vaiane and Haapiti, so the lemon model has two nurseries.
    • Recaptures keep their sex and grow, so this season adds no identity notes to /data-quality.
    • The season has its own random stream. The 2021-22 workbook and the logger CSVs come out identical, so only the new workbook is added.
  • The models now fit on the fixture:

    Model Sets
    All sharks 239
    Blacktips 239
    Lemons 96

    θ is 2.7, so the negative-binomial branch is exercised, not the Poisson limit. One set lacks a tide value, which exercises the "missing variable" sentence.

  • New catchModel.test.ts fails if a fixture edit or a threshold change stops any of the three fits converging. Without it, the e2e checks below would quietly lose coverage.

  • import.test.ts: set and season counts updated.

  • e2e/model-diagnostics.spec.ts: the "no model" branch is gone. It now opens the section, runs axe in light and dark on the real fit charts, and switches between all three models.

  • AGENTS.md: a note in the catch-model section.

Checks

  • pnpm lint, pnpm check and pnpm test (107 passed).
  • pnpm build and pnpm test:e2e (37 passed in 1.2 min locally, against 34 in about 50 s before; unit tests also stay quick).

Closes #153.

🤖 Generated with Claude Code

The fixture had 40 sets in one season, below the catch model's minimum
(200 sets, nurseries with at least 30, two seasons), so /drivers never
rendered its model section, fit diagnostics or selection chart in tests.

- make-fixture.mjs appends a 2022-23 season: 200 sets, one a night over
  the five sites (40 each), clumped catches that thin out through the
  season, lemons at Vaiane and Haapiti, recaptures that keep their sex
  and grow. It uses its own seeded stream, so the 2021-22 workbook and
  the logger CSVs are unchanged (only the new workbook is added).
- On the fixture all three models now fit: 239 sets for all sharks and
  blacktips, 96 for lemons, theta 2.7; one set lacks a tide value.
- catchModel.test.ts fails if the fixture stops fitting; import test
  counts updated; the diagnostics e2e test no longer has a "no model"
  branch and runs axe on real fits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Luen Luen mentioned this pull request Nov 4, 2026
@Luen
Luen merged commit ae5eead into main Nov 4, 2026
5 checks passed
@Luen
Luen deleted the feat/153-model-fixture branch November 4, 2026 05:25
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.

Fixture: enough synthetic sets for the catch model to fit in CI

1 participant