influxdata / influxdata/docs-v2

refactor(products): use products.yml as the single source for browser product context

Open
#7,671 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
82
Forks
326
Avg merge
1d 1h
Merged PRs (30d)
82

Description

## Problem

Browser product detection duplicates product metadata across data/products.yml, assets/js/page-context.ts, and assets/js/utils/product-mappings.ts.

InfluxDB 3 Cloud was added to data/products.yml, but /influxdb3/cloud/ was not added to the hardcoded browser mappings. As a result, page-context returns other for these pages. Ask AI cannot read the influxdb3_cloud ai_sample_questions, ai_input_placeholder, or ai_source_group_ids values and uses its generic defaults instead.

This drift is easy to repeat whenever a product or content path is added or renamed.

## Proposed direction

Use data/products.yml as the canonical source for mapping documentation paths to product keys and product configuration. Pass or generate the browser-compatible mapping from that data, and have page-context and other consumers use one shared lookup rather than maintaining separate regular-expression and fallback tables.

Keep product-specific URL-service selection separate if it cannot be derived from product metadata, but do not duplicate documentation content-path-to-product-key mappings.

## Acceptance criteria

- /influxdb3/cloud/ resolves to the influxdb3_cloud product configuration in browser page context.
- Ask AI uses the InfluxDB 3 Cloud sample questions, input placeholder, and source-group configuration from data/products.yml.
- Product path lookup has one canonical source derived from data/products.yml.
- Adding a product with a content_path does not require updating multiple hardcoded path maps.
- Automated tests verify the resolved product key or configuration, not only the page heading.
- Tests cover every products.yml entry that has a documentation content_path, including influxdb3_cloud.

## Related context

PR #7669 adds InfluxDB 3 Cloud to the interactive version detector and version documentation. The Ask AI widget uses the separate page-context mapping described here, so that PR does not address this drift.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the existing product lookup in data/products.yml, assets/js/page-context.ts, and assets/js/utils/product-mappings.ts, then inspect the Ask AI consumers. Run the current automated tests and identify how they resolve product context. Done means one lookup derived from products.yml resolves influxdb3_cloud and tests cover every entry with a documentation content_path.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation, frontend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.