Add city and profile dropdowns to discover/suggest workflows#27
Add city and profile dropdowns to discover/suggest workflows#27nicholasjpanella wants to merge 2 commits into
Conversation
Replace free-text workflow_dispatch inputs with choice dropdowns backed by metro city keys and active discovery profiles from taxonomy. Add a drift test so workflow option lists stay aligned with config/taxonomy.json. Co-authored-by: Nicholas P. <nicholasjpanella@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
PR Summary by QodoAdd dropdown city/profile inputs to ingestion discover/suggest workflows
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
16 rules 1. Brittle YAML regex parsing
|
| function extractChoiceOptions(workflow: string, inputKey: string): string[] { | ||
| const block = workflow.match( | ||
| new RegExp( | ||
| `${inputKey}:\\s*\\n(?:[ \\t]+[^\\n]+\\n)*?[ \\t]+options:\\s*\\n((?:[ \\t]+- [^\\n]+\\n)+)`, | ||
| ), | ||
| ); | ||
| assert.ok(block, `missing choice options for ${inputKey}`); | ||
| return [...block[1].matchAll(/^[ \t]+- (.+)$/gm)].map((match) => match[1]!.trim()); | ||
| } |
There was a problem hiding this comment.
1. Brittle yaml regex parsing 🐞 Bug ☼ Reliability
workflowDispatchOptions.test.ts parses workflow YAML via a single regex that is sensitive to formatting (blank lines, comments, indentation changes) and can fail CI even when the option values haven’t drifted. This creates noisy, merge-blocking test failures unrelated to the intended “options drift” signal.
Agent Prompt
### Issue description
`extractChoiceOptions()` uses a regex to parse YAML blocks, which is fragile to innocuous formatting changes and can produce false CI failures.
### Issue Context
This test is meant to detect drift between workflow dropdown options and the canonical sources, not to enforce a specific YAML layout.
### Fix Focus Areas
- src/lib/ingestion/workflowDispatchOptions.test.ts[17-25]
### Suggested fix
Replace the regex with a small indentation-aware line scanner that:
1) Finds `workflow_dispatch:` → `inputs:`
2) Locates the exact `${inputKey}:` block at the correct indentation
3) Finds its `options:` section
4) Collects consecutive `- ...` items until indentation decreases.
This avoids adding a YAML dependency while making the test robust to comments/blank lines and reduces accidental false failures.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| const REPO_ROOT = path.resolve(import.meta.dirname, "../../.."); | ||
|
|
||
| function readWorkflow(name: string): string { | ||
| return fs.readFileSync(path.join(REPO_ROOT, ".github/workflows", name), "utf8"); | ||
| } |
There was a problem hiding this comment.
2. Taxonomy read depends on cwd 🐞 Bug ☼ Reliability
The drift test reads workflow YAML using a repo-root derived from import.meta.dirname, but workflowDiscoveryProfileSlugs() ultimately loads config/taxonomy.json via process.cwd(). If tests are invoked with a non-repo working directory, the test can read the wrong taxonomy file (or fail to find it) and report incorrect drift.
Agent Prompt
### Issue description
The new drift test computes `REPO_ROOT` for reading `.github/workflows`, but taxonomy loading uses `process.cwd()` internally. If the test runner’s cwd isn’t the repo root, the test may validate against the wrong `config/taxonomy.json`.
### Issue Context
- The test reads workflows from `REPO_ROOT`.
- `getFileTaxonomySnapshot()` reads taxonomy from `path.join(process.cwd(), "config", "taxonomy.json")`.
### Fix Focus Areas
- src/lib/ingestion/workflowDispatchOptions.test.ts[11-15]
### Suggested fix
In the test file, ensure taxonomy reads from the same root by doing one of:
- Add `process.chdir(REPO_ROOT)` once near the top (and optionally restore the previous cwd after tests), or
- Refactor `workflowDiscoveryProfileSlugs()` (or `getFileTaxonomySnapshot()`) to accept an explicit base directory / repo root.
The smallest change is to `process.chdir(REPO_ROOT)` in the test setup so both workflow reads and taxonomy reads resolve from the same directory.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Replace regex YAML parsing with an indentation-aware line scanner so the drift test tolerates blank lines and comments. Chdir to REPO_ROOT in test setup so taxonomy.json resolves from the same root as workflow files. Co-authored-by: Nicholas P. <nicholasjpanella@users.noreply.github.com>
Summary
Replaces free-text
cityandprofileinputs on the Ingestion discover and Ingestion suggest GitHub Actions workflows withtype: choicedropdowns. Operators can pick metro cities and discovery profiles without memorizing slugs.allruns every city/profile (same as leaving inputs blank before).nonefor optional city on events; profile defaults tohidden_gems.Adds
workflowDispatchOptions.test.tsso workflow option lists stay aligned withconfig/taxonomy.jsonandsrc/lib/cities.ts.Type of change
Testing
npm test -- src/lib/ingestion/workflowDispatchOptions.test.ts(passes)Checklist
.github/workflows/README.md)Notes for reviewers
Workflow YAML option lists must be updated when adding cities or discovery profiles; the new drift test will fail CI if they diverge from taxonomy/cities sources.