Skip to content

knowledge: replay a retained Find ranking from its frozen rule - #771

Draft
fake0fan wants to merge 3 commits into
InferMatrixLab:mainfrom
fake0fan:p0-s4-candidate-replay
Draft

fake0fan wants to merge 3 commits into
InferMatrixLab:mainfrom
fake0fan:p0-s4-candidate-replay

Conversation

@fake0fan

Copy link
Copy Markdown
Contributor

Governing Issue and delivery slice

Refs #764

Anchors touched: none

Knowledge authorship declaration

{
  "schema_version": 1,
  "head_sha": "47156ea37b16b96e8904c099dd46b6f051100eb8",
  "human_only": false,
  "material_ai_authors": [
    {"tool": "Antigravity", "model_id": "claude-opus-5-5", "effort": "high", "role": "author"}
  ]
}

No protected path is changed; the policy status is expected to be Not applicable.

Changed artifacts and evidence

Requirement Actual change Check / evidence and result Remaining gap
Replay reproduces a candidate and default knowledge/ranking_replay.py tests/apps/test_indexer_deliveries.py: three limit/budget cases, ranks, delivered and omitted refs reproduced; candidate vs default difference reported none
Archival verification and exact replay separate same after an undelivered corpus change the old capture still verifies, the top delivered item is unchanged, and replay reports corpus_changed none
Missing binding / changed rule refused same missing corpus_sha256, context_bytes, scoring_version raise; changed weights fail the digest; bumped scoring version reports scoring_changed none
Documentation knowledge/README.md, harness/README.md — none

Checks and dependencies

  • Checks actually run (result and tested scope): ruff check src tests tools passed; tests/apps/test_indexer_deliveries.py and tests/repository passed; full pytest run, see next item.
  • Failed, skipped, timed-out or not-run checks: local host has Git 2.34 while the repository requires Git ≥ 2.45. Service-reuse tests ran with a local test-only wrapper that emulates git ls-tree --format; nothing in the repository was changed for it. The full suite still fails 387 tests on this host; 386 fail identically on the documentation-only S1 head (a main baseline here), with --no-lazy-fetch/Git ≥ 2.45 errors and one SSH-dependent plugin test. The remaining one, tests/benchmark/test_moe_benchmark.py::test_deadline_cleans_detached_workers_but_preserves_unrelated_process, failed once under full-suite load and passed 6/6 in isolation on this and the stacked heads. CI with a supported Git is the authoritative run.
  • Dependencies / shared interfaces: uses S2's RankingPolicy.from_configuration; replay is only as faithful as the supplied corpus, which the caller must pin.

Remaining work and Issue closure

…eight spaces

Add RankingPolicy.from_configuration to rebuild a policy from a frozen configuration or receipt, verifying fields, scoring version, canonical weights and digest. Add RankingSpace for experiment-declared editable weights with inclusive bounds and steps; undeclared fields stay at their defaults. Session behavior and named-policy receipts are unchanged.

Agent-assisted-by: Antigravity / claude-opus-5-5 [effort=high] (author)
Signed-off-by: Chenguang Zheng <zhengcg0505@gmail.com>
Managed sessions accept a candidate ranking configuration through --ranking-policy-file, mutually exclusive with --ranking-policy. The plan freezes its full configuration (with config_sha256 for ordinary plans) and records ranking_policy_source: configuration; the service manifest carries the same source. Resume, Find and Read rebuild the rule from the frozen configuration through the injected resolver instead of the registry, so search and read receipts carry the candidate. Candidate IDs cannot reuse registered names, and named-policy plans keep their registry check.

Agent-assisted-by: Antigravity / claude-opus-5-5 [effort=high] (author)
Signed-off-by: Chenguang Zheng <zhengcg0505@gmail.com>
Add ranking_replay: replay_binding records the query, limit, filters, byte budget, frozen rule, scoring version and corpus digest of one Find and delivery; verify_replay reproduces the returned, delivered and omitted order and reports reproduced only for the identical corpus and scoring version. Archival capture verification stays a separate check. Regression tests replay default and unregistered candidate captures over the frozen ranking corpus, report their delivery difference, show a changed corpus is not reported as reproduced while the old capture still verifies, and reject missing bindings and a changed rule.

Agent-assisted-by: Antigravity / claude-opus-5-5 [effort=high] (author)
Signed-off-by: Chenguang Zheng <zhengcg0505@gmail.com>
@Dong1017 Dong1017 added the area:knowledge Knowledge line: packs, skill library, knowledge admission label Nov 27, 2026

Copy link
Copy Markdown
Collaborator

inferRSI, acting for @amy-why-3459.

PR review verdict — DO NOT PASS

First independent review of #771 (S4 of #764; draft, stacked on #769 and #770).
Reviewed base 7626c58f8158986770f0515888572ebb550d1751 and head 47156ea37b16b96e8904c099dd46b6f051100eb8.
Unique S4 commit: 47156ea37b16b96e8904c099dd46b6f051100eb8 on parent 08c4aba91170702523314f1c2024cc5f6f954a72.

I am not approving this head. The PR still carries the unresolved S2 step-membership bug (b15402e0d2939180410af9fe0a68b458708c4e20; off-grid weights can pass RankingSpace.check, see #769) and does not merge onto current main (mergeable_state: dirty, same session/CLI conflicts with #758/#706 as #770). Approving this stack would land those problems.

Independent review of the unique S4 commit on this head (not an approval):

  • knowledge/ranking_replay.py keeps archival verification and exact replay as separate checks, as requested in 7212490379 and recorded in 7212939652. replay_binding records query, limit, backend, byte budget, the frozen rule as a receipt, scoring version and a corpus digest over every eligible document's scoring inputs. verify_replay reports reproduced only when the scoring version, corpus digest, ranks, delivered refs and omitted refs all match; otherwise scoring_changed or corpus_changed (or differs). A missing corpus_sha256, context_bytes or scoring_version raises, and a changed weight fails the configuration digest. This slice does not automatically bind replay inputs into managed-session receipts, as the PR states.
  • Locally, tests/apps/test_indexer_deliveries.py, tests/knowledge/test_ranking_policy.py, tests/apps/test_session_candidate_ranking.py and tests/apps/test_session_ranking_policy.py passed (81 tests) on this head. The new delivery tests replay a candidate and default over the frozen ranking corpus, report their delivery difference, keep the old capture verifiable after an undelivered corpus change while replay reports corpus_changed with the top delivered item unchanged, and reject a missing binding or a changed rule.
  • The S4 commit has Agent-assisted-by: Antigravity / claude-opus-5-5 [effort=high] (author) and a DCO sign-off.
  • Accuracy and performance comparison evidence: not applicable (replay of ranking order over a pinned corpus; the PR makes no retrieval-quality or speed claim).
  • Architecture / necessity: replay lives in Knowledge, which owns ranking. I did not find a redundant code or test change in the unique commit.

Please wait for a fixed S2 and a rebased S3 on current main, rebase this draft, and request re-review of the new head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:knowledge Knowledge line: packs, skill library, knowledge admission

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants