Repository navigation
Lock in feature flags, sync plans, version index and build state with snapshots - #4882
Merged
Merged
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 <noreply@anthropic.com>
Comment on lines
+219
to
+220
| 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.
Contributor
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 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.