Repository navigation
Resolve feature API-reference links against the reader's docs version - #447
Conversation
|
|
Thank you — the availability point is the one that mattered, and it would have Hide features newer than the reader's version. Confirmed and fixed. 86 Availability is now version-aware at all three sites: the feature filter, the One thing worth flagging, because it is the kind of bug that would have looked
Rebase onto #448. Done. Rather than hand-resolving 32 conflicts in Overlap with #451. Both touch the Verified: Still true and stated in the description: I cannot observe how a frozen page |
…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>
…s 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>
897983f to
2d53694
Compare
|
Rebased onto The only conflicting file was
Re-verified after the rebase: #451 is still open and still touches the same This is still waiting on your re-review for the availability change in |
|
@eugenia-scandit can you have another look please? |
eugenia-scandit
left a comment
There was a problem hiding this comment.
Approved, thanks - both of my earlier points are addressed. One small thing before merging: the effect that computes the filtered list reads activeVersionName but doesn't list it in its dependencies (around line 120), so the list won't refilter if the docs version changes while the component stays mounted.
Keep main's non-link chip for frameworks without an API reference (#451) and resolve the link through apiReferenceUrl against the reader's docs version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-up to #445, which fixes the same class of bug for Markdown. Raised in
review there by @eugenia-scandit.
Nothing is broken today
<FeatureList/>is used on 10 pages, all indocs/— the current version.Neither frozen version renders it:
7.6.14has the 6label-definitions.mdpages but none uses the component, and
6.28.11does not have them. Thecomponent landed in
909d295cb, after both freezes.For the current version, linking the unversioned API reference is correct —
the same convention its Markdown uses.
What breaks at the next freeze
docs:versioncopiesdocs/verbatim, so the snapshot gets all 10 pages with<FeatureList/>intact — and the component imports the sharedsrc/data/features.json, not a snapshot of it. The frozen version then renderstoday's unversioned URLs, and once the following minor publishes those resolve to
its API reference.
That is exactly what #445 fixes for Markdown, somewhere a substitution over
versioned_docs/structurally cannot reach: the URLs are not in the snapshot.withCurrentDocsPath()looked like it might already cover this. It does not — itprefixes relative
/sdks/<framework>paths for unreleased frameworks only, andreturns an absolute URL untouched.
The change
features.jsonnow stores the path within the API reference:and a new
apiReferenceUrl(path, versionName)indocsPaths.tsapplies theversion at render time:
currentdocs.scandit.com/data-capture-sdk/ios/…7.6.14docs.scandit.com/7.6/data-capture-sdk/ios/…6.28.11docs.scandit.com/6.28/data-capture-sdk/ios/…FeatureListreads the active version throughuseActiveDocContext(), thepattern
FrameworkSelectorMobilealready uses. 143 values converted.Availability has to move with it
features.jsonrecords the SDK version each feature arrived in, and 86framework entries are newer than 7.6. Those were harmless while the links
pointed at the unversioned API reference — it always documents the newest
release. Resolving against the reader's own line turns each into a 404:
/7.6/data-capture-sdk/has no page for a class added in 8.2.So the filter is now version-aware at all three sites — the feature filter, the
isAvailableflag, and the per-framework chip list.The comparison is numeric per component, which is less obvious than it
looks:
"6.5"is earlier than"6.28", and both a string compare(
"6.5" > "6.28") and a float one (6.5 > 6.28) get it backwards.6.28is areal docs version, so a lazy compare would hide every 6.5-era feature from the
6.28 docs.
currentshows everything; an unparseable version on either side shows thefeature rather than hiding it, so a data-entry slip degrades to today's
behaviour rather than silently emptying a table.
Verified
apiReferenceUrl()across current, frozen, leading-slash and already-absoluteinputs
tsc --noEmitclean, full build passesyarn verify:frameworksstill passes — that gate also readsfeatures.json, so the shape change had to keep it happy. I nearly missed it;FeatureListis not the only consumer.Not verified, stated plainly
How a frozen page renders. No frozen version uses the component today, so
there is nothing to observe — and
FeatureListis client-rendered: thestatic HTML carries
Loading features...and the data ships in the JS bundle, soa build cannot see those links either way. The frozen path rests on
useActiveDocContext()reporting the version name, which the existing selectorcomponent already depends on.
I tried to observe it by simulating a freeze and building. That failed three
times on release-process steps unrelated to this change — redirect collisions
from a snapshot that still contained
kmp, thenUNRELEASED_FRAMEWORK_SLUGShaving become derived rather than a literal list. Observing it properly needs a
real
minor_betaon a throwaway branch; happy to do that if you would rather nottake the reasoning.
Sequencing
This makes a frozen version's feature links point at
<major.minor>/, so it runsinto the same Algolia
api-reference-<line>tag question as #445. Both want toland alongside the crawler action rather than independently.
Overlap with #451
Both touch the
href={…}line in the framework-list branch: #451 wraps it in aconditional for a missing
apiUrl, this one changes the function that buildsit. They combine cleanly — the conditional stays and the
<a>branch callsapiReferenceUrl(frameworkInfo.apiUrl, activeVersionName). Whichever landssecond takes the merge.
Rebased onto
mainfor #448:features.jsonwas regenerated frommainwiththe host-stripping re-applied, so the
dotnet.ios/dotnet.androidcorrections are preserved by construction rather than hand-merged — all 32
verified present, zero stale
net/paths.