Conversation
|
There was a problem hiding this comment.
Pull request overview
Adds an auto-generated test catalog (from tests/**/*.feature) and a new website page that renders a browsable inventory of features/scenarios to help users understand and navigate the VIP test suite.
Changes:
- Add a lightweight Gherkin
.featureparser and a generator script to producewebsite/src/data/test-catalog.json. - Add a new
/tests/Astro page to browse categories, features, scenarios, and steps with progressive disclosure. - Update website navigation and Pages workflow to generate the catalog during the deploy build.
Reviewed changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| website/src/pages/tests.astro | New Test Inventory page rendering the generated catalog with TOC + details/summary disclosure UI. |
| website/src/components/Header.astro | Adds a “Tests” link to the site header nav. |
| src/vip/gherkin.py | New internal parser for .feature files (no external deps). |
| scripts/generate-test-catalog.py | New generator that walks tests/ and emits the website catalog JSON. |
| website/src/data/.gitkeep | Keeps website/src/data/ present in git while the JSON is generated/ignored. |
| justfile | Adds just website-data to generate the catalog locally. |
| .gitignore | Ignores the generated website/src/data/test-catalog.json. |
| .github/workflows/website.yml | Rebuilds/deploys the website when .feature/generator/parser change; generates catalog before Astro build. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
src/vip/gherkin.py
Outdated
| from pathlib import Path | ||
|
|
||
| # Keywords that terminate the feature description block. | ||
| _KEYWORDS = frozenset(["Scenario:", "Scenario Outline:", "Background:", "Rule:", "Examples:", "@"]) |
There was a problem hiding this comment.
_KEYWORDS includes "@", but tag lines are already handled earlier with if line.startswith("@"): and continue, so this entry can never influence description termination. Consider removing "@" from _KEYWORDS (or reordering logic) to avoid dead/ misleading configuration.
| _KEYWORDS = frozenset(["Scenario:", "Scenario Outline:", "Background:", "Rule:", "Examples:", "@"]) | |
| _KEYWORDS = frozenset(["Scenario:", "Scenario Outline:", "Background:", "Rule:", "Examples:"]) |
| def parse_feature_file(path: Path, *, relative_to: Path | None = None) -> dict: | ||
| """Parse a ``.feature`` file and return a structured dict. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| path: | ||
| Absolute or relative path to the ``.feature`` file. | ||
| relative_to: | ||
| If provided, ``file`` in the returned dict is set relative to this | ||
| directory. Otherwise the path is returned as-is. | ||
|
|
||
| Returns | ||
| ------- | ||
| dict with keys: ``title``, ``description``, ``marker``, ``file``, | ||
| ``scenarios`` (list of dicts with ``title`` and ``steps``). | ||
| """ | ||
| text = path.read_text(encoding="utf-8") | ||
| lines = text.splitlines() |
There was a problem hiding this comment.
parse_feature_file is new parsing logic that feeds a generated site artifact; there are existing selftests/ for other vip modules, but no unit tests added for this parser. Please add focused tests that cover at least: extracting the first @tag as marker, capturing the Feature title, collecting description lines up to the first Scenario, and collecting scenario titles + step lines.
scripts/generate-test-catalog.py
Outdated
| } | ||
|
|
||
| output.parent.mkdir(parents=True, exist_ok=True) | ||
| output.write_text(json.dumps(catalog, indent=2) + "\n") |
There was a problem hiding this comment.
output.write_text(...) relies on the platform default encoding, which can produce non-UTF8 JSON on some systems. Since the website consumes this file, write it explicitly with encoding="utf-8" (matching the parser’s read path).
| output.write_text(json.dumps(catalog, indent=2) + "\n") | |
| output.write_text(json.dumps(catalog, indent=2) + "\n", encoding="utf-8") |
| - uses: astral-sh/setup-uv@v5 | ||
|
|
There was a problem hiding this comment.
The workflow runs uv run python ... without setting up a cached/synced environment. Elsewhere in this repo (e.g. .github/workflows/ci.yml) setup-uv is configured with enable-cache: true and followed by uv sync before uv run. Consider enabling uv caching here and running a uv sync/uv sync --frozen step before generating the catalog to make the build faster and more reproducible.
| - uses: astral-sh/setup-uv@v5 | |
| - uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Sync Python dependencies | |
| run: uv sync --frozen |
- Remove dead "@" from _KEYWORDS in gherkin parser - Use encoding="utf-8" in catalog JSON write - Enable uv cache and add uv sync --frozen in website.yml
The report and website previews both use rossjrw/pr-preview-action which posts a sticky comment. Without distinct comment-tag values, one overwrites the other. Now each preview gets its own PR comment.
rossjrw/pr-preview-action doesn't support comment-tag, so both previews shared the same sticky comment and one overwrote the other. Disable the built-in comment on the website preview and use marocchino/sticky-pull-request-comment directly with a distinct header.
|
Website Preview · View preview |
Summary
src/vip/gherkin.py— shared Gherkin feature file parser (no external deps)scripts/generate-test-catalog.py— walkstests/and outputswebsite/src/data/test-catalog.jsonwebsite/src/pages/tests.astro— browsable test inventory with progressive disclosure (<details>/<summary>)tests/**/*.featurechanges, generates catalog at build time via uvjust website-datarecipeCloses #54, closes #53
Test plan
just website-datagenerates valid JSON with 7 categories, 24 featurescd website && npm ci && npm run buildsucceeds with 3 pages