fix(exports): add missing #| export directives across 10 modules

Systematic audit of all 20 modules against module-developer agent rules
found 9 standalone helper functions missing #| export — these are called
by exported code at runtime but were excluded from the generated package,
causing NameError/AttributeError in CI.

Modules fixed:
- 05_dataloader: _pad_image, _random_crop_region (used by RandomCrop)
- 06_autograd: _stable_softmax, _one_hot_encode (prior session)
- 07_optimizers: 5 mixin classes + monkey-patches (prior session)
- 08_training: 7 monkey-patched Trainer methods (prior session)
- 10_tokenization: _count_byte_pairs, _merge_pair (used by BPETokenizer)
- 11_embeddings: _compute_sinusoidal_table (prior session)
- 12_attention: _compute_attention_scores, _scale_scores, _apply_mask (prior)
- 15_quantization: _collect_layer_inputs, _quantize_single_layer (used by quantize_model)
- 18_memoization: _cached_generation_step, _create_cache_storage, _cached_attention_forward (used by enable_kv_cache)
- 19_benchmarking: rename TinyMLPerf→MLPerf, fix monkey-patch naming (prior)

Also includes: vscode-ext icon refactor (ThemeIcon migration).

All 789 tests pass (unit, integration, e2e, CLI).
This commit is contained in:
Vijay Janapa Reddi
2026-02-15 17:38:03 -05:00
parent a6bd9496e3
commit 09de699545
15 changed files with 204 additions and 154 deletions

View File

@@ -4,13 +4,14 @@ import { ModuleInfo, CommandRunRecord } from '../types';
/** A module entry in the Modules tree */
export class ModuleTreeItem extends vscode.TreeItem {
constructor(public readonly module: ModuleInfo) {
const icon = module.status === 'completed' ? '$(pass-filled)'
: module.status === 'started' ? '$(edit)'
: '$(circle-outline)';
const iconId = module.status === 'completed' ? 'pass-filled'
: module.status === 'started' ? 'edit'
: 'circle-outline';
super(
`${icon} ${module.number}${module.title ?? module.displayName}`,
`${module.number}${module.title ?? module.displayName}`,
vscode.TreeItemCollapsibleState.Collapsed,
);
this.iconPath = new vscode.ThemeIcon(iconId);
this.contextValue = 'module';
this.tooltip = `Module ${module.number}: ${module.title ?? module.displayName}\nStatus: ${module.status.replace('_', ' ')}`;
this.description = module.status === 'not_started' ? '' : module.status.replace('_', ' ');
@@ -25,12 +26,11 @@ export class ActionTreeItem extends vscode.TreeItem {
args: unknown[] = [],
icon?: string,
) {
// Visually offset leaf actions under expanded categories in sidebars.
super(` ${label}`, vscode.TreeItemCollapsibleState.None);
this.command = { command: commandId, title: label, arguments: args };
super(label, vscode.TreeItemCollapsibleState.None);
if (icon) {
this.iconPath = new vscode.ThemeIcon(icon);
}
this.command = { command: commandId, title: label, arguments: args };
this.contextValue = 'action';
}
}
@@ -40,8 +40,10 @@ export class CategoryTreeItem extends vscode.TreeItem {
constructor(
label: string,
public readonly categoryId: string,
icon?: string,
) {
super(label, vscode.TreeItemCollapsibleState.Expanded);
this.iconPath = new vscode.ThemeIcon(icon ?? 'symbol-folder');
this.contextValue = 'category';
}
}
@@ -49,11 +51,12 @@ export class CategoryTreeItem extends vscode.TreeItem {
/** An entry in the Run History tree */
export class RunHistoryTreeItem extends vscode.TreeItem {
constructor(public readonly record: CommandRunRecord) {
const icon = record.status === 'succeeded' ? '$(pass)'
: record.status === 'failed' ? '$(error)'
: '$(loading~spin)';
const iconId = record.status === 'succeeded' ? 'pass'
: record.status === 'failed' ? 'error'
: 'loading~spin';
const time = new Date(record.timestamp).toLocaleTimeString();
super(`${icon} ${record.label}`, vscode.TreeItemCollapsibleState.None);
super(record.label, vscode.TreeItemCollapsibleState.None);
this.iconPath = new vscode.ThemeIcon(iconId);
this.description = time;
this.tooltip = `${record.label}\n${record.command}\n${time}`;
this.command = {

View File

@@ -14,10 +14,10 @@ export class BuildTreeProvider implements vscode.TreeDataProvider<TreeNode> {
getChildren(element?: TreeNode): TreeNode[] {
if (!element) {
return [
new CategoryTreeItem('Site (HTML)', 'site'),
new CategoryTreeItem('PDF Course Guide', 'pdf'),
new CategoryTreeItem('Research Paper', 'paper'),
new CategoryTreeItem('Utilities', 'utilities'),
new CategoryTreeItem('Site (HTML)', 'site', 'globe'),
new CategoryTreeItem('PDF Course Guide', 'pdf', 'file-pdf'),
new CategoryTreeItem('Research Paper', 'paper', 'book'),
new CategoryTreeItem('Utilities', 'utilities', 'tools'),
];
}

View File

@@ -40,9 +40,9 @@ export class TestTreeProvider implements vscode.TreeDataProvider<TreeNode> {
getChildren(element?: TreeNode): TreeNode[] {
if (!element) {
return [
new CategoryTreeItem('Run All', 'all'),
new CategoryTreeItem('By Stage (CI Pipeline)', 'stages'),
new CategoryTreeItem('Single Module', 'module'),
new CategoryTreeItem('Run All', 'all', 'run-all'),
new CategoryTreeItem('By Stage (CI Pipeline)', 'stages', 'layers'),
new CategoryTreeItem('Single Module', 'module', 'symbol-method'),
];
}