Complete shared contour project linking and scoped application onboarding
This commit is contained in:
@@ -0,0 +1,171 @@
|
||||
# Device Core B2 user flow investigation
|
||||
|
||||
Date: 2026-10-01. Qualification of local sources, not a production release.
|
||||
|
||||
## Scope and conclusion
|
||||
|
||||
The requested flow is feasible after the local changes and the separately qualified
|
||||
shared-contour schema transition: create a project, import a fresh VPS administrator
|
||||
package, create a contour, issue independent application packages, register devices,
|
||||
discover externally created contours, and bind multiple same-company projects to one
|
||||
contour. Twenty bounded cross-system scenarios passed.
|
||||
|
||||
Two remaining delivery boundaries prevent describing the existing production product
|
||||
as fully qualified from an empty Ubuntu machine to Mission Core:
|
||||
|
||||
1. The existing root deployment runner pins the B2 foundation schema. The new SQL
|
||||
transition and rollback are local qualification inputs, **not registered deployment
|
||||
artifacts**. A separate canonical runner extension, migration registration,
|
||||
acceptance update and reviewed release are required. Never execute these SQL files
|
||||
manually against production or from application startup.
|
||||
2. Current Mission Core accepts the legacy MCV1 pairing format, not the new API v2
|
||||
application JSON. The simulated external client exercises API v2; it does not prove
|
||||
an existing Robot2B or Mission Core interface can import that file.
|
||||
|
||||
No production projects, contours, keys, devices, database migrations, VPS upgrades or
|
||||
physical tracker commands were created or executed during this investigation.
|
||||
|
||||
## Findings and local corrections
|
||||
|
||||
- Settings previously rendered projects as contours and omitted unlinked external
|
||||
VPS contours. They now render the authoritative VPS catalogue, display project
|
||||
associations explicitly, and refresh every 30 seconds while the visible settings
|
||||
window is open. A failed refresh identifies the displayed data as stale.
|
||||
- A new contour can be created with a name and a selected Device Core project.
|
||||
A stable request identity recovers uncertain responses without another contour.
|
||||
- The old primary key `(source_id, contour_id)` and backend conflict rule prohibited
|
||||
a second project. The separate forward transition uses
|
||||
`(source_id, contour_id, project_id)` and preserves existing rows and foreign keys.
|
||||
The old schema remains supported with an explicit migration-required error.
|
||||
- Existing contours can be attached to another authorized project of the same owner
|
||||
scope. A missing host view is created for that project. Unlink deletes only the
|
||||
selected relationship. Cross-company assignment remains forbidden.
|
||||
- Application creation selects the actual contour, no longer the first project link.
|
||||
The UI offers read, control and manage, with read selected by default. An application
|
||||
created before a lost key response is found by its stable identity; the UI directs
|
||||
the operator to issue a replacement instead of pretending the secret is replayable.
|
||||
- VPS v2 catalogue requests now reject a revoked domain client even if OAuth
|
||||
introspection still accepts a cached access token. Previously the contour catalogue
|
||||
could appear healthy but empty; protected fleet operations already denied access.
|
||||
- Project creation calls the owning company/personal space “Владелец проекта”.
|
||||
Device enrollment states that a stored profile still needs to be sent to hardware.
|
||||
|
||||
## Object and permission boundaries
|
||||
|
||||
A VPS contour is the device namespace on the server. A Device Core project is a local
|
||||
workspace with its own members and capabilities. A v2 application is an independently
|
||||
identified external consumer with contour grants and its own credentials/cursors.
|
||||
|
||||
External contours should appear in the administrative catalogue automatically, but
|
||||
must not create Device Core projects, memberships or data grants automatically. Root
|
||||
CLI or host-administrator credentials can create contours. An application's `manage`
|
||||
grant manages devices inside its contour and does not confer VPS administration.
|
||||
|
||||
Multiple projects may share one contour after migration. They see the same device
|
||||
identity, not copies. Project-local unlink/archive must not revoke external application
|
||||
credentials or alter other projects. External applications can share a contour with
|
||||
separate read/control/manage grants and independent event acknowledgments.
|
||||
|
||||
## Reproducible bounded qualification
|
||||
|
||||
From the Device Core repository:
|
||||
|
||||
```sh
|
||||
node scripts/qualify-b2-user-flow.mjs \
|
||||
/private/tmp/ndc-b2-sql-check/node_modules/@electric-sql/pglite/dist/index.js \
|
||||
../NODEDC_MISSION_CORE_ARNAVI-VPS \
|
||||
../outputs/device-flow-investigation-20261001/flow-report.json
|
||||
```
|
||||
|
||||
PGlite 0.5.8 is an explicitly supplied test dependency outside the production
|
||||
workspace. The VPS repository path is a qualification input, not a production
|
||||
dependency. The script uses the existing VPS `.venv/bin/python3`.
|
||||
|
||||
Real components: PostgreSQL WASM SQL engine and all 17 Device Core migrations,
|
||||
management repository, B2Infrastructure, private file vault, OAuth client library,
|
||||
VPS SQLite Store, SharedAPI, management domain and CLI parser.
|
||||
|
||||
Simulated boundaries: OAuth provider, TLS network transport, root privilege and
|
||||
hardware. No sockets are opened by the cross-system fixture. Three projects, three
|
||||
external contours and two synthetic devices bound the scenario. Temporary database
|
||||
and credential state is cleaned up; no exported secrets are written to the report.
|
||||
|
||||
The 20 cases include uncertain retries, old-schema rejection, migration preservation,
|
||||
two-project visibility, unrelated-project denial, external CLI discovery, independent
|
||||
applications and cursors, key rotation, lost issuance response, app deletion,
|
||||
cross-company denial, project unlink, restart persistence, audit redaction, rollback
|
||||
refusal when it would lose links, and lossless rollback/reapplication.
|
||||
|
||||
## Validation evidence
|
||||
|
||||
Evidence directory: `../outputs/device-flow-investigation-20261001/`.
|
||||
|
||||
- `flow-report.json`: 20/20 cross-system checks pass.
|
||||
- `device-tests.log`: 303/303 Device Core tests pass.
|
||||
- `vps-tests.log`: 317 VPS tests pass; one temporary loopback socket test is blocked
|
||||
by the sandbox. `vps-network-check.log` confirms that test and the three new
|
||||
revocation cases pass on the permitted rerun. All 318 cases are accounted for.
|
||||
- Final TypeScript/Vite build passes. Node syntax check and `git diff --check` pass.
|
||||
- Ruff passes on the modified VPS module and its new revocation tests.
|
||||
- `ui-checks.txt`, `ui-contours.png`: real changed React settings component tested
|
||||
in an isolated page with synthetic fetch responses. External discovery, shared
|
||||
project labels, explicit linking, grant selection, nested key output, contour
|
||||
creation and close behavior pass. This is not a production browser smoke test.
|
||||
|
||||
Base revisions before local changes:
|
||||
|
||||
- Device Core: `1b3001dfa12598af28882232336d837514502718`
|
||||
- VPS: `5ff082144eb0d2b8ccb46d1d08ead6b52f1d2021`
|
||||
- Mission Core, read only: `a78fdeae66287fa51f2888440d0f5abc0e70364b`
|
||||
|
||||
## Release and remaining acceptance
|
||||
|
||||
1. Register the new foundation transition and exact post-migration schema in the
|
||||
canonical deployment runner; include plan/apply, backup, rollback and acceptance.
|
||||
2. Release Device Core changes. Rebuild/version the VPS installer for the API
|
||||
revocation fix; the currently advertised 0.2.4 installer does not contain it.
|
||||
3. On an isolated Ubuntu Server 24.04 x86-64 host, qualify the actual installer,
|
||||
OAuth service, certificate pinning, restart and uninstall/restore boundaries.
|
||||
4. Repeat the browser flow against those released services and test an API v2
|
||||
consumer. Keep legacy Mission Core MCV1 pairing until its v2 consumer is implemented.
|
||||
|
||||
The reverse schema transition deliberately refuses execution while a contour has
|
||||
multiple project links. Do not delete assignments automatically to force rollback.
|
||||
The private credential vault retains immutable historical files; cleanup of orphaned
|
||||
or superseded secret files was not implemented in this investigation.
|
||||
|
||||
## Release preparation and partial activation, 2026-10-01
|
||||
|
||||
The shared-contour transition now has a fixed three-file descriptor, deterministic
|
||||
builder, bounded SQL locks, transaction-local row-preservation proof, private table
|
||||
backup, exact runtime/source acceptance and lossless automatic rollback in the
|
||||
canonical Platform runner. It remains a separate administrative deployment; the
|
||||
application does not migrate this schema at startup. The reverse transition refuses
|
||||
to remove a second project binding. A table marker without its verified applied
|
||||
archive is insufficient for subsequent application releases.
|
||||
|
||||
Runner source: Platform `27c1552`. Candidate 019 SHA-256:
|
||||
`048b77d0ce97c2179f89bb1c64d4d9915525dfa5b1e71a63fae15450205efeb3`.
|
||||
DCPLATFORM-21 design record: `c8f94c6a-7b57-4ae1-9463-425c5da5f3c6`.
|
||||
At this checkpoint the Synology promotion/migration and Device Core UI release are
|
||||
pending. Live r37 still has the old UI. Do not present the new UI as deployed.
|
||||
|
||||
The independent revocation fix is activated on ARNavi VPS **0.2.5**, source
|
||||
`193253dd48a1c6390ea4c5e500693123b88ce2ea`, installer manifest
|
||||
`139a3c1d7f3e8266e2154586783133078311aa9dae76d74ed229aab16f816197`.
|
||||
The versioned installer returned healthy; read-only before/after proofs preserve
|
||||
host, TLS, owner, devices, contours, applications and credentials. Packet count
|
||||
advanced 5478→5482. The active legacy Mission Core consumer was updated for the
|
||||
0.2.5 contract (`9761474`) through its canonical LaunchAgent; health accepted,
|
||||
VPS state paired, version 0.2.5 and last_error null. No real device command or
|
||||
production key mutation was used for acceptance.
|
||||
|
||||
New evidence directory: `../outputs/device-flow-release-20261001/`.
|
||||
20/20 cross-system checks, 303/303 Device Core tests, 318/318 VPS tests, 75/75
|
||||
Mission Core compatibility tests and production UI build pass. Platform regression
|
||||
suite passed 173 cases; two additional backup/acceptance cases then passed in the
|
||||
13-case focused shared-contour suite. Device artifact run reported 170 cases:
|
||||
153 passed and 17 environment skips, plus one sandbox-blocked health fixture;
|
||||
all four health fixture tests pass on the permitted local-listener rerun. New installer metadata
|
||||
and SHA checks pass. This checkpoint does not add Mission Core API v2 import or
|
||||
claim a clean Ubuntu installation/scale test.
|
||||
Reference in New Issue
Block a user