Skip to content

The deliberation faculty split by owner, rebuilt on canary (pure moves) - #5232

Closed
joelteply wants to merge 9 commits into
canaryfrom
fable/faculty-by-owner-canary
Closed

joelteply wants to merge 9 commits into
canaryfrom
fable/faculty-by-owner-canary

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

What this is

core/continuum-core/src/cognition/llm_deliberation_faculty.rs was 12,678 lines on canary. This splits it by owner into llm_deliberation_faculty/, with the same owner layout as the earlier split. Pure moves: no logic changes, no renames. Mechanical edits only: child modules use super::*;, private items widened to pub(super) / pub(in super::super) where a sibling or the parent uses them, super:: -> super::super:: in moved code one level deeper, parent mod child; use self::child::*;, test files start #![cfg(test)], and include_str! paths gain ../ per added directory level.

It replaces #5226, which was stacked on the unmerged epoch branch (that branch rewrote ~1,600 lines of this file, so it could not be cherry-picked). This one is regenerated from canary's version of the file.

Canary-only items (not on the earlier split) were placed with their owner: ContextComposition, GroundingPiece, GroundingPlan, Fitted and their impls go to prompt/fit.rs; ShedPreview and shed_preview to prompt/types.rs; latency_fill_cap, history_fill_cap, messages_within, PREFILL_TARGET_SECONDS to prompt/view.rs; FRONT_DROP_QUANTUM_DIVISOR to prompt/fit.rs. One deliberate difference from the earlier layout: canary's parent would still be 1,260 lines, over the 1,000-line rule, so the system-prompt composition (assembled_context_cost, render_assembled_context_within, compose_system*) moves to a new prompt/system.rs.

Commits, one per owner: tests, tool_surface, request, verdict, prompt, reply_claim + hands_surface.

What moved where (lines)

File Lines
llm_deliberation_faculty.rs (parent) 801
hands_surface.rs 82
reply_claim.rs 77
request.rs 594
tool_surface.rs 362
verdict/mod.rs 348
verdict/contribute.rs 827
prompt/mod.rs 12
prompt/types.rs 433
prompt/view.rs 784
prompt/messages.rs 542
prompt/fit.rs 665
prompt/system.rs 462
prompt/segments.rs 36
tests/mod.rs 345
tests/turn_bound.rs 46
tests/verdicts/{mod 165, act_verdicts 596, capacity_and_wire 852, window_feedback 659}.rs 2,272
tests/prompt_shaping/mod.rs 75
tests/prompt_shaping/{an_action_result_cannot_mute_a_citizen 172, grounding_never_mutes 99, the_budget_prices_the_surface_it_actually_sends 198, stable_prefix_first 139, turn_window 829, reply_reserve 871, prefix_and_grounding 419, tool_surface_and_fit 853, binding_and_history 455}.rs 4,035

Every file is at most 1,000 lines.

Verification

Not run locally (the machine that produced this is a serving node, so no cargo). What was checked locally: every new file parses under rustfmt --edition 2021 --check, and a line-multiset comparison of the old file against all new files shows the only differences are the mechanical edits above (visibility, super:: depth, mod/use lines, #![cfg(test)], include_str! depth).

Verification of record is CI: cargo test -p continuum-core --lib and the source-hygiene ratchets.

🤖 Generated with Claude Code

@joelteply

Copy link
Copy Markdown
Contributor Author

Independent source review of exact c776905: the faculty split passes source equivalence (231 functions, 52 declarations, 95 test annotations). Full scope is now clean: no prior epoch or engine-pin changes. File excess reduction 154999 -> 143321 is supported.

[P2] Do not credit derived-bounds 159 -> 158 as removed debt. The parser at derived_bounds.rs:115-120 does not recognize pub(in ...) const. Existing PREFILL_TARGET_SECONDS (prompt/view.rs:18) and PER_MESSAGE_TEMPLATE_TOKENS (prompt/fit.rs:13) consequently disappear from scanning after this move. Meanwhile the rule-specific production_lines ignores file-level cfg(test), counting relocated AGENTIC_SURFACE_CEILING at tests/prompt_shaping/tool_surface_and_fit.rs:410. Net minus one is two lost production findings plus one misclassified test finding. Repair visibility parsing and test projection with the hygiene owner, then remeasure. Current #5227 migration fixes projection but still needs restricted visibility coverage.

Logging limitation: four tracing calls and 40 moved probes inherit new child-module targets. Contents and probe classes are preserved; no exact old-target consumer was found. Preserve target parity through the explicit-target probe arm, or explicitly disclose this metadata change rather than claiming all observables unchanged.

Read-only review; no local builds or deployment. Full PR remains on hold for honest bounds accounting and CI.

joelteply added a commit that referenced this pull request Oct 21, 2026
…cargo_target is its own owner

The flaky "kept" (canary 9c2e7b8, CI run 39444285785; #5232 c776905) is
a real defect, not a test artifact. A reclaim pass released cargo's flock only
by closing its descriptor. A flock belongs to the open file description, so a
process forked while the pass held it (the core spawns git, engines and builds;
tests fork in parallel) kept it until its exec, and the next pass read an idle
tree as a live build.

- HeldCargoLocks owns the held locks and unlocks each one on drop; a failed
  unlock is a probe, never silent.
- Proving a tree is cargo's, holding its locks and taking it move to
  citizen_workspace_pool/cargo_target.rs (parent 993 -> 876 lines); callers
  unchanged (is_cargo_target re-exported pub(crate)).
- Regression test: a dup standing in for the forked child stays open past the
  release, and the lock must still be free. Deterministic.

Measured: a standalone rustc probe on the M5 (macOS, Darwin 25.5) showed a
rival try_lock fails after close-only with a dup alive (false) and succeeds
after an explicit unlock (true). continuum-core compile/test is left to CI
(serving node, no build window); source-hygiene 43/43 at baseline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit dd42301)
joelteply added a commit that referenced this pull request Oct 21, 2026
…cargo_target is its own owner (#5238)

The flaky "kept" (canary 9c2e7b8, CI run 39444285785; #5232 c776905) is
a real defect, not a test artifact. A reclaim pass released cargo's flock only
by closing its descriptor. A flock belongs to the open file description, so a
process forked while the pass held it (the core spawns git, engines and builds;
tests fork in parallel) kept it until its exec, and the next pass read an idle
tree as a live build.

- HeldCargoLocks owns the held locks and unlocks each one on drop; a failed
  unlock is a probe, never silent.
- Proving a tree is cargo's, holding its locks and taking it move to
  citizen_workspace_pool/cargo_target.rs (parent 993 -> 876 lines); callers
  unchanged (is_cargo_target re-exported pub(crate)).
- Regression test: a dup standing in for the forked child stays open past the
  release, and the lock must still be free. Deterministic.

Measured: a standalone rustc probe on the M5 (macOS, Darwin 25.5) showed a
rival try_lock fails after close-only with a dup alive (false) and succeeds
after an explicit unlock (true). continuum-core compile/test is left to CI
(serving node, no build window); source-hygiene 43/43 at baseline.


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit dd42301)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
joelteply and others added 9 commits October 21, 2026 03:52
… by theme (pure move)

Each nested test module becomes its own file; the loose prompt-shaping and
verdict tests group by theme as on the owner split. include_str! paths gain
two ../ for the added directory depth.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit 28e811b)
…ure move)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit 3b34e76)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit cfcf416)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit e3bda14)
…out of llm_deliberation_faculty.rs (pure move)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit 5e3eced)
…culty.rs (pure move)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit 9817768)
The depth rewrite skipped 'in super::' meant for pub(in super::..) but also
matched 'for fact in super::perception_facts'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit 24e88f6)
…nly)

ShedPreview, ContextComposition's framing fields and the GroundingPiece
notice helpers sit in prompt/ now; private -> pub(in super::super) like their
siblings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit c776905)
Rebuilt as canary plus this PR's own commits (cherry-picked with -x). The
old branch carried #5227/#5228's pre-squash history. Each changed count is
traced to its cause in the comment beside it. cargo test -p source-hygiene
passes 43/43 on a fresh per-worktree build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Landed via #5245 (merge-train, canary 741c118): this PR's own commits, cherry-picked unchanged. Its review stands at the head named in #5245's body.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant