Application constants
Application constants
Read references/specification.md and references/engineering-contract.md. This is a baseline greenfield skill installed with bmforge-project; no separate runtime service or dependency is introduced.
- Bootstrap already creates
<app>/constants/D<Name>.pyfrom the canonicalassets/DProject.py, with project name and subtype resolved. Use this existing literal-version file; don’t overwrite or regenerate it. Create otherD<Name>.pymodules by domain only when needed. - Use
typing.Finalfor defaults, paths, ports, protocol keys, JSON keys, timeouts, column-name mappings and fixed configuration values. Useenum.StrEnum(orenum.IntEnumfor numeric codes) when a closed vocabulary is meaningful, such as statuses or actions. Do not invent a metaclass, constant registry or import of another application’s code. - Keep names descriptive and domain grouped, such as
DNetwork.HTTP_PORT,DZMQ.PROTOCOL_VERSION,DField.RUN_ID,DStatus.RUNNING. Preserve externally established literal values when replacing magic strings. Configuration overrides resolve through the existing runtime-config contract, not by changing constants at runtime. - Expose stable machine-facing identifiers, never translated UI text. Human-readable labels belong in the
bmforge-localizationmessage catalogues; UI uses stableDTextkeys, not English strings in activities or handlers. - Inspect
references/source/snake-lab/for sophisticated constants (Finalplus enums and SQL mappings) andreferences/source/bmgeoip/for the smallerDGeoIp,DZMQ,DBMGeoIPpattern. They are examples, not importable dependencies. - Check new source changes for repeated behavioral literals. Don’t turn incidental prose, SQL statements, MIME types or everyday math constants into unnecessary abstractions; define a named group only when the value has semantic meaning or is reused.
- Run application tests to prove request/message keys, schema values, version metadata and defaults have not changed accidentally. Do not translate IDs or change wire/schema representations.