Repository navigation
feat(server): add protocol discovery and persistent identity - #1753
Conversation
|
@Teingi Thanks for the review. Both findings are fixed in
I also updated the English/Chinese lifecycle docs and the PR description. Local validation passed: 191 focused tests, |
| async with open_server_identity_repository(config.database) as identity_repository: | ||
| server_id = await identity_repository.load_or_create() |
There was a problem hiding this comment.
The identity database is closed before the runtime opens it. With shared-memory SQLite, two apps can read the same Scope but return different server_ids. Please initialize the identity using the runtime-owned primary database.
There was a problem hiding this comment.
Fixed in 1f58fe2. Server startup now initializes and loads the identity through runtime.primary_database, borrowing the same database that owns Scope data for the Runtime's lifetime. The separate identity database opener is retained only for the offline CLI. Identity schema creation remains idempotent, and initialization/loading errors still abort startup before readiness.
I reproduced the reported mismatch before the fix. The regression now creates a Scope through one app, reads it through a second app sharing the same SQLite memory URI, and checks that both advertise the same server_id. It also verifies that closing one app preserves the surviving app's data and identity, while reopening after all connections close starts a new database and identity.
Classify memory storage using dialect connection arguments and decoded SQLite URIs so offline reset cannot claim a nonpersistent rotation. Reject feature major zero during generation, matching the discovery model. Extend existing regressions and document both validation boundaries.
|
@Teingi Conflicts with current |
|
please update & resolve conflicts |
|
@hidb4ai Resolved. |
hidb4ai
left a comment
There was a problem hiding this comment.
Two SQLite identity issues remain at f5b4b988: the shared-memory startup failure detailed below and the temporary-database reset issue, which still reproduces on this commit. Please fix the startup failure before merging.
Classify persistence from SQLite's own URI rules so offline reset cannot report an identity that disappears on reopen. Retry only busy and locked errors across the complete identity initialization, and keep that classification in the SQLite adapter.
|
Addressed the two remaining SQLite findings in 633823b.
Local |
Which issue or RFC does this PR close?
Closes #1655.
Rationale
Remote consumers need an authenticated protocol handshake and a durable logical deployment identity, distinct from health, runtime capabilities, Access identity, and proof of trust.
Contract and current design
The wire authority is
openapi/powercontext.yaml. Detailed lifecycle, compatibility, restore/clone, and migration boundaries are documented in the English design and Chinese design.GET /v1/server-inforequiresserver.observeunder the configured authentication/authorization policy. It returnsschema_version,product,server_id,package_version,api_contract_version, andfeature_contracts; no secrets, paths, health, capabilities, inventory, or principal data.1.0; API contract:1.2; features:access.principal,scope.selection, andmemory.explicit, each1.0. Versions require integermajor >= 1,minor >= 0. Minor changes are backward compatible; incompatible changes increment major.server_idacross normal restarts, package upgrades, same-deployment restores, and cooperating replicas. It is distinct from Accessdeployment_idand migrationpc_schema_revision.powercontext server identity-reset --maintenance-confirmed. Active-replica detection and fencing are operator responsibilities. Logical data imports copy identity only if they includepc_server_identity.file:prefix and literal filename controls, and honoring decoded NUL termination for filenames and query parameter names/values.is_persistentexcludes memory (including the built-inmemdbVFS) and empty-path temporary file URIs. Nonpersistent pooling, offline guards, cursor-secret persistence, and subprocess workers consume this single authority. Reset rejects these targets before opening storage.get_server_info()and accepts unknown optional fields in compatible schema minors.The current unified migration bundle owns only four Artifact tables, not complete Server startup or
pc_server_identity; it rejects complete Server databases with unmanaged objects. Identity remains Runtime-owned within this boundary. Complete-schema migration adoption must preserve the existing singleton; clone rotation remains explicit and offline, with no separate identity migration ledger.Authority and evidence
Tests avoid duplicating the generated feature taxonomy in HTTP assertions or repeating SDK decoding at the model layer. Remaining projection and SDK tests were mutation-checked to reject broken membership and unknown-field handling. Plain repository memory lifetime is covered by the Server shared-data/identity lifecycle seam and persistence tests; no timing or process-memory assertions establish resource bounds.
User-facing changes
Additive endpoint, SDK method, offline maintenance command, and
pc_server_identitytable. Generated Python/host operation catalogs are included. No breaking API change. This PR does not implement trust establishment, automatic clone detection, client reconnection policy, legacy profile negotiation, or #1656/#1657 pagination/history work.Validation
make check: passed, including lock consistency, prek, ruff, ty, generated API checks, and 49 integration-manifest tests.make unit-test: 4235 passed, 207 skipped.make build: passed.make docs-test: passed; verified 947 public pages and their internal links.Focused regressions cover temporary and memory URI rejection, native filename classification, shared-memory identity convergence, held-lock recovery, and retry exhaustion. Retained feature-projection and SDK unknown-field tests were mutation-checked against broken obligations.
AI usage statement
OpenAI Codex and Pi-hosted AI assistants were used for analysis, implementation, test drafting, independent review, and validation. Changes were checked against the issue, maintainer feedback, repository conventions, and the explicitly listed verification results. AI review does not replace required maintainer approval.