Repository navigation
Repoint a frozen version's API Ref links at its <major>.<minor> instead of the default/stable - #445
Conversation
`docusaurus docs:version` snapshots docs/ verbatim, so a newly frozen version inherits the CURRENT version's convention of linking the UNVERSIONED API reference. It is not the current version any more, and nothing in the bump corrected it. That breaks during a beta window. The frozen version is served at the site root while the beta owns /next/, and both link the same unversioned tree. Whichever publish sets PUBLISH_DOCS_FOR_LATEST last owns that tree, so readers of the RELEASED version silently get the beta's API reference. version-8.5.3 shipped in exactly that state -- docusaurus.config.ts records it as "210 files link docs.scandit.com/data-capture-sdk, 0 versioned". 7.6.14 and 6.28.11 link their own lines only because someone corrected them by hand afterwards, most recently in #443 for 7.6's c_api. minor_beta now rewrites the snapshot's links to its own <major.minor> line, both for data-capture-sdk/ and for stable/c_api/. docs/ is untouched: the current version should keep linking the unversioned tree. The rewrite refuses rather than guessing. Before touching anything it samples real links from the snapshot, applies the rewrite, and checks they resolve -- freezing a version with links to a 404 would be worse than the problem being fixed. Only the link kinds the snapshot actually uses are required, so a version that never mentions the linux C API is not blocked by a missing /X.Y/c_api/. SKIP_API_TARGET_CHECK=1 bypasses it when offline. The check probes the rewritten LINKS, not the constructed prefix. https://docs.scandit.com/8.6/data-capture-sdk/ is a 404 -- there is no index at that level -- while .../8.6/data-capture-sdk/ios/... resolves, so a prefix check would have blocked every bump. Links carrying a `${...}` template expression are skipped, since the framework segment is filled in at render time. Verified by simulating a freeze of the current docs against the live origin: 2,267 links across 214 files rewritten, nothing left pointing at the unversioned tree, docs/ unchanged, and the rewritten URLs return 200. A freeze of an unpublished line (9.9.0) is refused with the snapshot left untouched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The check verified that <major.minor>/data-capture-sdk/ resolved before rewriting a frozen snapshot's links to it. That is wrong in principle, not just weak: the bump runs well BEFORE the release, so the release notes and the snapshot can be reviewed while there is still time to change them. The API reference for that line is published by the release pipeline, which has not run yet -- so the check would have refused every bump. The links are correct by construction and unresolvable by definition at the moment they are written. Verifying them belongs after the release publishes, not in the bump. Removes sample_api_links(), api_target_published(), SKIP_API_TARGET_CHECK and the urllib import. The rewrite itself is unchanged and no longer touches the network. Re-verified offline: a simulated freeze of the current docs rewrites 2,267 links across 214 files, leaves nothing pointing at the unversioned tree, leaves docs/ unchanged, and a version whose line does not exist yet (9.9.0) is rewritten rather than refused, which is the whole point. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…o-match Two problems in the rewrite, both reported in review. read_text()/write_text() had no encoding, so they used the locale default. 57 of the ~676 files under docs/ are not decodable as cp1252, so on a Windows checkout this raised part-way through the walk -- AFTER `docs:version` had already written versioned_docs/, versioned_sidebars/ and versions.json, and with files earlier in sorted() order already rewritten. main()'s catch-all printed "Unexpected error", leaving a half-frozen repo that cannot simply be re-run, since the version now exists. Both calls are explicit UTF-8 now. A zero-match logged "No API-reference links to rewrite" and continued. That is the wrong direction: every version so far carries hundreds of these links, so zero means the convention moved and the patterns no longer match -- in which case the snapshot silently keeps linking the unversioned tree, which is the 8.5.3 bug this change exists to prevent. It now raises, naming the patterns that found nothing. Re-verified: a simulated freeze still rewrites 2,267 links across 214 files, runs clean under LC_ALL=C, and a snapshot with no API links raises instead of passing silently. Reported by @eugenia-scandit. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Thank you — all four reproduce, and the first two are fixed in Encoding. Confirmed exactly: 57 of the 676 files under Zero-match. Agreed, and the direction was wrong. Every version so far carries
Search tag. Also right, and this is the one I would most like your steer on. And thank you for confirming the core substitution — non-overlapping, idempotent, |
|
Correcting one thing I said above about I wrote that
So nothing is broken today: the 143 unversioned Your conclusion still holds, though, and the timing is the uncomfortable part. I also checked const match = path.match(/^\/sdks\/([^/]+)/);
if (!match || !isUnreleasedFramework(match[1])) return path;Only relative Opening it as a separate PR, taking the tidier option: version-agnostic paths in One consequence to flag: that fix makes a frozen version's feature links point at |
eugenia-scandit
left a comment
There was a problem hiding this comment.
Non-blocking: check for matching links before docs:version runs, so the zero-match guard can't leave the repo half-frozen.
…version features.json stored 143 absolute apiUrl values pointing at the UNVERSIONED API reference, and FeatureList rendered them as-is. One shared data file serves every docs version, so there is no single correct prefix to bake into it. Nothing is broken today: the component is used on 10 pages, all in docs/, and for the current version the unversioned tree is the right target -- the same convention its Markdown uses. The problem is the next freeze. `docs:version` copies docs/ verbatim, so the snapshot gets all 10 pages with <FeatureList/> intact while still importing the SHARED features.json. The frozen version then renders whatever the unversioned tree documents, which after the following minor publishes is the newer release. That is the bug #445 fixes for Markdown, in a place a substitution over versioned_docs/ cannot reach. features.json now stores the path WITHIN the API reference ("ios/label-capture/api/serial-number-barcode.html#..."), and a new apiReferenceUrl() applies the version at render time: the unversioned tree for `current`, <major.minor>/data-capture-sdk/ for a frozen version. FeatureList reads the active version through useActiveDocContext(), the pattern FrameworkSelectorMobile already uses. withCurrentDocsPath() did not cover this and still does not: it prefixes relative /sdks/<framework> paths for unreleased frameworks only, and returns an absolute URL untouched. Verified: apiReferenceUrl() across current / frozen / already-absolute inputs, tsc clean, a full build passes, and `yarn verify:frameworks` still passes -- that gate reads features.json, so the shape change had to keep it happy. NOT verified, stated plainly: how a FROZEN page renders, because no frozen version uses the component today, and FeatureList is client-rendered -- the static HTML carries "Loading features..." and the data ships in the JS bundle, so a build cannot observe those links either way. The frozen path rests on useActiveDocContext() reporting the version name, which the existing selector component already depends on. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…#447) * fix(features): resolve API-reference links against the reader's docs version features.json stored 143 absolute apiUrl values pointing at the UNVERSIONED API reference, and FeatureList rendered them as-is. One shared data file serves every docs version, so there is no single correct prefix to bake into it. Nothing is broken today: the component is used on 10 pages, all in docs/, and for the current version the unversioned tree is the right target -- the same convention its Markdown uses. The problem is the next freeze. `docs:version` copies docs/ verbatim, so the snapshot gets all 10 pages with <FeatureList/> intact while still importing the SHARED features.json. The frozen version then renders whatever the unversioned tree documents, which after the following minor publishes is the newer release. That is the bug #445 fixes for Markdown, in a place a substitution over versioned_docs/ cannot reach. features.json now stores the path WITHIN the API reference ("ios/label-capture/api/serial-number-barcode.html#..."), and a new apiReferenceUrl() applies the version at render time: the unversioned tree for `current`, <major.minor>/data-capture-sdk/ for a frozen version. FeatureList reads the active version through useActiveDocContext(), the pattern FrameworkSelectorMobile already uses. withCurrentDocsPath() did not cover this and still does not: it prefixes relative /sdks/<framework> paths for unreleased frameworks only, and returns an absolute URL untouched. Verified: apiReferenceUrl() across current / frozen / already-absolute inputs, tsc clean, a full build passes, and `yarn verify:frameworks` still passes -- that gate reads features.json, so the shape change had to keep it happy. NOT verified, stated plainly: how a FROZEN page renders, because no frozen version uses the component today, and FeatureList is client-rendered -- the static HTML carries "Loading features..." and the data ships in the JS bundle, so a build cannot observe those links either way. The frozen path rests on useActiveDocContext() reporting the version name, which the existing selector component already depends on. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(features): hide features newer than the docs version the reader is on features.json records the SDK version each feature arrived in, and one shared file serves every docs version -- so a frozen version lists features that did not exist in it. 86 framework entries are newer than 7.6. That was harmless while their links pointed at the unversioned API reference, which always documents the newest release. Resolving links against the reader's own line turns every one of them into a 404: /7.6/data-capture-sdk/ has no page for a class added in 8.2. The fix would have introduced the breakage it exists to prevent. Availability is now version-aware at all three sites: the feature filter, the isAvailable flag, and the per-framework chip list. The comparison is numeric PER COMPONENT, which matters more than it looks: "6.5" is earlier than "6.28", and both a string comparison ("6.5" > "6.28") and a float one (6.5 > 6.28) get that backwards. 6.28 is a real docs version, so it is not hypothetical. `current` shows everything, and an unparseable version on either side shows the feature rather than hiding it, so a data-entry slip degrades to the previous behaviour rather than silently emptying a table. Also rebased onto main for #448: features.json is regenerated from main with the host-stripping re-applied, so the dotnet.ios / dotnet.android corrections are preserved rather than hand-merged (32 values checked). Verified: the comparison across both frozen versions and `current` including the 6.5/6.28 case, tsc clean, build passes, verify:frameworks passes. Reported by @eugenia-scandit. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
The bug
docusaurus docs:versionsnapshotsdocs/verbatim, so a newly frozenversion inherits the current version's convention of linking the unversioned
API reference. It is not the current version any more, and nothing in the bump
corrected it.
That breaks during a beta window:
lastVersion, served at the site rootcurrent, served at /next/docs.scandit.com/data-capture-sdk/Whichever publish sets
PUBLISH_DOCS_FOR_LATESTlast owns that tree — soreaders of the released version silently get the beta's API reference.
It has happened.
docusaurus.config.tsrecords the audit:8.5.3shipped frozen-but-unrewritten.7.6.14and6.28.11link their ownlines only because someone fixed them by hand — most recently #443, which
repointed 7.6's
c_apilinks last week.The fix
minor_betanow rewrites the snapshot's links to its own<major.minor>line,for both
data-capture-sdk/andstable/c_api/.docs/is deliberatelyuntouched — the current version should keep linking the unversioned tree.
No check that the target resolves — deliberately
An earlier revision verified that
<major.minor>/data-capture-sdk/resolvedbefore rewriting. That was wrong in principle: the bump runs well before the
release, so the snapshot and the release notes can be reviewed while there is
still time to change them. The API reference for that line is published by the
release pipeline, which has not run yet — so the check would have refused every
bump.
The links are correct by construction and unresolvable by definition at the
moment they are written. Verifying them belongs after the release publishes,
where the existing post-release checks live — not here. The rewrite touches no
network.
Verified
Simulated a real freeze of the current
docs/:docs/changedAlso runs clean under
LC_ALL=C, and a snapshot with no API links raises ratherthan passing silently.
And a version whose line does not exist yet (
9.9.0) is rewritten rather thanrefused, which is the case the bump actually runs in.
Context
Part of the docs-deploy cleanup (
data-capture-sdk!38971,!39020,!39061).This is also a prerequisite for automating the API-reference prune on the SDK
side: once a frozen version links
<major.minor>/, that line becomesload-bearing, and any pruning rule has to know not to delete it.
What this does NOT cover
Two things surfaced in review that this PR deliberately leaves alone. Both are
real; neither is fixable by a substitution over
versioned_docs/.src/data/features.jsonholds 143 unversionedapiUrlvalues. It is sharedrather than snapshotted —
docs:versioncopiesdocs/only — sosrc/components/FeatureListrenders the current data into whatever page shows it.Correcting an earlier version of this section: no frozen version renders
that component today.
<FeatureList/>is used on 10 pages, all indocs/;7.6.14has the 6label-definitions.mdpages and none uses it, and6.28.11does not have them. The risk starts at the next freeze, when the snapshot
picks up those 10 pages while still importing the shared data file. Fixing it
means resolving the version at render time rather than rewriting a file, which
is #447. The table above is scoped to the snapshot's Markdown accordingly.
The search tag moves in lockstep with the Algolia crawler.
linksToOwnApiLine()derivesapiReferenceTagsByVersionTagby reading what eachversion links, so after this rewrite the frozen version derives
api-reference-8.6. Until the crawler has an action producing records under thattag,
yarn verify:search-tagsreports THIN — a warning on PRs, a failure onmainwith--strict(THIN_PAGE_THRESHOLD = 100).docusaurus.config.tsalready predicts this for the 8.5 case.
Prerequisite of the next
minor_beta, not of this PR. This is inert untilthat freeze, so it merges ahead of the crawler action. But before the next freeze
runs, both of these have to be in place, or
verify:search-tags --strictgoesTHIN on
main:api-reference-<line>tagWorth putting on the release checklist rather than leaving it to whoever
remembers this thread.