feat: canonical STAR URI actor identity for target dispatch (STAR-SERVER-041) #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "agent/star-uri-identity-compat"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
gserver did not previously understand canonical STAR identities at all: target dispatch resolved actors by bare actor-name strings only (
target["actor"]→resolve-target-destination(actor-string)→get-dest-actor→ local Sento actor, oractors.<actor>.new.target/documents.target.dispatch.<actor>when no local actor exists). There was nostar://parsing, canonicalization, authority ownership, resource-kind validation, or STAR URI actor resolution anywhere insource/at base commit8fb297d(verified by inspection and by STAR-RESEARCH-060's source audit).This PR bridges that gap with a small, explicitly temporary Common Lisp STAR URI compatibility layer so BBPD can migrate safely, per the implementation slot recorded in STAR-SERVER-041 (starintel-labs/starintel-server issue #1).
Research / design documents followed (normative)
From
lost-rob0t/starintel-auto-research:roam/research/star-server/STAR-RESEARCH-041-unified-star-uri-authority-routing-and-fediwatch-rabbitmq.org(APPROVED) — RFC 3986 direction, canonicalization rules, legacy-input-only rule, gserver-owned authority, RabbitMQ durable dataflow.roam/design/star-server/STAR-SERVER-041-star-uri-authority-routing-protocol.org(APPROVED) — exact v1 URI grammar, 12 canonicalization rules, resource-kind registry, authority semantics, legacy migration contract, conformance requirements, Phase A/D TDD order.roam/design/star-lang/STAR-LANG-004-star-service-uri-discovery.org(APPROVED, amended) — shared URI value model (authority,path-segments,resource-kind,resource-path), nodomain/address/actor-namefields, explicitmigrate-legacy-star-uri ... :tomigration.roam/indexes/star-server/STAR-PROTOCOL-INDEX-000-authority-routing.org— protocol graph and implementation ordering.roam/design/star-server/STAR-SERVER-040-starrouter-zeromq-transport-api-overhaul.org(APPROVED) — routing/registration contract that 041 extends; transport-neutrality of identity.roam/research/star-server/STAR-RESEARCH-060-star-bbpd-runtime-modernization.org— BBPD wire-contract evidence: canonical dispatch keydocuments.target.dispatch.<actor>, compatibility keyactors.<actor>.new.target, RabbitMQ stays BBPD's transport.Current source inspected (base
8fb297d):source/actors.lisp(actor index,get-dest-actor, legacy target actor),source/target-dispatch.lisp+source/target-dispatch-fixes.lisp(durable coordinator, routing keys, validation),source/target-recovery.lisp/source/target-repository.lisp(target records),source/frontends/http-boundary-routes.lisp,source/frontends/http-authorization-routes.lisp(the live/new/target/:actorhandler),source/frontends/http-target-v1.lisp/http-target-v1-route.lisp(canonical target create v1),source/frontends/http-bulk-jobs.lisp(AMQP property/header patterns),source/rabbit.lisp(exchange/key constants),source/package.lisp,source/starintel-gserver.asd,t/target-routing-test.lisp,t/http-target-v1-test.lisp,t/v09-runtime-test.lisp,tests/test_v09_runtime_contract.py.Temporary compatibility-layer architecture
source/star-uri.lisp+source/star-uri-legacy.lisp(package:star.star-uri) implement the approved STAR v1 model — immutableauthority+path-segmentsvalue withresource-kind/resource-pathviews and the narrow API:parse-star-uri,canonicalize-star-uri,serialize-star-uri,canonical-star-uri-p,valid-star-uri-p,actor-star-uri-p,star-uri-owned-p,*gserver-star-authority*, plus the gated legacy API (parse-legacy-star-uri,migrate-legacy-star-uri).Canonicalization implements the STAR-SERVER-041 rules exactly: lowercase scheme and reg-name-profile authority, userinfo/port forbidden, pchar path validation, percent-encoded unreserved normalization, uppercase remaining escapes, dot segments rejected before and after percent normalization (
%2E,%2E%2E,%2e%2ecannot sneak through), query/fragment/malformed-escape rejection, the seven reviewed resource kinds, and resource-path case preservation.The package header carries a prominent replacement marker: it must be deleted in full once the shared StarLang/STAR URI library is consumable by gserver. The seam is structural: target routing only depends on the injectable
*target-actor-identity-resolver*and the:star.star-uripackage API — never on parser internals. A dedicated test (actor-routing-consumes-the-identity-interface-not-the-parser) injects a stub resolver and proves routing works without the temporary parser, anduri-parsing-stays-outside-the-actor-namespaceassertsstar.actorsexports no URI parsing.Backward compatibility retained (exact)
"actor": "domain-enricher") resolve exactly as before: local registry first, then the unchanged external-actor route familydocuments.target.dispatch.<actor>with compatibility keyactors.<actor>.new.target(asserted by tests).POST /new/target/:actorremains a bounded bare-name compatibility adapter (the live authorized handler now explicitly rejects STAR URIs with400 canonical_actor_identity_unsupportedinstead of leaking a URI into a routing key).POST /api/v1/targets(targets.create), whoseactorfield now accepts either a bare name or a canonical STAR actor URI (documented in the machine-readable contract).extensions.target_actor_urionly when canonical identity exists (bare-name dispatch metadata is byte-identical, asserted by test).BBPD interoperability demonstrated
star://bbpd.starintel.actor/actor/subfinderis proven to be:valid-target-actor-identity-p);bbpd.starintel.actor, resource-kindactor, resource-path("subfinder");documents.target.dispatch.subfinder+ compatibilityactors.subfinder.new.target(STAR-RESEARCH-041 keeps RabbitMQ as the durable transport; STAR-RESEARCH-060 records BBPD's dual-key binding);extensions.target_actor_uriin the document andx-star-destination-uriAMQP header —bbpd.starintel.actor/subfindernever becomes indistinguishable from another authority'ssubfinder;star://domain:address:actor-nameformat.A local-authority case is included too (
star://gserver.starintel.actor/actor/user-hunt→ local registry via the adapter; multi-segmentactor/quasar/user-huntresolves through slash-joined registry keys; fail-closed when the flat transport cannot express it).Legacy handling
Legacy tuples are input-only through the explicit compat API.
migrate-legacy-star-urirequires an explicit already-canonical:totarget or an explicit:mapentry, validates the target through the same canonical validator, and there is deliberately no automaticdomain -> authoritymapping and nolegacy.<domain>invention (both are asserted as negative tests, per the BBPD review note).What is not claimed
star-uri-owned-pis a configured-namespace comparison only (STAR_GSERVER_AUTHORITY), and resolution boundaries that require more fail closed. Authority is never derived from HTTP origin, broker host, ZMQ endpoint, hostname, or process identity.:star.star-urilayer is not the shared library and is not exported for ecosystem-wide reuse.Replacement path
When the shared StarLang STAR URI library is consumable: rebind
*target-actor-identity-resolver*(one defparameter) to a resolver backed by the shared library, deletesource/star-uri.lisp/source/star-uri-legacy.lispand the:star.star-uripackage, and keep everything else. No actor, HTTP, or RabbitMQ code rewrites.Test evidence (local)
nix run .#star-unit-tests(hermetic, exit 0): 23 required suites green — including newSTAR-URI-TESTS discovered=33 executed=33 passed=33 failed=0 skipped=0andSTAR-ACTOR-IDENTITY-TESTS discovered=19 executed=19 passed=19 failed=0 skipped=0; all 21 pre-existing suites unchanged and green (no existing test weakened).nix run .#star-integration-tests(exit 0) against live CouchDB 3.5.2 + Clouseau + RabbitMQ 4.3.4 + Valkey:VALKEY-LEASE-INTEGRATION-TESTS 24/24,COUCHDB-VIEW-INTEGRATION-TESTS 9/9,HTTP-API-TESTS 36/36(+ public-api integration checks).prolog-verify check) passed with machine-recorded observations of both runs.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.