2 Commits

Author SHA1 Message Date
Vijay Janapa Reddi
a74c98576e Merge origin/dev into yaml-audit
Sync the yaml-audit branch with the latest dev work since the previous
sync (5c5af75ed). Brings in 73 commits including:

  - CI security fixes: postcss XSS bump, uuid bounds bump, codeql
    paths-ignore for vendored bundles, read-only token on
    staffml-validate-vault workflow
  - kits/ dark mode polish: code-block readability, dropdown contrast
  - vault-cli/: pre-commit ruff hook + 20 ruff fixes, all-contributors
    auto-credit workflow change to pull_request_target
  - dev's earlier merge of yaml-audit (836d481b5) carrying the
    pre-trailer-strip Phase 1/2/3 history; this merge harmonises that
    with the current trailer-clean yaml-audit tip
  - misc bug fixes (tinytorch perceptron seed, infra workflows,
    socratiq vite dev injector)

Conflicts resolved (if any) preserve the yaml-audit-side authoritative
state for vault/* files (we own those) and the dev-side authoritative
state for .github/workflows/* and other shared infrastructure.

# Conflicts:
#	.github/workflows/all-contributors-auto-credit.yml
#	.github/workflows/staffml-preview-dev.yml
#	interviews/staffml/src/data/corpus-summary.json
#	interviews/staffml/src/data/vault-manifest.json
#	interviews/staffml/tests/chain-and-vault-smoke.mjs
#	interviews/vault-cli/README.md
#	interviews/vault-cli/docs/CHAIN_ROADMAP.md
#	interviews/vault-cli/scripts/build_chains_with_gemini.py
#	interviews/vault-cli/scripts/generate_question_for_gap.py
#	interviews/vault-cli/scripts/merge_chain_passes.py
#	interviews/vault-cli/scripts/validate_drafts.py
#	interviews/vault-cli/src/vault_cli/legacy_export.py
#	interviews/vault-cli/tests/test_chain_validation.py
#	interviews/vault/.gitignore
#	interviews/vault/ARCHITECTURE.md
#	interviews/vault/chains.json
#	interviews/vault/id-registry.yaml
#	interviews/vault/questions/edge/optimization/edge-2536.yaml
#	interviews/vault/questions/mobile/deployment/mobile-2147.yaml
#	tinytorch/src/03_layers/03_layers.py
2026-05-02 11:06:43 -04:00
Vijay Janapa Reddi
c92effc269 feat(vault-cli): Phase 4.7 — chain decay detection (advisory)
Detects chain members that have drifted semantically away from their
chain mates after an edit. Re-embeds changed YAMLs with the same model
the corpus uses (BAAI/bge-small-en-v1.5) and reports the min cosine to
each chain mate.

Default invocation (advisory):

    python3 scripts/check_chain_decay.py
    # diffs against origin/dev, flags chains with min mate-cosine < 0.40

Other modes:

    --files <a.yaml> <b.yaml>     explicit files instead of git diff
    --base HEAD~5                 different base ref
    --threshold 0.50              tighter cutoff (slow drift detection)
    --strict                      exit non-zero on flag (use as CI gate)

Default is advisory not blocking — first ship intentionally doesn't
fail commits or CI. The threshold 0.40 is calibrated against the
post-Phase-1 corpus; tune as needed once you've seen what real-edit
deltas look like in practice.

Implementation notes:
  - Reuses embeddings.npz for chain-mate vectors (no re-embedding the
    whole corpus per run).
  - Only the changed question gets re-embedded — fast for typical
    PR-sized changes.
  - Skips changed questions that aren't in chains; skips chain
    memberships where the mate isn't in embeddings.npz (e.g., the
    Phase 3 promoted drafts before they hit the next embedding rebuild).

Smoke checks:
  - --base origin/dev finds 4 changed YAMLs (the Phase 3 promoted
    drafts), correctly reports no chain memberships (those questions
    aren't in chains.json yet — by design, gated on human review).
  - --files <cloud-2520.yaml> on a real chain member: cos=0.79 vs
    its L5 mate cloud-2521 (well above 0.40 threshold ✓).
2026-05-01 17:31:30 -04:00