Skip to content

Commit a75f281

Browse files
fix: address code review feedback
- Improve error handling in discoverCategories to distinguish ENOENT from other errors - Add required field to test fixture secrets and update test assertion - Log warnings for unexpected filesystem errors
1 parent e37a7ba commit a75f281

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/core/registry.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('WorkflowRegistry', () => {
7373
expect(workflow?.metadata.secrets.length).toBe(1);
7474
expect(workflow?.metadata.secrets[0]?.name).toBe('TEST_SECRET');
7575
expect(workflow?.metadata.secrets[0]?.description).toBe('A test secret');
76-
expect(workflow?.metadata.secrets[0]?.required).toBeUndefined();
76+
expect(workflow?.metadata.secrets[0]?.required).toBe(true);
7777
});
7878

7979
test('should parse triggers from metadata', async () => {

src/core/registry.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,13 @@ export class WorkflowRegistry {
8585
path: join(this.workflowsRoot, entry.name),
8686
});
8787
}
88-
} catch {
89-
// Directory doesn't exist or can't be read, return empty categories
88+
} catch (error) {
89+
// Only ENOENT (directory doesn't exist) is expected - other errors should be logged
90+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
91+
// Expected - directory doesn't exist, return empty categories
92+
} else {
93+
console.warn('Warning: Could not read workflows directory:', error);
94+
}
9095
}
9196
return categories;
9297
}

src/test/fixtures/test-category/simple-workflow/simple-workflow.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# secrets:
99
# - name: TEST_SECRET
1010
# description: A test secret
11+
# required: true
1112
# triggers:
1213
# - push
1314
# - pull_request

0 commit comments

Comments
 (0)