Repository navigation
feat(common): add the rule pack and the outside_facts package that owns each outside-project fact - #2155
Open
zoroyihan7 wants to merge 8 commits into
Open
feat(common): add the rule pack and the outside_facts package that owns each outside-project fact#2155zoroyihan7 wants to merge 8 commits into
zoroyihan7 wants to merge 8 commits into
Conversation
…nds each fact to a name Facts about projects outside this repository (aiter, SGLang, vLLM, PyTorch, the HIP runtime, argparse, Transformers, InferenceX) that more than one reader depends on are stated once, in a YAML rule pack. Each entry carries the project that owns the fact, the reason it exists and its examples; a pattern that fails one of its own examples, a repeated key, an alias, an unknown kind or an entry the code reads but the pack lacks refuses the pack, naming the file and the entry, and nothing falls back to an empty pack. hyperloom.common.outside_facts binds each entry to the constant the readers import. HYPERLOOM_RULE_PACK names the pack a session reads; without it the reference copy beside the module is read. The pack ships as package data. Nothing reads the constants yet; the next commit moves the readers that already repeat these facts onto them. Co-Authored-By: Claude <noreply@anthropic.com>
…n the readers that repeat them failure_signature, env_safety, provenance, visible_devices, gpu_power_settings and agentx_workload spelled out facts that the rule pack now owns: the HIP, HSA, import-error, argparse and Transformers log markers, the ROCR mask name and the InferenceX benchmark variable names. Each now imports the constant. No behaviour change. The compiled patterns, the blocked-name set and the provenance keys are identical to before: every pattern is built from the same text, compared pattern by pattern. Co-Authored-By: Claude <noreply@anthropic.com>
Code metrics gate: PASSEDJudged: the 20 files this change touches. Files it does not touch never fail it; anything found there is listed under Outside this change for information.
Module length warning: over 800 lines, within the 1200-line failure limit (not failing): 1
Thresholds and sources: |
The test package's conftest imports hyperloom.common.gpu_power_settings, which now reads the rule pack, and the pack is YAML. The job installs only pytest because the lint itself is stdlib-only, so every test in it failed at setup with "No module named 'yaml'". The job installs PyYAML beside pytest and stays seconds long. Co-Authored-By: Claude <noreply@anthropic.com>
This was referenced Oct 23, 2026
siliangchen-amd
added a commit
that referenced
this pull request
Oct 24, 2026
…lds (#121 c2544, c2545) The sync brings main's directory-entries threshold and main's baseline, common 57, into dev. Without this line every dev change touching a file directly in src/hyperloom/common would fail gate 5 on a directory it did not grow. The two entries over main's count are owned and have a route to main: toolbox's common/outside_facts/ in #2155 (PR-3), and specialist's common/accuracy.py, which folds into common/gain_math.py in the PR that takes the accuracy bars to main. The comment above the line says so; --update-baseline rewrites the file without comments, so this message and #121 keep the record too. Shared-File: scripts/code_metrics_baseline.txt @yihan.wang-agent @xiaofei.zheng-agent Co-authored-by: Cursor <cursoragent@cursor.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Conflicts in env_safety.py, failure_signature.py and provenance.py were resolved by taking multibranch-dev's version of the six readers, which is today's main plus only the outside_facts swaps (checked with git diff origin/main origin/multibranch-dev on each reader). Co-Authored-By: Claude <noreply@anthropic.com>
Every file of the outside_facts package and its tests now equals origin/multibranch-dev e81281d byte for byte; the six readers already did after the merge of main. Moved: nothing (the package layout outside_facts/{__init__,rule_pack}.py and packs/default.yaml was already the dev layout). Added, because rule_pack.py on dev imports them (same package, same layer, not on main and not in another PR of the stack): - outside_facts/component_layout.py (each component's layout in the pack) - outside_facts/image_check_spec.py, image_check_eval.py, image_env.py (the image_check entries a pack declares, checked against each entry's own examples when the pack loads) - outside_facts/image_check.py (evaluates those checks against the environment it runs in; python -m ... image_check), which completes the package and is what test_image_check exercises - tests: test_component_layout.py, test_image_check.py, test_image_check_pack.py Changed: packs/default.yaml grows with the component layouts and the image_check entries; rule_pack.py validates them; __init__.py binds the new constants; test_rule_pack.py follows. Removed: nothing. Co-Authored-By: Claude <noreply@anthropic.com>
Main's #2308 moved the shared helpers to the top-level hyperloom_common package. The rule pack stays in hyperloom.common.outside_facts (only the optimizer reads it, and hl-common-is-leaf allows hyperloom.common to import hyperloom_common). Resolve the import conflicts in gpu_power_settings and provenance onto hyperloom_common, and point outside_facts.image_check at hyperloom_common.io. Co-Authored-By: Claude <noreply@anthropic.com>
… what was asked Same change as multibranch-dev 68e612b (CodeQL: non-standard exception in __getattr__). Co-Authored-By: Claude <noreply@anthropic.com>
zoroyihan7
marked this pull request as ready for review
October 31, 2026 17:09
This branch has not been deployed
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.
Summary
Adds the rule pack and
hyperloom.common.outside_facts, the one place that states a fact about a project outside this repository (aiter, SGLang, vLLM, PyTorch, Triton, the HIP runtime, argparse, Transformers, InferenceX), and moves the readers onmainthat already repeat those facts onto it.Matches
multibranch-deve81281d (refreshed 2026-10-30): all 18 files undersrc/are byte-identical to that commit; the two CI/packaging files are this PR's own. Stack position: the first PR of the toolbox split that the measurement PRs need (#2157 B1's base branch merges this PR with #2154); nothing below it.Commits on the branch:
feat(common): add the rule pack and the outside_facts package ...(original cut, 2026-10-23).refactor(common): read the outside-project facts from outside_facts ...(original cut).ci(packaging): install PyYAML in the pyproject-declarations job(see below).Merge origin/main into feature/yihan/rule-pack: conflicts inenv_safety.py,failure_signature.pyandprovenance.pyresolved by takingmultibranch-dev's version of the six readers, which is today'smainplus only theoutside_factsswaps (checked per file withgit diff origin/main origin/multibranch-dev).chore(common): bring the rule pack up to multibranch-dev e81281d60.What the package holds now:
common/outside_facts/packs/default.yaml(1252 lines) is the pack: each entry names the project that owns the fact, why it exists and its examples. Since the first cut it also states each component's source layout (aiter, triton, torch, sgl_kernel, flydsl, ...) and, per entry, an optionalimage_checkthat says how to confirm the fact against an installed image.common/outside_facts/rule_pack.py(363) loads and checks it. A pack is refused, with the file and the entry named, when the file is missing or not one YAML document, a key repeats, an alias or merge key appears, an entry has an unknown kind or lacksproject,reasonorexamples, a pattern does not compile or fails one of its own examples, a component layout or animage_checkis malformed or fails its own examples, or the code reads an entry the pack lacks. Nothing falls back to an empty or default pack, because an unreadable fact must never read as "no constraint".common/outside_facts/__init__.py(287) binds each entry to the constant the readers import (HIP_UNDEFINED_SYMBOL,ENV_CONC,ROCR_VISIBLE_DEVICES_ENV, ...) and exposes the component layouts.rule_pack.pyonmultibranch-devimports them (same package, same layer, not onmain, not in another PR):component_layout.py(158),image_check_spec.py(366),image_check_eval.py(231),image_env.py(316); andimage_check.py(304), which evaluates the pack's checks against the environment it runs in (python -m hyperloom.common.outside_facts.image_check, exit 1 when a fact fails). Nothing onmaincallsimage_check.run_image_check; the multibranch session does, and arrives later.test_rule_pack.py(438),test_component_layout.py(74),test_image_check.py(617),test_image_check_pack.py(281).pyproject.toml: onepackage-dataline sopacks/*.yamlships in the wheel.failure_signature.py,env_safety.py,provenance.py,visible_devices.py,gpu_power_settings.pyandagentx_workload.pyswap their literals (the HIP, HSA, import-error, argparse and Transformers log markers, the ROCR mask name and the InferenceX variable names) for the constants. ThehipError[A-Za-z]*pattern is now the one ofmain'sHIP_RUNTIME_ERRORrule (fix(failure-signature): a HIP call that failed while running is not a missing kernel #2141 landed) and readsHIP_ERROR_PREFIX + r"[A-Za-z]*"..github/workflows/packaging.yml: the pyproject-declarations job installs PyYAML. That job installs only pytest because the packaging lint is stdlib-only, but the test package'sconftest.pyimportshyperloom.common.gpu_power_settings, which now reads the rule pack, and the pack is YAML. It is the one place that shows what the pack costs:hyperloom.commonis no longer importable on a bare interpreter. Everything that runs the product already has PyYAML (the executors andbenchmark_configimport it at module level, theruntimeextra installs it). If the reviewers wanthyperloom.commonto stay importable without third-party packages, the pack would have to be read lazily or not as YAML; that changes the loader, which is taken verbatim here, so it is raised and not done.hyperloom/commondirectory count: no longer an issueAfter main's #2308 moved the shared helpers to
hyperloom_common,hyperloom/commonhas 35 entries onmainand 36 with this PR, under the 50-entry limit; the code-metrics gate passes.outside_factsstays inhyperloom.common(optimizer-only code by #2308's rule; thehl-common-is-leafcontract allows it to importhyperloom_common).CI state
Not yet observed at the refreshed head (e5cdfa0). The earlier head's only reds were the code-metrics verdict above and
main's own collection error (#2149).What is not in this PR, and why
measure/tests/test_outside_facts.py(the sentinel that changes every owned value in a fresh interpreter and requires each reader to follow) importshyperloom_multibranchandhyperloom.measure.aiter_merge_hook, neither of which is onmain. It lands with the measurement PRs.hyperloom.measure,hyperloom.sandboxandhyperloom_multibranchimport the same constants (and the multibranch session calls the image check); they arrive with their own PRs. The constants for them are already in the pack so the pack is one document from the start.profile_{sglang,vllm,atom}.yamlkeepDEBUG_CLR_GRAPH_PACKET_CAPTUREas literal data (a YAML file cannot import the owner); the sentinel above pins the copies to the pack once it lands.Review template
multibranch-devwith the code. On Python 3.10 and 3.11 (each,-n 4): 993 passed, 0 failed, 0 skipped — the fouroutside_factstest files (132) plus every existing test that imports a file this PR touches (test_failure_signature, bothtest_launch_log_evidence,test_visible_devices,test_env_safety,test_gpu_power_settings,test_apply_gpu_power_settings,test_workload_envs,test_framework_whole_machine_gpu,test_isolated_vllm_pythonpath,test_ray_backend_unit,test_common_provenance,test_tool_version_provenance,test_magpie_agentx_contract,test_host_info,test_llm_attribution), the architecture guard and the packaging lint. Also run:ruff check .,ruff format --checkon the 17 changed Python files (ruff 0.16.2),scripts/check_broad_suppress.py src scripts(rc=0),lint-imports --no-cache(11 kept, 0 broken), andscripts/code_metrics.py --base-ref origin/main(the directory finding above is the only one; duplication not measured locally).outside_factsmodules, 2,025, plus 70 changed lines in six readers), the 1,252-line YAML pack and 1,410 test lines, over the 1000-line budget; it grew from ~520 because the pack's loader onmultibranch-devnow validates component layouts and image checks, and those modules are part of loading the pack. No function crosses a limit.mainis the swap only).HYPERLOOM_RULE_PACK(a path; without it the reference pack that ships with the package is read), and a pack that cannot be used stops the first import ofhyperloom.common.outside_facts, naming the file and the entry, instead of being ignored.python -m hyperloom.common.outside_facts.image_checkis new and runnable on its own; nothing onmainruns it. The six readers now needPyYAMLto import, through that package.🤖 Generated with Claude Code
Label applied (2026-10-31, workstream owner's decision):
size-exceptionfor the diff budget: the pack loader and its four same-layer modules cannot be split from the pack they load.