Skip to content

Reduce repeated docs builds, S3 uploads, and retained output #210

Open

Description

@tony

Summary

Investigate avoidable documentation builds, repeated S3 uploads, and retained output across the shared site and its port publishers. The repository already has content comparison, audited artifact reuse, immutable-release checks, and preview cleanup, but those mechanisms cover different publishing paths and leave several opportunities to measure. This proposal collects evidence and avenues to investigate; it leaves the choice of publisher, cache strategy, and retention policy open.

Motivation

A sampled shared-docs preview published 191,441 objects, while an English production publication uploaded 23,014 objects after its comparison step classified 74,827 files as unchanged. Those counts establish the scale of publication work, but a new destination, an API change, or a shared-template change can legitimately require many uploads. The useful question is how much repeated work can be avoided while preserving complete, current documentation.

Track three outcomes separately: build and audit time, objects and bytes uploaded, and current/noncurrent storage retained. A faster render can still upload every file; deleting a preview can leave its previous object versions stored; a workflow run can build without publishing anything. Request-cost estimates should use the measured requests avoided and the applicable S3 regional pricing, with listing and metadata-read overhead included.

The deployment work in #27 provides relevant history: registry checks, changed-file publishing, port ownership, immutable tags, and dispatch orchestration already exist. The question here is how effectively the current paths avoid repeated work, including mutable previews, direct copies, cache reuse, and cleanup. #188 is a concrete reminder that dependency declarations can affect generated documentation and must be considered when deciding whether a build is needed.

Evidence

Source scope and public deployment measurements

The shared-docs source examined is the merged repository revision 8d14bb3. Code links below identify that snapshot unless another repository or revision is named. Historical run measurements cover October 24–25, 2026 UTC; the source snapshot and recorded diagnostic probes were examined on October 26. Current upstream documentation is linked as a behavior reference, while implementation claims use pinned source.

Public job Observed upload records Additional observation
Shared preview publication 191,441 41,786 HTML, 41,451 Markdown, and 41,064 JSON files; remaining records are assets and other output.
English production publication 23,014 22,577 uploaded files are HTML. The comparison step examined 97,722 files and classified 74,827 as unchanged.

The production job contains this summary:

skip-unchanged: 74827 of 97722 file(s) unchanged, 22895 to upload

Upload totals were counted from log records matching upload: ... to s3://..., with unique destination keys checked. The helper's candidate count and the job's upload count describe different scopes: direct-copy paths also publish files. Neither count establishes how many uploads were avoidable. Logs may expire under repository retention; the job links identify the sampled executions and the numbers above preserve the measured result.

The saved complete two-day workflow listing contains 581 documentation runs across the shared docs repository and 13 port repositories: 462 port runs and 119 shared test/deploy-shell runs. These include failures, cancellations, and builds without publication. Among 14 scheduled shell runs, 10 skipped building and four built/published both locales; this scheduled run is an example of the existing no-change path. The corresponding source gate is linked below.

The recorded probes described below are isolated diagnostics. They were not rerun as part of filing this issue, and no full-site incremental benchmark or end-to-end modified publisher has been demonstrated. Monthly savings and the removable storage total remain unmeasured. Account billing exports and private session records are not needed to reproduce the code findings.

Publisher behavior, metadata, and the timestamp interaction

The production comparison already has useful logic: unchanged() checks size, ETag/MD5, and header-policy freshness, and remoteObjects() lists the destination prefix. main() sets only matching files' timestamps to the epoch; changed candidates keep their existing filesystem timestamps.

Publishing path Current behavior Investigation clue
Production comparison step Applies the size/content/header-policy test before publishing. Reuse the comparison contract where appropriate, and verify that selected changes reach the upload operation.
Root publisher Uses deleting syncs for owned subtrees, recursive copies for hashed assets, and direct copies for landing pages and top-level files. Timestamp changes do not suppress unconditional aws s3 cp operations. Asset/header updates and ordinary identical uploads need distinct decisions.
Shared mutable publisher Recursively copies _astro assets, then runs a deleting sync with those assets excluded. This path has no equivalent unchanged-file pass. It intentionally retains older hashes for cached HTML.
Immutable-tag guard Compares an existing release tree, rejects different bytes, and skips publication when identical. Preserve this contract when changing mutable publication. Avoid treating every repeated release invocation as a fresh upload.

A recorded probe used AWS CLI 2.32.21, Node.js 26.12.1, the unmodified comparison helper, and an unsigned local S3-compatible listing fixture. The helper read fixture metadata; the real CLI ran aws s3 sync in --dryrun mode. No AWS account was contacted and no object was written. Remote content was four bytes, old!, with a modification time of 2026-10-25T00:00:00Z; the same-size changed content was new!. Old and fresh local timestamps were October 24 and October 26 respectively.

Fixture Helper's upload-candidate count Real CLI dry-run schedules an upload
Identical bytes, current header policy 0 No
Changed bytes, same size, old timestamp 1 No
Changed bytes, same size, fresh timestamp 1 Yes
Identical bytes, newer header policy, old timestamp 1 No
Different size, old timestamp 1 Yes
New destination key, old timestamp 1 Yes

The old-timestamp changed-content case reports:

skip-unchanged: 0 of 1 file(s) unchanged, 1 to upload

The subsequent CLI dry-run emits no upload record for that case. This is consistent with the documented S3 sync comparison and metadata behavior: candidate classification does not itself force the later sync to transfer an equal-size file with an older timestamp. --size-only would not solve same-size content changes, and checksum verification should not be assumed to replace the sync selection algorithm.

The current production workflow downloads its artifact before running the comparison. The recorded test of actions/download-artifact v8.0.2 extracted an entry dated 2001 with a fresh filesystem timestamp; the pinned bundle's ZIP extraction and file-writing implementation explain that result. Consequently, this probe establishes a condition to guard against when changing cache/archive transport; it does not demonstrate a missed update in the current production workflow. Port artifacts also have a separate provenance-checked unpacking path, which should be included in any transport audit.

Build reuse, cache inputs, and partial assemblies

The shared PR workflow already builds and uploads the audited preview, then passes its exact artifact ID to the publisher. The port publisher additionally selects the exact artifact and verifies publication provenance. Preserve that reuse and identity checking when reducing build work.

build-site.sh already has an output cache. fingerprint.mjs hashes all site source and public files, package source, the lockfile, and build scripts. A site-source edit therefore invalidates shell entries across targets. This is a useful basis for identical-input reuse; it does not currently provide page-level invalidation.

The build_shell() cache key and hit path include base, version, version kind, default-version settings, port, locale, port root, and native context. The subsequent build invocation also supplies LIBTMUX_DOCS_SITE, LIBTMUX_DOCS_ROOT, and LIBTMUX_DOCS_LOCALES_ROOT; the first two were independently exercised as omitted key inputs. The site origin feeds canonical and sitemap configuration.

In a recorded isolated test, the exact build_shell() function ran with a stub renderer that wrote the received origin/root context. The first call missed the cache; changing only site_origin hit the same entry; changing only LIBTMUX_DOCS_ROOT also hit it. Both hits returned the first call's output. This establishes incomplete cache identity at the function boundary. It is not a full Astro rendering test or proof that a current CI invocation changes those inputs independently.

No inspected shared-docs workflow restores the assembled-output cache. The port build also deliberately avoids a dependency cache for arbitrary publication refs. Any use of actions/cache or another persistent store needs an explicit policy for compatible inputs, trust, size, expiry, and recovery from absent or invalid entries.

--ports already narrows the per-port assembly loop, but the script still renders the shared shell and skips the whole-site link check for partial assemblies. A smaller preview needs a definition of which output and cross-port links are supported, plus an audit of that same artifact.

Trigger behavior and port workflow entry points

The shell's registry comparison and build gate already avoids unchanged scheduled builds. Push and manual events take the build path regardless of that comparison. The bulk publication workflow requests a shell refresh after port dispatches, including after partial failure so successful port manifests can reach the site.

The following inspected non-Python port workflows have no paths or paths-ignore filter. They differ in publication policy: for example, the Rust workflow builds PRs without publishing them, while Ruby has previews. Their run counts cannot be treated as equal upload costs.

Port Pinned workflow entry point Shared publisher revision in this snapshot
Ruby Trigger and identity inputs 00045828
Lua Workflow 00045828
PowerShell Triggers and queue de7abd59
Julia Workflow 00045828
Elixir Workflow 00045828
TypeScript Workflow 00045828
Rust Triggers and publishing jobs 00045828
Go Workflow 00045828
Java Workflow 00045828
.NET Workflow 00045828
C++ Workflow 00045828
Swift Workflow 00045828

The Rust caller's paired references and PowerShell caller's paired references demonstrate why a shared-repository change needs a caller rollout. Ruby and Lua have additional port-specific build logic, so their integration needs inspection beyond updating a shared build-workflow reference.

Python has a separate docs-site-deploy workflow, linked here as a maintained navigation entry point. Its inspected path selection includes library source, documentation, examples, changelog, dependency files, and the workflow itself. Treat that deployment ref separately from the default branch when auditing coverage.

Pruning and the existing cleanup contracts

keptVersions() intentionally preserves published end-of-life versions. toPrune() selects entries absent from the manifest, while listPort() looks directly below the port name. Deployed port output uses a locale above that port, so the listing scope needs review. Correcting the prefix alone would still leave preview status and legacy URL ownership unclassified. The current catch also treats any listing failure as an absent prefix; a cleanup planner should distinguish a failed read from a successful empty listing.

Cleanup already exists: the shared-docs close-triggered workflow deletes its PR preview, and the Ruby close-triggered workflow deletes its English port preview. Audit port and locale coverage, cleanup failures, and ordering against in-flight publication before introducing another cleanup job.

The reusable publisher deliberately retains old hashed assets for cached HTML. Those files need reference and cache/rollback analysis before deletion. Likewise, absence from a current version selector does not prove that a historical URL, redirect target, or release tree is unused.

For versioned S3 storage, ordinary deletion and current-version expiration leave a delete marker and noncurrent data; noncurrent expiration removes the old versions. Review current objects, noncurrent versions, delete markers, and incomplete multipart uploads separately. Preview recovery and production rollback may justify different retention periods; elapsed object age alone does not establish that a PR has closed.

Proposal

Explore the following independently or in combination. The evidence should determine which changes are worth carrying; this issue does not prescribe an implementation sequence or require a particular cache, upload library, or retention duration.

Make repeated publication cheap and measurable

Can the existing content/header-policy comparison cover mutable preview and port publications, assets, and the root publisher's direct copies? Possible approaches include an explicit changed-object upload list, a content manifest associated with each owned prefix, or a sync strategy whose transfer decision is verified against the comparison result. Compare complexity, metadata migration behavior, and read-request overhead before choosing one.

The comparison must preserve the complete desired file set for deletion decisions. Removing unchanged local files before a deleting sync would change that set. Keep asset-before-HTML ordering, immutable-tag behavior, publication receipts, and the root publisher's ownership checks.

Useful AWS entry points are paginated ListObjectsV2 for a prefix inventory, HeadObject for actual headers, and GetObjectAttributes for available object/checksum information. A listing exposes ETag, size, and modification time, but not the full publication header policy. ETags do not universally equal content MD5 and do not identify metadata changes; unsupported fingerprints should remain an explicit conservative case. Compare a bounded inventory plus selective lookups against a per-file metadata request strategy.

A useful first measurement is publishing identical output twice to the same disposable owned destination, followed by one equal-size content edit, one metadata-only policy change, and one removed file. Count planned and completed operations separately, including listings, metadata reads, uploads, deletions, and retries. The first publication to a new destination remains a distinct case.

Decide what needs rebuilding from the actual inputs

Would a cheap always-running planning job make required checks and skip decisions easier to understand than filtering out whole workflows? GitHub documents that a workflow skipped by path filtering can leave required checks pending. A planner could identify affected ports/output families and explain its decision, with a conservative full-build fallback when the baseline or dependency mapping is unknown.

Investigate path changes as an early signal and an effective-input digest as a stronger reuse signal. The inputs can include API-generating library source, staged native guides, examples, README/changelog content, package declarations and locks, exporter/toolchain versions, generated API models, shared components, resolved registry/default-version data, locale, base URL, and publication identity. The source of each input matters: port definitions and version/build identity are starting points. A generic Markdown-only filter would miss API and dependency changes.

The scheduled registry comparison is an existing example to build on. For push/manual/bulk-dispatch paths, determine whether a change needs a full shell render, a particular port, inventories/navigation, or only merged manifests. Keep a force/recovery path and truthful publication provenance when reusing output from an earlier revision.

Queue policy also deserves measurement. Rust queues publishing with queue: max, while Ruby and PowerShell queue broader workflow work. Superseded PR/latest builds may be coalescible; release tags and an in-progress publication have different durability requirements. Preserve cleanup/publication ordering while investigating this distinction.

Compare whole-build reuse with selective Astro rendering

First establish complete cache identity at the existing build_shell() boundary, including output-affecting environment and native/model inputs. Measure cache archive transfer time and size, hit rate, restore overhead, and clean/cached output equality. A large cache with few reusable entries can add work. Keeping audited artifacts is another reuse opportunity, but production and PR assembly inputs must match before their outputs are considered interchangeable.

Astro offers experimental incremental static builds. The lockfile selects patched Astro 7.4.2; the corresponding inspected upstream source contains IncrementalBuildCache.load(), canSkip(), and the render-or-restore decision. These check page keys together with dependency/content hashes and cached output. The inspected site configuration does not enable experimental.incrementalBuild.

A bounded candidate is the tmux catalog route's getStaticPaths(), which currently supplies parameters without cacheKey. Determine the data digest and context needed for a page before adding a key. Keep cache locations distinct where build contexts would otherwise overwrite one another, and check the installed version's behavior when dependencies, configuration, middleware, concurrency, or route sets change.

This site has work outside page rendering: API database seeding happens before route generation, Markdown twins are completed after rendering, Pagefind indexes assembled HTML, and inventories are emitted from assembled pages. Selective rendering should be judged across HTML, Markdown, JSON, search, inventories, sitemaps, redirects, and receipts. Measure the cheap seeding step before making it conditional.

For narrower previews, explore a documented selection of ports/versions and an explicit policy for links into omitted output. Compare that with whole-preview reuse; each has different audit and maintenance costs. Continue auditing the exact artifact that will be published.

Reconcile obsolete output without breaking supported URLs

Could cleanup produce a reviewable inventory classified by owner, locale, version kind, and PR status? Useful categories include open previews, confirmed closed previews, published releases, mutable aliases, legacy directories needing ownership review, and hashed assets still referenced by retained HTML. A failed or ambiguous status lookup should remain visible in the report.

GetBucketLifecycleConfiguration establishes configured retention. Prefix-scoped ListObjectsV2 can find current directory structure, and ListObjectVersions can estimate retained data within a deliberately bounded candidate prefix. Track pagination and exact keys. DeleteObjects distinguishes key deletion from deletion of a specified version; the byte-reclamation and recovery consequences differ.

Questions to settle include whether close-triggered cleanup covers every publishing locale, whether a delayed build can republish after cleanup, how old hashed assets remain referenced, which historical URLs must stay available, and what recovery window previews need. Compare retention choices using current/noncurrent bytes and rollback needs. A shorter retention period reduces future stored byte-days; it does not undo request charges already incurred.

Evidence that would justify a change

Scenario Evidence to collect
Identical inputs and destination Build reuse decision, output equality, actual uploads and metadata operations.
A source change that does not affect rendered docs The input rule that permits skipping, resolved required-check status, and preserved provenance.
API/docstring, example, dependency, or generator change Affected targets rebuild and changed documentation is published.
Equal-size edit, rollback, or metadata-only change The required upload happens even when restored timestamps are old.
Shared layout, locale, base URL, origin, or default-version change Correct invalidation and clean/cached output equivalence.
Page removed or renamed Owned stale output is handled, retained links remain valid, and adjacent publishers' files are untouched.
Missing/corrupt cache or unknown input A visible fallback produces audited output.
PR closes during queued work Cleanup and publication converge on the intended final state.
A release or identical tag rerun The release remains immutable and its publication receipt remains truthful.
Cleanup or retention change Current/noncurrent byte accounting, supported URL preservation, and an explicit recovery policy.

References

Activity

  1. tony commented on Dec 5, 2026

    @tony
    ContributorAuthor

    The Lua port shows how much work can sit ahead of a single preview. On December 5 at 19:24 UTC, 55 later Lua PR heads each had a pending or queued documentation run. The first PR in our merge sequence had been waiting for its docs job since 17:58 UTC. Those PRs get new commits as we rebase each one onto the preceding merge.

    The Lua build takes a repository-wide lock. The close-preview job takes a different lock for each PR. Those names are present in the original workflow commit, and the migration draft currently keeps them. The shared publisher can check whether the pull request still matches its tested commit before writing the preview. Build queue · Close queue · Current-PR check.

    A comparison would measure how soon one PR can see its docs when another PR is building. It should also verify two outcomes before changing publication ordering. A newer commit keeps its preview when an older build finishes later, and closing a PR removes its preview even if a build was underway.

    A local test then reproduced two separate Lua cleanup failures. An upload could recreate a preview after close, and a delayed close could delete a reopened PR’s fresh files. The Lua issue tracks those outcomes. Lua preview cleanup.

    Two successful website PRs on December 5 show where the time goes after a runner starts. These times come from the headings inside the test-all step. Runner queue time and the later upload are separate.

    Website PR Complete audit Build the preview Render production pages for English and Japanese Job
    #374 3h 54m 44s 1h 47m 27s 1h 05m 07s Job log
    #375 4h 48m 44s 2h 15m 46s 1h 16m 57s Job log

    Those two phases account for 74% of the audit in each run. The production pages check how crawlers see the site, including robots.txt and sitemaps. Timing a second build from identical production inputs would show how much of that time is recoverable. Audit commands.

    The version-picker PR also shows what a rebase costs. Its website audit had run for 1h 39m 08s when the branch picked up the newly merged Elixir guides. The version-picker patch stayed identical. GitHub canceled the old audit and scheduled a new one for the rebased commit. The Elixir change also touched shared guide pages, so any reuse needs to account for changes on the base branch. Canceled job · New run · Elixir guide changes.

    The three December 6 Lua-related website PRs built on separate runners. Each uploaded one audited preview archive to GitHub Actions. The audit and upload times below come from separate steps in each job.

    Website PR Site audit Upload to Actions Stored archive (bytes) Job
    #398 4h 38m 45s 10m 58s 3,032,262,667 Audit and upload
    #379 4h 25m 00s 10m 07s 3,032,222,788 Audit and upload
    #383 3h 19m 36s 8m 04s 3,032,247,997 Audit and upload

    After the audit finished, #398 waited 51m 42s for the publisher check to start. Checking the uploaded preview took 1m 46s. Publisher job.

    #379 waited 1h 25m 58s for the publisher check to start. Checking the uploaded preview took 2m 39s. Publisher job.

    #383 waited 56m 27s for the publisher check to start. Checking the uploaded preview took 2m 36s. Publisher job.

    The earlier #375 publisher check waited 35m 40s and ran for 1m 45s. Reporting the render, artifact transfer and wait for a publisher separately makes it possible to measure which part a change speeds up. #375 publisher · Workflow artifact dependency.

    The website preview for merged PR 383 was still serving pages while the upload ran. GitHub had rejected its cleanup before assigning it a runner. The website issue tracks the reader-visible URL and the cleanup that should remove it. Closed website previews.

  2. added
    enhancement
    p2
    area:publishing
    area:performance
    on Dec 5, 2026
  3. tony commented on Dec 5, 2026

    @tony
    ContributorAuthor

    The Elixir port has a confirmed retained preview. After libtmux/libtmux-elixir#173 merged, its owned-server reference preview still returned HTTP 200. GitHub blocked the close-event workflow before it assigned a runner, so the cleanup script never inspected the prefix. The same happened when libtmux/libtmux-elixir#172 and libtmux/libtmux-elixir#174 closed. The port ticket records the last successful cleanup, the run annotation and the expected post-close check. Elixir investigation · Surviving #173 preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:performancearea:publishingenhancementp2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions