Repository navigation
Lock in feature flags, sync plans, version index and build state with snapshots - #4882
Conversation
… snapshots Adds snapshots for FEATURE_* resolution, S3 sync plans and validator thresholds, the OpenAPI version index, page feedback request validation, the serve host build state machine and the build option parsers. They record today's behaviour ahead of the domain-model refactor in #4530. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
| var terminal = rest.Where(t => t is "build_complete" or "build_cancelled").Distinct().OrderBy(t => t, StringComparer.Ordinal); | ||
| $"first={first.Type}\nterminal events are a subset of: build_cancelled, build_complete => {terminal.All(t => t is "build_complete" or "build_cancelled")}\nfinal status is idle or complete => {state.Status is BuildStatus.Idle or BuildStatus.Complete}".Should().MatchInlineSnapshot( |
There was a problem hiding this comment.
Severity: P3 (Low)
The terminal-event assertion is always true: Where removes every unexpected event before All checks the same predicate, and an empty sequence also passes. Removing the shutdown path's build_cancelled broadcast would therefore leave this snapshot green as long as the state becomes idle. Assert that a terminal event actually exists and validate its relationship to the final state; ideally synchronize cancellation so the cancellation branch is exercised deterministically.
Generated by Libra. React with 👍 or 👎 to give feedback on this comment.
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4882/ |
On Windows the plan writes local paths with backslashes and the JSON serializer ends lines with CRLF, so the snapshots differed from the ones recorded on Linux and macOS. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Adds snapshot tests that record how feature flags, S3 sync plans, the OpenAPI version index, page feedback validation, the serve host build state and the build option parsers behave today, ahead of the domain-model refactor in #4530.
Affects: Configuration, Deployment, API
Prompt summary: Add behaviour-locking snapshot tests for several small areas before #4530, which must not change behaviour. Product code stays untouched.
Why
These areas have few tests that pin their full output, so a refactor could change a resolution rule, a plan or a status code without a test failing.
What
Feature flags
Tables for the YAML value times the
FEATURE_*variable, every known flag with explicit setters, key normalisation, and each assembler environment with and without overrides. The tests share the lock ofFeatureFlagsTestsbecause they set environment variables.Sync plans
Plans for 11 local and remote file sets (adds, updates, skips, deletes, excludes, symlinks, retained hashed assets, a missing bucket), written as the JSON plan with request lists sorted. A table covers the plan validator thresholds, and two tests cover plan serialization.
OpenAPI version index
The built index JSON for several key sets, including ordering,
mainandmaster, and invalid keys. The publisher tests record the put request for each case.Page feedback validation
A new
page-feedback-validation.httpfile with 49 requests; the existing http runner records each status code.Build state and options
The serve host build state machine (events, counts, queueing, shutdown) and the
--exportersparsers, the isolated options data annotations and the assume-build rule.Build.Testsnow references thedocs-builderproject to reachInMemoryBuildState.Out of scope: Some recorded behaviours look unintended, such as a numeric
0environment value enabling a flag. They are recorded, not fixed.Verify
mise run test mise run lint mise run snap:orphansEach new test class failed when the product code it covers was changed on purpose, then passed again after the revert. The fixtures use synthetic names only.