Skip to content

Latest commit

 

History

History
348 lines (294 loc) · 20.4 KB

contributing.md

File metadata and controls

348 lines (294 loc) · 20.4 KB

Contributing

InferRSI connects optimization conditions, measurements and verdicts. Start with quickstart, the module boundaries, and the Qwen B300 or Qwen Ascend case that matches your hardware.

Development

Use a task branch and keep each change reviewable. Sign commits with DCO:

python -m pip install -e '.[dev,image]'
ruff check src tests tools
pytest
git commit -s

Issue-led ownership, review and completion conventions for humans and agents are in agent collaboration.

Apply privacy and security rules before capturing logs, recording evidence or sharing changes. Use placeholders for private connection details, inject credentials securely at runtime and review artifacts for leaks.

image is optional for the control CLI and required to run PNG quality tests. Synthetic benchmark scripts belong in tests/fixtures/; historical validator snapshots in tests/fixtures/legacy/ remain byte-for-byte frozen. Current runnable examples are the three Qwen scripts under examples/.

Git treats recorded bundles under evidence/ and tests/fixtures/legacy/ as exact bytes (-text), so checkout and add do not normalize their line endings. The evidence README and reusable _template/ remain ordinary LF text. This policy does not renormalize existing blobs or authorize edits to frozen files. Nightly checks cover Linux and Windows checkouts with core.autocrlf set to false, true and input.

Use harness/serving for a new model's server and request protocol and benchmark/metrics.py with benchmark/validators for its metric and quality checks. harness/trials/external.py runs any external command as one trial and is the same for every model. Use apps/host/targets with harness/data/repo_packs for repositories, and apps/host/platforms for hardware. A backend is registered in apps/host/platforms/__init__.py; its probe command is defined in the implementing module under apps/host/platforms/. That module owns the command name and the discovery boundary. Reuse the common AB/BA loop, cleanup and adjudication. See extension contracts.

For a finding, edit one record. For a procedure, edit its registered owner. Commit changed skill sources, then regenerate the two build inputs with python tools/build_skill_index.py --source-revision <source-commit>. Verify with the same command plus --check. The catalog constructs schema-1 views when requested. See the knowledge contribution workflow.

Regenerate the checkout SearchSpace coordinate index after changing the SearchSpace Matrix, Skill registry or Skill metadata source files with python tools/build_skill_coverage.py --searchspace-index. Add --check to verify without writing. The index records resource and lifecycle stage pairs from the numbered matrix's Candidate Skills column. Supplementary, unknown, explicitly excluded and conflicting Skills have no matchable pairs. The Python reader load_searchspace_index(checkout) verifies both the source digests and the generated entries against the same canonical projection. It qualifies entries by Skill root, id and path. Coordinate verification reads checkout Skill metadata with PyYAML, which is included in the core install.

To filter Find by a matrix coordinate, supply the checkout's Skill root explicitly:

inferrsi find "graph mode" --skill-root src/inferrsi/knowledge/data/skill_library --searchspace-coordinate SSD Diagnose

Find ranks the chosen corpus and applies the coordinate before the result limit. The filter ranks the Skill inputs verified with the index and checks for source changes before returning matches. In Python, pass coordinate.index to load_corpus(searchspace_index=...) and the coordinate to find. External channels receive the original query. JSON reports the selected pair and matrix, registry and Skill source fingerprints. A wheel install can use the filter with an explicit matching source checkout because the wheel does not include the matrix or its generated index.

Protected changes also require a current-head knowledge authorship declaration. Every material AI author must use an approved model at xhigh or max; human-only work is declared explicitly. Mechanical/generated changes have no automatic exemption. The check is a required status on main, so a failing declaration blocks merging; the protect-main ruleset is the source of truth for that enforcement. A passing check establishes declaration compliance only, not execution settings or results.

The skill library owns complete procedures, metadata, references and cases. The seven primary inference skills live in tasks/. The main agent loads one before searching for evidence. The historical router supports explicit reads. Categorize supporting knowledge by its primary purpose as system-specific implementation, engineering playbook, cross-stage workflow or casebook. Follow the library navigation for its subcategory. Maintain the registered stable IDs and their categorized paths in skill-index.json, then refresh the compiled build inputs with tools/build_skill_index.py. Keep all skill content in the canonical library. Preserve source state and UNKNOWN license declarations; moving content does not resolve licensing.

Keep all library content in English. Engine procedures belong under systems/engines/<engine>/ and the collection router under workflows/research/inference-engine-research/, with their sub-skills and references. Keep a skill's supporting Markdown and JSON in its owner directory. At the library root, README.md describes the library and skill-index.json maps stable skill IDs to their owners. Place independent findings in records/ and shared search configuration in config/. The index builder writes the two generated catalog inputs to _compiled/. See the directory contract. Catalog abstracts link to packaged bodies via skill_documents.original for migrated skills or skill_documents.en for engine procedures. Update affected source content and catalog records together. Source snapshot revisions identify research evidence, not campaign defaults. Check linked resources, licenses, local links and reads from a noneditable wheel installation.

Documentation during a refactor

When a command, module or workflow changes owners, search the old name and path across the checkout. Include module READMEs, CLI help, plugin builders, workflow files, tests and generated indexes. Use each match in context. For example, SkillEval names GitHub workflows, while local skill evaluation runs through python -m tools.skill_eval_compare. Verify the actual entry point before renaming it in a guide.

Update the owning module README or task guide in the same PR as the code. Keep cross-module decisions in the architecture or the relevant contract. Keep a proposed design in its issue until adopted, then link the decision to the implementation and its tests. When a design is superseded, move its surviving guidance to the current owner and remove the obsolete page if no reader needs its path.

Keep recorded results, artifact hashes and names at their original revision. Cite that commit or release alongside the successor. Check links in published packages and frozen receipts. If they still use the old path, keep a short page there linking to both revisions. In the PR, record the old and new entry points, regenerate affected indexes, check incoming links and anchors, and try the documented entry point. Record any hardware, external service or historical run that was not verified.

Acceptance checklist

Use user-provided acceptance criteria, including those in a referenced accepted plan. When none are supplied, use performance-ceiling-analysis to formulate evidence-backed targets. Retain partial requirements and label derived fields; record their source, calibration, uncertainty and freeze authority. Missing evidence stays unresolved, and estimates never lower an existing gate. Freeze resolved criteria before candidate search.

For software packaging and automatic daily Releases, follow the release guide. Release preparation is separate from campaign acceptance and the four CI lanes.

Open an issue using the acceptance form before claiming a result. Record:

  1. Campaign name, owner, goal/non-goals and stop condition.
  2. Pinned baseline/candidate revisions and the immutable RunSpec: repository, revision, backend, devices, model, scenario, execution environment and budget.
  3. Workload, required validation levels, numeric gates and validator/input hashes frozen before candidate search.
  4. One hypothesis and one declared Harness/Model/Infra plane per iteration.
  5. Preparation, startup/readiness, warmups and measured work separately; identical controls and no unreported resource contention.
  6. All attempted configurations, rejected changes, raw samples, quality outputs, source checks and process cleanup records. Keep slow and failed trials.
  7. Evidence paths, verdict rationale and the exact downstream citation.

Keep campaign revisions and thresholds in the acceptance issue and frozen campaign evidence, not workflow defaults, generic skills or reusable recipes. Prioritize acceptance campaigns, blocking infrastructure, merge-ready work, then research spikes.

Evidence and claims

evidence/<campaign-id>/
  plan/        Hypothesis, RunSpec, frozen gates and environment
  results/     Metric summaries, complete trial index, archive references and rationale
  patch/       Candidate diff or exact revision pointer
  validator/   Frozen validation code, versions and inputs

Follow the archiving contract and bundle template. Keep large raw measurements, logs, profiler data and generated inventories in versioned external archives. The campaign's results/artifacts.json owns metadata; index every attempt and retain executable replay and comparison criteria. Existing frozen evidence is not rewritten to match the template.

Verdict Meaning
PASS Pinned comparison, complete evidence and every required gate met
FAIL Complete enough evidence shows a gate was not met
INCONCLUSIVE Missing freeze, incomplete runs or unqualified/mismatched environment

A public performance claim needs campaign-defined E2E evidence. Microbenchmarks, operator parity and green CI do not establish service latency or image quality. Use “on candidate versus baseline, under this RunSpec, we observed …” and link the acceptance issue, exact revisions and artifacts. Preserve the distinction between code-only comparisons and recipes that also change configuration.

Downstream PRs cite the same gates and evidence. Mark missing or stale results unverified; never invent a new threshold. Label each repository/revision/backend/ device/model/scenario combination independently as validated, unsupported or unverified. Imported reports do not become locally validated through CPU tests. External demos or production-readiness claims require a completed acceptance PASS and published evidence for the scope being claimed.

Execution status and campaign verdict answer different questions. A crashed or interrupted measurement/validator leaves its execution status and error reason, but incomplete comparison evidence is INCONCLUSIVE, including when the available samples show a regression. A completed quality command rejecting its gate, or a complete comparison missing the frozen gain threshold, remains FAIL.

Model integrity requires reading actual file bytes and comparing their SHA-256 with the frozen manifest. Equal size/mtime is only a metadata check. Validate positive measured-image group coverage before accepting first-request quality; a retained warmup image cannot substitute for the measured workload.

Validation levels

Run python tools/validate_evidence.py for a read-only check of every committed evidence bundle. The inventory declares campaign, template, source-import, review-summary and external-archive layouts; new directories and recognizable manifests require an explicit classification. The nightly lane runs this CPU-only check. It verifies available bytes using existing bundle SHA-256 maps, historical file mappings or archive SHA-256/size records. Historical mappings point only to preserved snapshots, never current implementations. Do not invent hashes or update frozen manifests to silence a failure.

The JSON result separates structural/hash errors (nonzero exit) from unavailable external dependencies. Remote archives are not downloaded; if supplied at their declared inventory paths, their recorded size and digest are checked. A missing locally required hashed file is an error. Raw outputs and original source files not committed here remain explicitly unavailable. Successful inventory checks do not verify those external bytes, replay validators, qualify hardware, or change any campaign verdict. This inventory is editable validation policy; the evidence it describes remains frozen.

Level Evidence Scope
L0 Operator correctness Numerical contracts, edge cases and fallbacks
L1 Microbenchmark Fixed inputs, shapes, warmups and timing
L2 Isolated scenario Stage behavior and integration
L3 Model/modality quality Complete outputs under the frozen quality protocol
L4 End-to-end service Complete workload, latency/throughput/SLO and stability

The issue specifies the required levels. Missing required evidence means INCONCLUSIVE. Numeric bars belong to the campaign, not this ladder. Ordinary repository tests check framework behavior; GPU/NPU acceptance runs remain explicit, separately budgeted experiments.

Shared-component review

  • Keep framework dispatch generic. Model/backend policy belongs to its adapter; reuse existing configuration rather than duplicating selection knobs.
  • Enumerate all direct and transitive consumers, including other models. Map dtype/layout, fast/fallback, hooks, gradients and encoder/decoder contracts to tests. One successful Qwen image run does not validate every shared consumer.
  • Prefer ordinary imports at module scope. Keep imports lazy where a module's transitive optional backend dependencies would otherwise break unsupported platforms; document and test that exception.
  • Reuse the owning shared helper for identical kernel eligibility predicates. Colocate a small ownership-only type with its consumer rather than creating a module for possible future members.
  • Preserve eager rounding and reduction order in exact kernels. Operator checks must be followed by full-model output comparison before promotion. Explain BF16-to-FP32 round trips when they preserve materialized eager intermediates; removing those casts can change output despite equivalent real arithmetic.
  • Record baseline failures and untested hardware honestly. Do not mark a failing suite green because the same failure also occurs on the baseline.
  • Freeze new references when helpers change; replay historical evidence with its original bundle. Never rewrite old manifests to fit a new validator.

The B300 guide links the review history and source-pinned evidence behind these rules.

CI and repository reuse

Keep the existing four lanes:

Lane Purpose
Draft Lint and lightweight CPU smoke
Ready Full repository checks for PRs
Merge Manifest check and lightweight CPU smoke on main
Nightly Scheduled lint/tests, evidence layout and label drift

Ready CI builds the source distribution and wheel, installs the core wheel without extras in a fresh virtual environment, and runs tests/repository/check_installed.py outside the checkout with PYTHONPATH unset and Python isolated mode enabled. This checks packaged knowledge, skill bodies, licenses, helpers and CLI reads without installing any inference engine. The ready test and installed-package jobs cover the declared minimum Python 3.10 alongside Python 3.11. This matrix does not certify later Python releases or accelerator runtime compatibility.

The ready host-compatibility jobs on Windows and macOS are advisory and non-blocking. They continue to run the selected host tests and installed-wheel checks and retain available logs and artifacts, with job-level continue-on-error: true. Failure, cancellation, queued or not-run status does not block PR approval or merging; a successful rerun or equivalent host-validation artifact is not an approval prerequisite. Keep these jobs out of branch-protection and ruleset required checks, and do not make gating jobs depend on them. Reviewers and integrators assess required checks individually rather than treating the aggregate Ready workflow status as a merge gate. Preserve actual test outcomes: an advisory failure or missing run does not establish host compatibility.

For non-draft PRs, the ready dashboard-browser job installs Playwright and Chromium on Python 3.11 and runs the dashboard navigation and experiment browser tests. Its verbose log identifies each executed case, and the dashboard-browser-results artifact retains the JUnit report for 30 days. These checks cover offline/live layouts, keyboard navigation and refresh/recovery; they do not certify other browsers or replace independent review. The pr-references job fails when the PR body uses GitHub closing syntax, including a standalone closing line or a negated sentence. Use Refs #N and follow the closure rules for the separate Issue closure. This advisory job reads the body at the triggering event. The integrator rechecks the live body and GitHub closing links at merge. The nightly safety-net job compares the repository labels with labels.json and fails on drift (labels). It reads labels with issues: read and never changes them.

The merge lane runs the same small smoke selection as draft on every main push, including direct pushes. It is a post-push safety check, not a branch-protection rule or a substitute for the full ready checks before merging. Required checks and permission to push directly remain repository-owner settings.

Do not add default model downloads, GPU jobs or campaign thresholds to these lanes. Dependency drift and hardware qualification require their own evidence.

When copying the repository, rename src/inferrsi, update package metadata, imports and tests, and keep the three module boundaries explicit. Copy the evidence template for each campaign. Reuse portable workflows as workflow guidance; keep campaign pins out of them.

For a standalone engine delivery, start with the engine delivery template in docs/template/ instead of copying the entire InferRSI runtime. It covers language-specific adaptation, approved local brand assets, the four evidence segments and schema-v1 source recipes for InferMatrixLab/recipe. The engine owns implementation and recipes; catalog maintainers own collection, schema and website; the acceptance owner owns performance verdicts. Follow the template's copy, validation and catalog-registration steps. Missing hardware verification remains explicit. Workbench experiments use the quickstart and evidence template; the four CI lanes retain their current roles.

For feedback-coupled models, stochastic audio and streaming/graph experiments, use the Omni experiment contract to select reference, preflight and executable per-trial qualification checks.