Skip to content

feat(analysis): bind posterior topic-context producer to an analysis-run profile - #432

Draft
seonghobae wants to merge 2 commits into
mainfrom
feat/topic-context-posterior-analysis-run-gap-004
Draft

feat(analysis): bind posterior topic-context producer to an analysis-run profile#432
seonghobae wants to merge 2 commits into
mainfrom
feat/topic-context-posterior-analysis-run-gap-004

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

GAP-004 leftover / ADR 0068. Bind existing analysis_engine::TopicContextPosteriorArtifact to a cutoff-safe topic_context_posterior_v1 analysis-run profile (tepp.topic_context_posterior.v1).

  • Validates the producer contract already on protected main. Does not reimplement TRSL-TM fitting.
  • Terminal digest uses inference status posterior_topic_coordinates_not_importance.
  • Missing draws are not collapsed. Lineage events remain producer-supplied; this slice does not invent birth/split/merge.
  • Snapshot, cutoff, accepted run identity, and profile mismatch fail closed, including reuse of lineage_criterion_v1, case_deletion_refit_v1, composed_fitted_lineage_v1, fitted_candidate_k_v1, trsl_topic_lineage_v1, and method_effects_v1.

Not project-history GET-by-id CLI (#431). Not location-membership refusals (#430 / ADR 0066). Not project-history GET-by-id (#429). Not collection CLI (#428). Not copied-text residue (#427 / ADR 0065). Not provenance-is-not-transition (#426 / ADR 0064). Not lineage-criterion (#423 / ADR 0063). Not a Bayesian sampler. Not GPU. Not implemented-main.

Distinct from live slices

Does not duplicate #431/#430/#429/#428/#427/#426/#425/#424/#423/#422/#421/#420/#419/#418/#417/#416/#415/#414/#413/#412/#411/#410/#409/#408/#407/#406/#405/#404/#398/#376/#374/#372/#389/#364/#356/#358/#359, Leiden (#351), or Driver p.16 std-family micro-PRs.

Verification

  • cargo test -p analysis_engine
  • cargo clippy -p analysis_engine --all-targets -- -D warnings
  • python3 scripts/validate_documentation.py

Merge gate

Two independent current-head APPROVEs required. Author/bot COMMENTED is not independent APPROVE. Exact-head Checks on this SHA only. Predecessor Checks do not transfer. Do not self-approve. Do not merge without two independent approvals.


Devin Review

Summary by CodeRabbit

  • 새 기능

    • 토픽-컨텍스트 사후 분석 실행 프로필을 추가했습니다.
    • 분석 결과를 권위 있는 스냅샷 및 아티팩트 다이제스트와 연결합니다.
    • 컷오프 이후 문서, 잘못된 계약, 누락·변조된 증거를 안전하게 거부합니다.
    • 결과에 검증된 토픽 좌표와 완료 상태를 제공합니다.
  • 문서화

    • 사용 범위, 검증 규칙 및 제한사항을 문서화했습니다.
    • 해당 결과가 토픽 중요도나 베이지안 샘플링을 의미하지 않음을 명확히 했습니다.
  • 테스트

    • 정상 실행과 다양한 유효하지 않은 입력에 대한 검증을 추가했습니다.

…run profile

GAP-004 leftover / ADR 0068. Bind existing TopicContextPosteriorArtifact
to cutoff-safe topic_context_posterior_v1. Posterior coordinates are not
importance; missing draws are not collapsed; lineage events stay producer-supplied.

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Author COMMENT on exact head 4ab92f3. This is not APPROVE. Independent = non-author, non-bot APPROVE. Two independent current-head APPROVEs required before merge. ADR 0068. Do not self-approve.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

This report is out of date. Scroll down for Devin Review's latest report on this PR.

Devin Review found 2 potential issues.

Devin Review

Comment on lines +669 to +675
pub fn execute_topic_context_posterior_run(
request: &AnalysisRunRequest,
accepted: &AnalysisRunAccepted,
snapshot_id: &str,
knowledge_cutoff: KnowledgeCutoff,
artifact: &TopicContextPosteriorArtifact,
completed_at: impl Into<String>,

@devin-ai-integration devin-ai-integration Bot Sep 1, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Late supporting evidence passes cutoff

When late membership, relation, or lineage evidence supports an eligible document, document_available_at checks only the document's availability. The historical run then accepts evidence unavailable at its cutoff.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread crates/analysis_engine/src/topic_context_posterior.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4ab92f3f2d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/analysis_engine/src/topic_context_posterior.rs Outdated
Comment thread crates/analysis_engine/src/topic_context_posterior.rs Outdated
Comment on lines +685 to +686
|| request.model_contract_version != TOPIC_CONTEXT_POSTERIOR_MODEL_CONTRACT_VERSION
|| request.output_profile != TOPIC_CONTEXT_POSTERIOR_OUTPUT_PROFILE

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Bind the producer model contract into the run

When an otherwise valid artifact declares any nonempty artifact.model_contract_version (for example a different or unapproved producer), this condition checks only the request's fixed profile value and still succeeds. The emitted terminal result then reports topic_context_posterior_v1 as its model contract while omitting the artifact's actual producer contract, making incompatible model output indistinguishable in run metadata; validate the artifact contract against an approved/request-bound producer version.

AGENTS.md reference: AGENTS.md:L26-L26

Useful? React with 👍 / 👎.

Comment thread crates/analysis_engine/src/topic_context_posterior.rs Outdated
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 274bd6fd-e6f6-4413-8b73-7a3d52e2477e

📥 Commits

Reviewing files that changed from the base of the PR and between 1bc02f5 and 3e09ff2.

📒 Files selected for processing (8)
  • CHANGELOG.md
  • crates/analysis_engine/src/lib.rs
  • crates/analysis_engine/src/topic_context_posterior.rs
  • crates/analysis_engine/tests/topic_context_posterior_execution_contract.rs
  • docs/TRACEABILITY.md
  • docs/adr/0068-topic-context-posterior-analysis-run.md
  • docs/adr/README.md
  • docs/doctoring/topic-context-posterior-analysis-run.md

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

topic_context_posterior_v1 실행 프로필이 추가되었습니다. 이 프로필은 기존 TopicContextPosteriorArtifact를 snapshot manifest와 digest로 검증하고, cutoff 이후 증거와 승인되지 않은 producer contract를 거부한 뒤 terminal result를 생성합니다.

Changes

Posterior topic-context 실행 프로필

Layer / File(s) Summary
Posterior 계약과 공개 API
crates/analysis_engine/src/topic_context_posterior.rs, crates/analysis_engine/src/lib.rs
계약 버전, 출력 프로필, inference 상태 상수와 TopicContextPosteriorSnapshotManifest, TopicContextPosteriorExecution 및 실행 함수가 추가되었습니다.
Digest-bound 실행 검증
crates/analysis_engine/src/topic_context_posterior.rs
실행 함수가 요청, receipt, snapshot, cutoff, source digest, artifact digest, 문서 availability와 producer contract를 검증합니다. 검증 성공 시 artifact와 terminal result를 반환합니다.
실행 계약 검증
crates/analysis_engine/tests/topic_context_posterior_execution_contract.rs
성공 결과와 digest-bound 좌표 수를 검증합니다. identity, snapshot, profile, cutoff, digest, availability, producer contract 및 malformed input 불일치를 fail-closed 방식으로 검증합니다.
결정과 추적성 문서
docs/adr/0068-topic-context-posterior-analysis-run.md, docs/adr/README.md, docs/TRACEABILITY.md, docs/doctoring/topic-context-posterior-analysis-run.md, CHANGELOG.md
프로필의 계약, 범위, 비추론 보장, 검증 계획, rollback 조건과 implemented-main 조건이 문서화되었습니다.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: 🔵 Low · up to 3e09f

This PR adds a public execution path that can produce a succeeded analysis result from caller-supplied run, manifest, and artifact data after consistency checks. If exposed beyond a trusted integration boundary, an unauthorized caller could provide internally consistent but non-authoritative inputs; the production adapter should enforce authorization and authoritative storage before relying on this path.

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant analysis_engine
  participant SnapshotManifest
  participant TopicContextPosteriorArtifact
  participant TerminalResult
  Operator->>analysis_engine: topic_context_posterior_v1 실행 요청
  analysis_engine->>SnapshotManifest: snapshot, cutoff, source digest, availability 검증
  analysis_engine->>TopicContextPosteriorArtifact: producer contract와 artifact digest 검증
  analysis_engine->>TerminalResult: 검증된 좌표 수와 digest-bound summary 생성
  analysis_engine-->>Operator: 성공 또는 fail-closed 오류 반환
Loading

Suggested reviewers: cursoragent

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 46.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 3 files. (5 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 기존 posterior topic-context producer를 analysis-run profile에 연결하는 주요 변경을 정확하고 간결하게 설명합니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 46.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 3 files. (5 skipped: 5 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/topic-context-posterior-analysis-run-gap-004

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Devin Review

Comment on lines +164 to +177
/// Authoritative snapshot and cutoff-eligibility manifest for one artifact.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct TopicContextPosteriorSnapshotManifest {
/// Immutable source snapshot identity.
pub snapshot_id: String,
/// Canonical digest of the resolved source snapshot bytes.
pub source_snapshot_sha256: String,
/// Historical cutoff applied while resolving eligibility.
pub knowledge_cutoff: String,
/// Canonical digest of the exact artifact admitted from this snapshot.
pub artifact_sha256: String,
/// Availability instant for every document represented by the artifact.
pub document_available_at: BTreeMap<String, String>,
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Manifest lacks a wire contract

TopicContextPosteriorSnapshotManifest has no versioned serialization, parser, or byte limit. Define its standalone exchange contract before another service supplies this authoritative input.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Operator-visible: head moved to 3e09ff2 (eligible-snapshot bind). Still zero independent current-head APPROVE. Author/bot COMMENTED is not APPROVE. Exact-head Checks on 3e09ff2 only. Predecessor 4ab92f3 evidence does not transfer. Do not self-approve.

Copy link
Copy Markdown
Contributor Author

Hour-35 exact-head review request.

Current head 3e09ff29cc89ef97a859f3ae50e1297846dd2eeb (not 4ab92f3). ADR 0068 topic_context_posterior_v1. Author COMMENT 5073678689 is not APPROVE. Exact-head Checks on 3e09ff2 only. Predecessor 4ab92f3 evidence does not transfer. Do not duplicate topic-context posterior. Do not invent a Bayesian sampler or topic birth/split/merge. Do not self-approve.

@opencode-agent review

Copy link
Copy Markdown
Contributor Author

Hour-36 re-verify: topic-context posterior head 3e09ff2. Zero independent APPROVEs. Do not duplicate. Exact-head Checks on 3e09ff2 only. Do not self-approve. @opencode-agent review.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant