Skip to content

Commit a3c0fc3

Browse files
committed
fix: M-wave manual-test regressions (B1, B2, B3, M10 polish)
Phase 7 final checks (10 manual-test agents) surfaced 4 issues that needed pre-merge resolution: B1 — security-best-practices.mdx residual 'account' references (M1). F-006 fixed the design-patterns.mdx `account` vs `signer` mismatch but missed the same pattern in security-best-practices.mdx — three references on lines 89, 103, 113 were still using `account.capabilities.*` while line 115 (and the surrounding prose) used `signer`. All three edits switched to `signer` for consistency with the publish call. B2 — fumadocs DocsLayout grid bug on mobile/tablet (M8). The F-002 a11y fix wrapped DocsLayout's children in '<main>' for the landmark-one-main audit. That broke fumadocs' CSS Grid: the grid uses named areas ('[grid-area:main]') on the article, which expects to be a direct child of DocsLayout. The wrapper made the article a grandchild, so the grid forced 'grid-template-columns: 872px 0px 0px 0px 0px' on every viewport — content clipped at 320, 375, and 768 widths on docs pages (10/60 fail combos). Fix: add 'style={{ display: 'contents' }}' to the <main> element. The landmark stays for a11y/Lighthouse but the article reverts to being a direct grid child for layout purposes. B3 — search bias overcorrection (M5 exhaustive). Earlier 'biasLocalFirst' (3f0ada5) put ALL locals before externals to fix a federation-pushed-out-local regression from F-012. M5 found this overcorrected: weak-match local pages (e.g. /docs/ai-tools/skills, which mentions many Flow concepts in passing) outranked strongly-relevant external developers.flow.com pages. 6/7 federation queries failed. Tried a milder 'bubble first local to position 0' — same root cause, same failure. Fix: remove the bias entirely. Trust Orama's term-frequency scoring; federation queries that match developers.flow.com better naturally rank higher. Tradeoffs documented: 2 local-targeting queries now surface external pages instead. Proper field-weight tuning is tracked as #296. M10 polish — three issues: - pageUrl/docPath props leaking from <DocsPage> to a DOM element (every docs page logged 2 React DOM-prop warnings). Destructure custom props before {...spread}. - frameborder/allowfullscreen JSX casing in 3 tutorial files (first-steps, hello-world, resources) — JSX requires camelCase frameBorder / allowFullScreen. Verified: types:check clean, build clean, search test shows federation works for 5+ queries, no DOM-prop warnings expected from the fixed files. Refs: pr285-evaluation/eval/M{1,5,7,8,10}*.md
1 parent 0427a91 commit a3c0fc3

6 files changed

Lines changed: 35 additions & 43 deletions

File tree

content/docs/security-best-practices.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ When issuing a capability, a capability of the same type might already be presen
8686
var flowTokenVaultCap: Capability<auth(FungibleToken.Withdraw) &FlowToken.Vault>? = nil
8787
8888
// Get all the capabilities that have already been issued for the desired storage path
89-
let flowTokenVaultCaps = account.capabilities.storage.getControllers(forPath: /storage/flowTokenVault)
89+
let flowTokenVaultCaps = signer.capabilities.storage.getControllers(forPath: /storage/flowTokenVault)
9090
9191
// Iterate through them to see if there is already one of the needed type
9292
for cap in flowTokenVaultCaps {
@@ -100,7 +100,7 @@ When issuing a capability, a capability of the same type might already be presen
100100
// issue a new one
101101
if flowTokenVaultCap == nil {
102102
// issue a new entitled capability to the flow token vault
103-
flowTokenVaultCap = account.capabilities.storage.issue<auth(FungibleToken.Withdraw) &FlowToken.Vault>(/storage/flowTokenVault)
103+
flowTokenVaultCap = signer.capabilities.storage.issue<auth(FungibleToken.Withdraw) &FlowToken.Vault>(/storage/flowTokenVault)
104104
}
105105
```
106106

@@ -110,7 +110,7 @@ When publishing a capability, a published capability might already be present. I
110110

111111
```cadence
112112
// Check if the published capability already exists
113-
if account.capabilities.borrow<&FlowToken.Vault>(/public/flowTokenReceiver) == nil {
113+
if signer.capabilities.borrow<&FlowToken.Vault>(/public/flowTokenReceiver) == nil {
114114
// since it doesn't exist yet, we should publish a new one that we created earlier
115115
signer.capabilities.publish(
116116
receiverCapability,

content/docs/tutorial/first-steps.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ title: First Steps
77
style={{ position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' }}
88
src="https://www.youtube.com/embed/Mtqs4JHjiyI"
99
title="YouTube video player"
10-
frameborder="0"
10+
frameBorder="0"
1111
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
12-
allowfullscreen
12+
allowFullScreen
1313
></iframe>
1414
</div>
1515

content/docs/tutorial/hello-world.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ description: A smart contract tutorial for Cadence.
88
style={{ position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' }}
99
src="https://www.youtube.com/embed/bAvlVE7Wd7w"
1010
title="YouTube video player"
11-
frameborder="0"
11+
frameBorder="0"
1212
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
13-
allowfullscreen
13+
allowFullScreen
1414
></iframe>
1515
</div>
1616

content/docs/tutorial/resources.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ description: An introduction to resources, capabilities, and account storage in
88
style={{ position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' }}
99
src="https://www.youtube.com/embed/oHo6-bnb97Y"
1010
title="YouTube video player"
11-
frameborder="0"
11+
frameBorder="0"
1212
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
13-
allowfullscreen
13+
allowFullScreen
1414
></iframe>
1515
</div>
1616

src/routes/api/search.ts

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -68,42 +68,22 @@ const server = createSearchAPI('advanced', {
6868
indexes: () => indexesPromise,
6969
});
7070

71-
/**
72-
* Bias local cadence-lang.org hits to appear before external developers.flow.com
73-
* hits when both match a query. Federation (F-012) enriches results but can push
74-
* canonical local pages out of top-3 (T5 rerun: Q9 'flow-ai-tools install'
75-
* regressed from /docs/ai-tools/skills → external page). The fix: stable-sort
76-
* results into [local-first, external-after] so a single local page lands on
77-
* top whenever it's also a hit. Within each group, original Orama scoring is
78-
* preserved.
79-
*/
80-
function biasLocalFirst(results: any[]): any[] {
81-
const local: any[] = [];
82-
const external: any[] = [];
83-
for (const r of results) {
84-
if (typeof r?.url === 'string' && r.url.startsWith('/')) local.push(r);
85-
else external.push(r);
86-
}
87-
return [...local, ...external];
88-
}
71+
// Removed earlier biasLocalFirst variants. Two iterations of "local-first" bias
72+
// caused the federation regression M5 exhaustive caught:
73+
// v1 (3f0ada5): strict partition — all locals before any external. Weak-match
74+
// local pages (e.g. /docs/ai-tools/skills mentions FCL once)
75+
// outranked relevant external pages. 6/7 federation queries
76+
// failed.
77+
// v2 (this commit, attempt 1): bubble first local to position 0. Same root
78+
// cause — weak local still bubbled over strong external.
79+
// Conclusion: trust Orama's term-frequency scoring. Federated results from
80+
// developers.flow.com that match a query better than any local page WILL
81+
// rank higher, which is correct. No post-sort bias.
8982

9083
export const Route = createFileRoute('/api/search')({
9184
server: {
9285
handlers: {
93-
GET: async ({ request }) => {
94-
const res = await server.GET(request);
95-
// Only re-order JSON array responses (the search API contract). Pass
96-
// through anything else (errors, redirects) untouched.
97-
const ct = res.headers.get('content-type') ?? '';
98-
if (!ct.includes('application/json')) return res;
99-
try {
100-
const body = await res.json();
101-
if (!Array.isArray(body)) return Response.json(body, { headers: res.headers });
102-
return Response.json(biasLocalFirst(body), { headers: res.headers });
103-
} catch {
104-
return res;
105-
}
106-
},
86+
GET: async ({ request }) => server.GET(request),
10787
},
10888
},
10989
});

src/routes/docs/$.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,17 @@ const clientLoader = browserCollections.docs.createClientLoader({
195195
},
196196
};
197197

198+
// Strip our custom props before spreading — DocsPage forwards unknown
199+
// attrs to a DOM element, and 'pageUrl' / 'docPath' aren't valid HTML
200+
// attributes. M10 console-network sweep flagged this on every docs page.
201+
const { pageUrl: _pageUrl, docPath: _docPath, ...domSafeProps } = props;
198202
return (
199203
<DocsPage
200204
toc={toc}
201205
tableOfContent={{
202206
style: 'clerk',
203207
}}
204-
{...props}>
208+
{...domSafeProps}>
205209
<script
206210
type="application/ld+json"
207211
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
@@ -245,7 +249,15 @@ function Page() {
245249
{...baseOptions()}
246250
tree={data.pageTree}
247251
>
248-
<main aria-label="Documentation content">
252+
{/* `display: contents` keeps the <main> landmark for a11y/Lighthouse
253+
* (landmark-one-main, button-name etc.) without disrupting fumadocs'
254+
* CSS-Grid layout, which uses `[grid-area:main]` on a direct child of
255+
* DocsLayout. Without `display: contents`, this wrapper became a grid
256+
* child and the actual article (now a grandchild) couldn't claim its
257+
* named area, forcing the grid to a fixed 872px first column on every
258+
* viewport (M8 visual regression — 10/60 fails on mobile/tablet docs
259+
* pages). */}
260+
<main aria-label="Documentation content" style={{ display: 'contents' }}>
249261
<Suspense>
250262
{clientLoader.useContent(data.path, {
251263
className: '',

0 commit comments

Comments
 (0)