refactor: dedup the resource layer + reach 100% enforced coverage#14
Merged
Conversation
|
The author of this PR, MarketDataDev03, is not an activated member of this organization on Codecov. |
Demo/unauthenticated responses carry x-api-ratelimit-limit=0, remaining=0 with a future reset on every successful (203) call — the API's "unmetered" signal, not an exhausted quota. The §10.3 preflight gate read that remaining=0 as exhaustion and short-circuited every request after the first demo response, breaking demo mode for the AAPL options/stocks/funds data the API serves without a token. Treat limit==0 as unmetered and allow the request; a genuine exhaustion is limit>0 && remaining==0 (still blocked). Adds a covering unit test (preflightAllowsWhenSnapshotIsUnmeteredDemo).
MarketDataDev01
approved these changes
Jun 26, 2026
MarketDataDev01
left a comment
Collaborator
There was a problem hiding this comment.
changed validation to allow demo mode to work after the first request.
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.
refactor: dedup the resource layer + reach 100% enforced coverage
A pre-v1 hardening pass. No new endpoints and no public-API changes — this collapses duplicated
plumbing across the five resource façades, fills the integration-test gaps, and ratchets line
coverage to 100% with build-time enforcement. The per-resource series (utilities, options, stocks,
markets, funds) was already complete on
main; this makes that code smaller and the safety nettighter before tagging v1.
What's included
021edbe). The universal-param setters (dateFormat/mode/limit/offset) and the CSV/HTML execute paths were copy-pasted across every resource. They now live intwo self-typed base types —
ConfiguredResourceandFormattedResource— plus aTextResponseshelper for the CSV/HTML facets. Net −160 lines in that commit (15 files, +187/−347), public
surface untouched.
892a974). The per-resource JSON dispatch (build request →execute → envelope into the typed
MarketDataResponse) is unified behind aJsonResponseshelperand a single top-level
ResponseFactory, applied across utilities/options/stocks/markets/funds.5a792ba). AddsUtilitiesIntegrationTest(status / headers /user) and a CSV-smoke integration test per resource (funds/markets/options/stocks). The suite is
33 IT methods, still env-gated behind
MARKETDATA_RUN_INTEGRATION_TESTS.c427ebb,7dc5cdb). New unit tests across the client, requestvalidation, parsers, resolutions, response predicates, the exception hierarchy, and the retry/
transport/semaphore internals. The handful of genuinely unreachable defensive guards (e.g. a
builder's empty-list check that the seeded
builder(first, …)makes impossible) are marked with anew internal
@Generatedannotation so they don't dilute the metric. Coverage is now enforced viajacocoTestCoverageVerification(minimum = 1.0) wired intocheck— the build fails if linecoverage drops below 100%.
Public API
Unchanged. Every refactor is internal: the new
ConfiguredResource,FormattedResource,TextResponses,JsonResponses,ResponseFactory, andGeneratedtypes are all package-private inthe
com.marketdata.sdkroot, consistent with ADR-007's single-package-internals boundary. The onlyedits to public request classes (
OptionsQuotesRequest,StockQuotesRequest,StrikeFilter) are@Generatedannotations on existing methods — no signatures added or changed.Tests & coverage
check(PR builds included)../gradlew check→ exit 0 (unit tests + coverage verification + formatting; integration testsstay gated by the env var, so PR builds remain fast and don't need the live-API secret).
Notes
@Generatedcoverage-exclusion convention. It's applied narrowly to provablyunreachable lines; documenting when it's appropriate is a follow-up for the docs/ADR pass.
Kotlin quickstart) lives on a separate branch (
15_improve_examples) and will land as its own PR.Commits
021edbe892a9745a792bac427ebb7dc5cdb