Skip to content

Add city and profile dropdowns to discover/suggest workflows#27

Open
nicholasjpanella wants to merge 2 commits into
mainfrom
dev/discovery-suggest-dropdowns-7680
Open

Add city and profile dropdowns to discover/suggest workflows#27
nicholasjpanella wants to merge 2 commits into
mainfrom
dev/discovery-suggest-dropdowns-7680

Conversation

@nicholasjpanella

Copy link
Copy Markdown
Contributor

Summary

Replaces free-text city and profile inputs on the Ingestion discover and Ingestion suggest GitHub Actions workflows with type: choice dropdowns. Operators can pick metro cities and discovery profiles without memorizing slugs.

  • Discover: all runs every city/profile (same as leaving inputs blank before).
  • Suggest: none for optional city on events; profile defaults to hidden_gems.

Adds workflowDispatchOptions.test.ts so workflow option lists stay aligned with config/taxonomy.json and src/lib/cities.ts.

Type of change

  • New feature
  • Documentation only

Testing

  • npm test -- src/lib/ingestion/workflowDispatchOptions.test.ts (passes)

Checklist

  • Docs updated if behavior or ops changed (.github/workflows/README.md)
  • No secrets committed

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.

Open in Web Open in Cursor 

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>
@vercel

vercel Bot commented Jul 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
baywire-app Building Building Jul 5, 2026 4:28pm
baywire-app (test) Ready Ready Preview Jul 5, 2026 4:28pm

Request Review

@nicholasjpanella nicholasjpanella marked this pull request as ready for review July 5, 2026 15:58
@cursor

cursor Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

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.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add dropdown city/profile inputs to ingestion discover/suggest workflows

✨ Enhancement 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Replace free-text city/profile workflow inputs with choice dropdowns for discover and suggest.
• Interpret sentinel values (discover: all, suggest: none) to preserve prior behavior.
• Add drift test (and docs) to keep workflow option lists aligned with taxonomy/cities.
Diagram

graph TD
  Op(["Operator"]) --> DiscWF["ingestion-discover.yml"] --> Ingest["Ingestion scripts"]
  Op --> SugWF["ingestion-suggest.yml"] --> Ingest
  Cities[["src/lib/cities.ts"]] --> Opts[["workflowDispatchOptions.ts"]] --> Drift["workflowDispatchOptions.test.ts"]
  Tax[("config/taxonomy.json")] --> Opts
  DiscWF --> Drift
  SugWF --> Drift

  subgraph Legend
    direction LR
    _wf["Workflow YAML"] ~~~ _mod[["TS module"]] ~~~ _cfg[("Config data")]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Generate workflow YAML from sources (codegen)
  • ➕ Single source of truth; eliminates manual YAML list edits
  • ➕ Can update cities/profiles by changing taxonomy/cities only
  • ➖ Adds a generation step and enforcement in CI
  • ➖ Harder to audit/edit workflows directly in GitHub UI
2. Keep free-text inputs and validate at runtime
  • ➕ No need to maintain option lists in YAML
  • ➕ Supports ad-hoc values without editing workflows
  • ➖ Worse operator UX; easy to mistype slugs
  • ➖ Validation logic lives in bash/runtime rather than UI constraints
3. Move dispatch UI to a small internal tool/CLI
  • ➕ Richer UI/validation; can query taxonomy live
  • ➕ Decouples operator experience from GitHub Actions limitations
  • ➖ More infrastructure and maintenance than needed for simple inputs
  • ➖ Still need to pass validated inputs into workflows

Recommendation: Current approach (dropdowns + drift test) is a good tradeoff: it improves operator UX while keeping GitHub Actions as the control plane. If the option lists grow significantly, consider codegen to avoid manual YAML edits entirely; until then, the drift test provides an effective guardrail.

Files changed (5) +110 / -9

Enhancement (1) +12 / -0
workflowDispatchOptions.tsCentralize workflow dropdown option sources (cities + active profiles) +12/-0

Centralize workflow dropdown option sources (cities + active profiles)

• Adds a small helper module that exports metro city keys from src/lib/cities.ts and derives active discovery profile slugs from the file-backed taxonomy snapshot. Used by the drift test to define the expected option lists.

src/lib/ingestion/workflowDispatchOptions.ts

Tests (1) +43 / -0
workflowDispatchOptions.test.tsAdd drift test to keep workflow dropdown options in sync +43/-0

Add drift test to keep workflow dropdown options in sync

• Introduces node:test coverage that parses the workflow YAML option blocks and compares them to derived city keys and active profile slugs. Fails CI if workflow dropdowns diverge from taxonomy/cities sources.

src/lib/ingestion/workflowDispatchOptions.test.ts

Documentation (1) +3 / -1
README.mdDocument new discover/suggest dropdown behavior and drift test +3/-1

Document new discover/suggest dropdown behavior and drift test

• Updates manual-run guidance to reflect city/profile dropdown inputs and sentinel values. Adds a note that dropdown lists are validated against taxonomy/cities by a drift test.

.github/workflows/README.md

Other (2) +52 / -8
ingestion-discover.ymlAdd city/profile choice inputs with 'all' sentinel for discover +27/-4

Add city/profile choice inputs with 'all' sentinel for discover

• Replaces free-text city/profile workflow_dispatch inputs with choice dropdowns and explicit option lists. Adds bash normalization to treat "all" as blank so existing CLI behavior (omit flag = run all) remains unchanged.

.github/workflows/ingestion-discover.yml

ingestion-suggest.ymlAdd city/profile choice inputs with 'none' sentinel and stricter place validation +25/-4

Add city/profile choice inputs with 'none' sentinel and stricter place validation

• Replaces free-text city/profile inputs with dropdowns (city defaults to "none"; profile defaults to "hidden_gems"). Normalizes "none" to blank for event hints and improves the error message when city is missing for place suggestions.

.github/workflows/ingestion-suggest.yml

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 16 rules

Grey Divider


Remediation recommended

1. Brittle YAML regex parsing 🐞 Bug ☼ Reliability
Description
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.
Code

src/lib/ingestion/workflowDispatchOptions.test.ts[R17-25]

+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());
+}
Relevance

⭐⭐ Medium

No historical evidence about avoiding regex YAML parsing in tests; unclear if team will add YAML
parser.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The test currently relies on a single regex to identify the options: block and list items, which
couples correctness to the exact YAML layout rather than the semantic content of the options.

src/lib/ingestion/workflowDispatchOptions.test.ts[17-25]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### 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


2. Taxonomy read depends on cwd 🐞 Bug ☼ Reliability
Description
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.
Code

src/lib/ingestion/workflowDispatchOptions.test.ts[R11-15]

+const REPO_ROOT = path.resolve(import.meta.dirname, "../../..");
+
+function readWorkflow(name: string): string {
+  return fs.readFileSync(path.join(REPO_ROOT, ".github/workflows", name), "utf8");
+}
Relevance

⭐⭐ Medium

No prior evidence on cwd-dependent test paths; team does accept reliability hardening (PR#19,
PR#13).

PR-#19
PR-#13

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The test explicitly derives a repo root for workflow file reads, while taxonomy loading resolves
relative to process.cwd(). This mismatch is a concrete source of environment-dependent failures if
cwd differs from the repo root.

src/lib/ingestion/workflowDispatchOptions.test.ts[11-15]
src/lib/ingestion/workflowDispatchOptions.ts[8-11]
src/ingestion/taxonomy/fileSnapshot.ts[10-14]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### 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


Grey Divider

Qodo Logo

Comment on lines +17 to +25
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());
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

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

Comment on lines +11 to +15
const REPO_ROOT = path.resolve(import.meta.dirname, "../../..");

function readWorkflow(name: string): string {
return fs.readFileSync(path.join(REPO_ROOT, ".github/workflows", name), "utf8");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

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

2 participants