Skip to content

test: keep placeholder content in the content package's shape - #1561

Closed
BenjaminMichaelis wants to merge 6 commits into
mainfrom
fix/chapter-descriptions-schema-and-content-checks
Closed

BenjaminMichaelis wants to merge 6 commits into
mainfrom
fix/chapter-descriptions-schema-and-content-checks

Conversation

@BenjaminMichaelis

@BenjaminMichaelis BenjaminMichaelis commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Why

The dev outage came from sitemap.descriptions.json changing shape (Key vs Keys) while the placeholders PR builds use did not model that file at all, so CI could not notice.

What changed

  • Add Placeholders/sitemap.descriptions.json in the shape the content package now ships (Keys + Value, matching SiteMappingDescription) and copy it into Chapters/ for placeholder builds.
  • Bring Placeholders/sitemap.json in line with SiteMapping (PrimaryKey, LastModified).
  • Add PlaceholderShapeTests, which compares each placeholder's JSON property names and value kinds with the content files the app loads. Built against the real content package (-p:AccessToNugetFeed=true) it fails when the package changes shape; failures print property names only, so no book content reaches a public log.

Narrowed from the original PR

  • The startup check moved to fix: construct content-backed services at startup #1734.
  • The Key/Keys reader fallback is dropped: tooling now ships Keys.
  • The smoke-test script is dropped: main runs the Playwright Deployed smoke tests.
  • The real-package restore in CI is not included and should be reviewed on its own. Until it exists, PlaceholderShapeTests compares the placeholders with themselves in CI and only does real work locally or in a build that restores the package.

Test plan

  • EssentialCSharp.Web.Tests: 351 passed; the 2 failures (CaptchaService_Verify_Success, KnownBreachedPassword_IsDetected) call external services and are unrelated.
  • Parser.Shared.dll from package 19663 declares SiteMappingDescription { Keys, Value } and SiteMapping with PrimaryKey and LastModified, matching the placeholders.
  • Not run against the real content files (no feed credentials here).

…in CI

The 19570 content package writes sitemap.descriptions.json entries with a
singular "Key" while the shared SiteMappingDescription type requires "Keys",
so ChapterDescriptionService throws and every page 500s (dev outage).

- ChapterDescriptionService reads both shapes and reports malformed entries
  with the file and entry index.
- Resolve ChapterDescriptionService and IGuidelinesService at startup so bad
  content fails the new revision instead of the first page request.
- Add a placeholder sitemap.descriptions.json in the package's shape so PR CI
  exercises the real code path; make chapter metadata tests content-agnostic.
- Add ContentPackageContractTests (structural assertions only).
- build-and-test restores/builds against the real content package; feed
  credentials exist only during restore.
- Add scripts/smoke-test.sh (health + real pages) and run it after the dev
  deploy and in the prod deploy.
…hape

PlaceholderShapeTests compares property names and value kinds of
Placeholders/{sitemap,sitemap.descriptions,guidelines}.json against the
content files the build uses. It passes trivially on PR builds (content is
the placeholders) and runs for real in build-and-test on main, where the
content package is restored. Failures report only property names/kinds.

The check immediately found drift: the placeholder sitemap.json lacked
PrimaryKey and LastModified, which the package has. Add them.
BenjaminMichaelis added a commit that referenced this pull request Oct 24, 2026
## Summary
- Bumps `ToolingPackagesVersion` 1.1.1.19570 -> 1.1.1.19573.
- 19570's content package shipped `sitemap.descriptions.json` with the
old single-string `"Key"` format, which `SiteMappingDescription` (used
by `ChapterDescriptionService` since #1560) cannot deserialize, so dev
returned 500. 19573 is built from
IntelliTect-dev/EssentialCSharp.Tooling#2606, which converts the file to
the `Keys` array format and adds a tooling test that reads the real
file.

## Test plan
- [x] `dotnet build EssentialCSharp.Web.slnx`
- [x] `EssentialCSharp.Web.Tests`: 190 passed
- [x] At the tooling commit 19573 was built from (1f77290e),
`sitemap.descriptions.json` has 589 `"Keys"` entries and no `"Key"`
entries
- [ ] Not checked locally: the restored ContentFeedNuget package
contents. Please confirm dev serves pages after deploy.

Related: #1561 (Key/Keys compatibility and CI check against the real
package content) is still open and no longer needed to fix dev once this
is deployed.
BenjaminMichaelis added a commit that referenced this pull request Nov 11, 2026
## Summary
- Upgrade gh-aw dispatcher templates and action pins to v1.2.2.
- Regenerate accessibility-review, ci-doctor, and repo-assist workflow
locks.
- Update accessibility-review setup-dotnet to v6.1.0.

## Validation
All three workflows compiled successfully with gh-aw v1.2.2. Shellcheck
completed with the existing unused-loop-variable warning;
accessibility-review still reports its existing missing discussions
permission warning. Container pin refresh reported a registry metadata
lookup failure. No live Actions runs were dispatched.

## Scope
This PR contains only the gh-aw upgrade extracted from #1561; the
upgrade was reverted on that PR. Unrelated local UI edits are not
included.
@BenjaminMichaelis

Copy link
Copy Markdown
Member Author

Closing in favor of #1734, which carries the startup content check rebased onto current main. The Key/Keys compatibility code is no longer needed (tooling ships Keys since #1562), and the smoke-test script is redundant with the Playwright Deployed smoke tests now on main. The NuGet-credential CI changes can be proposed separately if wanted.

@BenjaminMichaelis BenjaminMichaelis changed the title fix: accept Key/Keys in chapter descriptions and verify real content in CI test: keep placeholder content in the content package's shape Nov 26, 2026
BenjaminMichaelis added a commit that referenced this pull request Nov 28, 2026
## Why
The dev outage came from `sitemap.descriptions.json` changing shape
(`Key` vs `Keys`), and the placeholders that PR builds use did not model
that file at all, so CI could not notice.

## What changed
- Add `Placeholders/sitemap.descriptions.json` in the shape the content
package now ships (`Keys` + `Value`, matching `SiteMappingDescription`)
and copy it into `Chapters/` for placeholder builds.
- Bring `Placeholders/sitemap.json` in line with `SiteMapping`
(`PrimaryKey`, `LastModified`).
- Add `PlaceholderShapeTests`, which compares each placeholder's JSON
property names and value kinds with the content files the app loads.
Built against the real content package (`-p:AccessToNugetFeed=true`) it
fails when the package changes shape; failures print property names
only, so no book content reaches a public log.

## Relation to earlier work
This is the remaining part of #1561, which was closed in favour of #1734
(startup check). Not included: the `Key`/`Keys` reader fallback (tooling
ships `Keys`), the smoke-test script (main runs the Playwright
`Deployed` smoke tests), and a real-package restore in CI, which should
be reviewed on its own. Until that exists, `PlaceholderShapeTests`
compares the placeholders with themselves in CI.

## Test plan
- [x] `EssentialCSharp.Web.Tests`: 351 passed; 2 failures
(`CaptchaService_Verify_Success`, `KnownBreachedPassword_IsDetected`)
call external services and are unrelated.
- [x] `Parser.Shared.dll` from package 19663 declares
`SiteMappingDescription { Keys, Value }` and `SiteMapping` with
`PrimaryKey` and `LastModified`, matching the placeholders.
- [ ] Not run against the real content files (no feed credentials
available).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant