Skip to content

Workflow engines, store promotion, ports, and a task layout of only what is used; release 0.13.0 - #36

Merged
Marius1311 merged 5 commits into
mainfrom
worktree-plugin-port-tasks
Nov 26, 2026
Merged

Marius1311 merged 5 commits into
mainfrom
worktree-plugin-port-tasks

Conversation

@Marius1311

@Marius1311 Marius1311 commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Closes #35. The matching CONVENTIONS.md text: quadbio/analysis_template#34; merge this one first.

Decisions on the proposals

  • W1 A task's workflow-engine files go in workflow/, one fixed name (Q2). Snakemake finds
    workflow/Snakefile and workflow/profiles/default/ by itself; run with --directory set to the task's
    outputs/, its results and .snakemake/ land there (checked with Snakemake 9.27).
  • W2, W3 No new kind of write. A batch job, a workflow engine included, writes only into its task's
    outputs/; once reviewed, each store it built is moved into processed/ inside a writes block, which records
    the creating task. Nothing half-written reaches shared storage, a rerun cannot delete a shared store, and the store
    is reviewed before any task reads it (Q1). A test pins the move.
  • W4 Already supported: the store's record leads to the task, whose inputs.yaml lists the raw data; a trace
    through a symlinked raw/ was checked. declare-inputs now reads workflow/ too.
  • W5 analysis-workflow new --ported-from <repo>:<path>@<commit> writes a **Ported from:** header line and
    keeps the old version, which must be above every version beside it; without the option new still takes only
    the next. Lane and author follow the originator (template text); session rule 1 points there.

Task layout: clean up at the end

new and PATHS.ensure() lay a task out as before. At the task's end (skill, Finish 4), analysis-workflow tidy <task> removes every directory it left empty, at any depth, in the task's checkout and in the main checkout. It
deletes no file and follows no symlink. One rule for every directory; pruning at the end sees what was used,
whichever tool made it.

check inputs also notices changes in workflow/ after inputs.yaml was written.

Line delta: +148 / −23, tests included.

🤖 Generated with Claude Code

- `workflow/` is part of a task's layout, for a workflow engine's files; it is reserved, not created.
- `analysis-workflow new --ported-from <repo>:<path>@<commit>` records a port's origin in the README header and
  keeps the old version, which must be above every version beside it.
- Session rule 1: a port takes the lane the repo's `CONVENTIONS.md` gives it.
- A store a batch job built in the task's `outputs/` enters shared storage by a move inside a `writes` block,
  which records the task (tested); `declare-inputs` reads `workflow/` too.

Closes #35.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T10:03:52.704182Z 2d7a499 New commits
ℹ️ 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
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 89503ec785

ℹ️ 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
  • 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 address that feedback".

Comment on lines +21 to +23
1. Read every script and notebook of the task, `scripts/_common.py` and the workflow files in `workflow/` included.
Follow calls into the repo's own package and into sibling packages far enough to see which keys a called
function uses, its defaults included.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include workflow files in input-declaration staleness checks

Now that workflow/ can contain code that determines a task's inputs, changes there also need to invalidate its input declaration. changed_since_declared() in src/analysis_workflow/trace.py still checks only scripts/ and notebooks/: after committing an inputs.yaml, changing a Snakefile to consume a different raw file returns False for both uncommitted and committed changes. Consequently, check inputs can report clean while tracing continues to use the obsolete input list. Include workflow/ in both the history and working-tree checks.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2d7a499: changed_since_declared checks workflow/ along with scripts/ and notebooks/, with a test.

…tidy`

`tidy <task>`, at the task's end, removes its reserved directories left empty or holding only unchanged task
template files, in the checkout and, for the untracked ones, in the main checkout. `new` makes `notebooks/` only
with `--notebook`. `workflow/` is one more reserved name, with nothing of its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Marius1311 Marius1311 changed the title Tasks that run a workflow engine or port older work; release 0.13.0 Workflow engines, store promotion, ports, and a task layout of only what is used; release 0.13.0 Nov 26, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 758b6d843d

ℹ️ 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
  • 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 address that feedback".

Comment thread src/analysis_workflow/paths.py Outdated
Comment on lines +166 to +167
if file.is_dir() or NON_TASK_DIRS & set(file.parts): # a `__pycache__` is no use of the directory
return True

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve experiment artifacts when tidying task directories

When a task stores its experiment runs under logs/wandb/ or outputs/wandb/, this predicate treats every file in those runs as unchanged because wandb belongs to NON_TASK_DIRS. If the enclosing directory contains nothing else, tidy then recursively deletes it, including metrics and model checkpoints. I reproduced this with logs/wandb/run-20261126/files/model.ckpt: unused_dirs() classified logs as unused, and the deletion loop removed the checkpoint. Names excluded from task discovery are not necessarily disposable caches; preserve non-template experiment files rather than applying the entire NON_TASK_DIRS set here.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already gone in 4ae7315, which rewrote the predicate without NON_TASK_DIRS; since 2d7a499 tidy removes only empty directories, so no file is ever deleted.

Marius1311 and others added 2 commits November 26, 2026 10:54
…ke every reserved directory

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…plate files never changed

README.md and inputs.yaml always stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1186c72cad

ℹ️ 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
  • 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 address that feedback".

Comment thread src/analysis_workflow/paths.py Outdated
Comment on lines +168 to +169
template = TASK_TEMPLATE / file.relative_to(task) if file.is_relative_to(task) else None
return template is not None and template.is_file() and template.read_bytes() == file.read_bytes()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve unchanged template helpers that notebooks still import

When a task's notebooks import PATHS or the output-directory constants from the template's scripts/_common.py, that helper can remain byte-for-byte unchanged while still being required. This predicate marks it disposable, so tidy removes scripts/ even though the notebooks remain, and rerunning them fails with ModuleNotFoundError: No module named '_common'. I reproduced this with an unchanged template helper and a notebook importing it. Preserve the helper when retained task code depends on it rather than treating template equality as proof that it is unused.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2d7a499 by dropping the template-file rule: tidy removes empty directories only, so an unchanged _common.py stays.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4ae7315ec1

ℹ️ 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
  • 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 address that feedback".

Comment thread src/analysis_workflow/paths.py Outdated
Comment on lines +176 to +177
elif child.is_dir():
found += topmost(child, root)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Stop tidy traversal at directory symlinks

When a task contains a directory symlink, is_dir() follows it and this recursion scans outside the task. I reproduced this with outputs/shared pointing to an external directory containing data.txt and empty/: unused() selected outputs/shared/empty, and the deletion loop removed the external directory. A symlink cycle can also make discovery fail with a recursion error. Treat directory symlinks as retained entries rather than descending into them so tidying a task cannot modify shared targets.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2d7a499: a symlink is never followed and never removed, with a test of a link to an outside directory holding an empty one.

…k inputs` sees changes in `workflow/`

Template files are no longer removed: a notebook may import an unchanged `scripts/_common.py`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Marius1311
Marius1311 merged commit 79af130 into main Nov 26, 2026
3 checks passed
@Marius1311
Marius1311 deleted the worktree-plugin-port-tasks branch November 26, 2026 10:05
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.

Tasks that run a workflow engine, create a store, or port older work

1 participant