Skip to content

Media mgr updates and context class #1203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jun 26, 2025

Conversation

JamesHabben
Copy link
Collaborator

  • create context class to hold more info about current module and artifact
  • update media functions to use info from context class to reduce params required from modules
  • see commit notes for more details

- zero matches for test cases in test data so far
- create `Context` class
- update `artifact_processor` to hydrate context info
- update `artifact_processor` to determine old vs context func sig
- update `check_in_media` and `check_in_embedded_media` functions to use context instead of params
- remove now excess parameters from `check_in_media`
- update `test_module` to mock additional functions and context data
- update `test_module` to determine old vs context func sig
update to new media function
- update to use new media functions
- create test case data
- create test case results
- update module to use new media function signatures
- update module to include cache files in file pattern search
- update module to not use seeker to find additional files
- create test case data
- create result data
- update test module to better mock media item info
- update media check in function
- adjust file search path
- update columns to include lava render types
- update to use new media check in function
- update test case data
- update test results
- update to use new media check in function
- create test data
- create test results
- NOTE: responsive files, but no responsive records in db
- update to use new media function
- create test case data
- create test results data
- update to use new media check in
- create test case data
- create test results
- update to use new media function
- create test case data
- create test results
- update a missed line in address book. oops.
update to context param
update to using context param
@JamesHabben JamesHabben requested a review from Johann-PLW June 23, 2025 21:33
@JamesHabben JamesHabben added this to the 2.3.0 milestone Jun 23, 2025
@JamesHabben
Copy link
Collaborator Author

here is a rundown of what's going on:

  • the check in media functions use information about the module and artifact name when recording logs and media item information
  • there is no direct way to get the module and artifact names without going sort of 'back in time' and thats what the inspect.stack()[0] line was doing. it goes to the stack to find out what file was called to get where it is.
  • with the context class, its integrated into the artifact processor which is doing the call to these modules. it knows what module and artifact its calling, so its assigning those values into the context class before calling those modules. see ilapfuncs lines 344-250.
  • since the values are stored in the context object, the check in media functions can now pull from there instead of needing the data from the module itself. see ilapfuncs line 182-186.
  • not needing that info from the modules now simplifies the data needing to be passed in from the modules, so the check in media function params can be simplified. line 181 & 223
    • old: check_in_media(artifact_info, report_folder, seeker, files_found, file_found, app_name, png_path)
    • new: check_in_media(file_found, app_name, png_path)
  • now that we have the context object being created, its easy to add other things to the context. so i added the params that we have traditionally been passing into the artifact functions. with those being in the context object, we can now change the artifact functions to only accept the context.
  • with the function changed, the modules access the exact same data via new getter functions. it even serves to protect these values from being modified by a module accidentally.
    • files_found --> context.get_files_found()
    • report_folder --> context.get_report_folder()
    • seeker --> context.get_seeker()
  • context can now also be used to provide other information to the module, such as device information.
  • for backwards compatibility and not breaking all the existing modules, the artifact processor inspects the function its about to call and determines if it should call the old 5 param or the next single context param. see ilapfuncs lines 352-357.

thats a summary of the changes in context.py and ilapfuncs.py. then i updated a handful of modules to use the new versions. then i also included a bunch of test data stuff that can be ignored for the purposes of this code review.

@JamesHabben JamesHabben marked this pull request as ready for review June 24, 2025 20:01
@Johann-PLW
Copy link
Collaborator

Everything is OK.
Thank you for this welcome improvement.

@Johann-PLW Johann-PLW merged commit e9568c2 into abrignoni:main Jun 26, 2025
1 check failed
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