Skip to content

Lock in feature flags, sync plans, version index and build state with snapshots - #4882

Merged
Mpdreamz merged 2 commits into
mainfrom
snap/small-areas
Nov 17, 2026
Merged

Mpdreamz merged 2 commits into
mainfrom
snap/small-areas

Conversation

@Mpdreamz

Copy link
Copy Markdown
Member

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 of FeatureFlagsTests because 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, main and master, and invalid keys. The publisher tests record the put request for each case.

Page feedback validation

A new page-feedback-validation.http file 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 --exporters parsers, the isolated options data annotations and the assume-build rule. Build.Tests now references the docs-builder project to reach InMemoryBuildState.

Out of scope: Some recorded behaviours look unintended, such as a numeric 0 environment value enabling a flag. They are recorded, not fixed.

Verify

mise run test
mise run lint
mise run snap:orphans

Each 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.

… 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]>
@Mpdreamz
Mpdreamz requested a review from a team as a code owner November 16, 2026 21:16
@Mpdreamz Mpdreamz added the chore label Nov 16, 2026
@Mpdreamz
Mpdreamz requested a review from technige November 16, 2026 21:16
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(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions

Copy link
Copy Markdown
Contributor

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]>
@Mpdreamz
Mpdreamz merged commit d03db51 into main Nov 17, 2026
44 checks passed
@Mpdreamz
Mpdreamz deleted the snap/small-areas branch November 17, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant