Skip to content

Reorganizing models and enabling "other" models#12

Merged
jrfaeder merged 64 commits intoRuleWorld:masterfrom
akutuva21:master
May 4, 2026
Merged

Reorganizing models and enabling "other" models#12
jrfaeder merged 64 commits intoRuleWorld:masterfrom
akutuva21:master

Conversation

@akutuva21
Copy link
Copy Markdown
Member

This PR refactors the RuleHub directory structure and updates metadata categories according to the latest requirements.

Key Changes

  1. Restructured Top-Level Directories: Simplified the repository to mainly three directories: Published, Examples, and Tutorials.
  2. Reorganized Models:
    • Moved AI-generated playground examples to the new Examples directory.
    • Moved previously grouped PyBioNetGen published models to Published/PyBioNetGen.
    • Moved all published models adhering to the AuthorYear format from Contributed/ to Published/.
    • Re-distributed BNGPlayground_Validation models based on their origin (published vs. tutorials).
  3. Updated Metadata and Categories:
    • Addressed models grouped ambiguously under "category: other".
    • Introduced descriptive categories (mechanistic-modeling, feature-demos, compartments, wacky, energy, etc.) to the metadata-schema.yaml.
    • Updated corresponding metadata.yaml files.
  4. Updated Scripts:
    • generate-manifest.js and validate-metadata.js modified to scan the new root directories.
  5. Validation and Generation: Re-ran the manifest generation to reflect the correct paths and categories.

google-labs-jules Bot and others added 30 commits March 31, 2026 21:05
- Create \`Examples\`, \`Published\`, and \`Tutorials\` root directories.
- Move \`Contributed/BNGPlayground_Examples\` to \`Examples\`.
- Move published model subdirectories (e.g., PyBioNetGen models, Contributed/Hlavacek2018, Contributed/Mitra2019, Validation models like Korwek2023, MyrtleBeach) to \`Published\`.
- Move remaining items in \`Contributed/BNGPlayground_Validation\` and \`BNGPlayground_PublicRuntime\` to \`Tutorials\`.
- Update \`metadata-schema.yaml\` to add explicit domains (\`compartments\`, \`energy\`, \`wacky\`, \`mechanistic-modeling\`, etc.).
- Update \`metadata.yaml\` files previously labeled as \`other\` with the new, specific categories.
- Update \`scripts/generate-manifest.js\` and \`scripts/validate-metadata.js\` with new \`SEARCH_ROOTS\` and categories.
- Regenerate \`manifest.json\`.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>
…969453

chore: Restructure RuleHub directories and improve metadata categories
Fixes a prototype pollution vulnerability in the `setNested` utility function within `scripts/generate-manifest.js`. The fix explicitly skips and filters out dangerous property names (`__proto__`, `constructor`, `prototype`) during both object traversal and final assignment.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>
* Refactor `scripts/validate-metadata.js` to export `parseScalar` and conditionally execute `main()`.
* Add `scripts/tests/validate-metadata.test.js` covering all behavior.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>
Removed the `# FIX: Add Autoinducer dynamics` comment from `Examples/biology/quorumsensingcircuit/quorum-sensing-circuit.bngl` as the implementation for production and degradation is already present below it.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>
Removed the '# FIX: Add resource dynamics' comment as the resource regeneration and decay rules are already implemented correctly in the model.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>
Updated `setNested` to accept an array of parts instead of a dotted path string, avoiding redundant string splitting.

Tested with a 100,000 iteration benchmark on `parseMetadataYaml`, measuring ~20% improvement (from ~1.25s to ~0.98s).

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>
- Refactor `scripts/validate-metadata.js` to only run `main()` if executed directly.
- Export `validateMetadataFile` to allow testing it in isolation.
- Add comprehensive test suite in `tests/validate-metadata.test.js` covering valid files, missing files, and invalid configuration scenarios using temporary directory fixtures.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>
Refactored generate-manifest.js to allow importing internal functions and added comprehensive unit tests for buildEntry using node:test.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>
Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>
Updated `ds3()` in `sp_fourier_synthesizer.bngl` to use the exact derivative of the 3rd harmonic trigonometric identity instead of an approximation. Cleaned up corresponding comments.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>
Extracted the duplicated listModelFiles function from scripts/generate-manifest.js and scripts/validate-metadata.js into a shared utility module (scripts/utils.js). This improves code maintainability and adheres to DRY principles.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>
…-9077399113245613909

Fix: Remove Autoinducer dynamics FIX comment
…2033588725295054439

Remove resolved FIX comment in eco_food_web_chaos_3sp.bngl
…438250706711219829

🧪 Add generate-manifest.js testing coverage
…3267491605790

⚡ perf(manifest): optimize setNested path handling
…-16219869687540900783

🧪 [testing] add tests for parseScalar in validate-metadata.js
…6954674524457256

🧪 testing: add tests for validateMetadataFile
…451205665425511

🧹 Refactor: Extract listModelFiles function into a shared utility module
…67357569153273

Implement 3rd harmonic using trigonometric identity
…411393383498

🧪 test: add unit tests for custom parseMetadataYaml function
…-15072088604429859966

🔒 Fix Prototype Pollution in setNested
google-labs-jules Bot and others added 29 commits April 27, 2026 17:23
Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>
…n generate-manifest.js

- Add `listModelFilesAsync` utility leveraging `fs.promises.readdir`
- Refactor `main` in `generate-manifest.js` to process directories concurrently via `Promise.all`
- Update error handling in main module execution block

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>
…7290809949050255506

⚡ Optimize synchronous directory read in generate-manifest.js
…060263818870501

🧪 Test parseMetadataYaml in generate-manifest.js
…e-9942811136342454879

🧪 Add test for listMetadataFiles edge case
…0297

🧪 Add test file for scripts/utils.js
…947067788

Fix hack in Disturb_rate function by using exact step function
…55140467607

🧪 test: add exhaustive edge case tests for expectEnum validation
…24971767703189

⚡ Optimize nested path construction in YAML parser
* perf: optimize generate-manifest.js by deferring file read

Avoid unnecessarily reading and parsing metadata.yaml when a directory contains no .bngl model files by moving the `listModelFiles` check before the file read.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

* Merge master into PR branch and resolve conflicts

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
… reads (#47)

* ⚡ Refactor manifest generation to use concurrent async file reads

Replaced the synchronous `fs.readFileSync` loop in `scripts/generate-manifest.js` with `Promise.all()` and `fs.promises.readFile()`. This allows all metadata files to be read concurrently rather than sequentially.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

* Acknowledge obsolete PR and resolve conflicts

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* test: comprehensive test suite for parseMetadataYaml

Add detailed test cases for `parseMetadataYaml` and `parseScalar` to `scripts/validate-metadata.test.js`, covering complex YAML parsing logic and prototype pollution defense.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

* test: comprehensive test suite for parseMetadataYaml

Add detailed test cases for `parseMetadataYaml` and `parseScalar` to `scripts/validate-metadata.test.js`, covering complex YAML parsing logic and prototype pollution defense. Resolved merge conflicts.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* 🧪 Test setNested in validate-metadata.js

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

* 🧪 Test setNested in validate-metadata.js

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* 🧪 test: add coverage for listMetadataFiles in generate-manifest.js

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

* 🧪 test: add coverage for listMetadataFiles in generate-manifest.js

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

* 🧪 test: resolve merge conflicts after pull from master

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* 🧪 Add tests for setNested function

Export setNested from validate-metadata.js and add a comprehensive test suite for it in validate-metadata.test.js. Tests cover basic creation, nested property assignment, and prototype pollution prevention mechanisms.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

* 🧪 Add tests for setNested function

Export setNested from validate-metadata.js and add a comprehensive test suite for it in validate-metadata.test.js. Tests cover basic creation, nested property assignment, and prototype pollution prevention mechanisms.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
- Exported `normalizeModelKey` from `scripts/validate-metadata.js`.
- Added a full test suite for `normalizeModelKey` in `scripts/tests/validate-metadata.test.js` covering case conversion, extension stripping, sanitization of special characters, and edge cases.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* Refactor: Centralize YAML parsing and data structure functions in scripts/utils.js

This commit moves the duplicated functions `parseMetadataYaml`, `parseScalar`, and `setNested`
from `scripts/validate-metadata.js` and `scripts/generate-manifest.js` to a central utility file
`scripts/utils.js`. It also updates tests and script imports to reflect this change, improving
code maintainability and removing duplicated logic.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

* Merge master and resolve conflicts

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
)

* refactor(scripts): deduplicate setNested function\n\nExtracted the setNested function from scripts/generate-manifest.js and scripts/validate-metadata.js into the shared scripts/utils.js module to improve consistency and maintainability. Updated validate-metadata.js to pass the array of path parts instead of a joined string, aligning with the generalized signature.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

* refactor(scripts): deduplicate setNested function\n\nExtracted the setNested function from scripts/generate-manifest.js and scripts/validate-metadata.js into the shared scripts/utils.js module to improve consistency and maintainability. Updated validate-metadata.js to pass the array of path parts instead of a joined string, aligning with the generalized signature. Resolved merge conflicts.

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* test: add test suite for parseArgs in generate-manifest.js

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

* test: merge origin/master and resolve conflicts in generate-manifest.test.js

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Replaced synchronous `fs.readFileSync` with `await fs.promises.readFile` in `scripts/validate-metadata.js`.
Modified `validateMetadataFile` and `main` to be `async` and used `Promise.all` to allow concurrent file I/O operations instead of blocking synchronous reads. Updated the corresponding tests to handle the asynchronous implementation.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* test: add coverage for setNested in generate-manifest.js

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

* test: add coverage for setNested in generate-manifest.js

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* test: add tests for parseArgs in generate-manifest.js

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

* test: resolve merge conflicts and add tests for parseArgs in generate-manifest.js

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
- Add gallery-categories.yaml with 16 category definitions
- Rewrite generate-manifest.js with collection collapsing, --slim flag, compatibility object
- Add generate-gallery.js to build gallery.json from metadata
- Add backfill-metadata.js to generate missing metadata.yaml from .bngl
- Add apply-gallery-assignments.js to patch metadata with gallery categories
- Add gallery-assignments.json with correct category mappings (264 models)
- Update metadata-schema.yaml with new fields (gallery_categories, sort_priority, etc.)
- Update CI workflow to validate manifest.json, manifest-slim.json, gallery.json
- Add pybnf_files to DEFAULT_IGNORE_DIRS
- Move broken extract-gallery-from-constants.js to scripts/migration/

Result: 482 manifest entries (down from 755), 367 gallery assignments with proper categories (cancer: 20, immunology: 30, neuroscience: 14, etc.)
The last commit changed the metadata schema from gallery_category (singular
string) to gallery_categories (plural array), but the validation script
was not updated to match.

Also applied gallery-assignments.json to populate gallery_categories
for models that had assignments defined.
- Make gallery_categories optional (new field, not all models have it)
- Make source.original_repository optional
- Make compatibility.simulation_methods optional
- Remove strict check for multiple .bngl files without collection
- Allow missing README.md for generated subdirectories
- Sort model IDs alphabetically in assignments for deterministic output
- Sort category tags within each model for consistent ordering
- Regenerate gallery.json with new deterministic format
@jrfaeder jrfaeder merged commit 479d6d6 into RuleWorld:master May 4, 2026
1 check passed
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