11 Commits

Author SHA1 Message Date
eust-w
821c059081 🐛 Give a blue-green candidate and a fresh switch time to settle
The Compose and Kubernetes adapters checked a candidate once. A
container that had started but did not listen yet made the request
throw, and the deployment was reported as of unknown state, to be
reconciled by hand; one stray error from the stable entry right after
the switch rolled a healthy release back.

The candidate checks and the checks after the switch are now repeated,
six attempts two to ten seconds apart, as the POC's already were, and
the Runner logs each repeat. A candidate that never answers is
reported as not switched, with the previous release still serving.
A missing address or missing checks are reported at once instead of
being asked again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:41:47 +08:00
eust-w
ddb4cf5b5f 🐛 Stop the Runner reporting the control plane's own start-up as errors
The local service starts the Runner together with the control plane,
so its first polls were refused until the API listened, and every
restart left an ECONNREFUSED error line every five seconds in
runner.log that looked like a failure.

Until the Runner has reached the control plane once, and for two
minutes at most, a refused connection is now noted once as waiting for
it to start; reaching it is noted too. A control plane that never
comes up, and any other failure, are still errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 14:54:01 +08:00
eust-w
92a06dd3b2 🐛 Repeat the POC acceptance checks a settling rollout can fail, and show every retry
The public checks after a POC rollout (health, readiness, the entry
page, the API build commit and the protected smoke checks) were each
made once. Just after a rollout the public address can still reach a
Pod that is shutting down, which answers with the old build commit, and
the link can drop: either failed a healthy release and rolled it back.
They now take up to six attempts, waiting 2 to 10 seconds; a release
whose checks never pass is still rolled back.

Retries were also silent: a build slowed down by a flaky link looked
stuck. Every repeat now says what went unanswered and when the next
attempt comes, in the run's timeline during a build and in the Runner's
log during a release. Requests and checks share one retry helper.

The third live test found kubectl cp and exec reporting a failed dial
as "error: dial tcp ...: connect: operation timed out", without the
"Unable to connect to the server" of get. That upload was not retried
and the build stopped; dial failures and connection timeouts now count
as unanswered, checked against the messages seen on the POC link.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 05:06:46 +08:00
eust-w
9394241212 ✨ Time-stamp the Runner's log and record each release task
The Runner only ever logged errors, as JSON lines without a time, so
its log could not be lined up with a run's timeline: during the
2026-10-26 POC tests the connection errors of every service restart
looked like current failures, and a release left no trace at all.

Each line now carries its time and level. The Runner records when it
takes a task, and how the task ended with how long it took: the task,
action and release IDs, the outcome and the seconds. These are read
defensively before the signature check, which a malformed task must
still reach; payloads, arguments and credentials are never logged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 05:06:28 +08:00
eust-w
6fc7eaf00c ✨ Improve local WishForge reliability and LAN access
Detect actual service and Runner readiness, restore LAN access after network changes, protect production web builds with rollback, honor cancellation during executor startup, and show truthful cached-data and credential states.
2026-10-25 03:29:51 +08:00
eust-w
4e5ab1719c ✨ Enable local Claude delivery to Gitea and POC
Add authenticated LAN access, native Claude execution, checkpoint and budget recovery, and signed POC build/deploy/rollback contracts. Include local service management, regression coverage, and evidence from the completed POC delivery.
2026-10-22 16:21:33 +08:00
eust-w
78ed117763 feat: make the deployment mode explicit and fail closed
Security-relevant behaviour (development tokens, loopback HTTP, inline
checkpoints, raw provider keys, optional verification profiles) was
keyed off NODE_ENV === 'production', so any deployment that forgot
NODE_ENV silently ran with development rules.

- @wishforge/contracts exports deploymentMode/isProduction/
  requireDeploymentMode. WF_DEPLOYMENT_MODE wins; misspelled values and
  development combined with NODE_ENV=production are rejected; NODE_ENV
  remains a fallback only for libraries and tests.
- All API, runtime, artifact, Git service and operator-script checks use
  isProduction.
- The API, worker, Git service and Runner refuse to start without an
  explicit WF_DEPLOYMENT_MODE; the IDE gateway treats anything other
  than an explicit development mode as production.
- The development seed loads .env.local before checking the mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 14:07:02 +08:00
eust-w
82d35a3708 fix: use one canonical JSON implementation for digests and signatures
The API signed Runner tasks with keys sorted by localeCompare, while the
runner verified with code-unit order; environment keys such as
API_URL/API2 or DB_HOST/DBA sort differently, so valid deployment tasks
were rejected with INVALID_SIGNATURE. A third copy lived in the agent
package.

canonicalJson now lives in @wishforge/contracts (code-unit key order,
undefined properties omitted, non-JSON values rejected) and is used by
the API digest, Runner task signing/verification, the runner's state
digest and agent bundle digests. Binding digests computed by the old
locale-dependent order may differ, so releases requested before this
change must be requested again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 14:04:36 +08:00
eust-w
20bc7cfeb7 refactor: remove the private application gateway and its proof chain
Environments defaulted to "private" visibility, which required a
separate per-environment preview gateway, capability tokens, signed
anonymous/authorized probe proofs and API-side proof verification;
without that stack every deployment was blocked. Access control for a
deployed application is now the target environment's responsibility
(docs/requirements.md FR-G6).

- Delete apps/preview-gateway, the API preview controllers/domain
  (previews, private-access-verifier) and runtime private-access.
- Environments keep an optional application URL; production releases
  still require one plus a fresh access check reported by the Runner.
  The URL may never share an origin with the console, API or IDE.
- Release bindings, runner task payloads, deployment evidence and
  rollback compatibility no longer carry visibility or private-access
  policy digests. PATCH /v1/environments/:id/access becomes
  /v1/environments/:id/application-url.
- Web: the delivery launch route is gone; environments configure an
  application URL only (the always-rejected "Runner ID" field is
  removed); releases and run detail link the live application URL.
- Remove the preview-gateway image target and test:preview script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 13:48:49 +08:00
eust-w
0ef99b1e6d style: add Prettier and EditorConfig, format the codebase
Adds prettier 3.9.8 (exact) with a shared config (single quotes,
120 columns, trailing commas), .prettierignore, .editorconfig and the
`format` / `format:check` scripts, then formats all TypeScript,
JavaScript, CSS, JSON and YAML sources.

Purely mechanical: no behaviour change. Typecheck passes, the vitest
suite and the 74 IDE node tests produce the same results as before
(socket-binding tests still cannot run inside this sandbox).
Previously the longest source line was ~3000 characters; reviewing the
following semantic changes now produces readable diffs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 13:32:43 +08:00
eust-w
b47a07e8d2 chore: baseline snapshot of the Codex-delivered code before review
Imports the previously untracked working tree as-is so that the review
changes that follow (requirements -> design -> implementation) can be
reviewed as diffs and reverted if needed. No content changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 13:18:04 +08:00