Skip to content

docs: write advanced cookbook for production and automation workflows#64

Merged
JusterZhu merged 2 commits into
mainfrom
docs/issue-54-advanced-cookbook
Jun 3, 2026
Merged

docs: write advanced cookbook for production and automation workflows#64
JusterZhu merged 2 commits into
mainfrom
docs/issue-54-advanced-cookbook

Conversation

@JusterZhu

Copy link
Copy Markdown
Collaborator

Closes #54

Summary

  • Write comprehensive advanced cookbook covering all 10 proposed chapters
  • Provide zh-Hans (default) and English localized copies
  • Align all code snippets, PowerShell examples, and API references with current Samples

Content

  1. Production update architecture — topology, roles, minimum production topology
  2. Standardized release artifacts — types, versions.json fields, packaging scripts
  3. CI/CD integration — GitHub Actions example, version mapping strategies, release checklist
  4. Version strategy — conventions, update modes, staged rollout, forced updates
  5. Differential strategy — when to use, delete_files.json, blacklists, parallel processing
  6. Bowl reliability — lifecycle, config, backup/rollback, platform differences, log integration
  7. Extension system — lifecycle, manifest spec, query/install API, server API contracts
  8. Driver updates — Drivelution flow, Windows signing, Linux notes, batch updates
  9. Security & compliance — hash validation, authenticated downloads, OSS security, audit checklist
  10. Failure drills — 5 scenarios with simulation steps and expected behavior

Validation

  • git diff --check

Copilot AI review requested due to automatic review settings June 1, 2026 04:09

Copilot AI 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.

Pull request overview

Adds a comprehensive 10-chapter "Advanced cookbook" guide covering production deployment, CI/CD, version & differential strategies, Bowl reliability, extensions, drivers, security, and failure drills. The document is added as the default-locale Chinese copy under website/docs/quickstart/ and duplicated as zh-Hans and en localized copies under website/i18n/.

Changes:

  • New advanced cookbook in default-locale (Chinese) docs.
  • Localized zh-Hans copy (duplicates the default-locale content).
  • Localized English copy.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 10 comments.

File Description
website/docs/quickstart/Advanced cookbook.md Default-locale (Chinese) advanced cookbook content.
website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/quickstart/Advanced cookbook.md zh-Hans localized copy of the cookbook (duplicates default-locale file).
website/i18n/en/docusaurus-plugin-content-docs/current/quickstart/Advanced cookbook.md English localized copy of the cookbook.

Key concerns:

  • All three files link to ./Beginner cookbook.md, which does not exist anywhere in the docs tree — with onBrokenLinks: 'throw' in docusaurus.config.js this will break the build.
  • Several code samples reference APIs that do not exist in this codebase: ExtensionManager, DriverUpdater, AddBlacklist, and AddListenerDownloadConfig. The real APIs are GeneralExtensionHost, static GeneralDrivelution, Configinfo.BlackFiles/BlackFormats/SkipDirectorys, and Scheme/Token fields.
  • Client-side examples use GeneralUpdateBootstrap where GeneralClientBootstrap is the correct type for client-side flows.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


> **Target audience**: developers who have completed the beginner flow and are integrating GeneralUpdate into production products, CI/CD pipelines, and enterprise release workflows.

This cookbook complements the [beginner cookbook](./Beginner cookbook.md). The beginner cookbook gets you through your first update loop; this one assumes you've done that and jumps straight into production-grade design.
- [GeneralUpdate.Drivelution component docs](../doc/GeneralUpdate.Drivelution.md)
- [GeneralUpdate.Extension component docs](../doc/GeneralUpdate.Extension.md)
- [GeneralUpdate.Tools reference](../doc/GeneralUpdate.PacketTool.md)
- [Beginner cookbook](./Beginner cookbook.md)
Comment on lines +480 to +503
```csharp
var manager = new ExtensionManager(options =>
{
options.ExtensionsRootPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "extensions");
options.TempDownloadPath = Path.Combine(Path.GetTempPath(), "ext_downloads");
options.ManifestFileName = "extension.json";
});

// Query remote available extensions
var available = await manager.QueryRemoteExtensionsAsync("https://extensions.example.com/api/v1/extensions");

// Install
await manager.InstallAsync("com.mycompany.plugin.search", "1.2.0",
progress => Console.WriteLine($"Downloading: {progress.Percentage}%"));

// Update
await manager.UpdateAsync("com.mycompany.plugin.search", "1.3.0");

// Rollback
await manager.RollbackAsync("com.mycompany.plugin.search", "1.2.0");

// Uninstall
await manager.UninstallAsync("com.mycompany.plugin.search");
```
Comment on lines +546 to +617
```csharp
var updater = new DriverUpdater(options =>
{
options.DriverStorePath = @"C:\ProgramData\MyProduct\Drivers";
options.TempPath = Path.GetTempPath();
options.RequireSignature = true;
options.BackupBeforeInstall = true;
});

// 1. Validate driver package
var validation = await updater.ValidatePackageAsync(driverPackagePath);
if (!validation.IsValid)
{
Console.WriteLine($"Driver validation failed: {validation.Errors}");
return;
}

// 2. Backup current driver
await updater.BackupCurrentDriverAsync("MyDeviceDriver");

// 3. Install new driver
var result = await updater.InstallAsync(driverPackagePath);
if (!result.Success)
{
// 4. Install failed, auto-rollback
await updater.RollbackAsync("MyDeviceDriver");
Console.WriteLine($"Install failed: {result.ErrorMessage}");
return;
}

// 5. Verify new driver health
var health = await updater.HealthCheckAsync("MyDeviceDriver");
Console.WriteLine($"Driver health: {health.Status}");
```

### 8.3 Windows driver signing

Production Windows drivers must be signed:

1. Obtain an EV Code Signing certificate
2. Pass WHQL (Windows Hardware Quality Labs) certification
3. Enable `RequireSignature = true` in `DriverUpdater`

### 8.4 Linux driver considerations

- Use `dkms` (Dynamic Kernel Module Support) for kernel module management
- Check kernel version compatibility before updating
- `/lib/modules/$(uname -r)/` typically requires root permissions
- May need `depmod` and `modprobe` after update

### 8.5 Batch / parallel driver updates

```csharp
var updaters = new[]
{
new DriverUpdateTask { DeviceId = "PCI\\VEN_8086", PackagePath = @"drivers\gpu_2.1.0.zip" },
new DriverUpdateTask { DeviceId = "USB\\VID_0BDA", PackagePath = @"drivers\wifi_1.5.0.zip" },
};

var results = await Parallel.ForEachAsync(updaters,
new ParallelOptions { MaxDegreeOfParallelism = 4 },
async (task, ct) =>
{
var updater = new DriverUpdater(/* ... */);
return await updater.InstallAsync(task.PackagePath);
});

foreach (var r in results)
{
Console.WriteLine($"Driver {r.DeviceId}: {(r.Success ? "OK" : "FAILED")}");
}
```
Comment on lines +323 to +332
```csharp
new GeneralUpdateBootstrap()
.AddBlacklist(new List<string>
{
"appsettings.json", // user local config
"logs/", // log directory
"*.user", // user-specific files
"cache.db" // local database
})
```
Comment on lines +640 to +650
```csharp
// Client-side: add auth header to requests
new GeneralUpdateBootstrap()
.AddListenerDownloadConfig(config =>
{
config.Headers = new Dictionary<string, string>
{
["Authorization"] = $"Bearer {GetAccessToken()}"
};
});
```
Comment on lines +253 to +266
```csharp
bootstrap.AddListenerUpdatePrecheck(async (precheckArgs) =>
{
var forcedCount = precheckArgs.Versions.Count(v => v.IsForcibly);
if (forcedCount > 0)
{
// Forced update: don't show a "skip" button
ShowDialog("A critical security update is required.");
return false; // false = do not skip, proceed with update
}
// Optional update: ask the user
return await AskUserWhetherToSkip();
});
```
| Framework/runtime upgrade | Full | Wide file changes, low diff benefit |
| Large file update (>100MB) | Differential | Significant size reduction even with many changes |

### 5.2 Differential generation and `delete_files.json`

> **目标读者**:已有基础使用经验的开发者,正在将 GeneralUpdate 集成到生产产品、CI/CD 流水线和企业级发布工作流中。

本手册与[入门实战手册](./Beginner cookbook.md)互补。入门手册带你跑通第一次更新闭环;本手册假设你已经跑通,直接进入生产级方案设计。

> **目标读者**:已有基础使用经验的开发者,正在将 GeneralUpdate 集成到生产产品、CI/CD 流水线和企业级发布工作流中。

本手册与[入门实战手册](./Beginner cookbook.md)互补。入门手册带你跑通第一次更新闭环;本手册假设你已经跑通,直接进入生产级方案设计。
@JusterZhu JusterZhu force-pushed the docs/issue-54-advanced-cookbook branch 2 times, most recently from fa46c98 to f92eb9f Compare June 3, 2026 07:42
JusterZhu and others added 2 commits June 3, 2026 15:44
- Cover production update architecture, standardized Tools artifacts,
  CI/CD patch generation, version strategy, Differential strategy,
  Bowl reliability, Extension release workflow, Drivelution workflow,
  security & compliance, and failure drills.
- Provide zh-Hans (default) and English localized copies.
- Link to component reference pages and Tools documentation.
- Align code snippets and PowerShell examples with current Samples.

Closes #54

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Add Semantic Versioning (semver.org) reference in section 4.1
- Map GeneralUpdate 4-part versioning to SemVer MAJOR.MINOR.PATCH
- Use language-appropriate URLs: semver.org/lang/zh-CN/ for Chinese,
  semver.org/ for English
- Explain Revision segment as .NET System.Version extension

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@JusterZhu JusterZhu force-pushed the docs/issue-54-advanced-cookbook branch from f92eb9f to 71eff5a Compare June 3, 2026 07:44
@JusterZhu JusterZhu merged commit decc518 into main Jun 3, 2026
1 check passed
@JusterZhu JusterZhu deleted the docs/issue-54-advanced-cookbook branch June 3, 2026 16:47
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.

Docs subtask: write advanced cookbook for production and automation workflows

2 participants