fix: complete gate to green -- fork ledger flush (#243), coverage, Linux Rust base, release gh login - #258
Merged
Conversation
The fork of a running sandbox copies session.db while the writer still holds the last accepted rows in memory, up to its 5 s disk flush, so the fork lost the source's last seconds of events. The CloneState job now runs flush_checked under the guest freeze, then clones; a failed flush fails the fork. The new test writes a row, forks without waiting, and finds it in the clone; it failed before the barrier. Fixes #243.
fetch-channel-source-manifest required GITHUB_TOKEN in the environment. release-binaries already dispatches its hosted lane through gh, so the gh login is a release prerequisite anyway, and the missing export surfaced only at channel-source, after eight minutes of citadel, contract and build-system suites had passed. An exported GITHUB_TOKEN still wins; without one the operator's gh login supplies it, and only neither is an error.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #258 +/- ##
=======================================
Coverage 65.2% 65.3%
=======================================
Files 1452 1452
Lines 127831 127864 +33
Branches 91782 91801 +19
=======================================
+ Hits 83457 83544 +87
+ Misses 39391 39328 -63
- Partials 4983 4992 +9
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
The OTLP/HTTP export path (provider, HTTP client, install) landed with only its pure helpers tested, which dropped capsem-telemetry from its 97% coverage floor to 63%: nothing proved a metric ever left the process. A local collector now receives a real OTLP POST to /v1/metrics carrying the service, a session attribute and the recorded metric; install is refused a second time with RecorderAlreadySet; every facade unit maps to its exact UCUM code; uncataloged names, unit-bearing histograms and gauge increments reach the exporter. export.rs: 104/185 -> 182/185 lines.
Removing the snapshot tools in #228 took the builtin server's tested code with them and left main() -- peer lock naming, peer index parsing, active-profile loading -- as untestable process wiring, below the crate's coverage floor. Those rules are now functions with tests, and grep_http and http_headers get the refusal test fetch_http already had: a blocked URL comes back as an error result carrying its ledger record.
read_frame's non-EOF error branch and Table::is_empty had no test, which put capsem-network below its coverage floor. A connection reset must surface as an error rather than read as a clean end of stream.
…measure The complete gate's per-crate ratchet requires a floor within 3 points of its measurement. Raised to measured minus 2.5, per the ratchet's own guidance, for capsem, agent, api, config, foundation, logger, mcp-builtin, network, process, router and service, in the Darwin table since they were measured on macOS.
The image runs cargo fetch --locked over a manifest-only copy that held crates/ alone; sdk/rust joined the workspace outside crates/, and the cached image hid it until the 0.6.4 lockfile change invalidated it and the complete gate failed at warm-base (failed to read /src/sdk/rust/Cargo.toml). A citadel guard now checks every workspace member is copied.
The restored-mtime forgery test rewrote the file straight after its first write. Linux stamps inodes from a coarse clock that advances every few milliseconds, so both writes shared one ctime and nothing in the metadata could show the change; macOS stamps finer, so it only failed in the Linux coverage lane (reached for the first time once the Linux Rust base image built again). The test now rewrites until the kernel records a new ctime, the precondition its claim is about, and documents the granularity limit.
… environment Two Rust tests hand a WARC export to warcio through uv run --project build_system. The Linux lane runs with --network none to prove the base image is complete, and the image never built that environment, so uv tried to download it and the tests failed on DNS (hidden until the base image rebuilt). The image now builds build_system/.venv and keeps uv's cache under /src, which the lane's copy leaves alone (.venv is dockerignored) and the ownership step hands to the lane user; build_system/pyproject.toml and uv.lock join the image identity so a Python dependency change rebuilds it.
The service derived main.db from its run directory's parent, while foundation's capsem_sessions_dir() says <home>/sessions. With the run directory outside the home -- the gate puts it under /tmp for a short socket path -- every such service shared /tmp/sessions/main.db, and a copy left in ledger format v3 made each new service exit at startup (archive_state format version 3 is unsupported), which the artifacts module reported as a socket that never accepted. The runtime now opens capsem_sessions_dir(); main_db_path() reports the file the handle opened, one source of truth; test states keep their own temporary home.
WaitForSocket spent its whole readiness budget on a daemon that had already exited with a clear error, then reported that it did not accept a connection -- a hang, where there was a crash. It now checks the pid the launch recorded on every attempt and fails immediately, naming the pid and where its log is.
The integration helper located main.db by the old run-root rule, which the service no longer follows; check_session.py, doctor_session_test.py and list_sessions.py already used CAPSEM_HOME/sessions/main.db. The service home-layout guard keeps its rule (harnesses use the installed layout) with its text updated: the shared-ledger hazard it described is fixed in the service.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Everything the complete local gate (
just teston main48400d5) turned up, fixed and re-proven on this branch.just testhitfix(process)CloneStateflushes the writer under the guest freeze before copying; a failed flush fails the fork. Test fails without the barrier.fix(release)release-binariesdied atchannel-sourceafter 8 min:GITHUB_TOKEN is requiredgh auth token, the login the release already dispatches withtest(telemetry)capsem-telemetry63% vs its 97% floor: OTLP export landed with only pure helpers tested/v1/metricswith service, session and metric;installrefuses a second exporter; exact UCUM codes. 98.6%refactor(mcp-builtin)mainand tested;grep_http/http_headersget the refusal testfetch_httphad. 59%test(network)Table::is_empty. 100%chore(gate)fix(build)×2warm-base: Linux Rust base image couldn't build (sdk/rustworkspace member never copied), then the sealed lane couldn't run warcio tests (no Python env,--network none)build_system/.venv+ uv cache; addbuild_system/{pyproject.toml,uv.lock}to the image identitytest(fs-monitor)fix(service)assets.assemble: service never listenedmain.dbwas derived from the run dir's parent, so every/tmprun dir shared/tmp/sessions/main.db, and a v3-format copy stopped each new service. NowCAPSEM_HOME/sessions/main.db(foundation's rule); the path is the file the handle openedfix(gate)WaitForSocketchecks the launched pid each attempt and reports an exit at once, with its log dirtestmain.dbby the old ruleVerification on this branch
Every complete-gate module, run on this branch: fast ok · static ok · artifacts ok · functional ok (29m) · glow-up ok (18m).
capsem-gate test-static: ok. Coverage ratchet plus the full Linux Rust lane (5,345 tests) in the sealed--network nonecontainer.capsem-gate warm-linux-rust-base: ok.just fast-test: ok; citadel 1253.After merge,
just test <main sha> normal '' slowre-proves the whole plan on main in one run.🤖 Generated with Claude Code