Skip to content

fix(stella-protocol): unbreak main — resolve the CompactionRewrite doc link - #2010

Closed
macanderson wants to merge 1 commit into
mainfrom
fix/unbreak-main-rustdoc-protocol
Closed

fix(stella-protocol): unbreak main — resolve the CompactionRewrite doc link#2010
macanderson wants to merge 1 commit into
mainfrom
fix/unbreak-main-rustdoc-protocol

Conversation

@macanderson

@macanderson macanderson commented Aug 7, 2026

Copy link
Copy Markdown
Owner

What

The gate's doc-warnings step (RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps) fails on main at 6c34553:

error: unresolved link to `CompactionRewrite`
   --> crates/stella-protocol/src/event.rs:545:53
    |
545 |         /// under the same `call_id` (#1667); see [`CompactionRewrite`].
    |                                                     ^^^^^^^^^^^^^^^^^ no item named `CompactionRewrite` in scope

The type reaches this scope only through its crate-level re-export (lib.rs), so the bare name resolves to nothing. The field's own type annotation two lines below already spells the working path (Vec<crate::CompactionRewrite>); the doc link now matches it. One line, no behavior.

event.rs is a grandfathered god file closed to growth — this is a same-line edit, so it does not grow.

Why it surfaced only now

Layered masking, the shape #1965 records: rustdoc stops at the first crate that fails to document, so each fix reveals the next layer down. stella-cli was fixed in #1970; stella-protocol is the layer underneath, and it is the deepest — with this applied, cargo doc --workspace --no-deps is clean workspace-wide.

Scope — this is one of four independent red gates on main

Verified on origin/main at 6c34553 and deliberately not bundled, since each already has an owner:

Gate Status
doc-warnings (rustdoc) this PR — nothing else covers it
format-check (missing trailing newline in event/tests.rs) #2005
file-size (baseline skew: driver.rs +1, pipeline/tests.rs +1) #2003
lint (dead spend local) #2000

Main is green on none of these individually — all four must land. #2000 also touches crates/stella-protocol/src/event.rs, but a different region, so the two should not textually conflict.

Verification

  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-depsclean (fails on main without this)
  • cargo test -p stella-protocol — 0 failures
  • cargo clippy -p stella-protocol --all-targets -- -D warnings — clean

No witness test: a rustdoc-only fix, per the repo's pure-docs exemption. The reproduction above is the evidence.

Summary by Sourcery

Bug Fixes:

  • Correct the CompactionRewrite documentation link in AgentEvent to reference the crate-level type and restore successful rustdoc generation.

…c link

`RUSTDOCFLAGS=-D warnings cargo doc --workspace --no-deps` (the gate's
`doc-warnings` step) fails on main: the `rewrites` field's doc comment
links `[`CompactionRewrite`]`, but the type reaches this scope only through
its `crate`-level re-export, so the bare name resolves to nothing. The
field's own type annotation two lines below already spells the working path.

Layered masking is why this surfaced only now (#1965 records the shape):
rustdoc stops at the first crate that fails to document, so each fix reveals
the next layer down. `stella-protocol` is the deepest one.

Same-line edit: `event.rs` is a grandfathered god file closed to growth.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry @macanderson, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
stella-cli-docs Ignored Ignored Aug 7, 2026 3:02am

@sourcery-ai

sourcery-ai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Fixes a rustdoc unresolved link warning in stella-protocol by updating a documentation reference in AgentEvent to point to the crate-level CompactionRewrite type path, making cargo doc with -D warnings pass workspace-wide.

File-Level Changes

Change Details Files
Update a rustdoc link in AgentEvent documentation so it correctly resolves to the CompactionRewrite type via its crate-level path.
  • Change the bare CompactionRewrite doc link to crate::CompactionRewrite to match the field’s type annotation and re-export path.
  • Keep the surrounding documentation and field definition unchanged to avoid behavioral or structural modifications.
crates/stella-protocol/src/event.rs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@macanderson

Copy link
Copy Markdown
Owner Author

Superseded by #2000, which fixes the same doc-warnings break in a better form: [CompactionRewrite](crate::CompactionRewrite) keeps the short rendered label, where this PR's [crate::CompactionRewrite] would print the fully-qualified path in the generated docs.

I opened this before spotting that #2000's diff already reached crates/stella-protocol/src/event.rs — my own PR description asserted the two 'should not textually conflict', and that was wrong: they conflict on exactly this hunk.

The verification I did here still stands and is recorded on #2000: main at 6c34553 is red on four independent gates (rustdoc, fmt, file-size, clippy), and #2000 + #2003 + #2005 together green all four. Closing so there is one PR per gate.

@macanderson

Copy link
Copy Markdown
Owner Author

⚠️ This unbreak would trade one red gate for another. docs/wire still matches the types is failing on this PR, and the cause is the fix itself.

The edited line is a type doc comment, which is the wire contract. schemars copies it verbatim into the schema's description field, so changing

/// … (#1667); see [`CompactionRewrite`].

to anything else restales docs/wire/agentevent.schema.json and serveframe.schema.json. The wire-schema gate then fails, and the net effect on main is one break swapped for a different one.

Fix: run scripts/export-agentevent-schema.sh and commit the result in this PR (AGENTS.md § "Cite a document by its id" neighbours this rule; the exporter's own header says "Run after ANY change to AgentEvent or a type it carries").

Also worth comparing against #2015, which fixes the same link and does carry the regen. It spells it:

/// see
/// [`CompactionRewrite`](crate::CompactionRewrite).

rather than this PR's [crate::CompactionRewrite]. The difference is not cosmetic once you remember where the string ends up: the linked-form keeps the schema description reading see [`CompactionRewrite`], while the path-form bakes crate::CompactionRewrite into a wire artifact that non-Rust consumers read. The linked form is the better one to converge on.

Given #2015 already carries this fix plus its schema regen, the cheapest path is probably to let #2015 land and close this — flagging rather than acting, since I do not know what else is riding on this branch.

Context: there are currently seven open unbreak PRs against a main that is red on four gates (fmt, file-size, clippy, doc-link), and several overlap. I verified each failure against a pristine origin/main checkout before writing this.

macanderson added a commit that referenced this pull request Aug 7, 2026
…eir fixes (#2015)

## The problem

`main` at 6c34553 fails **five** independent gates. Four fixes already
exist across #2000, #2003 and #2005 — but **two of those PRs are red on
exactly the gate the other one repairs**, so none of them can merge:

- **#2003** regenerates `scripts/file-size-baseline.txt` and touches
nothing else → fails `wire-schema`, because main's `docs/wire/` is stale
against its own types.
- **#2005** regenerates `docs/wire/` and the park consumers → fails
`file-size`, because the baseline skew is #2003's fix.

That is a deadlock, and it is why main has stayed red while three
unbreak PRs sat open. This branch carries both halves plus #2000's
repairs so the set can land in one merge.

## The five gates

| Gate | Break | Fix from |
|---|---|---|
| `lint` | a dead `spend` local | #2000 |
| `doc-warnings` | `[`CompactionRewrite`]` resolves only via the
crate-level re-export | #2000 |
| `format-check` | missing trailing newline in `event/tests.rs` | #2005
|
| `file-size` | baseline skew (`driver.rs` +1, `pipeline/tests.rs` +1) |
#2003 |
| `wire-schema` | `docs/wire/` stale against #1994's
`TurnParked`/`TurnWoken` | #2005 |

The rustdoc one is worth a note: **layered masking**, the shape #1965
records. Rustdoc stops at the first crate that fails to document, so
#1970 had to repair `stella-cli` before `stella-protocol` underneath it
became visible at all. Anyone fixing one layer and re-running would
reasonably have believed they were done.

## Authorship

The substantive hunks are **from #2000, #2003 and #2005** — collected
here, not re-derived, so their authors keep the credit. Close those
three as superseded if this lands, or close this one if they can be
sequenced another way; the point is that they cannot each be green
independently. I also opened #2010 for the rustdoc break before finding
#2000 already covered it, and closed it as a duplicate.

## Verification

Run against this exact tree, each gate with the command the Makefile
uses:

| Check | Result |
|---|---|
| `cargo clippy --workspace --all-targets -- -D warnings` | clean |
| `RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps` | clean |
| `cargo fmt --all -- --check` | clean |
| `scripts/check-file-size.sh` | OK — none grew |
| `make wire-schema` | OK — `docs/wire/` matches the types |
| `cargo test -p stella-protocol -p stella-pipeline -p stella-tui -p
stella-core` | pass |

Each was also confirmed **failing** on `origin/main` beforehand, so this
is a demonstrated repair rather than an assumed one.

One caveat, stated rather than buried: `stella-tui`'s
`run_deck_paints_folds_resizes_and_restores_under_a_real_pty` failed
once in the batch run and passed in isolation (20s, against an 81s
timeout) — a real-PTY timing flake under concurrent build load, not a
regression.

The baseline was regenerated with `make file-size-update`, never
hand-edited — a hand-merged baseline is what produced the current skew.

## Note for reviewers

No witness test: every hunk restores an existing gate to green rather
than changing behavior. The reproduction table above is the evidence,
and each gate flips from fail to pass across this diff.

## Summary by Sourcery

Unstick main by combining previously separate fixes so all gates pass
together, including lint, doc warnings, formatting, file-size checks,
and wire-schema consistency.

Bug Fixes:
- Repair lint break by removing the unused `Spend` local from the
pipeline scope stage.
- Fix rustdoc warnings by correcting the `CompactionRewrite` intra-crate
link to the crate-level re-export and mirroring it in generated wire
docs.
- Restore format-check to green by adding the missing trailing newline
in `event/tests.rs`.
- Update `scripts/file-size-baseline.txt` to reflect current binary
sizes so file-size checks match the regenerated code and tests.
- Bring `docs/wire` schemas back in sync with protocol types and
serveframe definitions, including the `CompactionRewrite` documentation
changes.
- Ensure observatory transcripts correctly capture and render
`turn_parked` and `turn_woken` events so journal gaps and wake reasons
are visible.
- Adjust the management prompt tests to match the current set of model
roles and avoid stale expectations.
- Update the fleet dashboard UI to properly represent parked turns as a
distinct state instead of misclassifying them as blocked.

Enhancements:
- Extend the observatory database query and journal rendering to include
parked and woken turn events, with operator-facing descriptions and
timing details.
- Add UI support in the fleet dashboard for displaying parked turns and
holding their state across park/wake so operators can distinguish
deliberate waits from stalls.
- Clarify the flip-halt arming test module layout and move doubles into
the child module to protect against silent deletion on parent rewrites.

Tests:
- Tidy verification hardening tests around flip-halt arming by
delegating doubles into the child module and simplifying the parent’s
documentation.
- Align management prompt tests with the current role handling to keep
the test suite reflecting real behavior.
- Confirm wire-format tests and tag tables remain unchanged while
restoring formatting and wire-schema consistency.

Chores:
- Regenerate wire schema artifacts and file-size baselines using the
project’s existing tooling so all gates share a consistent view of the
repository state.
macanderson added a commit that referenced this pull request Aug 7, 2026
…ngress (#1787) (#2002)

## Why this PR exists

**#1787's fix is not in `main`.** PR #1982 carried it, but its base was
the topic branch `unbreak-main-pipeline`, whose own PR (#1975) was
**closed, not merged**. #1982 then merged into that dead branch, so the
oracle-trace bound landed nowhere `main` can see, and nothing is
carrying that branch forward.

It also merged in a **broken** state. While the base was being
reconciled with `main`, git's auto-merge of the two
independently-written unbreaks concatenated both sides, leaving:

- `struct PassingShell` and `fn shell_call_result` **defined twice**
- `async fn a_revision_halts_at_the_step_where_the_tracked_test_flips`
defined twice
- a duplicate `ModelCallRole::Research` match arm (unreachable pattern)

None of that compiles. `unbreak-main-pipeline` currently holds it;
`main` is unaffected.

This PR is the clean landing: **`main` plus `evidence.rs`, and nothing
else.**

## What it does (#1787)

Bounds the oracle trace at the verifier-prompt ingress. The trace grows
once per verification round and the repair gate can keep granting rounds
while a measured budget affords them — so unlike the diff, which rides
under a token budget, this channel had **no ceiling at all**.

- `MAX_ORACLE_TRACE_OBSERVATIONS = 24` — sized far above a normal run
(baseline plus a handful of rounds) so the bound only bites a
pathological loop.
- `bounded_oracle_trace` keeps the **newest** observations and states
the drop **in-band** (`…N earlier observation(s) omitted → …`), so the
verifier reads "earlier observations exist" rather than a trace that
silently starts mid-run.
- The **stored snapshot keeps the full trace**; only the prompt ingress
is clipped — the structural-bound rule from #1932.

## Witnesses

- `a_pathological_oracle_trace_is_clipped_with_the_drop_stated` — a
100-observation trace renders clipped to the newest 24 with the omission
counted in-band.
- `an_ordinary_oracle_trace_renders_unchanged` — the bound does not
touch a normal run, so this cannot ship as "always clip".

Observations alternate pass/fail in the fixture so a clipped render is
distinguishable from a repeated one.

## Verification

- `cargo test -p stella-pipeline` — **585 pass**, 0 fail, including both
witnesses above
- `cargo fmt --check -p stella-pipeline` — clean
- Diff vs `main` is exactly one file:
`crates/stella-pipeline/src/pipeline/evidence.rs` (+74/−2)

## CI is red on `main`'s breaks, not this diff

This branch is merged up to current `main`. Every failing step fails in
a file this PR does not touch, and each already has a dedicated unbreak
in flight:

| Failing step | Where | Covered by |
|---|---|---|
| `check-file-size` | `scripts/file-size-baseline.txt` (parallel-merge
skew) | **#2003**, **#2008** |
| `cargo fmt --check` | not this crate's file | **#2005** |
| clippy: unused `spend` / unused `mut` | `pipeline/scope_stage.rs:34` —
a dead local `#1985` left behind | **#2000** |
| rustdoc: unresolved `CompactionRewrite` | `stella-protocol` |
**#2010** |

The clippy one is worth naming precisely, since it is `stella-pipeline`:
`main`'s `scope_stage.rs` binds `let mut spend = Spend { budget, total
};` and then never uses it — the loop constructs a fresh `Spend` inline
per iteration. `spend` occurs exactly once in the file. That is `main`'s
dead local, untouched by this PR.

No competing unbreak is included here on purpose — six are already open
against `main`, and duplicating one is how `main` gets re-broken.

## Note on the dead branch

`unbreak-main-pipeline` still holds the duplicate-definition breakage
and the only copy of #1982's merge. It is not reachable from `main` and
its PR is closed, so nothing needs to be reverted — but it should not be
revived without first taking `main`'s copies of `flip_halt_arming.rs`,
`management_prompt/tests.rs` and `scope_stage.rs`, which is what this PR
does. Filed as #2001.

Closes #1787
@macanderson
macanderson deleted the fix/unbreak-main-rustdoc-protocol branch August 7, 2026 03:50
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