Repository navigation
Take over Microcosm's Orrery projection - #9
Merged
Merged
Conversation
The collector's Orrery worker is to project a build's saved compiler schema (graph.schema.json) and execution overlay (graph.execution.json), instead of the build machine doing it. Microcosm's projection lives in microcosm-graph, which is not published, and that package needs numpy, pandas and the content store. PolicyEngine/microcosm#1295 made the projection importable with only the standard library. Copy the projection's modules from #1295's head, 8d159a8, into telemetry_collector/orrery/projection, keeping their names and contents. orrery.py leaves out the command-line entry point, whose overlay option reads the content store, and the two functions that compile a Graph object before projecting it; the other eight modules are unchanged. tools/generate-orrery-projection-fixtures.py runs Microcosm's projection on six inputs and saves each input with the Orrery JSON it produced: Microcosm's toy country with and without an execution overlay, a failed threshold check, a schema exercising rewrites, expansion and numbers JavaScript cannot hold, UK calibration nodes with artifact summaries, and the complete UK dense graph's declarations. It also records the smallest node, edge and output-size limits at which the toy overlay still projects. tests/test_orrery_projection.py projects the saved files with the copy and requires identical bytes, and identical errors one below each limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The projection copy must stay identical to Microcosm's until Microcosm removes its own, and later Orrery publications are to record which projection wrote them. Neither was possible from the code alone. Add provenance.py: the Microcosm repository, commit (#1295's head, 8d159a8) and source directory; each copied module's source git blob ID; what orrery.py leaves out; and the adapter identifier the projection writes at metadata.adapter, microcosm.graph.orrery.v1, unchanged from Microcosm. Tests check that every unchanged module still has its source's blob ID, that no module is copied without a record, that the saved expected outputs came from the same commit, and that the projection writes that adapter identifier. The README's new "Orrery projection" section says where the projection comes from until Microcosm removes its copy, and how to take a later version and regenerate the expected outputs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tests/test_deployment_workflow.py refuses the word "repository" in the collector's own source and documentation files; it allows it only in GitHub's expression context and in the OIDC claim and attribute names. The provenance record used it in a constant, in the fixture index's key and in the generator and test that read them. Name them MICROCOSM_REPO and "microcosm_repo". The fixture index is otherwise unchanged and still matches the generator's output format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
added a commit
that referenced
this pull request
Oct 19, 2026
Brings in the Orrery projection (#9) and the 0.3.0 release commit, so the branch is up to date with main as the ruleset requires. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
added a commit
that referenced
this pull request
Oct 19, 2026
Brings in main (the Orrery projection, #9, and the 0.3.0 release commit) through the contract branch, so this branch is up to date as the ruleset requires. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
added a commit
that referenced
this pull request
Oct 20, 2026
Brings in the Orrery projection (#9) and the 0.3.0 release. No conflicts; none of main's new commits touch the extraction tool, its tests or the push workflow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8
Summary
Copies Microcosm's Orrery projection into the collector, so the collector's future Orrery worker can turn a build's saved compiler schema (
graph.schema.json) and execution overlay (graph.execution.json) into Orrery JSON without Microcosm's content store, numpy or pandas. Tests compare the copy's output with Orrery JSON saved from Microcosm's own projection and require identical bytes.Nothing in the service calls the projection yet. The worker, its image, validation with Orrery's Node validator and publication are later changes.
What was copied, and from where
The source is PolicyEngine/microcosm#1295 at its head,
8d159a8c5653ad63affb1a5d2e39034f877db2ff(#1295 is still open), frompackages/microcosm-graph/src/microcosm/graph/. #1295 is what makes the projection need only the standard library.orrery.pyorrery_document_from_schema,orrery_json_from_schemaand every helper they call, unchanged. It leaves outmainand its file-reading and reference-rebasing helpers, because the command's--evidence/--storeoption reads the content store, andorrery_document/orrery_json, which compile aGraphobject first.orrery_evidence.py,execution_overlay.py,presentation.py,schema.py,serialize.py,decl.py,canonical.py,expansion.pyschema.py,serialize.py,decl.pyandexpansion.pyare needed because the projection checks a schema by recompiling its embedded graph.provenance.pyrecords the repository, commit and directory, each source file's git blob ID, and whatorrery.pyleaves out. A test checks that every unchanged module still has its source's blob ID. The adapter identifier the projection writes atmetadata.adapter,microcosm.graph.orrery.v1, is unchanged, and a test checks it. The README's new "Orrery projection" section says where a later version comes from (Microcosm'smain, until Microcosm removes its copy) and how to take it.Where it lives
telemetry_collector/orrery/projection/:telemetry_collector, andtests/test_packaging.pyrequires that, so carried-over calibration-diagnostics commits keep merging. A second top-level package would break that.telemetry_collector/orrery/leaves room for the worker's validation and publication modules besideprojection.The modules are in the container image, because the Dockerfile copies
telemetry_collector, but the application doesn't import them.Evidence that the output is byte-identical
tools/generate-orrery-projection-fixtures.pyran Microcosm's projection at8d159a8(Python 3.14.6) and saved each input with the Orrery JSON Microcosm wrote from it, undertests/fixtures/orrery_projection/.tests/test_orrery_projection.pyloads the saved overlay with the copied reader, projects with the copy, and compares bytes.toy-recorded-execution: Microcosm's toy country with grouped presentation, a scope boundary and source references; the overlay holds a computing phase and its replay, loaded from saved run evidence the way UK finalize loads ittoy-declarations-only: the same schema without an overlaytoy-failed-check: one phase whose threshold check fails; no presentation contractdeclaration-features-titled: rewrites, expansion, reweighting, an artifact input, numbers outside JavaScript's safe range, and a titleuk-calibration-summaries: UK calibration nodes on a three-household fixture, with UK's artifact summaries and one failed summary provideruk-full-dense-declarations: the complete UK dense graph's declarations and presentation contract (5,805 nodes, 21,620 edges)Limits, found on
toy-recorded-execution: the generator searched for the smallest value of each limit at which Microcosm still projects it. The copy writes the same bytes at that value and raises the same error one below it:_MAX_NODESOrrery adapter: node limit._MAX_EDGESOrrery adapter: edge limit._MAX_OUTPUT_BYTESOrrery adapter: prospective metadata size.A test also checks that the defaults match Microcosm's (20,000 nodes, 100,000 edges, 64 MiB output, and the schema reader's limits).
As a check that the comparison is sensitive, I changed one value the projection writes (
metadata.truncated) locally and ran the file: 9 failed (all six cases and the three limits), and it passed again once the value was put back.The inputs are synthetic: Microcosm's test fixtures and the UK graph declarations, with overlays from running those fixtures. They hold no build data. I checked them for local paths and machine names; there are none. The fixtures total 2.8 MB, 2.2 MB of it the gzip-compressed UK dense schema and output.
Other tests in the file, ported from #1295's: the copied overlay reader refuses another protocol, a non-object, duplicate keys, non-finite numbers, non-UTF-8 bytes, a FIFO and a file over the byte limit, and it reads each saved overlay back to the same canonical bytes. A static check confirms that the copied modules import only the standard library and each other.
Commits (red, then green)
tests/test_orrery_projection.pyfailed to import (ModuleNotFoundError: telemetry_collector.orrery), so none of its 23 tests could runtests/test_orrery_projection_provenance.pyfailed to import (ModuleNotFoundError: ...projection.provenance), so none of its 5 tests could runtest_collector_uses_store_vocabulary(tests/test_deployment_workflow.py) refuses the word "repository" in the collector's own files. That file isn't changed here, so I didn't run it locally. A text search with the same exemptions found 6 occurrences in 4 of this branch's files.After each commit, I ran the new test files again: 23 passed, then 28, then 28.
Tests run locally
uv run pytest -q tests/test_orrery_projection.py tests/test_orrery_projection_provenance.py: 28 passed, about 2.4 s.ruff checkandruff format --checkon every changed Python file, which passed. The copied modules pass both unchanged.bash tools/check-changelog.sh, which passed.I didn't run the rest of the suite; CI runs it.
Dependencies and deployment
No new dependencies:
pyproject.toml,uv.lock, the Dockerfile and the workflows are unchanged, and the change reads no environment variables. Deployment stays switched off:COLLECTOR_DEPLOY_ENABLEDis untouched.Related pull requests
mainis the source.microcosm.graph.orrery.orrery_json_from_schemaandcanonical_json. This PR doesn't change that dependency. It matters only when Microcosm removes its copy.🤖 Generated with Claude Code