From 65f6f2215725c4c52a8d488005a3fdb39ecedeba Mon Sep 17 00:00:00 2001 From: Copilot <223556219+Copilot@users.noreply.github.com> Date: Tue, 23 Jun 2026 11:20:11 +0200 Subject: [PATCH] Add open-ended bc-version range shorthand [N..] A closed range like [23..28] wrongly implies guidance stops applying after BC28, so a reviewer targeting BC29+ would not match the file. Introduce an open-ended shorthand [N..] meaning ''version N and every later version''. - validate_frontmatter.py: RANGE_SHORTHAND allows an optional upper bound; expand_bc_version returns the normalized string ''N..'' for open-ended. - read.md: document the fourth bc-version form and its matching rule (matches target >= N; not enumerable). - write.md: prefer [N..] over a closed range for a feature introduced in N and not expected to be removed. - Apply [23..] to the actionable-errors article (actionable errors shipped in BC23 and are not version-bounded above). - README: mention [N..] in the frontmatter example. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/scripts/validate_frontmatter.py | 14 ++++++++++---- README.md | 2 +- .../prefer-errorinfo-for-actionable-errors.md | 2 +- skills/read.md | 11 ++++++----- skills/write.md | 2 +- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/.github/scripts/validate_frontmatter.py b/.github/scripts/validate_frontmatter.py index d969cef..4d9bdc8 100644 --- a/.github/scripts/validate_frontmatter.py +++ b/.github/scripts/validate_frontmatter.py @@ -59,7 +59,7 @@ MAX_KNOWLEDGE_LINES = 100 KEBAB_CASE = re.compile(r"^[a-z0-9]+(-[a-z0-9]+)*$") ISO_ALPHA2 = re.compile(r"^[a-z]{2}$") -RANGE_SHORTHAND = re.compile(r"^(\d+)\.\.(\d+)$") +RANGE_SHORTHAND = re.compile(r"^(\d+)\.\.(\d+)?$") FENCED_CODE_BLOCK = re.compile(r"^```", re.MULTILINE) HEADING_H2 = re.compile(r"^##\s+(.+?)\s*$", re.MULTILINE) @@ -149,6 +149,8 @@ def expand_bc_version(value: Any) -> tuple[list[int] | str | None, str | None]: """Return (expanded, error-message). One of the two is None. For the universal sentinel ["all"], `expanded` is the string "all". + For an open-ended range like ["26.."], `expanded` is the normalized + string "26.." (it cannot be enumerated; consumers match target >= 26). Otherwise it is the expanded list of version integers. """ if not isinstance(value, list) or not value: @@ -163,15 +165,19 @@ def expand_bc_version(value: Any) -> tuple[list[int] | str | None, str | None]: if any(v <= 0 for v in value): return None, "integers must be positive" return sorted(set(value)), None - # Case 2: single-element range-shorthand like "[26..28]" + # Case 2: single-element range shorthand — closed "[26..28]" or open-ended "[26..]" if len(value) == 1 and isinstance(value[0], str): m = RANGE_SHORTHAND.match(value[0].strip()) if m: - start, end = int(m.group(1)), int(m.group(2)) + start = int(m.group(1)) + if m.group(2) is None: + # Open-ended: "start.." applies from start onwards, no upper bound. + return f"{start}..", None + end = int(m.group(2)) if start > end: return None, f"range '{value[0]}' is not ascending" return list(range(start, end + 1)), None - return None, "must be [all], a list of integers, or a single-element range shorthand like [26..28]" + return None, "must be [all], a list of integers, or a range shorthand like [26..28] or [26..]" def headings_in_order(body: str) -> list[tuple[str, int]]: diff --git a/README.md b/README.md index 01f85c1..ecddd1d 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ Every knowledge file is a markdown file with mandatory YAML frontmatter. Files t ```yaml --- -bc-version: [all] # or [26..28] for version-gated guidance +bc-version: [all] # or [26..28], or [26..] for "26 and later" domain: performance # security | performance | ux | telemetry | ... keywords: [query, filtering, partial] # free-text tags for retrieval technologies: [al] # al | javascript | powershell | ... diff --git a/microsoft/knowledge/error-handling/prefer-errorinfo-for-actionable-errors.md b/microsoft/knowledge/error-handling/prefer-errorinfo-for-actionable-errors.md index 54ef285..f774cc8 100644 --- a/microsoft/knowledge/error-handling/prefer-errorinfo-for-actionable-errors.md +++ b/microsoft/knowledge/error-handling/prefer-errorinfo-for-actionable-errors.md @@ -1,5 +1,5 @@ --- -bc-version: [23..28] +bc-version: [23..] domain: error-handling keywords: [errorinfo, actionable-errors, fix-it, show-it, addaction, addnavigationaction, error-dialog] technologies: [al] diff --git a/skills/read.md b/skills/read.md index dbeaa63..8badb97 100644 --- a/skills/read.md +++ b/skills/read.md @@ -26,7 +26,7 @@ A file that violates any of these rules is invalid and MUST be skipped by consum ```yaml --- -bc-version: [all] # or [26, 27, 28] or the range shorthand [26..28] +bc-version: [all] # or [26, 27, 28], the range [26..28], or the open-ended range [26..] domain: performance keywords: [query, filtering, partial] technologies: [al] @@ -39,13 +39,14 @@ All six fields are required. Missing or empty fields invalidate the file. ### Fields -**`bc-version`** — Array. The Business Central major versions this file applies to. Three forms are accepted: +**`bc-version`** — Array. The Business Central major versions this file applies to. Four forms are accepted: - Universal sentinel: `[all]` means the guidance applies to every BC version and matches any target. - Explicit list: `[26, 27, 28]`. -- Range shorthand: `[26..28]` means every integer from 26 through 28 inclusive. +- Closed range shorthand: `[26..28]` means every integer from 26 through 28 inclusive. +- Open-ended range shorthand: `[26..]` means version 26 and every later version, with no upper bound. Use it for guidance tied to a feature introduced in a specific version that is not expected to be removed. -`[all]` is mutually exclusive with explicit versions; do not combine. Consumers MUST expand ranges to the full set before comparison. +`[all]` is mutually exclusive with explicit versions; do not combine. Consumers MUST expand closed ranges to the full set before comparison; an open-ended range `[N..]` is not enumerable and instead matches any target version greater than or equal to `N`. **`domain`** — String. A single domain tag that places the file within a broader area of concern. Standard values include `performance`, `security`, `ux`, `telemetry`, `testing`, `api`, `pipelines`, `finance`, `supply-chain`, `manufacturing`, `jobs`. New domains may be introduced by contributors; no closed enumeration is enforced at the schema level. Consumers MUST treat unknown domains as valid. @@ -94,7 +95,7 @@ Conflict detection is the consumer's responsibility; BCQuality does not enforce When a consumer filters or matches files against a task context, these rules apply: -- **`bc-version`** — the file matches if its set is `[all]`, or if the target BC version is an element of the file's expanded `bc-version` set. Range shorthand (`[26..28]`) MUST be expanded before comparison. +- **`bc-version`** — the file matches if its set is `[all]`, or if the target BC version is an element of the file's expanded `bc-version` set. Closed range shorthand (`[26..28]`) MUST be expanded before comparison; an open-ended range (`[26..]`) matches when the target BC version is greater than or equal to its lower bound. - **`technologies`** — non-empty intersection between the task's technologies and the file's technologies. There is no sentinel for this field. - **`countries`** — the file matches if its set contains `w1`, or if there is a non-empty intersection with the task's countries. - **`application-area`** — the file matches if its set contains `all`, or if there is a non-empty intersection with the task's application areas. diff --git a/skills/write.md b/skills/write.md index 6fe2eee..9a3b208 100644 --- a/skills/write.md +++ b/skills/write.md @@ -43,7 +43,7 @@ Knowledge files do not contain code. Samples live as **sibling files** next to t ## Choosing frontmatter values -**`bc-version`.** Default to `[all]` when the guidance is universal — a BC language pattern, a property on a long-standing platform type, a CodeCop rule, or a platform behaviour that has not changed across versions. Use an explicit list or range (`[26, 27, 28]`, `[26..28]`) only when the guidance is tied to a version-gated API, a deprecation, or platform behaviour that genuinely differs across versions. Most knowledge files should be `[all]`; reach for a range only with a concrete reason. +**`bc-version`.** Default to `[all]` when the guidance is universal — a BC language pattern, a property on a long-standing platform type, a CodeCop rule, or a platform behaviour that has not changed across versions. Use an explicit list or range (`[26, 27, 28]`, `[26..28]`) only when the guidance is tied to a version-gated API, a deprecation, or platform behaviour that genuinely differs across versions. When guidance applies to a feature introduced in version N and not expected to be removed, prefer the open-ended range `[N..]` over a closed range so the file keeps matching future versions — reserve a closed upper bound for guidance that genuinely stops applying (for example, a behaviour removed or replaced in a later version). Most knowledge files should be `[all]`; reach for a range only with a concrete reason. **`domain`.** Pick one. If two fit, the file is probably two concerns. If no existing domain fits, introduce a new one — domains are open. Prefer existing domains when they are a reasonable fit, to keep retrieval predictable.