Skip to content

PCF-DCP: full TypeScript / .NET / PHP ports + cross-port conformance#24

Open
kduma wants to merge 5 commits into
masterfrom
claude/dynamic-nonlinear-partitions-vSXIn
Open

PCF-DCP: full TypeScript / .NET / PHP ports + cross-port conformance#24
kduma wants to merge 5 commits into
masterfrom
claude/dynamic-nonlinear-partitions-vSXIn

Conversation

@kduma

@kduma kduma commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Brings the PCF-DCP profile (Dynamic Container Partition) from Rust-only to
full parity across all four languages, modeled 1:1 on the pcf-sig ports.
Each port is a complete library — reader, writer, arena (content-defined dedup,
copy-on-write edits, sharing-preserving compaction), and promotion/demotion —
layered strictly above the base pcf package with no cryptographic
dependency
(data/table hashing comes from pcf). No CLI, matching the
library-only precedent of the existing profile ports.

The strongest guarantee: all four writers (Rust, TypeScript, .NET, PHP) emit
the byte-identical canonical 700-byte vector
, SHA-256
b9bb59794abed008863063886d8d0daa810c44939c1c5d29449475ced8156b90 (spec §17),
verified locally and in CI.

Commits

Commit What
5f169c5 Build fix — the v0.0.9 release bump missed three crates' path-dep pins (pfs-mspcf-sig/pcf-sig-cli, and all of tools/pcf-sig), leaving them at 0.0.8 while the crates are 0.0.9. A ^0.0.8 requirement excludes 0.0.9, so cargo could not resolve the workspace at all. Bumps the pins and hardens release-prepare.yml so it can't recur.
5f64e80 TypeScript port @kduma-oss/pcf-dcp — 28 vitest tests, coverage, byte-exact vector.
d1105f9 .NET port KDuma.Pcf.Dcp (netstandard2.0) — 28 xUnit tests, dotnet pack, byte-exact vector.
d605cb2 PHP port kduma/pcf-dcp (≥8.1) — 28 PHPUnit tests, composer validate, byte-exact vector.
c290104 Cross-port conformance — Rust cross_port_testdata test asserting each port ships the identical 700-byte canonical.bin, plus a cross-port-interop.yml job that regenerates all four writers and pins the SHA.

Note: the first commit (5f169c5) is an independent fix for a latent
master-build breakage discovered while merging master; it's bundled here
because the new Rust cross-port test can't compile until the workspace builds.

Each port mirrors the Rust crate

  • consts / errors / header / fragment — on-disk records (24 B DCP Header, 9 B Fragment Table header, 18 B Fragment Entry) + walk/reconstruct.
  • arena — in-memory byte pool + fragment lists; content-defined dedup (intra- and inter-partition), CoW edits (append / insert / overwrite / delete / truncate via fragment splitting), mark-and-sweep compact normalising the SHARED flag, and a canonical serialiser reproducing the §17 layout.
  • readerDcpReader over the base Container, so trailer-mode host files read transparently; full DCP-aware verify (inner table_hash, reconstruction length + data_hash, no nesting, file-wide uid uniqueness).
  • writer — whole-file model with promotion (a MOVE preserving uid + data_hash — the promotion invariant), demotion, dedup, defrag, optional trailer.
  • vector + example + testdata/canonical.bin.

CI / release wiring

  • TS: workspace + ts-ci.yml (build / test / 700-byte test-vector / coverage) + release.yml npm publish.
  • .NET: dotnet-ci.yml matrix + release.yml publish-nuget-dcp job.
  • PHP: php.yml matrix + 700-byte test-vector + php-split.yml (→ PHP-PCF-DCP-lib) + release-prepare.yml composer pin bump.
  • Cross-port: cross-port-interop.yml cross-port-byte-exact-dcp job.

Verification (local)

  • Rust: cargo build/test/clippy/fmt green (incl. the new cross_port_testdata).
  • TS: npm test -w @kduma-oss/pcf-dcp (28) + coverage thresholds.
  • .NET: dotnet test (28) + dotnet pack.
  • PHP: vendor/bin/phpunit (28) + composer validate --strict.
  • Cross-check: the Rust, TS, .NET and PHP writers each produce the same 700-byte file with the pinned SHA-256.

https://claude.ai/code/session_01XzcjWWbNiuNX9ZywevfbQu


Generated by Claude Code

claude added 5 commits June 8, 2026 12:38
The v0.0.9 release-prepare bump missed three crates added in the same cycle,
leaving path-dependency version pins at 0.0.8 while the crates themselves are
0.0.9. Because a `^0.0.8` requirement excludes 0.0.9, cargo could not resolve
the workspace at all.

- reference/PFS-MS-v1.0: bump pcf-sig and pcf-sig-cli pins to 0.0.9.
- tools/pcf-sig: bump its own version and its pcf / pcf-sig pins to 0.0.9.
- release-prepare.yml: add the missing sed lines (tools/pcf-sig version + pins,
  PFS-MS pcf-sig / pcf-sig-cli pins) so future bumps stay in lockstep.

cargo build --workspace is green again.

https://claude.ai/code/session_01XzcjWWbNiuNX9ZywevfbQu
Full library port of the PCF-DCP profile to TypeScript, modeled 1:1 on the
@kduma-oss/pcf-sig port and layered strictly above @kduma-oss/pcf (no crypto
dependencies — DCP does not sign; data/table hashing comes from the base pcf).

- src/{consts,errors,header,fragment}.ts: on-disk records (24 B DCP Header,
  9 B Fragment Table header, 18 B Fragment Entry) + walk/reconstruct.
- src/arena.ts: in-memory model with content-defined dedup (intra/inter
  partition), copy-on-write edits (append/insert/overwrite/delete/truncate),
  mark-and-sweep compaction that normalises the SHARED flag, and a canonical
  serialiser reproducing the spec Section 17 layout.
- src/reader.ts: DcpReader over Container (trailer-mode transparent); full
  DCP-aware verify. src/writer.ts: DcpWriter whole-file model with promotion
  (a MOVE preserving uid + data_hash), demotion, dedup, defrag, optional trailer.
- src/vector.ts + examples/gen-testvector.ts reproduce the byte-exact 700-byte
  vector (SHA-256 b9bb5979…), identical to the Rust reference and the other
  ports. testdata/canonical.bin shipped (gitignore negation added).
- 28 vitest tests (canonical, spec-compliance, roundtrip, coverage);
  coverage >=85% lines / >=90% functions.

Wiring: add pcf-dcp to the ts workspace; build/test/test-vector(700)/coverage
in ts-ci.yml; npm publish -w @kduma-oss/pcf-dcp after pcf-sig in release.yml.

https://claude.ai/code/session_01XzcjWWbNiuNX9ZywevfbQu
Full library port of the PCF-DCP profile to C#/.NET (netstandard2.0), modeled
1:1 on the KDuma.Pcf.Sig port and layered strictly above KDuma.Pcf via a
ProjectReference. No crypto dependency — data/table hashing comes from the base
PCF library.

- src/Pcf.Dcp/{Constants,PcfDcpException,LittleEndian,DcpHeader,FragmentEntry,
  FragTableHeader,Chunker,InnerInfo}.cs: on-disk records + Fragment Table walk/
  reconstruct.
- src/Pcf.Dcp/Arena.cs: in-memory model with content-defined dedup (intra/inter
  partition), copy-on-write edits (Append/Insert/Overwrite/Delete/Truncate),
  mark-and-sweep compaction normalising the SHARED flag, and a canonical
  serialiser reproducing the spec Section 17 layout.
- src/Pcf.Dcp/DcpReader.cs: DcpReader over Container (trailer-mode transparent)
  with full DCP-aware Verify. src/Pcf.Dcp/DcpWriter.cs: whole-file model with
  Promote (a MOVE preserving uid + data_hash), Demote, Dedup, Defrag, trailer.
- src/Pcf.Dcp/ReferenceVector.cs reproduces the byte-exact 700-byte vector
  (SHA-256 b9bb5979…), identical to the Rust reference and the TS port.
  testdata/canonical.bin shipped.
- 28 xUnit tests (canonical, spec-compliance, roundtrip, coverage), all green;
  dotnet pack produces KDuma.Pcf.Dcp.nupkg.

Wiring: dotnet-ci.yml paths + matrix include pcf-dcp; release.yml adds a
publish-nuget-dcp job (needs publish-nuget). Shared Directory.Build.props
already carries the 0.0.9 version.

https://claude.ai/code/session_01XzcjWWbNiuNX9ZywevfbQu
Full library port of the PCF-DCP profile to PHP (>=8.1), modeled 1:1 on the
kduma/pcf-sig port and layered strictly above kduma/pcf via a path repository.
No crypto dependency (ext-sodium not required) — data/table hashing comes from
the base PCF library (ext-hash).

- src/{Consts,ErrorKind,PcfDcpException,DcpHeader,FragmentEntry,FragTableHeader,
  FragmentTable,Chunker,ExtentInfo,InnerInfo}.php: on-disk records + Fragment
  Table walk/reconstruct.
- src/Arena.php: in-memory model with content-defined dedup (intra/inter
  partition), copy-on-write edits (append/insert/overwrite/delete/truncate),
  mark-and-sweep compaction normalising the SHARED flag, and a canonical
  serialiser reproducing the spec Section 17 layout.
- src/DcpReader.php: DcpReader over Container (trailer-mode transparent) with
  full DCP-aware verify. src/DcpWriter.php: whole-file model with promote (a
  MOVE preserving uid + data_hash), demote, dedup, defrag, trailer.
- src/ReferenceVector.php reproduces the byte-exact 700-byte vector
  (SHA-256 b9bb5979…), identical to the Rust reference and the TS/.NET ports.
  testdata/canonical.bin shipped.
- 28 PHPUnit tests (canonical, spec-compliance, roundtrip, coverage), all green;
  composer validate --strict passes.

Wiring: php.yml test + test-vector(700) matrices include pcf-dcp; php-split.yml
splits to PHP-PCF-DCP-lib; release-prepare.yml bumps the pcf-dcp composer pin.

https://claude.ai/code/session_01XzcjWWbNiuNX9ZywevfbQu
Mirror the PCF-SIG cross-port machinery for DCP so all four implementations are
held to the same byte-exact canonical vector.

- reference/PCF-DCP-v1.0/tests/cross_port_testdata.rs: assert that the
  testdata/canonical.bin shipped by each language port (TS, PHP, .NET) is
  byte-identical to the reference 700-byte vector, and that the reference is
  exactly 700 bytes.
- cross-port-interop.yml: add a cross-port-byte-exact-dcp job that regenerates
  the DCP vector from each writer (Rust example, TS/PHP gen-testvector, an
  on-the-fly .NET CLI over ReferenceVector.Build) and asserts all four match the
  pinned SHA-256 b9bb5979… and each other; add DCP trigger paths.

Verified locally: the Rust, TypeScript, PHP and .NET writers all emit the same
700-byte file with SHA-256
b9bb59794abed008863063886d8d0daa810c44939c1c5d29449475ced8156b90.

https://claude.ai/code/session_01XzcjWWbNiuNX9ZywevfbQu
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.

2 participants