The MolOps screening pipeline uses a Python-based molecular graph analyzer to validate bond graphs for small organic compounds before chemists can release a suspect-batch report. During a recent incident hotfix, several components drifted and the production triage job now fails.
No internet access or third-party chemistry libraries are available β all chemistry knowledge is encoded directly in the Python source and JSON fixtures.
Repair all bugs in the codebase so that the static incident verifier (verify.sh)
accepts the graph algorithms, deterministic report generation, and Make-driven
audit workflow.
The code must:
- Correctly compute bond-order sums for all atoms in a molecular graph
- Use correct standard valence values for common organic elements
- Properly normalize aromatic bonds (KekulΓ© alternation: alternating single/double)
- Validate atom valences using bond-order sums (not neighbor counts)
- Generate deterministic reports (consistent ordering across runs)
- Have a working Makefile with correct targets and safe
cleanbehaviour
make auditfails to execute at all- When run manually, the audit reports incorrect expected valence for oxygen-containing molecules
- Benzene fails valence checks after aromatic bond normalization
- Molecules with double bonds report wrong actual bond-order sums
- Running the audit multiple times may produce differently-ordered reports
make cleanhas destructive behaviour that removes input fixture data
workspace/
βββ molops/ # Python package (contains bugs)
β βββ __init__.py
β βββ graph.py # Molecular graph data structure
β βββ valence.py # Standard valence rules & validation
β βββ normalize.py # Aromatic bond-order normalization
β βββ report.py # Audit report generation
βββ fixtures/ # JSON molecular graph fixtures (correct β do NOT modify)
β βββ water.json # HβO
β βββ methane.json # CHβ
β βββ ethanol.json # CβHβ
OH
β βββ benzene.json # CβHβ
β βββ acetic_acid.json # CHβCOOH
βββ run_audit.py # Main audit entry point
βββ Makefile # Build / audit workflow targets (contains bugs)
From the project root:
bash verify.shAll verification phases must pass for the task to be considered complete.
| Element | Standard Valence (total bond-order sum) |
|---|---|
| H | 1 |
| C | 4 |
| N | 3 |
| O | 2 |
| S | 2 |
| F | 1 |
| Cl | 1 |
| Br | 1 |
Aromatic bonds (order 1.5) must be normalized to KekulΓ© form: alternating double (2) and single (1) bonds around the ring.