Files
webstudio/docs/university
Oleg Isonen 896a383e32 feat: show publish logs in Builder, CLI, and MCP (#6690)
Staging work for publish diagnostics. This PR pairs with
webstudio-is/webstudio-saas#681. No production release is authorized.

## What changes

People can open Diagnostics from a domain or static export to see
warnings, errors, and publishes from the current Builder session. Each
publish has its own collapsible report and copy control. A failed
publish keeps a short reason and links to its own log when that publish
was accepted. Builder, CLI, and MCP use the same publish reference and
log access path.

Status and logs stay separate. Builder keeps session reports in memory,
and Edge retrieves available output from the current publish runner.
Reloading Builder loses session reports. An unavailable log does not
change publish success or failure. Log pages still require runner
retrieval and transfer through Edge and Builder; there is no Webstudio
log archive in this PR.

The UI now keeps publish state in its owning component, with separate
site and static actions, focused diagnostics views, and one domain
status control. Both actions share completion handling while retaining
their different request and download behavior. Late best-effort checks
cannot erase a final rejection. A new rejected request does not make an
older publish look like its log. Site errors stay scoped to the selected
domains. The existing site and asset publish paths are unchanged.

## Checklist

- [x] Keep confirmed session success ahead of stale Build timeout during
popover reconciliation; cover an old Build timestamp.
- [x] Retry a temporarily pending or failed publish-log read before
marking it unavailable; cover session behavior.
- [x] Verify CI on the rebased PR head and confirm review threads remain
resolved.
- [x] Let a matching session's confirmed result clear stale pending
controls for site and static; cover success and failure.
- [x] Remove redundant static-export loading icon while keeping the
export button's pending state and diagnostics access.
- [x] Prefer confirmed runner success over a timeout inferred from a
stale matching Build; cover site and static publishes.
- [x] Keep MCP publish input valid when a target union is converted to
tool JSON Schema; cover both the adapter and real CLI contract.
- [x] Finish an accepted publish by its build ID even if another publish
becomes the project's latest; cover site and static behavior.
- [x] Review docs impact, verify local checks and CI, and reply to the
new review threads.

- [x] Keep current validation findings ahead of an older publish success
notice; cover rejected requests and manual validation.
- [x] Scope accepted-publish status errors to the domains in that
publish; cover another domain's Diagnostics.
- [x] Make success, warning, and error publish notices distinct and
readable in dark mode; use the existing PanelBanner variants and leave
light mode unchanged.\n- [x] Review documentation impact and run focused
tests, typecheck, lint, and CI for these fixes. The publishing guide
needs no wording change.

- [x] Resolve the four Builder review comments and push the focused fix.
- [x] Split Diagnostics into findings, detail, publish history, and
dialog shell without new copy or icons.
- [x] Keep Warnings and Errors separate from Publish logs; preserve
current-session history, log copying, and access checks.
- [x] Consolidate site/static flow and quota reads; narrow UI access to
flow internals.
- [x] Preserve completed findings, final rejection, target/domain
isolation, and accepted-build log links across both completion orders.
- [x] Review the remaining publish UI; share the duplicated domain
status control and leave cohesive baseline domain/export UI in place.
- [x] Review authoritative publishing docs for this UI change.
- [x] Correct the guide's statement that all validation errors block the
request; the approved wording is in the publishing guide.
- [x] Audit names introduced by this PR against their runtime values and
existing repository terminology; fix misleading local names without
changing stored or public contracts.
- [x] Review docs impact of naming-only changes and verify tests, types,
lint, and CI. Docs need no change; 179 publish tests, Builder typecheck,
root lint, formatting, diff checks, and all non-visual CI on the
previous commit passed. Visual approval remains open.
- [x] Remove single-use publish hooks; keep their state/effects in the
owning component and test behavior through that component.
- [x] Split site and static publish actions into clear component-owned
flows without the target-discriminated publish function.
- [x] Review docs impact of the structural change. No user-facing copy
or behavior changed, so no further docs change is needed.
- [x] Verify migrated tests, coverage, Builder core tests, typecheck,
lint, formatting, and package boundaries.
- [x] Simplify publish component tests: share the tRPC test transport
and use named Diagnostics options without losing behavior coverage.
- [x] Replace the global fetch test stub with a scoped tRPC request
interceptor for publish component tests.
- [x] Simplify publish component tests again: share only reusable
browser setup and interactions, remove duplicate scenarios and
incidental assertions, and preserve behavior coverage.
- [x] Review `trpc-interface` package exports and packed-package
consumers. Keep the explicit source subpaths; no manifest change is
needed.
- [x] Review every test changed in this PR for avoidable module mocking;
replace only clear cases without reducing behavior coverage.
- [x] Update and validate the global testing skill with the decision
learned from that review.
- [x] Re-run focused tests and relevant checks for the module-mock
cleanup.
- [x] Finish non-visual CI on the current commit.
- [x] Audit Builder-wide global fetch replacements and no-request spies;
keep injected fakes and valid narrow spies.
- [x] Replace backend-style global fetch stubs and the Storybook fixture
override with scoped request handlers.
- [x] Preserve success, HTTP/network failure, abort, cleanup, and
no-request coverage with red/green checks.
- [x] Run focused and broader Builder tests, typecheck, lint,
formatting, and package-boundary checks for the fetch-test cleanup.
- [x] Review docs impact of the test-only cleanup; no user-facing
documentation changes are needed.
- [x] Make user database tests verify ownership filters, inserted
values, and workspace linkage.
- [x] Make patch-service tests prove the intended patch was applied and
remove vacuous cases.
- [x] Add focused DomainCheckbox integration coverage while keeping
useful helper cases.
- [x] Make publish test transport fail on unexpected requests and
distinguish protocol errors from network failures.
- [x] Remove duplicate permission cases and run selected DOM-free tests
in Node.
- [x] Review documentation impact and run relevant red/green, test,
type, lint, and config checks.
- [x] Show the latest successful site publish and static export in their
popovers with a See logs link to the Publish tab.
- [x] Cover success, new-attempt reset, Free-plan access, and both flows
in component tests.
- [x] Review publishing docs and verify focused tests, types, lint,
formatting, and diff.

- [x] Review the three expected visual differences and approve the CI
rerun; visual regression passed on a0c2ca73f.

## Verification

Local: 177 publish tests passed after simplifying the component suites.
Two duplicate scenarios were removed; the dedicated suites still cover
network failures, paged logs, plan changes, and stale responses. The
latest test cleanup removes 174 net lines. Builder production code is
unchanged. The earlier test cleanup removed 135 net lines across seven
files. Coverage increased from 84.2% statements / 83.3% branches to
88.63% / 86.98%. Builder core passed 1,698 tests with one skip. Builder
typecheck, root lint, package-boundary check, formatting, and diff
checks passed. Representative migrated tests were shown failing when
project scoping, late-check isolation, session eviction, validation
reset, or static download behavior was temporarily broken, then passing
after restoration.

The current commit passed the main workflow, lint, and submodule checks.
Visual approval remains open for three previously identified story
differences. The prior visual report had the same three known story
differences; baseline approval remains open. The visual approval gate
remains open for the previously identified story differences; no new
local Storybook capture was run at the user's request. The agent
evaluation suite remains 8/9 because of an unrelated Form-authoring
failure; baselines were not changed.

The Builder-wide test cleanup replaces 11 global fetch stubs and one
Storybook override. It keeps two narrow no-send spies for a pure preview
function. Focused checks passed (43 Node tests, 16 browser tests,
typecheck, lint, formatting, package boundaries). Full local core and
app runs each had one failure in an unchanged test; the app test passed
alone, and the core failure reproduced in its unchanged file. CI will
provide the full-matrix check. Local request-interception work remains;
no product behavior changes.


A follow-up review checked all 30 changed test files for module mocks.
Two unnecessary wrappers were removed: the resource-preview call counter
and the cross-origin guard fake. The real HTTP boundary and a cross-site
request now carry those assertions. The narrow Email preview exception
fake remains because malformed real inputs do not reach that catch
reliably; seven older Preview-route mocks remain tied to auth, database,
protected fetch, and environment setup. This test-only follow-up passed
41 focused tests, Builder typecheck, targeted lint/formatting, diff
checks, and independent review. The global testing skill was updated and
validated outside this repository. The previous commit's complete main
CI passed; the visual baseline approval gate remains open.

Commit d340a5225 is pushed to `pub.staging`. It strengthens the user,
patch, permission, checkbox, and publish-transport tests; it also shows
successful site publishes and static exports in a shared notice with
**See logs**. A newer attempt hides an older success, and static export
does not claim “Downloaded” without a download filename. The publishing
and export guides describe the new notices. New behavior assertions
failed before their fixes and passed afterward. The latest local Builder
core run passed 1,755 tests (one skipped); 82 focused browser tests,
Builder typecheck, root lint, formatting, and diff checks also passed.
No fixture inputs or outputs changed. Visual checks were not run locally
at the user's request.

The current visual gate passed on run 43725523044 after reviewing the
two Diagnostics stories and the Activity icon. Earlier notes about
pending visual approval describe previous commits.

Commit cae33d877e fixes the two current Builder review findings and adds
a dark-mode edge to success, warning, and error banners without changing
light mode. The new rejection and domain-scope tests failed before their
fixes and passed afterward. Local checks passed: 185 publish tests, 287
design-system tests, Builder and design-system typechecks, lint,
formatting, package boundaries, and diff checks. Main CI and the
approved visual rerun passed. The first visual run failed on the same
three previously reviewed light-theme differences; no new dark-theme
screenshot was taken at the user's request.\n\nCommit db5984eb95 fixes
two later review findings. MCP now permits branch fields at the root of
a composed tool schema; the target branches and API still validate
values. Completion uses the accepted build's job status when another
build becomes the project's latest. The new focused tests failed before
the fixes and passed afterward. Local checks passed: 189 publish tests,
146 MCP adapter tests, 74 CLI MCP tests, relevant typechecks, lint,
formatting, package boundaries, and generated MCP docs. Main CI and the
approved visual regression run passed on b15eebaab3. The initial
unapproved visual run showed only the three previously reviewed
differences.\n\nLive staging MCP smoke check: the CLI started a staging
publish, its job succeeded, and `get-publish-log` returned one complete
page (6,077 characters) in the same MCP session. No log text or share
token was saved in the PR.

The stale-Build regression failed before a04d6c287c and passed
afterward. All 193 publish tests, Builder typecheck, formatting,
targeted lint, and diff checks pass. The refreshed popover trusts a
matching confirmed session result but still clears a retained failure
when the Build reports `PUBLISHED`.

Main CI and the approved visual rerun passed on a04d6c287c. The initial
visual run showed only the same three previously reviewed differences.
All review threads are resolved.

## Before release

- Verify a live staging publish once both staging PRs are deployed.
- Release and pin the existing Builder contract package before removing
the temporary copied contract in the SaaS PR. Local packed-package
typecheck, Worker bundle, and tests passed; registry installation is not
yet verified.
- Production deployment and package publication remain user-run steps.

Ref #3550
Closes #6693
2026-11-15 17:55:45 +01:00
..