Skip to content

Derive the test symbol from the registry instead of naming VIX - #20

Merged
mspinola merged 1 commit into
mainfrom
claude/derive-test-symbol-from-registry
Aug 21, 2026
Merged

Derive the test symbol from the registry instead of naming VIX#20
mspinola merged 1 commit into
mainfrom
claude/derive-test-symbol-from-registry

Conversation

@mspinola

Copy link
Copy Markdown
Owner

main is red at 80b60df. This fixes it.

What happened

#18 and #19 are each correct, and each was green on its own base. They break when combined:

#18 branched before #19 landed, so the two never ran against each other. The merge produced a commit no pipeline had tested, and two cases went red:

assert update.main(["--bars", "--domain", "equities", "--symbols", "VIX"]) == 0
E   SystemExit: 2
marketdata-update: error: not in the marketdata registry: VIX.

What did not go wrong

The guard did exactly what #18 built it to do — refuse --symbols VIX against a registry that no longer carries VIX — and #19's own commit message predicted that consequence in writing. The production code is right in both PRs. Only the test fixture asserted a world that no longer exists.

The fix

The fixture reads an equities symbol out of the registry instead of naming one:

def a_registered_equities_symbol() -> str:
    for s in all_symbols():
        if s.domain == "equities" and s.yahoo:
            return s.internal
    raise RuntimeError("registry carries no equities symbol to test with")

There is no longer a symbol name to keep in step, so a future retirement cannot turn these tests red for a reason unrelated to what they assert. That is the same class of drift the module was written to catch, so it should not have been reproduced in its own fixture.

Verification

ruff check src tests clean. pytest tests/ -q -m "not network" — CI's exact invocation — 205 passed, 12 deselected.

🤖 Generated with Claude Code

main is red. #18 and #19 are each correct and green on their own base, and break
when combined: #18's tests used VIX as the example of a symbol that IS registered,
and #19 retired VIX from registry.yaml. Neither PR's CI could see it -- #18 was
branched before #19 landed, so the two never ran against each other until the
second merge produced a commit no pipeline had tested.

The fixture now asks the registry for an equities symbol rather than naming one.
There is no list to keep in step, so the next retirement cannot turn these tests
red for a reason that has nothing to do with what they assert.

Worth noting what did NOT go wrong: the guard behaved exactly as designed. It
refused `--symbols VIX` against a registry that no longer carries VIX, which is
the whole point of #18, and #19's commit message predicted that consequence in
advance. The tests asserted the old world, not the guard.

ruff clean; `pytest tests/ -q -m "not network"` (CI's invocation) 205 passed,
12 deselected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mspinola
mspinola merged commit 40e3171 into main Aug 21, 2026
5 checks passed
@mspinola
mspinola deleted the claude/derive-test-symbol-from-registry branch August 24, 2026 23:30
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