Repository navigation
Add source URLs for material properties - #13
Conversation
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
| "density": float, | ||
| "elastic_modulus": float, | ||
| "yield_strength": float, | ||
| "source": str, | ||
| }, | ||
| ) | ||
| """TypedDict: New type to contain material properties""" | ||
| """TypedDict: New type to contain material properties. | ||
|
|
||
| The ``source`` field stores a URL pointing to the origin of the | ||
| mechanical property data for traceability. |
There was a problem hiding this comment.
[P1] Populate source for materials loaded from files
Introducing source as a required key on the Material TypedDict means every Material is now expected to provide provenance information, yet the file readers (read_trs and read_json) still construct material dictionaries with only name, density, elastic modulus, and yield strength. Any truss rebuilt from a .trs or JSON file will therefore produce Material objects without a source, and downstream code that relies on the new field (e.g. material["source"] or re‑serialisation) will raise KeyError or silently drop the provenance after a save/load cycle. Consider defaulting to an empty string or looking up the source from MATERIAL_LIBRARY when creating materials from external data.
Useful? React with 👍 / 👎.
Summary
sourcefieldTesting
ruff check trussme testsmypy trussme/components.py --config-file /tmp/mypy.ini(fails: Missing key "source" for TypedDict "Material" in truss.py and other pre-existing issues)pytestpip-audithttps://chatgpt.com/codex/tasks/task_e_68bcc02ee20083259f085a314b3fd841