Skip to content

fix(cli): docs ledger lazy file loading, stable tokens, ADR wiring#15932

Merged
broady merged 9 commits into
feat/docs_ledgerfrom
cbro/ledger-work
May 16, 2026
Merged

fix(cli): docs ledger lazy file loading, stable tokens, ADR wiring#15932
broady merged 9 commits into
feat/docs_ledgerfrom
cbro/ledger-work

Conversation

@broady

@broady broady commented May 16, 2026

Copy link
Copy Markdown
Member

Description

Docs ledger publish improvements: lazy file blob loading, stable file tokens, ADR 0009/0011/0012 wiring.

Changes Made

  • Lazy file blob loading (publishDocs.ts, publishDocsLedger.ts, publishDocsLedgerPreview.ts): Instead of holding all file Buffers in memory for the entire publish duration, store only hash → filePath mappings. Files are re-read on demand during the upload step, and only for blobs the server reports as missing (CAS dedup means most republishes need zero re-reads).
  • Ledger mode skips V2 register: In ledger-only deploy mode, the CLI no longer calls startDocsRegister — avoids minting non-deterministic UUID FileIds that would rotate deployment hashes on every publish.
  • Stable file tokens: File references in markdown use deterministic file:<sanitizedPath> tokens instead of UUIDs, enabling page-level CAS dedup.
  • ADR 0009 (customDomains): Forwards custom domains into the ledger publish input.
  • ADR 0011 (git provenance): Populates structured git metadata (repo URL, branch, commit SHA) from CI environment into the ledger deployment.
  • ADR 0012 (preview): Preview publishes go through the dedicated /preview/init endpoint.
  • Stable apiManifest serialization: buildLedgerInput uses stableStringify (sorted keys) so the apiManifest blob hash is deterministic regardless of Map insertion order.
  • normalizeRepoUrl: Normalizes CI repo URLs (SSH, gitlab, bitbucket) to HTTPS for consistent git provenance.
  • Fix biome lint: remove non-null assertion in legacy publish path.

Testing

  • Unit tests added/updated (buildLedgerInput.test.ts, normalizeRepoUrl.test.ts)
  • All 154 tests in the package pass
  • TypeScript type-check passes
  • Biome lint passes

@github-actions

Copy link
Copy Markdown
Contributor

🌱 Seed Test Selector

Select languages to run seed tests for:

  • Python
  • TypeScript
  • Java
  • Go
  • Ruby
  • C#
  • PHP
  • Swift
  • Rust
  • OpenAPI

How to use: Click the ⋯ menu above → "Edit" → check the boxes you want → click "Update comment". Tests will run automatically and snapshots will be committed to this PR.

@broady broady force-pushed the cbro/ledger-work branch 2 times, most recently from 7a5ea08 to 2db8136 Compare May 16, 2026 04:21
broady added 8 commits May 16, 2026 00:28
Populate the remaining snippets metadata path used during API-definition
registration and add direct unit coverage for the language-specific payload
builder.

This keeps docs-ledger dynamic IR checks and uploads aligned with the actual
snippet package/version inputs instead of empty placeholders, including the
AUTO-version fallback behavior.
Sort apiDefinitionCollector entries by key before serializing the
docs-ledger apiManifest blob. Map iteration order today depends on
Promise.all completion order (random run-to-run), which leaks into the
manifest blob hash and therefore the docs-ledger deployment hash.

Pairs with the server-side (orgId, apiName, contentHash) dedup added in
fern-platform: with both fixes, byte-identical publishes produce
byte-identical apiManifests and a deterministic deployment hash.
…sage

Instead of holding all file Buffers in memory for the entire publish
duration, store only hash→filePath mappings. Re-read files on demand
during the upload step, and only for blobs the server reports as missing.
@broady broady force-pushed the cbro/ledger-work branch from 2db8136 to 99270a9 Compare May 16, 2026 04:28
@broady broady changed the title Cbro/ledger work fix(cli): docs ledger lazy file loading, stable tokens, ADR wiring May 16, 2026
@broady broady marked this pull request as ready for review May 16, 2026 04:35
@broady broady requested a review from amckinney as a code owner May 16, 2026 04:35

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@broady broady merged commit 4eb12a0 into feat/docs_ledger May 16, 2026
10 of 17 checks passed
@broady broady deleted the cbro/ledger-work branch May 16, 2026 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant