Skip to content

feat(analysis): compose fitted candidate-K selection with topic lineage - #412

Draft
seonghobae wants to merge 2 commits into
mainfrom
feat/composed-fitted-lineage-analysis-run-gap-004
Draft

feat(analysis): compose fitted candidate-K selection with topic lineage#412
seonghobae wants to merge 2 commits into
mainfrom
feat/composed-fitted-lineage-analysis-run-gap-004

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

GAP-004/#166/#167 leftover / ADR 0055. Bind existing model_selection::select_fitted_candidate_k then execute_topic_lineage_run at the selected K to a cutoff-safe composed_fitted_lineage_v1 analysis-run profile (tepp.composed_fitted_lineage.v1).

  • Invokes fitted Schwarz selection and the CPU f64 topic-lineage executor already on protected main. Does not reimplement scoring or lineage edges.
  • Artifact carries selected K, candidate/evidence counts, lineage topic/edge counts, the inner lineage digest, and inference status fitted_k_composed_lineage_not_bayesian_sampler.
  • Lexical methods fail closed. Snapshot/profile/cutoff mismatch fails closed, including reuse of fitted_candidate_k_v1, pareto_candidate_k_v1, trsl_topic_lineage_v1, and joint_posterior_draws_v1.

Not standalone fitted candidate-K (#404 / ADR 0049). Not interpreter/verifier (#405 / ADR 0050). Not topic activity (#407 / ADR 0051). Not joint Gauss-Newton Laplace draws (#408 / ADR 0052). Not Pareto candidate-K (#409 / ADR 0053). Not export retrieval (#411 / ADR 0054). Not a Bayesian sampler. Not GPU. Not topic birth/split/merge. Not implemented-main.

Distinct from live slices

Does not duplicate #411 (export retrieval), #410 (export authorize CLI), #409 (Pareto candidate-K), #408 (joint posterior Laplace draws), #407 (topic activity), #406 (wait CLI), #405 (interpreter/verifier), #404 (fitted candidate-K), #398 (membership-posterior ICC), #376 (ESEM/DSEM), #374 (Rubin), #372 (CWC), #389 (irregular event-time), #364 (TDT/CHRONOS), #356/#358/#359 (GAP-003A), #351 (Leiden), 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

GAP-004/#166/#167 leftover / ADR 0055. Bind existing
select_fitted_candidate_k then execute_topic_lineage_run at selected K
as cutoff-safe composed_fitted_lineage_v1. LLM votes cannot define the
numerical optimum. Not a Schwarz-only bind, not Pareto, not a Bayesian
sampler, and not implemented-main.

@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 COMMENT on exact head e2b3c3b.

This is not an APPROVE. Author COMMENTED is not an independent review. Ruleset 18156473 still needs two independent current-head APPROVEs from non-author, non-bot reviewers.

Bind is fitted candidate-K composed with topic lineage as composed_fitted_lineage_v1 (ADR 0055). Distinct from Schwarz-only (#404 / ADR 0049), Pareto (#409 / ADR 0053), joint Laplace (#408 / ADR 0052), topic activity (#407 / ADR 0051), interpreter/verifier (#405 / ADR 0050), and export retrieval (#411 / ADR 0054). LLM votes cannot define the numerical optimum. Not a Bayesian sampler. Not implemented-main.

Do not self-approve. Do not merge without two independent approvals. Predecessor Checks do not transfer.

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 46 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cd626307-4d33-4d9d-9ccf-e2291a6a1479

📥 Commits

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

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (15)
  • CHANGELOG.md
  • crates/analysis_engine/Cargo.toml
  • crates/analysis_engine/src/composed_fitted_lineage_artifact.rs
  • crates/analysis_engine/src/lib.rs
  • crates/analysis_engine/src/topic_lineage_artifact.rs
  • crates/analysis_engine/tests/composed_fitted_lineage_execution_contract.rs
  • crates/analysis_engine/tests/topic_lineage_execution_contract.rs
  • crates/corpus_split/src/snapshot.rs
  • crates/model_selection/src/fitted.rs
  • crates/model_selection/src/lib.rs
  • crates/topic_measurement/src/reference.rs
  • docs/TRACEABILITY.md
  • docs/adr/0055-composed-fitted-lineage-analysis-run.md
  • docs/adr/README.md
  • docs/doctoring/composed-fitted-lineage-analysis-run.md

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.

Note

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

Devin Review found 4 potential issues.

Devin Review

Comment thread crates/analysis_engine/src/composed_fitted_lineage_artifact.rs Outdated
Comment thread crates/analysis_engine/src/composed_fitted_lineage_artifact.rs
Comment thread crates/analysis_engine/src/composed_fitted_lineage_artifact.rs Outdated
Comment on lines +194 to +214
pub fn execute_composed_fitted_lineage_run(
request: &AnalysisRunRequest,
accepted: &AnalysisRunAccepted,
snapshot_id: &str,
knowledge_cutoff: KnowledgeCutoff,
composition: &ComposedFittedLineageInput<'_>,
completed_at: impl Into<String>,
) -> Result<ComposedFittedLineageExecution, AnalysisEngineError> {
request.to_json()?;
accepted.to_json()?;
require_receipt_identity(request, accepted)?;
if request.snapshot_id != snapshot_id {
return Err(AnalysisEngineError::SnapshotMismatch);
}
if request.knowledge_cutoff != knowledge_cutoff.to_rfc3339()
|| request.model_contract_version != COMPOSED_FITTED_LINEAGE_MODEL_CONTRACT_VERSION
|| request.output_profile != COMPOSED_FITTED_LINEAGE_OUTPUT_PROFILE
|| !valid_identifier(composition.method_name())
{
return Err(AnalysisEngineError::InvalidEvidence);
}

@devin-ai-integration devin-ai-integration Bot Aug 31, 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.

🔍 Cutoff binding remains caller asserted

ReferenceTopicInput retains no snapshot or cutoff provenance. The executor validates supplied labels, not the input’s actual construction boundary.

Devin Review

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

@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 3 new potential issues.

Devin Review

Comment on lines +175 to +179
pub struct ComposedFittedLineageExecution {
/// Digest-bound composed selection-plus-lineage artifact.
pub artifact: ComposedFittedLineageArtifact,
/// Terminal result carrying the composed artifact identity, digest, and schema.
pub terminal_result: AnalysisRunTerminalResult,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 Inner artifact retrieval is unclear

ComposedFittedLineageExecution retains only the inner digest and summary counts. No visible persistence path exposes the lineage edges identified by that digest.

Devin Review

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

};
let digest = artifact.sha256()?;
#[rustfmt::skip]
let summary = AnalysisResultSummary::new("composed_fitted_lineage", artifact.evidence_count, 4, COMPOSED_FITTED_LINEAGE_INFERENCE_STATUS)?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 Statistic count lacks a contract

The summary hard-codes four statistics without identifying them. Other executors derive this count, leaving consumers unable to interpret the composed total consistently.

Devin Review

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

Comment on lines 267 to +274
if candidates.is_empty() {
return Err(ModelSelectionError::NoSuccessfulFit);
}
select_candidate_k(&candidates)
let selected_k = select_candidate_k(&candidates)?;
fitted
.into_iter()
.find(|(candidate_k, _)| *candidate_k == selected_k)
.ok_or(ModelSelectionError::NoSuccessfulFit)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📝 Info: Failed fits remain isolated

select_fitted_candidate_model preserves the existing candidate-failure policy. LLM votes cannot supply the returned model because lookup uses only successful fits.

(Refers to this code)

Devin Review

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

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