Repository navigation
fix(deploy): prune unused runtime schema history #7496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
72faa85
fix(deploy): prune unused runtime schema history
bokelley 3dd3e27
fix: refresh runtime schema retention for current SDK and training ch…
bokelley 960ae49
ci: measure the default runtime image with its repository cache
bokelley c238b56
fix(ci): initialize footprint path in the runner step
bokelley 58d64e0
Merge branch 'main' into conductor/safe-fly-image-size-unblock
bokelley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| name: Default runtime image footprint | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| paths: | ||
| - '.github/workflows/runtime-default-image.yml' | ||
| workflow_dispatch: | ||
| inputs: | ||
| expected_sha: | ||
| description: Exact reviewed source commit to measure | ||
| required: true | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| footprint: | ||
| name: Default image with repository cache | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 60 | ||
| env: | ||
| SOURCE_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | ||
| EXPECTED_SHA: ${{ inputs.expected_sha }} | ||
| IMAGE: adcp-default-runtime-footprint | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | ||
| persist-credentials: false | ||
|
|
||
| - name: Verify the exact source commit | ||
| run: | | ||
| set -euo pipefail | ||
| test "$(git rev-parse HEAD)" = "$SOURCE_SHA" | ||
| if [ "$GITHUB_EVENT_NAME" = workflow_dispatch ]; then | ||
| test "$EXPECTED_SHA" = "$SOURCE_SHA" | ||
| fi | ||
| OUTPUT_DIR="$RUNNER_TEMP/default-runtime-footprint" | ||
| printf 'OUTPUT_DIR=%s\n' "$OUTPUT_DIR" >> "$GITHUB_ENV" | ||
| mkdir -p "$OUTPUT_DIR" | ||
| printf '%s\n' "$SOURCE_SHA" > "$OUTPUT_DIR/source-sha.txt" | ||
|
|
||
| - name: Build with default repository cloning and size ceiling | ||
| run: | | ||
| set -euo pipefail | ||
| # No build-argument overrides: the production cache and 7424 MiB | ||
| # application ceiling are enforced by the unchanged Dockerfile. | ||
| docker build --progress=plain --tag "$IMAGE" . 2>&1 | tee "$OUTPUT_DIR/build.log" | ||
|
|
||
| - name: Measure the image and verify every configured repository cache | ||
| run: | | ||
| set -euo pipefail | ||
| docker image inspect "$IMAGE" > "$OUTPUT_DIR/image.json" | ||
| docker run --rm --interactive --user 0 --entrypoint node "$IMAGE" --input-type=module > "$OUTPUT_DIR/runtime.json" <<'JS' | ||
| import fs from 'node:fs'; | ||
| import { execFileSync } from 'node:child_process'; | ||
| const mib = path => Number(execFileSync('du', ['-smx', path], { encoding: 'utf8' }).split(/\s+/)[0]); | ||
| const root = '/app/.addie-repos'; | ||
| const repositories = fs.readdirSync(root).filter(name => fs.statSync(`${root}/${name}`).isDirectory()).sort(); | ||
| console.log(JSON.stringify({ rootFilesystemMiB: mib('/'), applicationMiB: mib('/app'), cacheMiB: mib(root), repositories }, null, 2)); | ||
| JS | ||
| python3 - <<'PY' | ||
| import json, os, pathlib, re | ||
| output = pathlib.Path(os.environ['OUTPUT_DIR']) | ||
| runtime = json.loads((output / 'runtime.json').read_text()) | ||
| dockerfile = pathlib.Path('Dockerfile').read_text() | ||
| clone_lines = re.findall(r'^run_clone\s+.*$', dockerfile, re.M) | ||
| configured = set(re.findall(r'^run_clone\s+\S+\s+\S+\s+([\w-]+)\s*$', dockerfile, re.M)) | ||
| assert configured, 'No configured repository clones found' | ||
| assert len(configured) == len(clone_lines), 'Repository clone parser did not match every configured clone' | ||
| assert configured <= set(runtime['repositories']), sorted(configured - set(runtime['repositories'])) | ||
| assert runtime['cacheMiB'] > 0 | ||
| assert runtime['applicationMiB'] <= 7424 | ||
| runtime.update(sourceSha=os.environ['SOURCE_SHA'], defaultBuildArguments=True, configuredRepositories=sorted(configured)) | ||
| (output / 'runtime.json').write_text(json.dumps(runtime, indent=2) + '\n') | ||
| with open(os.environ['GITHUB_STEP_SUMMARY'], 'a') as summary: | ||
| summary.write(f"Source `{runtime['sourceSha']}`: visible unpacked root {runtime['rootFilesystemMiB']} MiB; application {runtime['applicationMiB']} MiB / 7424 MiB; repository cache {runtime['cacheMiB']} MiB, {len(configured)} configured repositories.\n") | ||
| PY | ||
|
|
||
| - name: Initialize every configured docs snapshot | ||
| run: | | ||
| set -euo pipefail | ||
| docker run --rm --interactive --entrypoint node "$IMAGE" --input-type=module < scripts/smoke-docs-index-runtime.mjs 2>&1 | tee "$OUTPUT_DIR/docs-smoke.log" | ||
|
|
||
| - name: Load every hosted bundle with the production SDK | ||
| run: | | ||
| set -euo pipefail | ||
| docker run --rm --interactive --entrypoint node "$IMAGE" --input-type=module < scripts/smoke-hosted-compliance-runtime.mjs 2>&1 | tee "$OUTPUT_DIR/sdk-smoke.log" | ||
|
|
||
| - name: Retain footprint and smoke receipts | ||
| if: always() | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | ||
| with: | ||
| name: default-runtime-footprint-${{ github.run_id }} | ||
| path: ${{ runner.temp }}/default-runtime-footprint | ||
| if-no-files-found: warn | ||
| retention-days: 7 |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MUST FIX: Pruning the 35 omitted schema versions from the Fly image changes the wire for pinned immutable URLs if the Node server still serves
/schemas/.schemas-middleware.ts:462-493does not 404 a missing pinned version —resolvePinnedFallbacksilently rewrites/schemas/3.0.5/...to the nearest lower kept version on the same major and serves different bytes withCache-Control: public, no-cache, must-revalidateinstead of the exactimmutablebytes. On main the image carries all 86 versions, so these are exact hits. After this prune, every adopter who pinned one of the 35 omitted paths — exactly the population the immutability rule protects — gets silently substituted schema content. The PR body's "confirm routing before deploying" is procedural, not a guard. Fail-closed: do not deploy this image as the/schemas/origin unless the public route is bound to the artifact-cdn worker (which carries all versions); the discovery surfaces already advertise only the kept subset, so the exposure is direct pinned requests.