Skip to content

[M3.7b] Web: applications, deployments and secrets - #169

Merged
samuelmbabhazi merged 3 commits into
mainfrom
feat/m3.7b-application-screens
Nov 6, 2026
Merged

samuelmbabhazi merged 3 commits into
mainfrom
feat/m3.7b-application-screens

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

What changed

M3.7b plus the application screens: from the web UI you can now create an application, set its secrets, deploy it and follow the deployment.

  • Environment page:
    • Applications: list, and creation from a shipkeep.yml document in a YAML editor prefilled with an example. The document is validated in the browser with the API's own schema (@shipkeep/config-schema). Problems are listed by JSON pointer before anything is sent.
    • Secrets (write-only, SPEC 9): names and versions only; set (password field, cleared after every attempt, and the value never enters the retry fingerprint) and remove.
  • Application page (…/applications/:applicationId):
    • Deploy button;
    • deployment history (start, state in color with its literal label, error);
    • while a deployment runs, its state is refreshed every 3 s and Cancel deployment is offered;
    • the configuration is shown as YAML with its version.
  • DeliveryApi extends the workspace client: same origin, CSRF, bounded errors.
  • Fix: parseShipkeepConfig measured documents with Node's Buffer, which does not exist in the browser. It now uses TextEncoder.
  • Dependencies: @shipkeep/config-schema (workspace) and yaml 2.9.1 (ISC, already in the lockfile) for the web app. They load only in lazy route chunks: the initial bundle is 361 kB, under the 500 kB budget.

How it was tested

  • New delivery-pages.spec.ts, with a fake API:
    • invalid YAML shows /name without any request, and valid YAML posts the exact parsed config;
    • a secret is set with the exact body, its value never appears on the page, the field is cleared, and removal works;
    • the application page shows the YAML and a failed deployment's error, deploys, follows queued, and cancels.
  • Web: 59 tests, config-schema: 86, plus lint, typecheck and build. The local gate passes.

Security considerations

  • Secret values only travel in the POST body. They are not kept in signals after submission, not shown, and not part of retry keys.
  • Same-origin cookie requests with CSRF, as in the rest of the UI.

The validator now runs in the browser too, where Buffer does not exist.

Signed-off-by: Samuel Mbabhazi <[email protected]>
The environment page lists applications and creates them from a
shipkeep.yml document validated in the browser with the API's schema,
and manages write-only secrets (values never shown, field cleared after
each attempt). The application page shows the configuration as YAML,
deploys, follows running deployments every 3 s and cancels them.

Signed-off-by: Samuel Mbabhazi <[email protected]>
@samuelmbabhazi
samuelmbabhazi merged commit 57af855 into main Nov 6, 2026
1 of 10 checks passed
@samuelmbabhazi
samuelmbabhazi deleted the feat/m3.7b-application-screens branch November 6, 2026 08:30
samuelmbabhazi added a commit that referenced this pull request Nov 7, 2026
…he CSP (#189)

## What changed

The `shipkeep.yml` validator is now compiled at generation time (`pnpm
gen:config` → `packages/config-schema/src/gen/validator.ts`) instead of
at runtime. Ajv's standalone output needs two small helpers, which live
in `validator-runtime.ts`, so Ajv itself no longer reaches the web
bundle.

## Why

**The environment page has been blank in real browsers since #169.**
That page holds application creation, and everything after it is reached
through it.

Ajv's runtime compiler builds functions from strings. The production CSP
(`script-src 'self'`, no `unsafe-eval`) refuses that, so the module
threw `EvalError` when loaded and the route rendered nothing. jsdom does
not enforce CSP, so every unit test passed, and with CI off the browser
suite never ran. A real Chromium run caught it today.

Allowing `unsafe-eval` was not considered: the CSP is doing its job, and
that would weaken it for the whole UI.

## How it was tested

- **Guard test** `csp.spec.ts`: refuses `Function` and `eval`, then
loads and validates. It **fails on the old code** with `EvalError` and
passes now, so jsdom can no longer hide this.
- All golden fixtures, valid and invalid, pass through the generated
validator (89 tests).
- **Real Chromium**, against the production build, API and a local
PostgreSQL 18.4: the environment page renders under the production CSP.
That spec arrives in the next PR, with M2.3f2.
- Local gate, including the generation drift check.

The same schema now validates on the API through the generated code,
which the integration suite exercised before this change only through
the old path. The fixtures cover the new path; the suite should be rerun
with CI-1.

## Security considerations

The CSP is unchanged. The generator refuses output containing
`require(`, `new Function` or `eval(`. `deepEqual` and `ucs2length` are
new hand-written code on validation paths, with their own tests,
including lone surrogates.

## Checklist

- [x] Tests, including a regression guard
- [x] No new shell invocation, no new secret exposure path
- [x] Generated code comes from the schema, not edited by hand (rule 9)
- [x] No new state change

Signed-off-by: review <[email protected]>
Co-authored-by: review <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant