mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-06-13 08:45:13 +02:00
Replaces the previous pair of single-purpose bootstrap processors
(config_bootstrap + pulsar_bootstrap) with a generic Bootstrapper
that runs a configurable list of pluggable "initialisers" in a
reconciliation loop.
Design
------
See docs/tech-specs/bootstrap.md for the full spec.
The bootstrapper is a single AsyncProcessor that:
* Reads a list of initialiser specifications (class, name, flag,
params) from either a direct `initialisers` parameter
(processor-group embedding) or a YAML/JSON file (`-c`, CLI).
* On each wake, runs a cheap service-gate (config-svc + flow-svc
round-trips), then iterates the initialiser list, running each
whose configured flag differs from the one stored in
__system__/init-state/<name>.
* Stores per-initialiser completion state in the reserved
__system__ workspace; services never see these keys because of
the _-prefix notification filter.
* Adapts cadence: ~5s on gate failure, ~15s while converging,
~300s in steady state.
* Isolates failures — one initialiser's exception does not block
others in the same cycle; the failed one retries next wake.
Initialiser contract
--------------------
* Subclass trustgraph.bootstrap.base.Initialiser.
* Implement async run(ctx, old_flag, new_flag).
* Opt out of the service gate with class attr
wait_for_services=False (only used by PulsarTopology — config-svc
cannot come up until Pulsar namespaces exist).
* ctx carries short-lived config and flow-svc clients plus a
scoped logger.
Core initialisers (trustgraph.bootstrap.initialisers.*)
-------------------------------------------------------
* PulsarTopology — creates Pulsar tenant + namespaces
(pre-gate, blocking HTTP offloaded to
executor).
* TemplateSeed — seeds __template__ from an external JSON
file; re-run is upsert-missing by default,
overwrite-all opt-in.
* WorkspaceInit — populates a named workspace from either
__template__ (with an explicit types list)
or a seed file; raises cleanly if the
template isn't seeded yet (retries on
next cycle).
* DefaultFlowStart — starts a specific flow in a workspace;
no-ops if the flow is already running.
Enterprise or third-party initialisers plug in via fully-qualified
dotted class paths in the bootstrapper's configuration — no core
code change required.
pyproject.toml
--------------
* Replaces config-bootstrap + pulsar-bootstrap entries with a
single `bootstrap` script pointing at the new Processor.
|
||
|---|---|---|
| .. | ||
| trustgraph | ||
| pyproject.toml | ||
| README.md | ||