Skip to content

Commit 87af900

Browse files
authored
chore: Accumulated backports to v4-next (#22924)
BEGIN_COMMIT_OVERRIDE docs: add map and state variable docs (#22824) fix: e2e compat should not fail for contracts added after legacy stables (#22900) chore: fix kv-store browser tests hangs (#22721) feat: kv-store sqlite backend with page level encryption (#22759) fix: install node 22 for aztec-cli acceptance test (#22917) feat: backport kv-store sqlite encryption (#22759) to v4-next (#22927) fix(docs): correct llms.txt links for versioned developer docs (#22819) feat(docs): improve discoverability of Aztec.nr API reference docs (#22861) feat(docs): backport improve discoverability of Aztec.nr API reference docs (#22861) to v4-next (#22931) feat(aztec-nr): add call_self stubs for utility functions (#22885) docs: add map and state variable docs (backport #22824) (#22880) refactor: `getPackageVersion` fn cleanup (#22941) fix(ci): skip acceptance test for canary -commit. tags (#22951) fix: closing db, correct stub side effects (#22939) END_COMMIT_OVERRIDE
2 parents 9b298a1 + 40ba340 commit 87af900

80 files changed

Lines changed: 2205 additions & 280 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/aztec-cli-acceptance-test.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ jobs:
2121
runs-on: ubuntu-latest
2222
if: >-
2323
github.event_name == 'workflow_dispatch' ||
24-
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
24+
(github.event_name == 'workflow_run'
25+
&& github.event.workflow_run.conclusion == 'success'
26+
&& !contains(github.event.workflow_run.head_branch, '-commit.'))
2527
timeout-minutes: 30
2628
env:
2729
VERSION: ${{ github.event.inputs.version || github.event.workflow_run.head_branch }}
@@ -31,6 +33,13 @@ jobs:
3133
with:
3234
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
3335

36+
# Node is only used to run the .ts harness in run-test.sh, which needs >=22.18 for TS
37+
# type-stripping. The aztec CLI installer manages its own node version independently.
38+
- name: Setup Node.js
39+
uses: actions/setup-node@v4
40+
with:
41+
node-version: 22
42+
3443
- name: Run Aztec CLI acceptance test
3544
run: ./aztec-up/test/aztec-cli-acceptance-test/run-test.sh
3645

.test_patterns.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,19 @@ tests:
167167
- *palla
168168

169169
# yarn-project tests
170+
# Attempt to catch all kv-store browser test failures (consider them quarantined for now)
171+
- regex: "yarn-project/kv-store"
172+
error_regex: "vitest"
173+
owners:
174+
- *martin
170175
- regex: "yarn-project/kv-store"
171176
error_regex: "Could not import your test module"
172177
owners:
173178
- *grego
174179
- regex: "yarn-project/kv-store"
175180
error_regex: "timeout: sending signal TERM to command"
176181
owners:
177-
- *alex
182+
- *martin
178183
- regex: "yarn-project/kv-store"
179184
error_regex: "Failed to fetch dynamically imported module"
180185
owners:

docs/docusaurus.config.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,16 @@ const config = {
260260
{
261261
generateLLMsTxt: true,
262262
generateLLMsFullTxt: true,
263-
docsDir: `developer_versioned_docs/version-${mainnetDeveloperVersion || developerTestnetVersion}/`,
263+
docsDir: `developer_versioned_docs/version-${mainnetDeveloperVersion || developerTestnetVersion}`,
264264
title: "Aztec Protocol Documentation",
265265
excludeImports: true,
266266
version: mainnetDeveloperVersion || developerTestnetVersion,
267+
addMdExtension: false,
267268
pathTransformation: {
268-
ignorePaths: ["docs"],
269+
ignorePaths: [
270+
`developer_versioned_docs/version-${mainnetDeveloperVersion || developerTestnetVersion}`,
271+
],
272+
addPaths: ["developers"],
269273
},
270274
},
271275
],

docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.0.0",
44
"private": true,
55
"scripts": {
6-
"build": "yarn clean && yarn preprocess && yarn spellcheck && yarn preprocess:move && yarn validate:redirects && yarn validate:api-ref-links && docusaurus build && node scripts/append_api_docs_to_llms.js",
6+
"build": "yarn clean && yarn preprocess && yarn spellcheck && yarn preprocess:move && yarn validate:redirects && yarn validate:api-ref-links && docusaurus build && node scripts/augment_sitemap.js && node scripts/append_api_docs_to_llms.js",
77
"validate:redirects": "./scripts/validate_redirect_targets.sh",
88
"validate:api-ref-links": "./scripts/validate_api_ref_links.sh",
99
"clean": "./scripts/clean.sh",
@@ -41,7 +41,7 @@
4141
"@docusaurus/tsconfig": "3.9.1",
4242
"@tsconfig/docusaurus": "^1.0.7",
4343
"cspell": "^8.19.4",
44-
"docusaurus-plugin-llms": "^0.2.0",
44+
"docusaurus-plugin-llms": "^0.4.0",
4545
"dotenv": "^16.6.1",
4646
"netlify-cli": "^24.0.1"
4747
},

docs/scripts/append_api_docs_to_llms.js

Lines changed: 102 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,42 @@ const path = require("path");
1515
const BUILD_DIR = path.join(__dirname, "..", "build");
1616
const STATIC_DIR = path.join(__dirname, "..", "static");
1717

18-
// Load version from developer_versions.json (same as docusaurus.config.js)
18+
// Load version config (source of truth for type→version mapping)
19+
let developerVersionConfig;
20+
try {
21+
developerVersionConfig = require("../developer_version_config.json");
22+
} catch {
23+
// Fallback to legacy array-based detection
24+
developerVersionConfig = null;
25+
}
1926
const developerVersions = require("../developer_versions.json");
2027

21-
// Find testnet version dynamically (same logic as docusaurus.config.js)
22-
const testnetVersion = developerVersions.find((v) => v.includes("rc") || v.includes("testnet"));
23-
24-
// The API docs directories use stable folder names
25-
const API_DIRS = [
26-
...(testnetVersion ? [{
27-
name: "Aztec.nr API Reference (Testnet)",
28-
dir: "aztec-nr-api/testnet",
29-
description: `Auto-generated API documentation for Aztec.nr (${testnetVersion})`,
30-
}] : []),
31-
];
28+
// Determine the default (highest-priority) API docs version to append.
29+
// Only include one set to avoid bloating llms.txt. Priority: mainnet > testnet.
30+
const defaultType = developerVersionConfig?.mainnet ? "mainnet"
31+
: developerVersionConfig?.testnet ? "testnet"
32+
: null;
33+
const defaultVersion = defaultType ? developerVersionConfig[defaultType] : (developerVersions[0] || null);
34+
35+
const API_DIRS = [];
36+
if (defaultType && fs.existsSync(path.join(STATIC_DIR, `aztec-nr-api/${defaultType}`))) {
37+
API_DIRS.push({
38+
name: "Aztec.nr API Reference",
39+
dir: `aztec-nr-api/${defaultType}`,
40+
description: `Auto-generated API documentation for Aztec.nr (${defaultVersion})`,
41+
format: "html",
42+
});
43+
} else if (!defaultType) {
44+
console.warn("Warning: No default version found for API docs");
45+
}
46+
if (defaultType && fs.existsSync(path.join(STATIC_DIR, `typescript-api/${defaultType}`))) {
47+
API_DIRS.push({
48+
name: "TypeScript API Reference",
49+
dir: `typescript-api/${defaultType}`,
50+
description: `Auto-generated TypeScript API documentation for Aztec packages (${defaultVersion})`,
51+
format: "markdown",
52+
});
53+
}
3254

3355
/**
3456
* Extract text content from HTML, stripping tags and normalizing whitespace.
@@ -81,9 +103,9 @@ function htmlToText(html) {
81103
}
82104

83105
/**
84-
* Recursively find all HTML files in a directory.
106+
* Recursively find all files with a given extension in a directory.
85107
*/
86-
function findHtmlFiles(dir, files = []) {
108+
function findFiles(dir, ext, files = []) {
87109
if (!fs.existsSync(dir)) {
88110
return files;
89111
}
@@ -93,15 +115,30 @@ function findHtmlFiles(dir, files = []) {
93115
for (const entry of entries) {
94116
const fullPath = path.join(dir, entry.name);
95117
if (entry.isDirectory()) {
96-
findHtmlFiles(fullPath, files);
97-
} else if (entry.name.endsWith(".html")) {
118+
findFiles(fullPath, ext, files);
119+
} else if (entry.name.endsWith(ext)) {
98120
files.push(fullPath);
99121
}
100122
}
101123

102124
return files;
103125
}
104126

127+
/**
128+
* Recursively find all HTML files in a directory.
129+
*/
130+
function findHtmlFiles(dir) {
131+
return findFiles(dir, ".html");
132+
}
133+
134+
/**
135+
* Recursively find all markdown files in a directory.
136+
* Note: `llm-summary.txt` is naturally excluded since it does not end in `.md`.
137+
*/
138+
function findMarkdownFiles(dir) {
139+
return findFiles(dir, ".md");
140+
}
141+
105142
/**
106143
* Get the relative URL path for a file.
107144
*/
@@ -158,6 +195,7 @@ function main() {
158195
: "";
159196

160197
let totalFiles = 0;
198+
let sectionsAdded = 0;
161199
let linksSection = "\n\n# API Reference Documentation\n\n";
162200
let fullContentSection = "\n\n---\n\n# API Reference Documentation\n\n";
163201

@@ -169,43 +207,66 @@ function main() {
169207
continue;
170208
}
171209

172-
const htmlFiles = sortByImportance(findHtmlFiles(dirPath));
173-
console.log(`Found ${htmlFiles.length} HTML files in ${apiDir.dir}`);
210+
const isMarkdown = apiDir.format === "markdown";
211+
const files = isMarkdown
212+
? findMarkdownFiles(dirPath).sort()
213+
: sortByImportance(findHtmlFiles(dirPath));
214+
const ext = isMarkdown ? ".md" : ".html";
215+
console.log(`Found ${files.length} ${isMarkdown ? "markdown" : "HTML"} files in ${apiDir.dir}`);
174216

175-
if (htmlFiles.length === 0) {
217+
if (files.length === 0) {
176218
continue;
177219
}
178220

221+
sectionsAdded++;
222+
179223
// Add section header
180224
linksSection += `## ${apiDir.name}\n\n`;
181225
linksSection += `${apiDir.description}\n\n`;
182226
fullContentSection += `## ${apiDir.name}\n\n`;
183227
fullContentSection += `${apiDir.description}\n\n`;
184228

185-
// Process only index files for links to avoid overwhelming the llms.txt
186-
const indexFiles = htmlFiles.filter(
187-
(f) => f.endsWith("index.html") || f.includes("/fn.") || f.includes("/struct.") || f.includes("/trait.")
188-
);
189-
190-
// Add links for key files
191-
for (const file of indexFiles.slice(0, 100)) {
192-
// Limit to 100 links per section
193-
const urlPath = getUrlPath(file, STATIC_DIR);
194-
const fileName = path.basename(file, ".html");
195-
linksSection += `- [${fileName}](${urlPath})\n`;
196-
}
229+
if (isMarkdown) {
230+
// For markdown API docs, add a link per file and include llm-summary.txt if present
231+
const summaryPath = path.join(dirPath, "llm-summary.txt");
232+
if (fs.existsSync(summaryPath)) {
233+
linksSection += fs.readFileSync(summaryPath, "utf-8") + "\n\n";
234+
}
235+
// Cap link list at 100 entries to bound llms.txt size as the API surface grows.
236+
for (const file of files.slice(0, 100)) {
237+
const urlPath = getUrlPath(file, STATIC_DIR);
238+
const fileName = path.basename(file, ext);
239+
linksSection += `- [${fileName}](${urlPath})\n`;
240+
}
241+
if (files.length > 100) {
242+
linksSection += `- ... and ${files.length - 100} more files\n`;
243+
}
244+
} else {
245+
// For HTML API docs, process only index files for links
246+
const indexFiles = files.filter(
247+
(f) => f.endsWith("index.html") || f.includes("/fn.") || f.includes("/struct.") || f.includes("/trait.")
248+
);
249+
250+
// Add links for key files
251+
for (const file of indexFiles.slice(0, 100)) {
252+
// Limit to 100 links per section
253+
const urlPath = getUrlPath(file, STATIC_DIR);
254+
const fileName = path.basename(file, ext);
255+
linksSection += `- [${fileName}](${urlPath})\n`;
256+
}
197257

198-
if (indexFiles.length > 100) {
199-
linksSection += `- ... and ${indexFiles.length - 100} more files\n`;
258+
if (indexFiles.length > 100) {
259+
linksSection += `- ... and ${indexFiles.length - 100} more files\n`;
260+
}
200261
}
201262

202263
linksSection += "\n";
203264

204265
// Add full content for all files
205-
for (const file of htmlFiles) {
266+
for (const file of files) {
206267
try {
207-
const html = fs.readFileSync(file, "utf-8");
208-
const text = htmlToText(html);
268+
const raw = fs.readFileSync(file, "utf-8");
269+
const text = isMarkdown ? raw.trim() : htmlToText(raw);
209270

210271
if (text.length > 100) {
211272
// Only include if there's meaningful content
@@ -220,6 +281,11 @@ function main() {
220281
}
221282
}
222283

284+
if (sectionsAdded === 0) {
285+
console.log("No API docs found on disk — leaving llms.txt and llms-full.txt unchanged");
286+
return;
287+
}
288+
223289
// Append to llms.txt
224290
fs.writeFileSync(llmsTxtPath, llmsTxtContent + linksSection);
225291
console.log(`Updated llms.txt with API reference links`);

docs/scripts/augment_sitemap.js

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#!/usr/bin/env node
2+
/**
3+
* Post-build script to add static API documentation URLs to the sitemap.
4+
*
5+
* Docusaurus only includes its managed routes in sitemap.xml. This script
6+
* appends entries for the auto-generated API docs in static/ that are
7+
* copied to build/ but not indexed by the sitemap plugin.
8+
*/
9+
10+
const fs = require("fs");
11+
const path = require("path");
12+
13+
const BUILD_DIR = path.join(__dirname, "..", "build");
14+
// Override with SITE_URL env var if the canonical URL ever changes.
15+
// Kept in sync with `url` in docusaurus.config.js.
16+
// Trailing slash is stripped because <loc> entries below prepend "/".
17+
const SITE_URL = (process.env.SITE_URL || "https://docs.aztec.network").replace(/\/+$/, "");
18+
19+
// Load version config to determine which version subdirectory to index.
20+
let developerVersionConfig;
21+
try {
22+
developerVersionConfig = require("../developer_version_config.json");
23+
} catch {
24+
developerVersionConfig = null;
25+
}
26+
27+
const defaultType = developerVersionConfig?.mainnet
28+
? "mainnet"
29+
: developerVersionConfig?.testnet
30+
? "testnet"
31+
: null;
32+
33+
if (!defaultType) {
34+
console.warn("Warning: No default version found — skipping sitemap augmentation");
35+
process.exit(0);
36+
}
37+
38+
/**
39+
* Recursively find all files with a given extension.
40+
*/
41+
function findFiles(dir, ext) {
42+
const results = [];
43+
if (!fs.existsSync(dir)) return results;
44+
45+
const entries = fs.readdirSync(dir, { withFileTypes: true });
46+
for (const entry of entries) {
47+
const fullPath = path.join(dir, entry.name);
48+
if (entry.isDirectory()) {
49+
results.push(...findFiles(fullPath, ext));
50+
} else if (entry.name.endsWith(ext)) {
51+
results.push(fullPath);
52+
}
53+
}
54+
return results;
55+
}
56+
57+
function main() {
58+
const sitemapPath = path.join(BUILD_DIR, "sitemap.xml");
59+
60+
if (!fs.existsSync(sitemapPath)) {
61+
console.error("Error: build/sitemap.xml not found. Run the build first.");
62+
process.exit(1);
63+
}
64+
65+
let sitemap = fs.readFileSync(sitemapPath, "utf-8");
66+
67+
// Aztec.nr API HTML files (skip raw markdown — those aren't browsable pages)
68+
const nrApiDir = path.join(BUILD_DIR, `aztec-nr-api/${defaultType}`);
69+
// Exclude Noir stdlib (duplicated at noir-lang.org), the all.html mega-index,
70+
// and per-constant global.*.html pages. Keeps the sitemap aligned with the
71+
// Typesense stop_urls list so both discovery paths surface the same content.
72+
const EXCLUDE_RE = new RegExp(
73+
`aztec-nr-api/${defaultType}/(std/|all\\.html$|.*/global\\.[^/]+\\.html$)`
74+
);
75+
const htmlFiles = findFiles(nrApiDir, ".html").filter(
76+
(f) => !EXCLUDE_RE.test(f.replace(/\\/g, "/"))
77+
);
78+
79+
if (htmlFiles.length === 0) {
80+
console.log("No static API docs found to add to sitemap");
81+
return;
82+
}
83+
84+
// Build XML entries
85+
const entries = htmlFiles
86+
.map((file) => {
87+
const relativePath = path.relative(BUILD_DIR, file).replace(/\\/g, "/");
88+
return `<url><loc>${SITE_URL}/${relativePath}</loc><changefreq>monthly</changefreq><priority>0.3</priority></url>`;
89+
})
90+
.join("");
91+
92+
// Insert before closing </urlset>
93+
if (!sitemap.includes("</urlset>")) {
94+
console.error("Error: build/sitemap.xml missing </urlset> closing tag — aborting.");
95+
process.exit(1);
96+
}
97+
sitemap = sitemap.replace("</urlset>", entries + "</urlset>");
98+
99+
fs.writeFileSync(sitemapPath, sitemap);
100+
console.log(`Added ${htmlFiles.length} Aztec.nr API doc URLs to sitemap.xml`);
101+
}
102+
103+
main();

0 commit comments

Comments
 (0)