Skip to content

Python Reference Inventory (#4789) ​

The Python files still in packages/ are behavioural references for C# ports that do not exist yet or are not yet covered by tests (AGENTS.md pattern 11, MIGRATION_WORKFLOW.md). They are never built, run or imported by anything. Everything else was deleted once a tested C# port existed, the kernel specification superseded it, or it had no behaviour worth keeping (ADR-2492). Deleted files stay recoverable from git history (for example git show 354f7ea:packages/database/graph.py).

A file leaves this list when one of these is true:

  • Port missing: a C# implementation lands with tests, or the kernel specification or an ADR records that the behaviour is not carried forward.
  • Port untested: tests cover the C# port's main behaviour (the note says which paths are missing).
  • Ported, deletion pending: the tested C# port exists; the file goes once a maintainer approves the deletion.

Delete the Python file and its row here in the same PR. Update the package README's "Python reference sources" line too.

PackagePort missingPort untestedPorted, deletion pending
packages/ddf100
packages/engine_core500
packages/security700

packages/ddf ​

Python fileWhat it doesC# todayStatusNotes
dataset_json_etl.pyeCRF observations → SDTM Dataset-JSONnonePort missing

packages/engine_core ​

Python fileWhat it doesC# todayStatusNotes
operations/engine.pySite startup greenlight facadenonePort missing
operations/evaluator.pyGreenlight rules: IRB, contract, staff qualification, facility, IP depotnonePort missingSpec K-TIME-4/5 and K-AUTH-5 are the target
operations/models.pyGreenlight modelsnonePort missing
timeline/engine.pyVisit-window schedule and deviation assessmentExpectedSchedule (kernel, ADR-2487) places timed activities with their windows and window status from the reference start (K-TIME-7)Port missingEarly/late classification of an actual visit is ExpectedSchedule.Assess (ADR-2507); major/minor is a Quality rule, not a fixed 7 days. Not in the kernel yet (#5045, ADR-2507): repeating cycle templates and visits anchored on another visit
timeline/models.pyTimeline modelsnonePort missing

packages/security ​

Python fileWhat it doesC# todayStatusNotes
auditor_token.pyIssues and validates time-boxed read-only auditor JWTs signed with GATEWAY_SECRET (with a hard-coded fallback)none (AuditorWriteGuardMiddleware.cs only enforces read-only access)Port missingLikely a Keycloak concern under ADR-2256, so the owner could decide to drop it
cert_store.pyX.509 register, revoke, CRL status, self-signed and trust checksnonePort missing
crypto_verifier.pyverify_electronic_signature: JSON/PEM/XML signature parsing, XML-DSig stripping, mock-key detection, asymmetric verification or HMAC fallbackonly the primitive packages/security/src/AsymmetricSigner.AsymmetricVerifyPort missingThe orchestration is not ported
fail_fast.pyRefuses to start in non-dev environments on missing or insecure-fallback secrets; brand validationGATEWAY_SECRET (required, at least 32 chars), the execution demographics key and the gateway service URLs (ADR-2490)Port missingSee note S1
permissions.pySecond permission scheme: PermissionEnum (study:read, rtsm:randomize, …), RoleEnum, role → permission mapnone (C# PermissionMatrix uses a different resource → actions scheme; none of the 26 colon permissions exist in C#)Port missingAsk the owner whether spec §9.3 capability tokens make it obsolete
rbac.pyRole aliases, role → resource → action matrix, Principal, site/study scope, payload masking, auditor checkspackages/security/src/Rbac/RoleNormalization.cs, PermissionMatrix.cs, SiteAccessEvaluator.cs, StudyAccessEvaluator.cs, Blinding/FieldMasker.cs, Authentication/AuditorWriteGuardMiddleware.csPort missingSee note S2
signing.pyGateway HMAC, canonical signature, asymmetric sign, Merkle root and block hash, inbound-email webhook HMAC with replay cache, site greenlight tokenAuthentication/HmacSigner.cs, CanonicalSigner.cs, AsymmetricSigner.cs, Audit/AuditDigestEngine.csPort missingSee note S3

Note S1. fail_fast.py refuses to start outside development when any required secret is missing or still set to an insecure placeholder, and validates the brand settings. In C#, every service requires GATEWAY_SECRET (at least 32 characters), execution requires a valid demographics encryption key and the gateway requires every service URL outside Development (#4872, ADR-2490). To delete: cover the remaining services' required settings the same way, or record that the Python's placeholder and brand checks are dropped.

Note S2. The C# PermissionMatrix has no entries for the roles grants_manager, sponsor_clinical, quality_manager, qa_lead or quality_oversight (rbac.py:645-763). The system and anonymous entries are rightly dropped (K-TX-5). The rest is ported and tested. To delete: port those five role bundles or record that they are dropped.

Note S3. Not ported:

  • verify_inbound_email_signature (eTMF inbound webhook; INBOUND_EMAIL_HMAC_SECRET).
  • generate_greenlight_token / verify_greenlight_token.
  • compute_merkle_root / compute_block_hash.