HomeTrang chủ hs:tesths:test
Tell the truth about the runNói thật về lần chạy

hs:test

100% pass

Runs tests for what just changed, then reports honestly. A failing test is information, not an enemy — never deleted, skipped, or weakened to fake green. The final verdict and a checks[] array land in verification.json, the exact evidence the hard gate reads.Chạy test cho phạm vi vừa đổi, rồi báo cáo thật. Test fail là thông tin, không phải kẻ thù — không bao giờ xóa/skip/weaken để xanh giả. Verdict cuối + mảng checks[] vào verification.json, đúng bằng chứng hard gate đọc.

When to useKhi nào dùng

✓ Reach for it when✓ Dùng khi

  • a phase just changed code and needs a verdictmột phase vừa đổi code và cần verdict
  • before a hard stage — run the integration profiletrước stage cứng — chạy profile integration
  • you need a tight, honest QA reportbạn cần một QA report gọn, thật

✗ Won't do✗ Sẽ không làm

  • delete / skip / weaken a test for fake greenxóa / skip / weaken test để xanh giả
  • write PASS while the suite is failingghi PASS khi suite đang fail
  • run blind — preflight stops on missing depschạy mò — preflight dừng khi thiếu dep

How to run itCách chạy

Invoke /hs:test after a phase changes code. The standard command is python3 -m pytest harness/tests/ -q (target repos run their own suite per standards).Gọi /hs:test sau khi một phase đổi code. Lệnh chuẩn là python3 -m pytest harness/tests/ -q (repo đích chạy suite riêng theo standards).

Pre-flightPre-flight

preflight_deps.py checks pytest/PyYAML/defusedxml — missing → stop with the install command. Then a quick import-check of the changed module.preflight_deps.py kiểm pytest/PyYAML/defusedxml — thiếu → dừng với lệnh cài. Rồi import-check nhanh module vừa đổi.

Pick a profileChọn profile

unit (changed module → full unit suite) for every TDD cycle; integration (adds the e2e vertical slice) before a hard stage.unit (module vừa đổi → toàn suite unit) cho mỗi vòng TDD; integration (thêm e2e vertical slice) trước stage cứng.

Run, then read honestlyChạy, rồi đọc thật

100% pass is the gate. Fix the code, or fix a genuinely-wrong test with a stated reason — never delete, skip, or weaken a test to fake green.100% pass là gate. Sửa code, hoặc sửa một test SAI thật kèm lý do — không bao giờ xóa, skip hay weaken test để xanh giả.

QA reportQA report

Under 200 lines: every failing test by name + a one-line reason, notable coverage changes (line ≥80%, branch ≥70%), and one final verdict.Dưới 200 dòng: mọi test fail kèm tên + một dòng lý do, thay đổi coverage đáng kể (line ≥80%, branch ≥70%), và một verdict cuối.

Write the verdictGhi verdict

The verdict + checks[] array go into verification.json (schema artifact-verification.json) — the exact evidence the hard gate reads.verdict + mảng checks[] vào verification.json (schema artifact-verification.json) — đúng bằng chứng hard gate đọc.

A real run, and the verdictLần chạy thật, và verdict

Worked exampleVí dụ thật

The whole suite, greenCả suite, xanh

The real run over harness/tests/ — unit tests plus bug-class invariants, all passing. 100% pass is the gate; anything less blocks a hard stage. real output Lần chạy thật trên harness/tests/ — test unit cộng invariant bug-class, tất cả pass. 100% pass là gate; thiếu một cái là chặn stage cứng. đầu ra thật

python3 -m pytest harness/tests/ -q
........................................................................ [  8%]
........................................................................ [ 17%]
........................................................................ [ 26%]
........................................................................ [ 35%]
........................................................................ [ 44%]
........................................................................ [ 52%]
........................................................................ [ 61%]
........................................................................ [ 70%]
........................................................................ [ 79%]
........................................................................ [ 88%]
........................................................................ [ 97%]
........................                                                 [100%]
816 passed in 17.28s

The verdict the gate readsVerdict mà gate đọc

The QA result is serialized as verification.json — stage, actor, a checks[] array, and one final verdict. The gate reads exactly this off disk. captured artifact Kết quả QA serialize thành verification.json — stage, actor, mảng checks[], và một verdict cuối. Gate đọc đúng cái này từ đĩa. artifact đã ghi

cat plans/<plan>/artifacts/verification.json
{
    "stage": "push",
    "plan": "260612-1237-harness-w2-horizontal-1",
    "actor": "user:dev@team.example",
    "ts": "2026-06-12T05:48:36.669571+00:00",
    "checks": [
        {
            "name": "preflight_deps",
            "status": "PASS",
            "detail": "pytest, pyyaml"
        },
        {
            "name": "pytest harness/tests",
            "status": "PASS",
            "detail": "258 passed (incl. 5 invariants)"
        },
        {
            "name": "schema load yaml+json",
            "status": "PASS",
            "detail": "yaml ok, schemas ok"
        },
        {
            "name": "verify_install --strict",
            "status": "PASS",
            "detail": "manifest 53 files"
        },
        {
            "name": "e2e vertical slice",
            "status": "PASS",
            "detail": "12 passed, 0 failed, transport=simulated-stdin"
        }
    ],
    "verdict": "PASS"
}

A captured snapshot (actor scrubbed, counts from when it was written). Any check with status FAIL blocks the hard stage. Schema: harness/schemas/artifact-verification.json.Một bản chụp đã ghi (actor đã làm sạch, số liệu từ lúc nó được ghi). Bất kỳ check nào status FAIL đều chặn stage cứng. Schema: harness/schemas/artifact-verification.json.

Two profilesHai profile

ProfileProfileScopePhạm viWhenKhi nào
unit (default)changed module → whole unit suitemodule vừa đổi → toàn suite unitevery TDD loopmỗi vòng TDD
integrationadds the e2e vertical slicethêm e2e vertical slicebefore a hard stagetrước stage cứng

Three verdicts, no fourth way outBa verdict, không có lối thứ tư

The QA report (<200 lines) lists every failing test by name with a one-line reason, any meaningful coverage change, and ends with one verdict:QA report (<200 dòng) liệt kê mọi test fail kèm tên + một dòng lý do, mọi thay đổi coverage đáng kể, và kết bằng một verdict:

PASS PASS_WITH_RISK BLOCKED

PASS ships. PASS_WITH_RISK ships but names the risk out loud. BLOCKED doesn't ship — fix the code, or fix a genuinely-wrong test with a stated reason. Removing a test to go green is never an option.PASS thì ship. PASS_WITH_RISK ship nhưng nêu rõ risk. BLOCKED không ship — sửa code, hoặc sửa một test SAI thật sự kèm lý do. Xóa test để xanh không bao giờ là lựa chọn.

HARD-GATE — wiring is real.wiring là thật. gate_stage.py reads verification.json: any check at FAIL blocks the hard stage. A dishonest PASS surfaces the moment the suite re-runs in CI; the trace records the attribution either way. gate_stage.py đọc verification.json: bất kỳ check nào FAIL đều chặn stage cứng. Một PASS gian lộ ngay khi suite chạy lại ở CI; trace ghi attribution dù thế nào.

FAQHỏi đáp

Can I skip a flaky test to go green?Skip test hay nhiễu để xanh được không?
No. Deleting, skipping, or weakening a test to fake green is forbidden. Fix the code, or fix a genuinely-wrong test with a stated reason. A failure is information, not an enemy.Không. Xóa, skip, hay weaken test để xanh giả là cấm. Sửa code, hoặc sửa một test SAI thật kèm lý do. Fail là thông tin, không phải kẻ thù.
Unit or integration profile?Profile unit hay integration?
unit (default) runs the changed module plus the full unit suite on every TDD cycle. integration adds the e2e vertical slice — run it before a hard stage (push/pr/ship).unit (mặc định) chạy module vừa đổi cộng toàn suite unit mỗi vòng TDD. integration thêm e2e vertical slice — chạy trước stage cứng (push/pr/ship).
What do the three verdicts mean?Ba verdict nghĩa là gì?
PASS ships. PASS_WITH_RISK ships but names the risk out loud. BLOCKED does not ship until the code (or a genuinely-wrong test) is fixed.PASS thì ship. PASS_WITH_RISK ship nhưng nêu rõ risk. BLOCKED không ship đến khi sửa code (hoặc một test SAI thật).
Does hs:test fix the failing code?hs:test có sửa code fail không?
No — it only runs and reports. Fixing is hs:cook / hs:fix; post-test review is hs:code-review; deep root-cause tracing is hs:debug.Không — nó chỉ chạy và báo cáo. Sửa là hs:cook / hs:fix; review sau test là hs:code-review; truy nguyên nhân gốc là hs:debug.
What if someone writes PASS while the suite is failing?Nếu ai đó ghi PASS khi suite đang fail?
It surfaces the moment the suite re-runs in CI, and the trace ledger records who wrote what. The gate is honest about being a presence gate — actor is attribution, not proof of identity.Nó lộ ngay khi suite chạy lại ở CI, và sổ trace ghi ai ghi gì. Gate trung thực rằng nó là presence gate — actor là attribution, không phải bằng chứng danh tính.