Paper Metadata Gate (Strict-Only)
Breaking change
After this rollout, paper-trading sessions require both session.model_urn
and session.pipeline_urn to be present and valid at startup.
If either URN is missing, malformed, unresolved in entity_aspects, or (for
the model URN) resolves to a non-Production/non-Staging model status, the
session raises MetadataValidationError and refuses to start.
There is no warn-only fallback mode.
How strict gate validation works
The paper gate performs these checks in order:
- Parse
model_urnandpipeline_urnwith AlphaSwarm URN validation. - Resolve
mlModelMetadataformodel_urnandpipelineMetadataforpipeline_urn. - Enforce model lifecycle status (
ProductionorStagingonly). - Emit a
metadata_gateprogress frame and raise on any validation error.
Startup is blocked until all checks pass.
Seeded URNs from migration 0049
Alembic revision 0049_paper_metadata_seed_aspects seeds these baseline URNs:
configs/paper/alpaca_mean_rev.yamlurn:alphaswarm:mlmodel:prod:alpaca_mean_reversion_v1urn:alphaswarm:pipeline:prod:alpaca_mean_reversion_loop
configs/paper/ibkr_mean_rev.yamlurn:alphaswarm:mlmodel:prod:ibkr_mean_reversion_v1urn:alphaswarm:pipeline:prod:ibkr_mean_reversion_loop
configs/paper/avellaneda_stoikov_quotes.yamlurn:alphaswarm:mlmodel:prod:avellaneda_stoikov_v1urn:alphaswarm:pipeline:prod:avellaneda_stoikov_quotes_loop
configs/paper/lucic_tse_options.yamlurn:alphaswarm:mlmodel:prod:lucic_tse_options_v1urn:alphaswarm:pipeline:prod:lucic_tse_options_loop
configs/paper/tradier_rest.yamlurn:alphaswarm:mlmodel:prod:tradier_rest_baseline_v1urn:alphaswarm:pipeline:prod:tradier_rest_loop
To add a new paper config, seed matching MlModel + Pipeline aspects first,
then point YAML session.model_urn / session.pipeline_urn at those URNs.
Operator runbook (custom paper YAMLs)
- Run migrations through
0049_paper_metadata_seed_aspects. - For each custom paper model, register an
MlModelaspect (status must beProductionorStaging) using theaspect.register_modelMCP tool. - Register a matching
Pipelineaspect for each paper pipeline URN. - Update custom YAML files so
session.model_urnandsession.pipeline_urnmatch the newly seeded aspects. - Start paper sessions and confirm metadata-gate startup checks pass.
Rollback
If you must revert this rollout:
alembic downgrade 0048git revert <this-pr-commit>
After rollback, redeploy and re-run paper sessions with the reverted code/docs.