Extract endpoint attributes#10
Open
shhovhan wants to merge 2 commits into
Open
Conversation
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.
This PR contains two commits:
out the review feedback on Expand repository scanner: organization scan + per-endpoint scan #7 and lays the runner infrastructure the
repository scanner - extract attributes #5 work needed.
quality-report design and the Style-A parameter / example extraction
pipeline.
Commit 1 — Scanner runner cleanup, config, output
PR #7 review feedback addressed
ScannerService.__init__now wrapsexcluded_segmentsin afresh
frozenset. Every instance owns its own object — no leakyshared reference
DocProvider.fetch_contentgains abranchargument;GitHubDocProviderpasses it as?ref=to the Contents API. Alignsthe signature with
list_files/path_exists.excluded_segmentsis now read from[scanner].excluded_segmentsin the new TOML config; the previouslyhardcoded set is gone. Pydantic field defaults in
config.pyarethe single source of truth for OTC-specific values.
Config from file
scan-config.tomlat the project root with[github],[scanner],[output],[logging]sections, loaded viapydantic-settings
TomlConfigSettingsSource.GITHUB_TOKENstays out of TOML on purpose — env /.envonly, soit can never be committed accidentally.
load_settings(config_path)supports--config <path>overridingthe default TOML.
tomliadded as a dependency for Python 3.10CLI and output
main.pyrewritten aroundargparsewith--config,--output,--org,--branch,--stdout,-v/-q.scan-output.json)instead of stdout.
--stdoutprints to stdout in addition to thefile.
--output -skips the file and emits to stdout only.EXIT_OK/EXIT_RUNTIME_ERROR/EXIT_USAGE_ERROR.Error handling
GITHUB_TOKEN, missing--configfile, and invalid TOMLnow surface as clean one-line errors with exit code 2 instead of
Python tracebacks.
RepositoryError(auth / rate-limit / network) duringthe scan emits a clean log message and exits 1. Per-document errors
continue to be recorded inside the scan report.
Commit 2 — Quality-report model and endpoint attribute extraction
Implements @RusselSand 's #5 design with some refinements:
two-tier shape (single gating
failure_reason: Issuevs per-sectionSectionResult), structuredIssue(code, location, details),extracted
parameters/examplesco-located with their field-levelmetrics, and computed
overall_status/completeness/service/all_issuesproperties.overall_status="unsupported"is distinctfrom
"failed".New parser modules (
infrastructure/parsers/)Scanner + CLI
S3-compatible →
failure_reason=Issue(UNSUPPORTED_DOC_STYLE),non-endpoint →
RepoScanResult.non_endpoint_documents(no longersilently dropped).
documents_by_versionfilters onoverall_status in (ok, partial).main.pysummary usesquality_summary— per-overall-statuscounts, top issue codes, per-version distribution.
Testing
New tests, no network access required:
Fixtures under
tests/fixtures/cover the format variationsdocumented in the upstream investigation: