fix(descriptor): prefer plain forwards — stock-CHR TLS endpoints are not dialable (#95)#96
Conversation
…not dialable (#95) Descriptor v1 shipped secure-preferred service endpoints, but on a stock CHR `www-ssl` is disabled and `api-ssl` is certificate-less (TLS alert 40, grounded on CHR 7.23.2), so `services["rest-api"]`/`["native-api"]` advertised dead endpoints — surfaced by the first real consumer (tikoci/centrs#134 `--quickchr` CHR acceptance). Pick `http`/`api` (the ports `restUrl` has always used), falling back to `https`/`api-ssl` with `tls: true` only when the plain forward is excluded; the excludePorts latent-bug fix is preserved. Co-Authored-By: Claude Fable 5 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughDescriptor v1 now prefers plain forwards for ChangesDescriptor endpoint selection
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant descriptor
participant buildHttpService
participant forwardedPorts
descriptor->>buildHttpService: construct REST and native API services
buildHttpService->>forwardedPorts: select plain port before secure fallback
forwardedPorts-->>buildHttpService: selected port and TLS state
buildHttpService-->>descriptor: service endpoint definitions
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR fixes descriptor v1’s service endpoint selection so that, on a stock quickchr-booted CHR, services["rest-api"] and services["native-api"] advertise dialable endpoints by preferring the plain forwards (http / api) and only falling back to the TLS forwards (https / api-ssl) when the plain forward is excluded/missing.
Changes:
- Switched descriptor selection order to plain-first (
plain ?? secure) while preserving theexcludePortsfallback behavior. - Updated unit tests to assert the new port/url/tls expectations for REST and native API services.
- Revised interface documentation and added a changelog entry describing the behavioral correction and grounding.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/lib/quickchr.ts |
Changes descriptor endpoint selection to prefer plain forwards and keeps secure as fallback. |
test/unit/descriptor.test.ts |
Updates expectations to validate plain-first selection and correct tls/url fields. |
test/unit/cli-env-inspect.test.ts |
Updates CLI JSON descriptor expectations to match the new service port/tls values. |
docs/centrs-interface.md |
Revises the contract note to document the plain-first behavior and rationale (#95). |
CHANGELOG.md |
Records the fix under Unreleased with context and consumer impact. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
scripts/release-prep.ts:17
- The top-level doc comment still says the script always gates on a non-empty
CHANGELOG.md[Unreleased]section and rolls it over. In--from-packagemode it no longer reads[Unreleased]at all (it extracts an existing## [X.Y.Z]section), so the comment is now inaccurate. Clarify the two modes to avoid misleading release-process documentation.
* release-prep — compute the next version, roll CHANGELOG.md's [Unreleased]
* section over to it, and bump package.json for a local/manual release-prep PR.
* The CI release workflow uses --from-package instead: it reads committed
* package.json + CHANGELOG.md and never mutates tracked files.
*
* Usage: bun scripts/release-prep.ts <patch|minor|major|X.Y.Z> [--dry-run] [--notes-out <file>]
* bun scripts/release-prep.ts --from-package [--notes-out <file>]
*
* - Fails if CHANGELOG.md's [Unreleased] section is empty — a release must say
* what changed. (The end-of-session checklist keeps [Unreleased] current.)
* - Inserts `## [X.Y.Z] — YYYY-MM-DD` below a fresh [Unreleased] heading.
* - Prints machine-readable lines: `version=X.Y.Z` and `npm-tag=next|latest`
* (odd minor → next, even minor → latest — the repo's pre-release scheme).
* - --notes-out writes just the released section body (the GitHub Release notes).
* - --dry-run computes and prints everything but writes no files.
Fixes #95.
Fixes #94.
What
Descriptor v1 (
0.4.4) advertised the secure forwards forservices["rest-api"]/services["native-api"]. On a stock quickchr-booted CHR both are dead:/ip/service:www-ssl:443 disabled=true→ thehttpsforward resets every connection (ECONNRESET);/certificateis[]→api-sslis enabled but certificate-less; a standard TLS handshake fails (openssl s_client: alert 40).Grounded on CHR 7.23.2. This also contradicted
docs/centrs-interface.md's own consumer scope note ("don't add preference logic to quickchr").The descriptor now picks the plain forwards (
http/api) — the same portsrestUrlhas always used — falling back tohttps/api-ssl(withtls: true) only when the plain forward is excluded, so theexcludePortslatent-bug fix is preserved.Release CI now publishes from the committed
package.jsonversion instead of bumpingpackage.json/CHANGELOG.mdand pushing a release commit to protectedmain. The workflow remains a simpleworkflow_dispatch, but release prep is now a PR/human-owned version + changelog promotion.This branch prepares
0.4.5so centrs can consume the descriptor fix from npm without a localbun link.Validation
bun scripts/release-prep.ts --from-package --notes-out /tmp/quickchr-release-notes.md→version=0.4.5,npm-tag=latest.actionlint .github/workflows/release.yml.bun test test/unit/release-prep.test.ts: 9 pass / 0 fail.bun test test/unit/: 710 pass / 0 fail / 18 skip.bun run check.60f9ebf: green.--quickchrCHR acceptance (test/integration/quickchr-target.test.tsin tikoci/centrs, #134 Phase 5) runs green against this branch viabun link— retrieve/execute/api/transfer + fan-out + the sftpbatchModesgate, on a real CHR 7.23.2.Follow-up
Secure preference can return once boot provisioning installs a certificate and enables
www-ssl; tracked implicitly in #95's discussion.