Topology Specification
Purpose
Sigil topology defines the canonical representation of external runtime dependencies for topology-aware projects.
Topology is declaration only. Concrete environment worlds live in config modules.
Canonical Files
A topology-aware project uses:
src/topology.lib.sigil
config/.lib.sigil
src/topology.lib.sigil is the canonical source of truth for:
- declared dependency handles
- declared environment names
config/ is the canonical source of truth for:
- one selected environment's runtime world
Topology Surface
§topology defines:
t Environment=Environment(String)
t HttpServiceDependency=HttpServiceDependency(String)
t TcpServiceDependency=TcpServiceDependency(String)
λenvironment(name:String)=>Environment
λhttpService(name:String)=>HttpServiceDependency
λtcpService(name:String)=>TcpServiceDependency
†runtime and world entry roots define the canonical env surface:
t World={clock:†clock.ClockEntry,fs:†fs.FsEntry,http:[†http.HttpEntry],log:†log.LogEntry,process:†process.ProcessEntry,random:†random.RandomEntry,tcp:[†tcp.TcpEntry],timer:†timer.TimerEntry}
λworld(clock:†clock.ClockEntry,fs:†fs.FsEntry,http:[†http.HttpEntry],log:†log.LogEntry,process:†process.ProcessEntry,random:†random.RandomEntry,tcp:[†tcp.TcpEntry],timer:†timer.TimerEntry)=>World
Compile-Time Rules
Topology declaration location
Calls to these constructors are only valid in src/topology.lib.sigil:
§topology.httpService§topology.tcpService§topology.environment
World entry location
Calls to †http. and †tcp. entry constructors are only valid in:
config/*.lib.sigil- test-local
world { ... }clauses
Ambient env access
process.env access is only valid in config/*.lib.sigil.
It is invalid in:
src/topology.lib.sigil- ordinary application modules
- tests
- any other project source file
Dependency-aware API usage
Topology-aware HTTP/TCP APIs require dependency handles:
§httpClient.*requiresHttpServiceDependency§tcpClient.*requiresTcpServiceDependency
The compiler rejects:
- raw URLs passed to topology-aware HTTP client APIs
- raw host/port values passed to topology-aware TCP client APIs
- dependency kind mismatches
Validate-Time Rules
Validation is environment-specific.
For selected environment :
src/topology.lib.sigilmust existmust be declared in topologyconfig/must exist.lib.sigil config/must export.lib.sigil worldworldmust provide all primitive effect entries- every declared dependency must appear exactly once in
world - no undeclared dependencies may appear in
world - dependency names must be unique in topology
Execution Model
Topology-aware commands require an explicit environment:
sigil validate --env
sigil run --env
sigil test --env
Sigil does not provide an implicit default environment for topology-aware projects.
Diagnostics
Topology diagnostics use SIGIL-TOPO-*.
Current codes include:
SIGIL-TOPO-MISSING-MODULESIGIL-TOPO-MISSING-CONFIG-MODULESIGIL-TOPO-INVALID-CONFIG-MODULESIGIL-TOPO-ENV-REQUIREDSIGIL-TOPO-ENV-NOT-FOUNDSIGIL-TOPO-ENV-ACCESS-LOCATIONSIGIL-TOPO-CONSTRUCTOR-LOCATIONSIGIL-TOPO-RAW-ENDPOINT-FORBIDDENSIGIL-TOPO-DEPENDENCY-KIND-MISMATCHSIGIL-TOPO-INVALID-HANDLESIGIL-TOPO-DUPLICATE-DEPENDENCYSIGIL-TOPO-DUPLICATE-BINDINGSIGIL-TOPO-MISSING-BINDINGSIGIL-TOPO-BINDING-KIND-MISMATCH