Skip to content

docs(paper): apply the CPC reframe prose - #128

Open
HaoZeke wants to merge 1121 commits into
developfrom
feat/reframe-v5
Open

HaoZeke wants to merge 1121 commits into
developfrom
feat/reframe-v5

Conversation

@HaoZeke

@HaoZeke HaoZeke commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Commits:

  • docs(paper): apply the CPC reframe prose
  • docs(paper): wire exchange ratios to macros
  • docs(paper): fix exchange macro names for TeX
  • docs(paper): fit the device export table
  • docs(paper): reword the CPC manuscript to the tone review
  • docs(spec): record the measurement for the reworded text

The specification blob changed with the absent and omitted wording.

Lands after #127 (stacked on feat/referee-r6).


Note

Medium Risk
Normative spec patch and writer metadata affect conformance pins and cross-language tests; build-time Python probing can fail on unusual environments; large regenerated paper datasets increase review surface without obvious runtime logic changes to the core reader.

Overview
Bumps the CON format specification to 4.0.5 (2026-11-26): normative clauses and surrounding prose now say absent or omitted instead of missing (CON-cell.3, CON-count.4, CON-units.9), with matching updates in clauses.tsv, Org/RST docs, and round-trip examples expecting con_spec_patch 5. A new bench pin and refreshed million-atom fixture SHA reflect the 4.0.5 writer stamp.

Build and CI: build.rs wires a python feature path that probes sysconfig (Unix LDLIBRARY, Windows/MSVC including free-threaded python313t.lib) via support/python_link.rs and emits link args for Rust test binaries. Weak-scaling ASV tests now expect TimeWeakThreads.setup to be callable. Cachegrind generated artifacts are refreshed.

CPC paper / referee bundle: Manuscript highlights reframe CON 3.1 → 4 and broaden the ecosystem pitch (metatensor, readcon-db/ops, etc.). Adds or supersedes measurement records (failure matrix, survey frame, test run, corpus crosscheck, clause coverage 134/179, drift, format H2H, Fortran standard check) and small evidence-script tweaks; TeX macros for clause counts and e5 prefactor ratios are updated.

Reviewed by Cursor Bugbot for commit 17f5646. Bugbot is set up for automated code reviews on this repo. Configure here.

CON-cell.7 accepts a radicand above -1e-12 and rejects one below it.
The cell stays sheared inside the window and is not a real cell outside.
The parallel frame scan treated a blank line and a component
label as a section of the current frame, then dropped the error.
The scan parses the same header as the iterator and skips only
the sections that header declares. Thread arms agree on the class.
Reject the cells, tokens, and metadata the spec names, and accept a
JSON major of 3.0 or 3e0. A frame that begins with U+FEFF is rejected
on every frame (CON-file.2). Present unit strings must match their
dimension (CON-units.2).
CON-cell.6 builds the cell from lines 3-4 only when lattice_vectors is
absent, and CON-cell.1 has the reader prefer lattice_vectors. Angles of
170 170 170 with lattice_vectors still parse.
CON-file.2 rejects U+FEFF at the start of any frame. iter_con and
ConFrameReader rebuild the position on the remainder, and that frame is
still rejected, the same way read_con rejects it.
The reader reads -0 as major 0 (CON-line2.4, CON-line2.5), and the Rust
oracle test already expects that class. The Python twin matches it.
Check the token boundary before a non-finite spelling, so trailing
junk such as -Inf{inity is InvalidNumberFormat. Trim leading spaces
and tabs on line 2 (CON-file.4). Reserved key types apply in every mode.
CON-token.3 and CON-file.4 restrict field separators and trailing
characters to spaces and tabs. Numeric, scalar-section, and count
tokenizers use that set. A form feed between line-2 tokens stays
whitespace the minor scan skips.
CON-frame.3 names the first missing line when a frame ends early.
The line position records that line once, including a UTF-8 rejection
and a section that runs out of rows.
CARGO_MANIFEST_DIR in corpus31_manifest.rs stays in a cfg(test)
module so the library source scan does not treat it as shipped code.
spec_corpus_recount.py previously wrote data/spec/corpus_recount.json
in place. Walk existing corpus_recount(-<n>).json files in
recount_paths() so each rerun writes the next corpus_recount-<n>.json
exclusively with open('x') and records supersedes on the previous
record, while --tables reads the newest record in the chain and
gen_version_map.py maps any corpus_recount(-<n>).json to the
specification corpus recount campaign.
Merging develop (25b1e08) added three test files and updated the
library sources, making clause_coverage-0.24.0-sources.json and
corpus_recount-2.json stale for the merged tree. Append
clause_coverage-0.24.0-sources-2.json and corpus_recount-3.json without
editing the existing records, refresh version_map.tex from the
superseding recount, and register the new superseding patterns in
scripts/check_version_sot.sh.
CON-units.21 requires units.velocity to equal units.length divided
by the time the version assigns. Major 3 assigns the natural unit,
and units.time must not decide the quotient. v31_units_compound
names velocity nm/ps, so the reader rejects it. The base oracle
still records the earlier acceptance.
fix: keep Python frame atoms and xyz in sync
Bring in #113, which keeps frame.atoms and frame.xyz on one
coordinate buffer, onto the column model of this branch.

src/types.rs: both sides added atomic_store_f64. Keep one copy,
built on AtomicU64::from_ptr like the load beside it, with the
documented contract from develop.

src/python.rs: each cached Atom views its row of the xyz buffer,
so a store into xyz after frame.atoms is built still reaches the
next write. to_con_frame reads those views in place of the copies
it held before. AtomDatum holds no coordinate pointer here, so the
pointer drift fixup in overwrite_coords is dropped and the
fingerprint fallback reads the positions column. canonical_owner
also returns the buffer length. A short buffer leaves atoms
unlinked, and an xyz assignment falls back to per-atom stores.

Docs and pins: keep both doc edits. The cxx wrap hash keeps this
branch's value here and is re-recorded later on this branch.
The lints job runs ruff-format through prek and failed on the
clause coverage script and two Python test files. The output path
in clause_coverage.py fits on one line, and latest() was missing
the two blank lines before the next top-level name. Two test
expressions are rewrapped. No behaviour changes.
cargo fmt --check failed on src/python.rs at develop. It rewraps
hash_coords and two error paths in canonical_owner, and fixes the
indent of source_coord_hash in pyconframe_from_ase. No behaviour
changes.
clause_coverage.py --check failed against the r3 record. The Python
frame sync tests from develop raise the Python test count, and the
tree already counted more test files, Rust tests and Python tests
than r3 records. The r4 record supersedes r3 with 221 files, 986
Rust tests and 632 Python tests. The clause totals are unchanged and
r3 stays as it was.
The develop merge changes src/python.rs and src/types.rs, which are
in the slim cxx archive, so check_cxx_wrap_pin.sh no longer matched.
Record the digest of this tree in the wrap file, the sha256 sidecar
and the FetchContent snippets. The saved source date epoch is kept.
fix: harden types, writer and Python buffers
clause_coverage.py --check reads clauses_macros.tex and fails when
that file is missing. The file is gitignored, so a checkout has no
copy and the check reports that it differs. The r4 record already
matches the sources. Track the TeX the script writes from it.
Refresh archive pins, package contents, tutorial checks and manifests
against the recorded release inputs. Clean clones now validate the same
files that the submission archive ships.
Name the line of the parse error. The referee coverage record counts
the regression test.
Use the zstandard module when Python has it, otherwise the zstd
program, libzstd, or the harness socket.
The corrected counts are this record: 165 files, readcon 125
matches, 23 disagreements, 17 not followed. Referee records
keep the library version that produced them.
The error-line test starts an interpreter. Link that library only
when the tests are compiled, so the cdylib stays free of it.
Replace the manuscript and supplement wording with the CON 4.0.4
text, the added sections and the ecosystem figure.

@cursor cursor 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.

Stale Bugbot comment from a previous run.

"cthreeoneAccepted": s["accepted"],
"cthreeoneRejected": s["rejected"],
"cthreeoneAccepted": legal,
"cthreeoneRejected": len(record["files"]) - legal,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Legal corpus counts omit stored files

High Severity

macros() now treats cthreeoneAccepted and cthreeoneRejected as manifest legal/illegal totals, but it counts record["files"] instead of the summary. The referee record sets explicit_files_stored false and keeps only the non-explicit entries, so --tables writes legal/illegal macros that do not add up to \cthreeoneFiles and undercount the corpus the paper prints.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 59ab8e6. Configure here.

"127",
jget(RECORDED, "spec.clauses"),
RECORDED,
"spec.clauses: the clauses of the recorded CON 3.1 specification",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Spec rules mix two cross-check records

Medium Severity

The clause-count rule now reads data/referee/r1h/corpus_crosscheck.json, but the corpus31 basis rules still read data/corpus_crosscheck.json. Those records are different measurements (127 vs 125 clauses; disagreements vs none), so the number tracer can certify table figures against a stale file after the paper moved to the referee record.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 59ab8e6. Configure here.

return []
return [
"the velocity row does not state both its convention and lack of an in-file declaration"
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Velocity-row check never runs

Low Severity

velocity_row_problems is new manuscript-check logic, but nothing in check_front, check_conformance, or the main() check list calls it. Only isolated tests invoke it, so a velocity row that names “no unit convention” still passes check_manuscript.py.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 59ab8e6. Configure here.

Point the exchange macros at a new summary-2.csv copied from
bench/ecosystem/summary.csv. The raw log ratios match that file.
The first paper summary.csv stays as stored.
CPC-FORM.md was still the CON 3.1 abstract, title and keywords.
make_packet.front_problems fails when those fields drift from
rg_main.tex. The word count is check_manuscript.words.
gen_highlights.py writes highlights.txt from rg_main.tex and
fails when a line differs or exceeds 85 characters. The packet
records the lengths of those lines.
CON-status.4 requires a patch bump when normative sentences
change. CON-cell.3, CON-count.4 and CON-units.9 now say
absent or omitted where 4.0.4 said missing.
gen_spec_supp.py --measure names the 4.0.5 text, and
clause_coverage.py --record supersedes the spec-major-11
coverage record. The named commit is the parent.
The writer patch follows the specification text. A stored
measurement stays byte-identical, and a later run appends
the next record. Readers still accept a frame stamped 4.0.4.
The survey frame, the failure matrix, the version-safety
rows and the test-run frame hash supersede the 0.24.0
records. The stored files are unchanged.
The generated fixture stamps specification patch 5.
Record its sha256 in the next pin file.
Set the executable bit so the shebang matches sibling scripts.
Read the successor names once per chain.
The csv path is the json record with a csv suffix.
Resolve docs/source/_generated/cachegrind_results.json by taking
main's newer measurement, then regenerate
docs/source/_generated/cachegrind_results.rst.
The successor walk re-read every later file on each hop.
Parse each file once, then follow supersedes.
Windows CPython has no LDLIBRARY sysconfig value. On MSVC, name
pythonXY.lib from LIBDIR or base_prefix\libs. If that import lib
is not on the target, skip the link instead of panicking. Linux
and macOS still use the LDLIBRARY stem.
py_version_nodot stays 313 or 314 when the GIL is disabled, but the
import library is python313t.lib or python314t.lib. Read the plat
version, ABIFLAGS, or Py_GIL_DISABLED, and link that library.
PYO3_PYTHON is first when it is set. python3 is next, and python is
last, because python3 may be missing or the Microsoft Store alias.
Linux and macOS still call python3.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

There are 5 total unresolved issues (including 3 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 17f5646. Configure here.

Comment thread build.rs
if !dir.is_empty() {
let flag = python_link::msvc_libpath_arg(dir);
println!("cargo:rustc-link-arg-tests={flag}");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

MSVC LIBPATH misses unit tests

High Severity

cargo:rustc-link-arg-tests does not apply to the lib unit-test harness. The generated #[link] lives in src/python.rs unit tests, so on MSVC the search path never reaches the binary that needs pythonXY.lib. cargo test --features python then fails unless that import library already sits on the default LIB path.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 17f5646. Configure here.

Comment thread build.rs

#[cfg(feature = "python")]
#[path = "support/python_link.rs"]
mod python_link;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Python link file omitted from package

High Severity

support/python_link.rs is pulled in by build.rs (python feature) and by lib tests, but Cargo.toml's include list still names only support/metatensor_install.rs. A crates.io package therefore omits the file, so --features python builds and cargo test of the published crate cannot compile.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 17f5646. Configure here.

This branch has not been deployed

No deployments
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