|
| 1 | +# lo_assets Built Package Reference |
| 2 | + |
| 3 | +This document explains how Learning Observer consumes built packages from [`ArgLab/lo_assets`](https://github.com/ArgLab/lo_assets), why this exists, and current operational caveats. |
| 4 | + |
| 5 | +## Why `lo_assets` exists |
| 6 | + |
| 7 | +Some frontend-related packages require an `npm` build step before they are usable. That build tooling is not always available on deployment servers, so we publish prebuilt artifacts to `lo_assets` and fetch them during setup/startup. |
| 8 | + |
| 9 | +In `lo_assets`, each package typically has its own directory containing: |
| 10 | + |
| 11 | +- versioned archives (for example, `package-name-v1.2.3.tar.gz`) |
| 12 | +- a `package-name-current.tar.gz` pointer file (a plain-text file containing the current archive filename) |
| 13 | + |
| 14 | +## Where this repository is referenced in Learning Observer |
| 15 | + |
| 16 | +### 1) Python package install path (`Makefile`) |
| 17 | + |
| 18 | +The top-level `Makefile` installs `lo_dash_react_components` by: |
| 19 | + |
| 20 | +1. downloading `lo_dash_react_components-current.tar.gz` from `lo_assets` |
| 21 | +2. reading the returned filename |
| 22 | +3. installing that resolved tarball with `pip` |
| 23 | + |
| 24 | +This is implemented in the `install` target and is currently specialized to LODRC. |
| 25 | + |
| 26 | +### 2) Runtime frontend asset fetch (`remote_assets.py`) |
| 27 | + |
| 28 | +`learning_observer.remote_assets.fetch_module_assets()` supports a generic pointer-file workflow for prebuilt frontend bundles (for example exported Next.js apps): |
| 29 | + |
| 30 | +1. read a `*-current.tar.gz` pointer file from `lo_assets` |
| 31 | +2. resolve it to a concrete archive name |
| 32 | +3. download and extract the archive into a target module directory |
| 33 | + |
| 34 | +This logic is used for modules that ship prebuilt frontend assets outside of the main repo. |
| 35 | + |
| 36 | +## Package-specific notes |
| 37 | + |
| 38 | +### LODRC (`lo_dash_react_components`) |
| 39 | + |
| 40 | +- This is a Python package, so downloading and reinstalling is an acceptable update path. |
| 41 | +- Current behavior is handled by the top-level `Makefile` install process. |
| 42 | + |
| 43 | +### Portfolio Diff (`wo_portfolio_diff`) |
| 44 | + |
| 45 | +- This is a Next.js-derived frontend bundle copied into `modules/wo_portfolio_diff/wo_portfolio_diff`. |
| 46 | +- Current fetch logic can pull the bundle when assets are missing. |
| 47 | +- Current behavior does **not** automatically refresh when a newer remote bundle exists and local assets are already present. |
| 48 | + |
| 49 | +## Operational caveats |
| 50 | + |
| 51 | +- Whenever a new package version is published in `lo_assets`, the `*-current.tar.gz` pointer file should also be updated to point to that new archive. |
| 52 | +- Most consuming code paths intentionally resolve the `current` pointer rather than pinning a hard-coded version. |
| 53 | +- In some cases, users may need to remove local assets and re-run setup/startup steps to force retrieval of the latest bundle. |
| 54 | + |
| 55 | +## Future improvement (TODO) |
| 56 | + |
| 57 | +A generic Learning Observer startup check should: |
| 58 | + |
| 59 | +1. track the resolved remote archive version in a local state file |
| 60 | +2. compare local version vs. current `*-current.tar.gz` pointer target |
| 61 | +3. auto-refresh assets when the remote current version changes |
| 62 | + |
| 63 | +This would eliminate manual remove-and-refetch workflows and make behavior consistent across modules. |
0 commit comments