Repository navigation
feat(server-picker): probe ObjectOS discovery and confirm the server before connecting - #165
Merged
Merged
Conversation
…ving it Replace the /api/v1/health probe with lib/server-probe.ts, which reads the anonymous discovery, runtime-config and auth-config endpoints, and add the confirm step: nothing is saved until the user confirms. Claude-Session: https://claude.ai/code/session_01QSeKYnW1Xf6HDSWz1eGAqv Co-authored-by: Claude <noreply@anthropic.com>
…d the save-on-confirm flow Claude-Session: https://claude.ai/code/session_01QSeKYnW1Xf6HDSWz1eGAqv Co-authored-by: Claude <noreply@anthropic.com>
…; add changeset Claude-Session: https://claude.ai/code/session_01QSeKYnW1Xf6HDSWz1eGAqv Co-authored-by: Claude <noreply@anthropic.com>
…onent tests Claude-Session: https://claude.ai/code/session_01QSeKYnW1Xf6HDSWz1eGAqv Co-authored-by: Claude <noreply@anthropic.com>
…be-confirm
Conflicts: locales/{en,zh,ar}.json serverConfig.subtitle only; kept this
branch's rewritten subtitle, which already says ObjectOS.
Claude-Session: https://claude.ai/code/session_01QSeKYnW1Xf6HDSWz1eGAqv
Co-authored-by: Claude <noreply@anthropic.com>
…ll warm-up The first render of the picker requires and babel-transforms react-native's lazily exported components (Text, ScrollView, Image, ...). On a cold transform cache that cost about 3.7-4.0 s locally, landed inside the first test, and exceeded the 5 s timeout on CI. Render once in beforeAll under its own timeout instead. Claude-Session: https://claude.ai/code/session_01QSeKYnW1Xf6HDSWz1eGAqv Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
repo:mobile#1 · os-justin · session_01QSeKYnW1Xf6HDSWz1eGAqv Seat verdict: ACCEPT — Head-sha: 维护者速读
席位意见: 范围与卡面一致。保存点只有确认后一处,有测试钉住,消融实测可证伪。有一处契约措辞请你知道: 席位核对
|
os-justin
pushed a commit
that referenced
this pull request
Nov 2, 2026
Resolves the docs/HYBRID-SHELL.md Testing-list conflict with #165: both entries kept (the server probe and picker tests, and the load state machine test). #165's Server selection section, Session-and-auth wording and Layout entries merged cleanly beside this branch's Load states and Safe area sections. Claude-Session: https://claude.ai/code/session_01QSeKYnW1Xf6HDSWz1eGAqv Co-authored-by: Claude <noreply@anthropic.com>
This was referenced Nov 2, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #154
Clause-②: no
Metadata-protocol: none
维护者速读
/api/v1/health,而是读平台的三个匿名接口,判断"这是不是 ObjectOS 服务器、是哪一台",然后进入新的确认页(Logo 或品牌色首字母、产品名、完整地址、HTTPS 锁、登录方式、平台版本);用户点「连接并登录」才保存服务器。lib/server-probe.ts(probeServer判定顺序与xhrFetch)、app/server-config.tsx(runProbe/handleConfirm,保存只在确认后)、components/shell/ServerConfirm.tsx。npx jest --ci __tests__/lib/server-probe.test.ts __tests__/components,预期 4 个文件全过,含 TLS、404、超时、重定向、部分失败各用例。What changes
lib/server-probe.ts(new, pure, injected fetch).probeServer(input, { fetch, allowInsecure, timeoutMs })normalizes the typed address (normalizeServerUrl, so the https rule and pasted Console links behave as before), then:GET /.well-known/objectstackdecides "is this ObjectOS": it must be the{ success: true, data }envelope withdata.name,data.versionand adata.routesobject. A 4xx or any other body isnot-objectos; a 5xx isserver-error.serverUrlAfterRedirect(apex to www, http to https). A redirect onto plain http to a public host is refused asinsecure-http.GET /api/v1/runtime/config(branding.productName,branding.logoUrl,branding.brandColor) andGET /api/v1/auth/config(data.emailPassword,data.socialProviders,data.features.sso,data.features.ssoEnforced) run in parallel and are best-effort: when either fails, the result is stillok, with no branding (initial on the default colour) or no sign-in row.ok,empty,invalid,insecure-http,unreachable,tls,timeout,not-objectos,server-error. Each failure maps 1:1 to its own copy key.credentials: "omit", no cookie, no credential.xhrFetch(same module). React Native'sfetch(whatwg-fetch 3.6.20 over XHR) rejects every transport failure with the sameTypeError: Network request failed, so a certificate error cannot be told from an unreachable host. RN'sXMLHttpRequestkeeps the native error text inresponseTexton failure (Libraries/Network/XMLHttpRequest.js,__didCompleteResponse).xhrFetchrejects with that text, and the probe classifies the iOSNSURLErrorDomainand Androidjavax.net.ssl/java.security.certwordings astls.components/shell/ServerConfirm.tsx. It shows the logo (falling back to the initial on the brand colour when there is no logo or it fails to load), the product name, the full URL, a lock row only for https, the sign-in methods, and the platform name and version. Actions: 连接并登录 / 不是这台服务器. Android back counts as "not this server".app/server-config.tsx. The screen runs the probe and only then shows the confirm step. The server is saved only inhandleConfirm. A probe that finishes after the address was edited is ignored. New copy: "在哪里找到地址?" steps and the VPN hint.lib/server-url.ts.resolveServerUrlandvalidateServerUrlare deleted, along with their tests; the persistence functions stay.stores/server-store.tsis unchanged: the save was already only inconnect, which is now called only from the confirm step.serverConfig.*andserverConfirm.*copy, written as "ObjectOS".serverConfig.helpis replaced byserverConfig.where.step3.docs/HYBRID-SHELL.md: new "Server selection" section covering the probe contract, the outcomes and the transport. "makes no API calls of its own" now says "no authenticated API calls; only the anonymous probe".Tests
All runs below are on head
49de79b.npx tsc --noEmit: exit 0npx eslint . --ext .ts,.tsx: exit 0npx jest --ci --coverage: exit 0. Test Suites 29/29, Tests 329/329; on8c6f13ait was 26 suites and 283 tests.lib/coverage is 84.73% of statements (threshold 80);server-probe.tsis at 95.2%.__tests__/lib/server-probe.test.ts: an ObjectOS server, a non-ObjectOS 200 HTML page, JSON that is not discovery, a 404, a 5xx, a timeout, five TLS wordings, five unreachable wordings, redirect adoption, a redirect to a login page, a redirect to plain http, typed http (public and local), empty and invalid input, a pasted Console link, the partial failures (branding missing gives the initial on the default colour, branding transport failure, auth config missing, a bad colour, relative logos), SSO-only mode, a disabled provider, andxhrFetch(no credentials, final URL, native error text, abort).__tests__/components/ServerConfirm.test.tsx: the confirm screen's fields, the logo fallbacks, the lock row, the sign-in row, its two actions, and Android back.__tests__/components/ServerConfigScreen.test.tsx: nothing is saved before confirm, "not this server" keeps the address, each failure kind shows its own message, and a stale probe is ignored.ablation-replace.mjs, both restored to the HEAD blob with an emptygit diff HEAD:ServerConfigScreen.test.tsx2 failed / 10 passed.server-probe.test.ts5 failed / 30 passed. A first attempt was refused by the tool, because the replacement text was not distinguishable on disk; it did not run, and was redone with a distinct replacement.Acceptance notes
main@d9885f5d). Every field the card names exists. Two are nested differently from how the card writes them:branding.productName/branding.logoUrl/branding.brandColorin a bare, non-enveloped body (packages/cloud-connection/src/runtime-config-plugin.ts:1199, sent bysendRevalidatedat :308-315).ssoEnforcedisdata.features.ssoEnforced, next todata.features.sso(packages/plugins/plugin-auth/src/auth-manager.tsgetPublicConfig, served enveloped atauth-plugin.ts:3103-3110).packages/runtime/src/dispatcher-plugin.ts:1134-1155), withname: 'ObjectOS'andversionfromhttp-dispatcher.ts:2105-2113.logoUrlmay be relative (its doc comment,runtime-config-plugin.ts:760). A root-relative logo resolves against the server origin; any other relative form is dropped and the initial is shown instead.main@d9885f5d: grep ofui/apps/console/srcfinds no mobile-app settings page, and Connect by QR code:objectos://connect?server=…links and the native scanner screen #156 says an objectstack card will add it. Copy that sends users to a page that does not exist would be a misleading-copy defect. So the steps say what is true today: open ObjectOS in a browser, copy the address bar (a pasted Console link is cut to the server part), and otherwise ask the administrator. Once that page ships, this is a one-string change per locale (serverConfig.where.step1/step2).objectos://connect?server=…links and the native scanner screen #156) cannot do anything yet. The seam is named in theapp/server-config.tsxheader ("Scan entry point"): the scanner adds its button beside the address field and passes the scanned address torunProbe.server-error(5xx) is an outcome beyond the suggested union. The card does not cover a 5xx on discovery. Calling it "not ObjectOS" would be wrong, and calling it "unreachable" would hide a server that did answer.{ success, data }envelope landed on/.well-known/objectstack. A deployed server older than the envelope would read as "not ObjectOS". The probe stays strict to the contract as served onmain.features.ssois served and classified inpackages/spec/src/kernel/public-auth-features.ts:188, butGetAuthConfigResponseSchema(packages/spec/src/api/auth-endpoints.zod.ts) does not declare it. That is a read-only observation, not filed. The probe reads the served body without parsing it through that schema.Imagecannot render SVG. The confirm screen falls back to the initial ononError. Not device-verified.Verification
Device checks are not verified by this PR. They are listed under 需要你做的 above: a real private server, a server with a TLS error, and a non-ObjectOS https site.
Gate readings on 49de79b
Ablation readings
Generated by Claude Code