feat(cpp-phase2): PR-03 HTTP loader, Windows/Darwin walker, CI workflow#681
Open
shivasurya wants to merge 3 commits intoshiva/cpp-phase2-pr02-loaderfrom
Open
feat(cpp-phase2): PR-03 HTTP loader, Windows/Darwin walker, CI workflow#681shivasurya wants to merge 3 commits intoshiva/cpp-phase2-pr02-loaderfrom
shivasurya wants to merge 3 commits intoshiva/cpp-phase2-pr02-loaderfrom
Conversation
Fills in PR-02's stubbed loadManifestFromHTTP / fetchHeaderFromHTTP paths so the remote loaders work end-to-end against a CDN. Local file:// behavior is unchanged. clike_http.go shared helpers: - fetchURL: single GET, 200-only, error message embeds the URL so CDN-side issues are diagnosable without bouncing through retries. - verifyChecksum: optional sha256:<hex> verification; empty checksum disables verification (manifests pre-PR-03 ship without it). - joinURL: trailing/leading slash-tolerant URL composition shared between C and C++. C and C++ HTTP loaders now: - Construct paths as <baseURL>/<platform>/<lang>/v1/<file>, prefer per-entry URL when the manifest embeds one. - Try the on-disk cache first when fresh (24h TTL); always fall back to stale cache on network failure so offline scans still resolve stdlib calls. - Best-effort write to the on-disk cache after a successful fetch; cache write failures warn but never block the in-memory result. Updated tests: - New httptest-driven coverage for both loaders: 200, 404, network failure with cache fallback, checksum match, checksum mismatch, parallel fetches, embedded URL, garbage body. - Two PR-02 stub assertions (HTTPMode_Stub, HTTPMode_FetchHeaderStub) rewritten to point at an unreachable port and assert the proper network error. - cmd/scan_stdlib_test.go now isolates XDG_CACHE_HOME / HOME when exercising the unreachable-host path so a developer cache cannot produce a false-positive success. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replaces the PR-01 PR-03-error stubs in DiscoverHeaderSources with working source-tree probes for the four cross-platform combinations the workflow targets next. walker_xplat.go: - windowsCSource / windowsCppSource probe the mingw-w64 install at /usr/x86_64-w64-mingw32 (the layout `apt install mingw-w64` produces on ubuntu-latest). The C source covers Win32 + MSVCRT; the C++ source picks the freshest libstdc++ version directory. - darwinCSource / darwinCppSource probe Apple's Command Line Tools first and fall back to a full Xcode install. The C source uses the macOS SDK; the C++ source uses the clang-shipped libc++ tree. - findVersionedDir, firstExistingDir, detectMingwVersion, detectDarwinSDKTag, detectDarwinCppTag are small helpers that derive the version tag stamped into manifest.SystemTag. All probe paths are package vars rather than literals so tests can override them to exercise both hit and miss branches without depending on whether the host actually has mingw/Xcode installed. Two PR-01 tests rewritten to assert the new "headers not found" error messages instead of the deferred-PR-03 stub. Coverage on the new helpers: 75-100%. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Three-runner matrix that produces the six manifest sets the loader
expects (linux/{c,cpp}, windows/{c,cpp}, darwin/{c,cpp}):
- generate-linux ubuntu-latest with libc6-dev + libstdc++-13-dev
- generate-windows ubuntu-latest with mingw-w64 (Win32 + libstdc++)
- generate-darwin macos-latest using Command Line Tools' SDK +
libc++ tree
The publish job collects the artifacts, asserts all 6 manifest.json
files are present, and uploads to Cloudflare R2 under the same
bucket/prefix scheme the existing Go stdlib pipeline uses
(s3://code-pathfinder-assets/registries/<platform>/<lang>/v1/).
The R2 upload + CDN verification steps run only when both
R2_ACCOUNT_ID and R2_ACCESS_KEY_ID are configured — keeps the
workflow green on forks and during operator setup.
Triggered on push to main when generator code or overlays change,
plus manual workflow_dispatch.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
SafeDep Report SummaryNo dependency changes detected. Nothing to scan. This report is generated by SafeDep Github App |
Code Pathfinder Security ScanNo security issues detected.
Powered by Code Pathfinder |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## shiva/cpp-phase2-pr02-loader #681 +/- ##
================================================================
+ Coverage 85.61% 85.67% +0.05%
================================================================
Files 200 202 +2
Lines 28912 29141 +229
================================================================
+ Hits 24754 24966 +212
- Misses 3195 3203 +8
- Partials 963 972 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
PR-03 of the C/C++ Phase 2 stdlib stack. Wires the loaders to the network and stands up the GitHub Actions matrix that produces the six manifest sets (linux/{c,cpp}, windows/{c,cpp}, darwin/{c,cpp}) the loader expects.
Stacked on #680 — must merge AFTER PR-02. Base branch is
shiva/cpp-phase2-pr02-loader.What's in here
graph/callgraph/registry/clike_http.go,c_stdlib_remote.go,cpp_stdlib_remote.go): fills in PR-02's stubbedloadManifestFromHTTP/fetchHeaderFromHTTPpaths. Optionalsha256:<hex>checksum verification, 24h disk-cache freshness, stale-cache fallback on network failure so offline scans keep resolving stdlib calls. Backed by httptest coverage (200 / 404 / network failure / checksum match + mismatch / parallel fetches / embedded URL / garbage body).tools/internal/clikeextract/walker_xplat.go. Probes/usr/x86_64-w64-mingw32(mingw-w64 on Ubuntu),/Library/Developer/CommandLineTools/SDKs/MacOSX.sdkand the Apple libc++ tree. All probe paths are package vars so tests don't need a real toolchain..github/workflows/generate-clike-stdlib.yml): three-runner matrix (Linux, Linux+mingw, macos-latest) → six artifacts → R2 upload + CDN verification. R2 steps gated on secret presence so forks and pre-secret runs still pass.Local-first, then remote
By design, the default
--stdlib-base-urlstays empty in this PR. Operators need to:workflow_dispatchrun (no secrets needed).R2_ACCOUNT_ID/R2_ACCESS_KEY_ID/R2_SECRET_ACCESS_KEYand verify the CDN serves the manifests.https://assets.codepathfinder.dev/registriesin a follow-up so users get cross-platform resolution out of the box.Out of scope (deferred)
Verification
gradle buildGo— cleango test ./...— all packages passgolangci-lint run ./...— 0 issuesTest plan
workflow_dispatchofgenerate-clike-stdlib.ymlproduces all 6 manifest.json files (R2 upload skipped until secrets are wired)--stdlib-base-url=https://assets.codepathfinder.dev/registriesmatches PR-02's local resolution numbers🤖 Generated with Claude Code