codecraftai-integration-runtime 1.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. ccai/integrationruntime/__init__.py +27 -0
  2. ccai/integrationruntime/entrypoints.py +59 -0
  3. ccai/integrationruntime/initialize.py +100 -0
  4. ccai/integrationruntime/integratedtestjob.py +100 -0
  5. ccai/integrationruntime/integrationruntimedefaulttypefactory.py +51 -0
  6. ccai/integrationruntime/py.typed +0 -0
  7. ccai/integrationruntime/results/__init__.py +13 -0
  8. ccai/integrationruntime/results/concentrators/__init__.py +13 -0
  9. ccai/integrationruntime/results/concentrators/progressconcentratorservice.py +526 -0
  10. ccai/integrationruntime/results/recorders/__init__.py +22 -0
  11. ccai/integrationruntime/results/recorders/integrationjsonresultrecorder.py +126 -0
  12. ccai/integrationruntime/results/recorders/streamingresultrecorder.py +271 -0
  13. ccai/integrationruntime/results/streaming/__init__.py +25 -0
  14. ccai/integrationruntime/results/streaming/resultstreamer.py +581 -0
  15. ccai/integrationruntime/runtimeoutputcontext.py +68 -0
  16. ccai/integrationruntime/runtimerunmetadata.py +165 -0
  17. ccai/integrationruntime/templates/v2/static/images/test-report-banner-background-image.png +0 -0
  18. ccai/integrationruntime/templates/v2/static/javascript/d3.v7.js +20625 -0
  19. ccai/integrationruntime/templates/v2/static/javascript/icon-components.js +510 -0
  20. ccai/integrationruntime/templates/v2/static/javascript/mojo-components.js +1417 -0
  21. ccai/integrationruntime/templates/v2/static/javascript/prism.js +1789 -0
  22. ccai/integrationruntime/templates/v2/static/javascript/testsummary-accessibility.js +704 -0
  23. ccai/integrationruntime/templates/v2/static/javascript/testsummary-comparison.js +1287 -0
  24. ccai/integrationruntime/templates/v2/static/javascript/testsummary-components.js +3499 -0
  25. ccai/integrationruntime/templates/v2/static/javascript/testsummary-helpers.js +426 -0
  26. ccai/integrationruntime/templates/v2/static/javascript/testsummary-responsive.js +493 -0
  27. ccai/integrationruntime/templates/v2/static/javascript/testsummary.js +1128 -0
  28. ccai/integrationruntime/templates/v2/static/javascript/webcomponent-helpers.js +112 -0
  29. ccai/integrationruntime/templates/v2/static/styles/branding-theme.css +144 -0
  30. ccai/integrationruntime/templates/v2/static/styles/icon-styles.css +9 -0
  31. ccai/integrationruntime/templates/v2/static/styles/mojo-components.css +384 -0
  32. ccai/integrationruntime/templates/v2/static/styles/prism.css +143 -0
  33. ccai/integrationruntime/templates/v2/static/styles/tabs-responsive.css +186 -0
  34. ccai/integrationruntime/templates/v2/static/styles/testsummary-accessibility.css +413 -0
  35. ccai/integrationruntime/templates/v2/static/styles/testsummary-comparison.css +746 -0
  36. ccai/integrationruntime/templates/v2/static/styles/testsummary-responsive.css +679 -0
  37. ccai/integrationruntime/templates/v2/static/styles/testsummary.css +1631 -0
  38. ccai/integrationruntime/templates/v2/tabs/tab-data.html +870 -0
  39. ccai/integrationruntime/templates/v2/tabs/tab-images.html +110 -0
  40. ccai/integrationruntime/templates/v2/tabs/tab-logs.html +594 -0
  41. ccai/integrationruntime/templates/v2/tabs/tab-sounds.html +112 -0
  42. ccai/integrationruntime/templates/v2/tabs/tab-timeseries.html +368 -0
  43. ccai/integrationruntime/templates/v2/tabs/tab-videos.html +372 -0
  44. ccai/integrationruntime/templates/v2/testsummary.html +81 -0
  45. codecraftai_integration_runtime-1.3.0.dist-info/METADATA +73 -0
  46. codecraftai_integration_runtime-1.3.0.dist-info/RECORD +48 -0
  47. codecraftai_integration_runtime-1.3.0.dist-info/WHEEL +4 -0
  48. codecraftai_integration_runtime-1.3.0.dist-info/licenses/LICENSE.md +204 -0
@@ -0,0 +1,27 @@
1
+ """
2
+ .. package:: ccai.integrationruntime
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: The integration test-job layer of the Code Craft AI suite.
5
+
6
+ This package hosts :class:`IntegratedTestJob` and the heavyweight reporting /
7
+ integration machinery (JSOS/JSON streaming recorder, HTML summary rendering,
8
+ result server, progress concentrators, streaming infrastructure, and the
9
+ activation-driven integration CLI) that extends the near-standalone
10
+ :mod:`ccai.testbase` single-host test framework.
11
+
12
+ Present (Phase 4 core plus the landed Phase 3 results split): :class:`IntegratedTestJob` /
13
+ :class:`DefaultIntegratedTestJob` (``integratedtestjob``), :class:`RuntimeOutputContext`
14
+ (``runtimeoutputcontext``), :class:`RuntimeRunMetadata` (``runtimerunmetadata``), the
15
+ :class:`IntegrationRuntimeDefaultTypeFactory` extension that registers the integration default
16
+ job type, the integration entry point / activation wiring (``entrypoints``, ``initialize``), and
17
+ the reporting code split out of ``codecraftai-testbase`` -- the JSON/JSOS streaming recorder, HTML
18
+ summary rendering, ``templates/v2``, streaming infrastructure, progress concentrators, and result
19
+ server -- all now local to this package. See
20
+ ``REFACTOR-TESTBASE-INTEGRATION-RUNTIME-ROADMAP.md`` at the monorepo root.
21
+
22
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
23
+ """
24
+
25
+ __author__ = "Myron Walker"
26
+ __copyright__ = "Copyright 2026, Code Craft AI LLC"
27
+ __credits__ = []
@@ -0,0 +1,59 @@
1
+ """
2
+ .. module:: ccai.integrationruntime.entrypoints
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: The integration test entry point — activates the application as a test-run job, then
5
+ runs a test module under an :class:`IntegratedTestJob`.
6
+
7
+ Plain ``testbase`` exposes :func:`ccai.testbase.entrypoints.generic_test_entrypoint`, the
8
+ standalone entry point that records to stdout via ``StdoutResultRecorder`` and performs no
9
+ activation. :func:`integrated_test_entrypoint` is the integration counterpart: it performs the
10
+ this-app activation (persona + runtime-variable resolution + ``activate_profile_job``) so the
11
+ presence-folder / ``RuntimeVariables`` behaviour is available, then delegates to the same
12
+ decoupled testbase core with an :class:`IntegratedTestJob`-derived job type — which records JSOS
13
+ + the rendered HTML summary under the presence folder.
14
+
15
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
16
+ """
17
+
18
+ __author__ = "Myron Walker"
19
+ __copyright__ = "Copyright 2026, Code Craft AI LLC"
20
+ __credits__ = []
21
+
22
+
23
+ from typing import Optional, Type
24
+
25
+ from ccai.testbase.testjob import TestJob
26
+ from ccai.testbase.entrypoints import generic_test_entrypoint
27
+
28
+ from ccai.integrationruntime.initialize import initialize_integration_runtime, initialize_integration_results
29
+ from ccai.integrationruntime.integratedtestjob import DefaultIntegratedTestJob
30
+
31
+
32
+ def integrated_test_entrypoint(job_type: Optional[Type[TestJob]] = None) -> None:
33
+ """
34
+ Integration test entry point for running a test module under an :class:`IntegratedTestJob`.
35
+
36
+ Activates the process as a ``TestRun`` job (establishing the application persona, resolving
37
+ runtime variables, and configuring the result resources) and then delegates to the decoupled
38
+ testbase core (:func:`generic_test_entrypoint`) — which performs test-module resolution,
39
+ argument parsing, and job execution. Because the runtime is activated, the
40
+ :class:`IntegratedTestJob` records results under the well-known presence folder.
41
+
42
+ :param job_type: The :class:`TestJob` subclass to run. Defaults to
43
+ :class:`DefaultIntegratedTestJob` when not supplied. (Downstream packages such as
44
+ ``testplus`` pass their own ``IntegratedTestJob``-derived type.)
45
+
46
+ :returns: This function does not return; ``generic_test_entrypoint`` exits with the
47
+ test result code.
48
+ """
49
+ initialize_integration_runtime()
50
+
51
+ initialize_integration_results()
52
+
53
+ resolved_job_type = job_type
54
+ if resolved_job_type is None:
55
+ resolved_job_type = DefaultIntegratedTestJob
56
+
57
+ generic_test_entrypoint(job_type=resolved_job_type)
58
+
59
+ return
@@ -0,0 +1,100 @@
1
+ """
2
+ .. module:: ccai.integrationruntime.initialize
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: The integration activation/initialisation wiring — establishing the application
5
+ persona, resolving runtime variables, configuring HTML result resources, and
6
+ activating the process as a ``TestRun`` job.
7
+
8
+ This is the integration init that used to live in ``ccai.testbase.initialize``
9
+ (``initialize_testbase_runtime`` / ``initialize_testbase_results``). It moved here as part of
10
+ pushing ``testbase`` down the dependency tree: plain ``testbase`` runs standalone (stdout,
11
+ ``SimpleOutputContext``, no activation), while the integration runtime performs the activation
12
+ that lights up the presence-folder / ``RuntimeVariables`` behaviour consumed by
13
+ :class:`ccai.integrationruntime.integratedtestjob.IntegratedTestJob`.
14
+
15
+ .. note::
16
+ As of the landed Phase 3 results split, the HTML summary template + static-resource paths
17
+ live in this package's own ``templates/v2``; :class:`IntegrationResultResources` resolves
18
+ them from this package directory.
19
+
20
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
21
+ """
22
+
23
+ __author__ = "Myron Walker"
24
+ __copyright__ = "Copyright 2026, Code Craft AI LLC"
25
+ __credits__ = []
26
+
27
+
28
+ import os
29
+
30
+ from ccai.thisapp.wellknown import ThisApplicationSingleton
31
+ from ccai.thisapp.persona import establish_app_persona
32
+ from ccai.thisapp.enumerations import JobType
33
+ from ccai.thisapp.activation import activate_profile_job
34
+ from ccai.thisapp.runtimevariables import RuntimeVariables, RuntimeVariablesDesc, resolve_runtime_variables
35
+
36
+
37
+ _PACKAGE_DIR = os.path.dirname(__file__)
38
+
39
+
40
+ class IntegrationResultResources:
41
+ """
42
+ Well-known locations of the HTML summary template and static render resources used by the
43
+ integration result recorder. As of the Phase 3 results split these resources live in this
44
+ package's own ``templates/v2`` directory (relocated out of ``codecraftai-testbase``).
45
+ """
46
+
47
+ TEMPLATES_DIR = os.path.join(_PACKAGE_DIR, "templates")
48
+ RESOURCE_DEST_LEAF = os.path.join("static", "v2")
49
+ RESOURCE_SRC_DIR = os.path.join(TEMPLATES_DIR, "v2", "static")
50
+ SUMMARY_TEMPLATE = os.path.join(TEMPLATES_DIR, "v2", "testsummary.html")
51
+
52
+
53
+ def initialize_integration_runtime(name: str = "ccai", logger_name: str = "TB",
54
+ log_basename: str = "testrun") -> None:
55
+ """
56
+ Establishes the application persona and resolves runtime variables for an integration run.
57
+
58
+ This must be called early in an integration entry point, before constructing an
59
+ :class:`IntegratedTestJob`, so the ``ThisApplication`` singleton and ``RuntimeVariables`` are
60
+ available.
61
+
62
+ :param name: The application name (also the home-directory leaf under the user's home).
63
+ :param logger_name: The prefix used to identify log messages.
64
+ :param log_basename: The base name used for log files.
65
+
66
+ :returns: None
67
+ """
68
+ home_dir = os.path.join(os.path.expanduser("~"), name)
69
+
70
+ establish_app_persona(name=name, presence_dir=home_dir, logger_name=logger_name, log_basename=log_basename)
71
+
72
+ resolve_runtime_variables()
73
+
74
+ return
75
+
76
+
77
+ def initialize_integration_results() -> None:
78
+ """
79
+ Configures the HTML result-resource paths (if unset) and activates the process as a
80
+ ``TestRun`` job.
81
+
82
+ Activation sets ``AM_JOB_TYPE`` (lighting up the presence-folder path helpers) and wires up
83
+ logging for the job profile. It must be called after :func:`initialize_integration_runtime`.
84
+
85
+ :returns: None
86
+ """
87
+ this_app = ThisApplicationSingleton()
88
+
89
+ dest_static_dir = os.path.join(RuntimeVariables.AM_PRESENCE_DIR, "results", IntegrationResultResources.RESOURCE_DEST_LEAF)
90
+
91
+ if RuntimeVariables.AM_RESULTS_STATIC_RESOURCE_SRC_DIR is None:
92
+ this_app.override_variable_value(RuntimeVariablesDesc.AM_RESULTS_STATIC_RESOURCE_SRC_DIR, IntegrationResultResources.RESOURCE_SRC_DIR)
93
+ if RuntimeVariables.AM_RESULTS_STATIC_RESOURCE_DEST_DIR is None:
94
+ this_app.override_variable_value(RuntimeVariablesDesc.AM_RESULTS_STATIC_RESOURCE_DEST_DIR, dest_static_dir)
95
+ if RuntimeVariables.AM_RESULTS_STATIC_SUMMARY_TEMPLATE is None:
96
+ this_app.override_variable_value(RuntimeVariablesDesc.AM_RESULTS_STATIC_SUMMARY_TEMPLATE, IntegrationResultResources.SUMMARY_TEMPLATE)
97
+
98
+ activate_profile_job(job_type=JobType.TestRun)
99
+
100
+ return
@@ -0,0 +1,100 @@
1
+ """
2
+ .. module:: ccai.integrationruntime.integratedtestjob
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: :class:`IntegratedTestJob` — the integration-tier test job that re-supplies the
5
+ heavyweight reporting/integration behaviour the near-standalone ``testbase``
6
+ :class:`TestJob` deliberately leaves out.
7
+
8
+ ``IntegratedTestJob`` extends :class:`ccai.testbase.testjob.TestJob` and overrides the three
9
+ provider hooks the standalone framework exposes:
10
+
11
+ * ``_create_output_context`` -> :class:`RuntimeOutputContext` — results / diagnostics /
12
+ per-testcase by-products land under the activated application's well-known presence folder.
13
+ * ``_create_run_metadata`` -> :class:`RuntimeRunMetadata` — build / pipeline / job metadata is
14
+ sourced from the resolved ``RuntimeVariables`` (CI/runtime context) instead of ``(unknown)``
15
+ placeholders.
16
+ * ``_create_recorder`` -> :class:`ccai.testbase.results.recorders.jsonresultrecorder.JsonResultRecorder`
17
+ — JSOS streaming + the rendered HTML summary, in place of the stdout recorder.
18
+
19
+ It sits between ``TestJob`` and the landscape-aware ``LandscapeTestJob`` in the job
20
+ chain ``TestJob -> IntegratedTestJob -> LandscapeTestJob -> DistributedTestJob``.
21
+ The landscape-activation lifecycle lives in ``ccai.landscaping.testing.testjob`` —
22
+ the package that owns the landscape model — so this tier and everything below it
23
+ stays landscape-free.
24
+
25
+ NOTE: ``IntegratedTestJob`` assumes the process has already been activated as a test-run job
26
+ (``this-app`` activation sets ``AM_JOB_TYPE`` / ``AM_PRESENCE_DIR`` / ``AM_RESULT_PATH_FOR_TESTS``)
27
+ before ``begin()`` resolves the presence-folder paths. The integration entry point performs that
28
+ activation prior to constructing the job.
29
+
30
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
31
+ """
32
+
33
+ __author__ = "Myron Walker"
34
+ __copyright__ = "Copyright 2026, Code Craft AI LLC"
35
+ __credits__ = []
36
+
37
+
38
+ from datetime import datetime
39
+
40
+ from ccai.testbase.testjob import TestJob
41
+ from ccai.testbase.output.outputcontext import IOutputContext
42
+ from ccai.testbase.output.runmetadata import IRunMetadata
43
+ from ccai.testbase.results.model.buildinfo import BuildInfo
44
+ from ccai.testbase.results.model.pipelineinfo import PipelineInfo
45
+ from ccai.testbase.results.model.jobinfo import JobInfo
46
+ from ccai.testbase.results.model.renderinfo import RenderInfo
47
+ from ccai.testbase.results.recorders.resultrecorder import ResultRecorder
48
+
49
+ from ccai.integrationruntime.runtimeoutputcontext import RuntimeOutputContext
50
+ from ccai.integrationruntime.runtimerunmetadata import RuntimeRunMetadata
51
+ from ccai.integrationruntime.results.recorders.integrationjsonresultrecorder import IntegrationJsonResultRecorder
52
+
53
+
54
+ class IntegratedTestJob(TestJob):
55
+ """
56
+ Integration-tier :class:`TestJob` that records JSOS / HTML results under the activated
57
+ application's presence folder and sources its run metadata from ``RuntimeVariables``.
58
+ """
59
+
60
+ def _create_output_context(self) -> IOutputContext:
61
+ """
62
+ Provides the presence-folder-backed output context for integration runs.
63
+
64
+ :returns: A :class:`RuntimeOutputContext` instance.
65
+ """
66
+ inst = RuntimeOutputContext()
67
+ return inst
68
+
69
+ def _create_run_metadata(self) -> IRunMetadata:
70
+ """
71
+ Provides run metadata sourced from the resolved ``RuntimeVariables``.
72
+
73
+ :returns: A :class:`RuntimeRunMetadata` instance.
74
+ """
75
+ run_title = "Test Run"
76
+ if self.name is not None and len(self.name) > 0:
77
+ run_title = self.name
78
+
79
+ inst = RuntimeRunMetadata(title=run_title)
80
+ return inst
81
+
82
+ def _create_recorder(self, runid: str, start: datetime, render_info: RenderInfo, build_info: BuildInfo,
83
+ pipeline_info: PipelineInfo, job_info: JobInfo) -> ResultRecorder:
84
+ """
85
+ Provides the JSOS-streaming, HTML-rendering result recorder for integration runs.
86
+
87
+ :returns: An :class:`IntegrationJsonResultRecorder` instance.
88
+ """
89
+ inst = IntegrationJsonResultRecorder(runid=runid, start=start, render_info=render_info, apod=self._apod,
90
+ build_info=build_info, pipeline_info=pipeline_info, job_info=job_info)
91
+ return inst
92
+
93
+
94
+ class DefaultIntegratedTestJob(IntegratedTestJob):
95
+ """
96
+ The :class:`DefaultIntegratedTestJob` is used as a job container when an integration run does
97
+ not specify a job.
98
+ """
99
+ name = "Test Job"
100
+ description = "Unspecified integration test job."
@@ -0,0 +1,51 @@
1
+ """
2
+ .. module:: ccai.integrationruntime.integrationruntimedefaulttypefactory
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: Extension factory that registers :class:`IntegratedTestJob` as the default job type
5
+ when ``codecraftai-integration-runtime`` is installed.
6
+
7
+ This mirrors :class:`ccai.testplus.testplusdefaulttypefactory.TestPlusDefaultTypeFactory`:
8
+ it extends the testbase factory protocol via :class:`FactoryExtension` so the super-factory
9
+ search path can discover it. Its ``PRECEDENCE`` sits above the testbase base default
10
+ (``DefaultTestJob``) and below testplus's distributed default — so the resolved default job type
11
+ is ``DefaultTestJob`` with testbase alone, ``DefaultIntegratedTestJob`` once integration-runtime
12
+ is present, and ``DistributedTestJob`` once testplus is present.
13
+
14
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
15
+ """
16
+
17
+ __author__ = "Myron Walker"
18
+ __copyright__ = "Copyright 2026, Code Craft AI LLC"
19
+ __credits__ = []
20
+
21
+
22
+ from typing import Type
23
+
24
+ from ccai.extension.factory.factoryextension import FactoryExtension
25
+
26
+ from ccai.testbase.factoryprotocols import TestBaseFactoryProtocol
27
+ from ccai.testbase.testjob import TestJob
28
+
29
+ from ccai.integrationruntime.integratedtestjob import DefaultIntegratedTestJob
30
+
31
+
32
+ class IntegrationRuntimeDefaultTypeFactory(FactoryExtension, TestBaseFactoryProtocol):
33
+ """
34
+ Supplies :class:`DefaultIntegratedTestJob` as the default job type for integration runs when
35
+ no job is explicitly specified.
36
+ """
37
+
38
+ PRECEDENCE = 10
39
+
40
+ @classmethod
41
+ def get_testbase_default_job_type(cls) -> Type[TestJob]:
42
+ """
43
+ Used to lookup and return the most relevant default job type as determined by the
44
+ super-factory search path.
45
+
46
+ Declared as a ``classmethod`` to satisfy the parent contract on
47
+ :class:`ccai.testbase.factoryprotocols.TestBaseFactoryProtocol`.
48
+
49
+ :returns: The :class:`DefaultIntegratedTestJob` type.
50
+ """
51
+ return DefaultIntegratedTestJob
File without changes
@@ -0,0 +1,13 @@
1
+ """
2
+ .. module:: ccai.integrationruntime.results
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: Integration-tier results reporting extras (streaming, concentrators, and the
5
+ HTML-capable recorder) relocated out of the near-standalone ``codecraftai-testbase``
6
+ framework. The JSOS/JSON serialization core and the result model remain in testbase.
7
+
8
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
9
+ """
10
+
11
+ __author__ = "Myron Walker"
12
+ __copyright__ = "Copyright 2026, Code Craft AI LLC"
13
+ __credits__ = []
@@ -0,0 +1,13 @@
1
+ """
2
+ .. module:: ccai.integrationruntime.results.concentrators
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: Module for concentrators.
5
+
6
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
7
+ """
8
+
9
+ __author__ = "Myron Walker"
10
+ __copyright__ = "Copyright 2025, Code Craft AI LLC"
11
+ __credits__ = []
12
+
13
+