Fix acquire_sky_supply_basis: omit fully_diluted_supply when incoherent with total_supply#117
Merged
Merged
Conversation
…nt with total_supply Real CoinGecko data for Sky reports max_supply fractionally below total_supply for the same snapshot, which violated SupplyBasisSnapshot's canonical total<=fully_diluted invariant and caused the live workflow run to fail after successfully reaching CoinGecko. build_supply_payload now omits the optional fully_diluted_supply component when max_supply < total_supply rather than passing through data the model would correctly reject. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ZwAhhLUYJMGgJm9yyzs7H
fafa33
marked this pull request as ready for review
July 26, 2026 07:43
This was referenced Jul 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up fix for the Milestone 1 one-shot workflow (
.github/workflows/acquire-sky-supply-basis.yml,scripts/acquire_sky_supply_basis.py, merged via PR #116). The first live run against a GitHub-hosted runner reached CoinGecko successfully (first-ever live acquisition in this effort) but failed with:Root cause: CoinGecko's real
market_datafor Sky reportsmax_supply(23462665147.3) fractionally belowtotal_supply(23462665147.36596) for the same snapshot — a real provider data-precision quirk, not an acquisition bug.build_supply_payload()unconditionally mappedmax_supplyto thefully_diluted_supplyquantity component, so it handedSupplyBasisSnapshot.__post_init__'s canonical invariant (total_supply <= fully_diluted_supply,src/hunter/value_capture/models.py) a payload it correctly rejects.Scope and architecture
SupplyBasisSnapshotcoherence invariant is untouched and unweakened, per this repo's stated constraint that canonical service/model contracts must not be relaxed to accommodate acquisition scripts.fully_diluted_supplyis (and already was) an optionalquantity_componentsentry; this change only adds a coherence pre-check before including it, rather than fabricating, rounding, or otherwise altering either provider-observed value.Acceptance-criteria matrix
build_supply_payloadstill passestotal_supply/max_supplyvalues through verbatim; it only conditionally omitsfully_diluted_supplyas a componentSupplyBasisSnapshot's canonical coherence invariantsrc/hunter/value_capture/models.pyunchangedtests/test_acquire_sky_supply_basis.py::test_build_supply_payload_omits_fully_diluted_supply_when_max_supply_is_below_total_supplyfully_diluted_supplytests/test_acquire_sky_supply_basis.py::test_build_supply_payload_includes_fully_diluted_supply_when_max_supply_meets_total_supplytests/test_acquire_sky_supply_basis.py— 16/16 passFAIL/BLOCKEDcriterion remains.Verification
ruff check .black --check .mypy(viapython -m mypy, matching the project's installed interpreter)pytestsuiteOperational validation
This is a pure logic fix to an acquisition script's payload-building helper; it does not itself perform live acquisition. Operational (live CoinGecko + persisted
SupplyBasisSnapshot) validation happens when the Milestone 1 workflow is re-run from the Actions tab after this PR merges tomain(the workflow fetchesscripts/acquire_sky_supply_basis.pyfresh frommainat run time).89768088150, commit2772c9c) is the operational evidence motivating this fix: it reached live CoinGecko, ingested and persisted market facts, then failed exactly at thefully_diluted_supplycoherence check this PR fixes.SupplyBasisSnapshotis deferred to the next workflow dispatch after merge (tracked as follow-up, not part of this PR's scope).Operational evidence:
Remaining limitations and risks
SupplyBasisSnapshotfor Sky is not yet created; that requires a fresh "Run workflow" dispatch ofacquire-sky-supply-basis.ymlonmainafter this PR merges.max_supplyfor Sky is later corrected upstream to be >=total_supply, thefully_diluted_supplycomponent will simply be included again automatically — no further code change needed.Implementer readiness declaration
READY FOR REVIEWGenerated by Claude Code