Skip to content

Docs/occupancy typed reading - #134

Closed
hyperpolymath wants to merge 3 commits into
mainfrom
docs/occupancy-typed-reading
Closed

hyperpolymath wants to merge 3 commits into
mainfrom
docs/occupancy-typed-reading

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

Closes #

Type of change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (would change existing behaviour)
  • 🕳️ Soundness fix (fixes a checker/proof false-negative)
  • 📖 Documentation
  • 🧹 Refactor / tech debt (behaviour-preserving)
  • ⚡ Performance
  • 🔧 Build / CI / tooling

How has this been verified?

Checklist

  • My commits are signed (git commit -S).
  • I ran the project's own checks/tests locally and they pass.
  • New files carry the correct SPDX-License-Identifier (code/config MPL-2.0,
    prose CC-BY-SA-4.0); I did not relicense existing files.
  • Docs are updated, and no public claim now overstates what the code does.
  • I have not introduced a soundness hole (or I have flagged where I might have).

Notes for reviewers

hyperpolymath and others added 3 commits October 14, 2026 01:41
…wo-thread disagreement test

The vsearch stage runs its ASV and OTU searches concurrently in the full
pipeline and one after the other in a single-stage re-run. Nothing measured
what either shape occupies. The searches run as child processes, so
Sys.maxrss() of the Julia process never sees them.

MemoryProbe (src/core/memory_probe.jl), off unless a pipeline.yml sets
occupancy_probe.enabled: true, records per attested stage:
- julia_allocated_bytes, the Base.gc_num() delta (cost);
- per task, the largest sampled VmRSS of the children it started, and their
  kernel VmHWM;
- child_peak_rss_kib, the largest sum of the stage's children's VmRSS at one
  sampling instant.

It samples /proc every 10 ms (interval_ms) with preallocated buffers, so the
sampling adds next to nothing to the allocation figure it reports.
_run_killable registers each child. _attest stores the record under the
stage's new optional `occupancy` key. Both vsearch call sites label their
searches vsearch:asv and vsearch:otu.

With the flag off, start() returns nothing and every hook passes straight
through, so a stage record has exactly the keys it had before. The key is not
added to the defaults because the run config is embedded in attestation.yml;
it is documented there as a comment. The probe never throws into the stage it
measures, and getpid is read once, while the child is alive.

test/occupancy_disagreement_test.jl (run with the full suite) runs the two
searches in three orders on a generated fixture: 1000 reference sequences,
the smallest of a calibrated ladder that keeps both resident together for 15
or more samples. Assertions:
- the cost agrees within 1% (measured: 0.04%), and the hits are
  byte-identical in every order;
- the peaks are recorded in the log, not asserted. Locally: serial 9204 and
  9192 KiB, concurrent 18380 KiB.

The test runs vsearch with --threads 1. With several threads its output order
varies, and _sort_hits_by_query!, whose key splits each line on every
comparison, then moved the stage's allocation by up to 12% between repeats of
the same order. This commit does not change that.

The test file also covers:
- the flag off and on, through the real _attest;
- a failed stage, which keeps its occupancy and still rethrows;
- old records, which still parse and merge;
- a 64 MiB child against a sleep control;
- chained commands and an instantly exiting child.

Checks, run locally with Julia 1.12.5 -t 2 and vsearch 2.30.5:
- the test file passes, 46/46;
- test_provenance, test_tools, test_routes, test_jobs and
  test_config_hashing pass 547. One error is the live R probe, which needs
  the dada2 R package that CI installs and this machine lacks.
- Five planted mutants are each caught: children ignored, flag ignored, key
  always written, stage peak computed as a sum, and extra work in one order
  (spread 0.249).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015pMjy981ie74uCttyYDanC
A dated record of what the occupancy probe found on 2026-10-14, and the typed
reading checked against it, as MMW-01 asks.

- docs/occupancy-2026-10.adoc: the table per order, with each search's peak,
  the measured stage peak, Session IR's counted bytes, the HWM typed peak and
  the Julia allocation. It also has a status ledger (MMW-01.1-4 TESTED, the
  general v0 to typed bridge still OPEN), the limits, and what the next
  proofs would change.
- docs/occupancy/vsearch-*.sir: the stage as occupancy-types Session IR, one
  buffer per search, in each order. The stepper counts 9204, 9192 and 18380
  KiB.
- docs/occupancy/TypedPeak.agda: the typed peak computed by refl with
  occupancy-types' Timeline over resource-algebra's HWM grade. A search alone
  exits holding nothing; the concurrent first search is still resident.
  Results: 9204, 9192, 18380. docs/occupancy/reject holds two claims that
  must be refused: concurrent = serial, and serial = sum (occupancy read as
  cost).
- scripts/fetch-siblings.sh pins occupancy-types af95728 and resource-algebra
  cf9235c into _build/dependencies. Their definitions are consumed, never
  copied.
- scripts/check-occupancy.sh is the gate: Session IR check and run --trace,
  TypedPeak, the rejections at their own declarations, and counted bytes
  against typed peak per order. The occupancy workflow runs it whenever these
  files change, on any base branch, so this stacked PR is checked too. It
  uses the digest-pinned Debian trixie image with Agda 2.6.4.3, as upstream's
  proof job does, and setup-julia 1.12.5.
- docs/occupancy/results-2026-10-14.yml: the raw probe records behind the
  table.
- .gitignore: unignore exactly these docs (docs/* is otherwise kept local),
  and ignore _build/ and *.agdai.

Checks run locally:
- scripts/check-occupancy.sh exits 0 (Agda 2.6.4.3 wheel, Julia 1.12.5).
- Its negative controls fail it: one SIR byte off (18381 != 18380), a true
  claim planted as a rejection, and a rejection failing for a scope error.
- zizmor finds nothing in the workflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015pMjy981ie74uCttyYDanC
… test here

Both runs ended in startup_failure. This account allows only GitHub's own
actions and its own, SHA-pinned, and julia-actions/setup-julia is neither.
The same policy has kept ci.yml (julia-actions, setup-bun, codecov) from
starting on this fork since at least 2026-10-02, so the three-order test in
its full suite never runs here.

The workflow now uses no third-party action:
- Julia 1.12.5 from julialang's tarball, checked against julialang's
  published SHA256, as the official Docker image records it;
- vsearch from its tool_versions.yml pin, checked against the pinned
  SHA256, as ci.yml installs it.

It has two jobs:
- disagreement: Julia, R (RCall builds against it), the project
  environment, then test/occupancy_disagreement_test.jl with -t 2;
- typed-peak: scripts/check-occupancy.sh, as before.

The paths also cover the probe's sources and the test.

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

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next included review available in 42 minutes.

Check out review usage here.

View limit details

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 60e27837-afa8-449d-8729-3c46cdf9600a
📥 Commits

Reviewing files that changed from the base of the PR and between ebebed2 and d46d846.

📒 Files selected for processing: 20
  • .github/workflows/occupancy.yml
  • .gitignore
  • config/defaults/pipeline.yml
  • docs/occupancy-2026-10.adoc
  • docs/occupancy/TypedPeak.agda
  • docs/occupancy/reject/ConcurrentIsSerial.agda
  • docs/occupancy/reject/SerialIsCost.agda
  • docs/occupancy/results-2026-10-14.yml
  • docs/occupancy/vsearch-asv-then-otu.sir
  • docs/occupancy/vsearch-concurrent.sir
  • docs/occupancy/vsearch-otu-then-asv.sir
  • scripts/check-occupancy.sh
  • scripts/fetch-siblings.sh
  • src/MetaManifold.jl
  • src/core/memory_probe.jl
  • src/core/provenance.jl
  • src/pipeline/tools.jl
  • src/server/routes/pipeline.jl
  • test/occupancy_disagreement_test.jl
  • test/runtests.jl
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@sonarqubecloud

Copy link
Copy Markdown

@hyperpolymath

Copy link
Copy Markdown
Owner Author

Resolved by inspection rather than rebase: this branch's three commits are the pre-squash originals of work already on main.

Verified -- 4a6e26e (occupancy probe + two-thread disagreement test) merged as #106 (bf68ba1); 17ea030 (dated reading + gate) merged as #107 (4dc19c0); d46d846 (pinned tarball installs) merged as #108 (91f3bb8). Since then main evolved the same files far past the branch -- memory_probe.jl grew the HWM-algebra grading (#116), docs/occupancy gained schedules.yml and GradedStages.agda, check-occupancy.sh gained the annotations -- so a rebase would resolve every hunk to main's side. The only files the branch carries that main does not are ones main later moved or removed on purpose (codecov.yml, CONTRIBUTING.md -> .github/, install.jl -> scripts/, per #126's root tidy).

The branch can be deleted; the record stays in its commits and in #106/#107/#108.

@hyperpolymath
hyperpolymath deleted the docs/occupancy-typed-reading branch October 15, 2026 03:01
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