feat: TM1 chore as a first-class task kind (closes #156)#157
Open
nicolasbisurgi wants to merge 2 commits into
Open
feat: TM1 chore as a first-class task kind (closes #156)#157nicolasbisurgi wants to merge 2 commits into
nicolasbisurgi wants to merge 2 commits into
Conversation
Introduces a polymorphic task abstraction where each task carries exactly one of `process` (TI process) or `chore` (TM1 chore). The field name is the discriminator — no meta-`kind` field. Mutual exclusion is enforced at parse-time validation and as a class invariant on `Task.__init__`, so downstream code can rely on exactly one being set. Chores are intentionally narrower than processes: no parameters, no minor-error tier, no native timeout. `safe_retry` is honoured only for SINGLE_COMMIT chores so partial state cannot leak on failure. The existence + execution-mode checks are added to `validate_tasks` and deduplicated by (instance, chore_name) so each chore is fetched at most once per run. JSON, TXT, and cube-source readers all accept chore tasks. TXT now runs through `validate_taskfile` on read, closing a pre-existing gap that silently accepted malformed input. Cube reader raises on rows with both `process` and `chore` populated. Schema changes are additive: a new `chore` measure element on the results cube (auto-merged by existing `_merge_measure_dimension_elements` path), a new `vchore` TI variable + `CellPutS` line in both v11 and v12 `}rushti.load.results` bodies, and a `chore TEXT` column on the SQLite `task_results` table with PRAGMA-driven migration. Dashboard replaces the per-task "Process" column with a unified "Task target" column carrying a `[P]` / `[C]` kind indicator in both the runtime dashboard and the DAG visualization templates. CHANGELOG records the two behavioural changes (TI schema, TXT validation tightening). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
13 integration tests against tm1srv01 (v11.8) using the preconfigured `test_chore_success` and `test_chore_error` chores. Covers: - execute_chore_with_retries: success, failure without safe_retry (single attempt), failure with safe_retry (raises after budget). - validate_tasks chore branch: existence pass/fail, SingleCommit check on safe_retry. - execute_task dispatch routes chore-kind tasks to the chore path on success and on failure (HTTP 500 → False). - Mixed process + chore DAG with predecessors crossing kinds — forward path executes in order, a failing chore aborts dependent tasks via require_predecessor_success. - build_logging_objects idempotently adds the `chore` measure element to an existing rushti cube. - Stats DB records process and chore rows with disjoint signatures (no collision when they share a name). - End-to-end results push: chore execution row → stats DB → upload_results_to_tm1 → }rushti.load.results TI → cube cell under the `chore` measure. Validates the v11 TI body, the CSV column ordering against PROCESS_VARIABLES, and the additive cube schema in a single round-trip. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements TM1 chore as a first-class task kind alongside TI process (closes #156). A task now carries exactly one of
processorchore— the field name is the kind discriminator (no meta-kindfield). Mixed process + chore taskfiles are supported across JSON, TXT, and cube sources, and chores participate in the DAG (predecessors, stages, retry) on equal footing with processes.Anchor docs (in-repo working artefacts; only
CONTEXT.mdis committed):CONTEXT.md— Task / Task kind / Chore vocabulary (committed in this PR).docs/adr/0002-polymorphic-task-kinds.md— full decision record (local-only).IMPLEMENTATION_PLAN_CHORE_KIND.md— file-by-file change list (local-only).What's in scope
TaskDefinition/Task/OptimizedTaskwith mutual-exclusion as a class invariant onTask.__init__and per-kind forbidden-field validation invalidate_task.tm1.chores.exists(...)for every unique(instance, chore_name), plus aSINGLE_COMMITcheck whensafe_retry: true(deduplicated so the chore object is fetched at most once per run).execute_taskdispatch to_execute_chore_task+ newexecute_chore_with_retries. Binary success/fail (HTTP 204 / exception).safe_retryre-executes the whole chore.validate_taskfileon read (closes a pre-existing gap).processandchoreset.choremeasure element +vchoreTI variable +CellPutSline in both v11 and v12}rushti.load.resultsbodies.chore TEXTcolumn ontask_results, PRAGMA-driven migration on first connection.calculate_task_signatureis chore-aware; signatures occupy a disjoint hash space from process signatures.[P]/[C]kind indicator (bothvisualization_template.pyandtemplates/visualization.htmlupdated to stay consistent).chore: Optional[str]parameter (does not overloadprocess).Out of scope
Test plan
tests/unit/test_chore_kind.py(37 cases) cover validation, theTaskinvariant, TXT conversion + validation tightening, chore signature disjointness, retry behaviour with mockedTM1Service,execute_taskdispatch,validate_taskschore branch, and the cube reader's chore acceptance + both-populated rejection.tests/unit/test_taskfile.pyupdated to match the new "exactly one of 'process' or 'chore'" message.tm1srv01) intests/integration/test_v11_chore_kind.py— 13/13 pass. Uses preconfiguredtest_chore_successandtest_chore_errorchores. Verifies:execute_chore_with_retries: success (single attempt), failure withoutsafe_retry(single attempt), failure withsafe_retry(exhausts budget then raises).validate_taskschore branch: existence pass/fail, SingleCommit check onsafe_retry.execute_taskdispatch routes chore-kind tasks to the chore path on success and on failure.require_predecessor_success.build_logging_objectsidempotently adds thechoremeasure element to an existing rushti cube.upload_results_to_tm1→}rushti.load.resultsTI execution → cube cell readback under thechoremeasure. This proves the v11 TI body compiles against the newvchorevariable, the CSV column ordering aligns withPROCESS_VARIABLES, and the additive cube schema works in a single round-trip.Upgrade notes
rushti build --tm1-instance Xon existing installations to add the newchoremeasure to the cube. The additive merge logic already in place handles this without data loss.}rushti.load.resultsTI variable list changed and old-format CSVs cannot be loaded.🤖 Generated with Claude Code