embed_docsite: download docsite via git clone instead of GitHub contents API - #627
Open
IZO-Ong wants to merge 2 commits into
Open
embed_docsite: download docsite via git clone instead of GitHub contents API#627IZO-Ong wants to merge 2 commits into
IZO-Ong wants to merge 2 commits into
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.
Short Description
Replaces
embed_docsite's recursive GitHub Contents API walk with a shallow, blobless and sparsegit cloneofOpenFn/docs.Fixes #182
Implementation Details
The old
github_utils.pyfetchedgeneral_docs/adaptor_docsone directory at a time viaapi.github.com/.../contents/{path}(~22 requests for OpenFn/docs, against a 60/hour unauthenticated limit), then downloaded each file individually. This PR ships two commits 4315b60 (for naivegit clone --depth 1) and 4508e30 (for a more optimized git clone using--filter=blob:none --sparse, checked out to onlydocs/andadaptors/, thus avoiding downloading static assets and images).adaptor_functionsis untouched.New module
services/embed_docsite/docs_repo.pyholds all git/filesystem access behind one subprocess seam (_run_git) for unit-testing.sync_docs_repo()clones on the first call in a process andfetch+reset --hards on every call after. If a refresh fails and a checkout already exists, the existing copy is served and a warning is logged; the run only fails if there's no checkout to fall back on, similar tolatest_adaptors.py's cache.Measurements
git clone --depth 1(commit 1)The sparse clone's corpus was verified byte-identical to the naive clone's by hashing the full
get_docsoutput (sha256 of sorted-key JSON).Next steps
If the optimized, blobless / sparse
git cloneis ok, we can change the command fordockerfileon line 17 to use the optimized version instead.AI Usage
Please disclose whether you've used AI in this work (it's cool, we just want to
know!):
You can read more details in our
Responsible AI Policy