Skip to content

Load workspace Makefile targets from selected asta-plugins ref - #168

Closed
gas2own wants to merge 18 commits into
mainfrom
feat/managed-workspace-makefile
Closed

gas2own wants to merge 18 commits into
mainfrom
feat/managed-workspace-makefile

Conversation

@gas2own

@gas2own gas2own commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Workspace projects currently commit the full shared Makefile. This PR adds a managed workspace.mk and an optional thin Makefile.managed: project targets stay in the root Makefile, while the shared targets come from the selected asta-plugins ref. A committed root workspace.mk takes control of the shared targets.

The default scaffold still copies the full assets/Makefile. Its docs.yml pins v0.104.1, which lacks workspace.mk, so switching new projects to the thin loader before a release would break their first make. After a release includes the managed asset, a separate PR can make the thin loader the default. Existing projects opt in only when their selected ref provides the asset. The copied check and preview-wait scripts remain separate follow-up work.

The optional loader caches by source and ref, refreshes moving refs hourly, and reuses a cached release when offline. It checks archive contents before replacing the cached Makefile. A project's committed override wins.

Validation: 393 tests passed and one skipped in the full local suite; Ruff lint, Ruff format check, and skill validation passed. CI on the current head passes. The previous review was assessed in finding-by-finding resolutions and commit 28af7c4. A different reviewer found no issues on that current head. All CI checks pass; the PR is ready for human review.

Tracked by the workspace issue.

Reviewer requested: jbragg

Suggested-by: @jbragg

@gas2own

gas2own commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Automated review status

  • claude review of 7ce0094 (job gas2own-0c4b67a47092) — findings posted; follow-up on executor dispatch-3fa3d8ee8f0f47d2 done
  • codex review of 9595765 (job gas2own-123ef30b84e1) — findings posted
  • claude review of 56b7b60 (job gas2own-abb83a9a56cd) — findings posted; follow-up on executor dispatch-6bc1951679e3493b
  • codex review of eec04ca (job gas2own-f0944c91dacb) — findings posted; follow-up on executor dispatch-92fb2f4a8a4241f9
  • claude review of 9039d85 (job gas2own-6254b3b36f1b) — findings posted; follow-up on executor dispatch-3c4bc3fd06164c05
  • codex review of 60a3f2c (job gas2own-440eabdc83cf) — findings posted; follow-up on executor dispatch-b647c800b139449c
  • claude review of 6efd481 (job gas2own-f0184d2841cd) — findings posted; follow-up on executor dispatch-4ec12270d9fb43ac done
  • codex review of 9733896 (job gas2own-3dc563aff807) — findings posted; follow-up on executor dispatch-fae7263374aa445b done
  • claude review of ab7bb2a (job gas2own-cafe2f401843) — findings posted; follow-up on executor dispatch-588082ca19b2468d
  • codex review of 28af7c4 (job gas2own-5b8b5fa3926f) — findings posted; follow-up on executor dispatch-b9d58cc2c9044bb0

Now: follow-up triaging the latest findings (executor dispatch-b9d58cc2c9044bb0); fixes or a re-review may follow.

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Independent AI code review (Claude)

Automated review of the PR by a separately invoked Claude reviewer. Prioritised P0/P1/P2; treat as advisory input for the human reviewer, not a merge gate.

P0 (blocking)

None.

P1 (should fix)

  • assets/Makefile:7 — hard-coded fallback can drift. The fallback ASTA_PLUGINS_REF := v0.104.1 is a second literal version that the release process does not bump. test_scaffolded_workflow_ref_matches_project_version only checks docs.yml, so a project without a parseable docs.yml silently pins an old release forever. Fix: derive the fallback from the same release-bump source, or add a test asserting it equals the project version.
  • assets/Makefile:47 — fallback can make the Makefile include itself. When workspace.mk is absent, the recipe falls back to assets/Makefile. At any ref from this PR onward, that file is the thin loader, so the cache would include a copy of itself and recurse. Fix: restrict the fallback to refs that predate workspace.mk, or reject an extracted file that contains ASTA_WORKSPACE_MK.
  • assets/Makefile:40 — remote code is run with no integrity check. The recipe downloads a full repo tarball and executes its Makefile. This applies to mutable main/latest and to retaggable tags, with no checksum or SHA pin. Any compromise of the ref runs arbitrary code on every make locally and in CI (make check). Fix: at minimum, document the trust model and recommend SHA pins. Preferably, verify a published checksum for tagged refs.
  • assets/Makefile:40 — first fetch is fragile and doubles the download. --max-time 30 applies to a whole-repository tarball, and workspace-assets then downloads the same tarball again. A slow link or a growing repo makes the first fetch and CI make check flaky. Fix: fetch only the single file (raw URL at the ref) or drop or raise --max-time. Optionally reuse one archive for both assets.
  • assets/Makefile:13-14 — unvalidated ref used at parse time. $(ASTA_PLUGINS_REF) reaches include and the unquoted $(shell find …) before the ../charset check in the recipe runs. An env or CLI value such as ../../x can include an arbitrary path or inject into find. Fix: validate the ref with $(if $(filter-out …))/$(error …) before building ASTA_WORKSPACE_MK.
  • assets/Makefile:34 — latest is mapped inconsistently. The loader maps latest to refs/heads/latest, a branch that is unlikely to exist. workspace.mk builds archive/latest.tar.gz for the evidence extension, so the two can resolve to different content or fail. Fix: drop latest from the floating set or define it consistently, e.g. resolve the newest v* tag in both places.

P2 (nits)

  • assets/Makefile:38 — trap … EXIT HUP INT TERM runs rm -rf "$tmp" on INT/TERM but does not exit, so the recipe continues against a deleted dir. Fix: trap 'exit 1' HUP INT TERM plus trap 'rm -rf "$tmp"' EXIT.
  • assets/Makefile:11 — an untracked or uncommitted-but-unstaged workspace.mk is silently ignored. A tracked but deleted one makes include fail. Fix: warn when workspace.mk exists but is untracked, and use -include combined with an existence check.
  • assets/Makefile:13 — .asta/cache/<ref>/ directories accumulate on every ref bump. Fix: prune sibling ref directories after a successful fetch, or document rm -rf .asta/cache.
  • SKILL.md:53 — there is no migration note for existing projects with project-specific targets in their old full Makefile. Re-copying the thin Makefile drops those targets. Fix: tell users to move custom targets below the include, or into workspace.mk.
  • tests/test_workspace_workflow.py:347 — coverage gaps. Add tests for:
    • the missing-docs.yml default ref;
    • the legacy assets/Makefile fallback;
    • invalid-ref rejection;
    • ASTA_PLUGINS_REF propagating into workspace-assets.

Recommendation: request-changes

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the independent review in commit 9595765.

P1 findings:

  • Version fallback: removed the separate v0.104.1 default. A missing or unparsable docs.yml ref now fails with a clear message; an explicit ASTA_PLUGINS_REF still works.
  • Self-include: the old assets/Makefile fallback remains for older releases, but a fallback containing the thin loader's ASTA_WORKSPACE_MK marker is rejected before it enters the cache. Tests cover both the old full Makefile and a loader-only archive.
  • Remote code trust: documented that the managed Makefile executes on every make, that moving refs require trust in their maintainers, and that a commit SHA can be pinned for an immutable version. A checksum cannot make main or latest immutable; the project's selected workflow ref remains the source of truth.
  • Fetch time: raised the full-archive timeout from 30 to 120 seconds. workspace-assets still fetches its own archive; sharing that download would change its independent offline and refresh behavior, so this PR leaves it separate.
  • Parse-time ref: rejected empty, traversal, absolute-path, and unsupported-character refs before computing the include path or running find. A test supplies shell metacharacters and checks that they do not execute.
  • latest alignment: the managed evidence asset now explicitly fetches refs/heads/latest, matching the loader. A local archive test checks that both assets come from that branch.

P2 findings:

  • Signal cleanup: termination signals now exit, while the exit trap removes the temporary directory.
  • Local overrides: an untracked workspace.mk warns; a tracked but missing one fails with a restore/remove message.
  • Cache growth: DEVELOPER.md explains how to remove old .asta/cache copies. Automatic pruning would discard offline fallbacks, so it remains manual.
  • Migration: the workspace skill and developer guide tell users to move custom targets before replacing an existing full Makefile.
  • Tests: added missing-ref, legacy fallback, invalid-ref, shared-ref, and latest branch cases.

Validation: 44 workspace workflow tests pass locally; Ruff check, Ruff format check, and git diff --check pass. The new head's CI is running.

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Independent AI code review (Codex)

Automated review of the PR by a separately invoked Codex reviewer. Prioritised P0/P1/P2; treat as advisory input for the human reviewer, not a merge gate.

P0 (blocking)

None.

P1 (should fix)

  • plugins/asta-tools/skills/workspace/assets/Makefile:27 — grep -c accepts a ref with one valid line and additional invalid lines. Reject the entire value, including newlines, before using it in an include path or shell recipe.
  • plugins/asta-tools/skills/workspace/assets/Makefile:31 — A fresh checkout must download the managed file even for make clean; cleanup fails without network access. Keep local housekeeping targets in the thin Makefile and skip the remote include for those goals.

P2 (nits)

  • plugins/asta-tools/skills/workspace/assets/workspace.mk:3 — The comment says the default ref is the latest tag, but the thin Makefile derives it from docs.yml. Update the comment.

Recommendation: request-changes

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the latest independent review in commit 925c90d.

  • Multiline ref (P1): reject line breaks before constructing the include path or running a shell command. The ref validation test now covers a valid first line followed by an invalid second line.
  • Offline cleanup (P1): make clean removes local build output before any managed-file fetch. A committed workspace.mk still controls its own clean target. Both paths have tests.
  • Ref comment (P2): corrected the managed file's comment to describe the project-selected ref and standalone fallback.

Validation: all 47 workspace workflow tests pass locally; Ruff check and format check, and git diff --check, pass. CI on this commit is pending.

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Additional validation found that GNU Make expanded $(shell ...) from an environment-supplied ASTA_PLUGINS_REF before the ref check. Commit 56b7b60 now converts an externally supplied ref to a literal value before validation. The regression test confirms the command does not execute. All 48 workspace workflow tests, Ruff checks, and git diff --check pass locally.

The follow-up AI review was submitted on 925c90d before this extra fix. Its result may not cover the current head, so I am keeping the PR draft until the review state is reconciled.

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Independent AI code review (Claude)

Automated review of the PR by a separately invoked Claude reviewer. Prioritised P0/P1/P2; treat as advisory input for the human reviewer, not a merge gate.

P0 (blocking)

None.

P1 (should fix)

  • Unverified remote code runs on every make (assets/Makefile:62, assets/Makefile:73-101). include $(ASTA_WORKSPACE_MK) executes a Makefile downloaded over HTTPS with no integrity check.
    • For main or latest, that code is re-fetched hourly on developer machines and in CI.
    • The evidence Lua filter already ran remote code, but this raises the exposure from a Quarto filter to arbitrary shell code on every target.
    • The DEVELOPER.md caveat helps, but the scaffold still ships a movable tag.
    • Fix: have the release process write a commit SHA, or tag@sha, into docs.yml. Alternatively, publish a checksum per release and verify the extracted workspace.mk before mv.
  • Regression for projects without a matching docs.yml line (assets/Makefile:27-29, 43).
    • Previously, an empty ref resolved to the latest v* tag. Now every target except clean hard-errors when docs.yml is missing, renamed, or uses another uses: form (e.g. a fork or a local ./.github/... path).
    • This also breaks existing projects that adopt the thin Makefile before a docs.yml exists.
    • Fix: fall back to the same git ls-remote --tags latest-tag resolution that workspace.mk:40-45 already implements, and warn instead of erroring. Or document the hard requirement in SKILL.md step 6.
  • Thin clean duplicates managed logic (assets/Makefile:12-14). When the goal is only clean, the hardcoded rm -rf _site .quarto replaces the managed clean.
    • Any future change to the managed clean (e.g. also removing _extensions/evidence or .asta/cache) silently diverges between make clean and make clean render.
    • Fix: include the cached managed file if it already exists (-include $(ASTA_WORKSPACE_MK), without triggering a fetch), and use the hardcoded rule only when there is no cache. Or document that this fallback is intentionally minimal.

P2 (nits)

  • assets/Makefile:68-69: workspace-ref-check is declared .PHONY but has no rule, so the floating refresh relies on GNU make's implicit handling. Add an explicit workspace-ref-check: ;.
  • assets/Makefile:6-10 and 33-37: the tracked-workspace.mk check and include are duplicated, and git ls-files runs twice per invocation. Compute it once, e.g. ASTA_LOCAL_MK := $(shell git ls-files --error-unmatch workspace.mk 2>/dev/null), before both branches.
  • assets/workspace.mk:47-51: the v[0-9]*.[0-9]*.[0-9]* and * branches build identical URLs, while the thin Makefile (assets/Makefile:81) uses archive/refs/tags/. Use refs/tags/ here too so the two fetches are consistent and unambiguous when a branch and a tag share a name.
  • assets/Makefile:80 and assets/workspace.mk:48: latest is mapped to refs/heads/latest. If no latest branch is published, this 404s. Users may also reasonably read latest as "newest release tag." Confirm the branch exists, and state in DEVELOPER.md that latest is a branch.
  • SKILL.md:53: users are now expected to edit the root Makefile with project targets. Confirm that the CI vendored-copy drift check no longer covers Makefile, otherwise every customized project will get spurious drift warnings.
  • assets/Makefile:90: the grep pattern uses unescaped . in workspace.mk$. Escape it, or match with grep -F plus a suffix check.
  • assets/Makefile:28: the awk extraction stops at the first uses: match and ignores YAML comments only at line start. Add a test for an inline trailing comment (@v1.2.3 # pinned).

Recommendation: request-changes

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Paired asta_skills eval completed on commit 7ce0094 (before the current head): baseline 0.667, PR 0.500 across three runs of the single empty-repo bootstrap case. I inspected the retained transcripts. Both arms passed the load-bearing check in all three runs: neither pushed a feature branch to the empty remote. The difference is one baseline run explicitly checking for origin/main while no PR-arm run did. The workspace skill already instructs that check in both arms, and this PR changes the Makefile scaffold; the case does not exercise the new managed Makefile. This result is too narrow to attribute the missed check to this PR or validate the Makefile design.

The relevant validation remains the managed-Makefile tests and a downstream project run. The current head passes CI; the latest independent review has separate findings to resolve before human review.

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the latest independent review in commit 3e652d7.

  • Remote-code trust (P1): the thin Makefile necessarily loads shared commands from the project's selected asta-plugins ref. The scaffold currently selects the release tag in docs.yml; main and latest are explicit moving-channel choices. The developer guide already calls out the local code-execution boundary and how to pin an immutable commit SHA. A checksum of a moving branch would not prevent its maintainers from changing the code. Making @latest the scaffold default remains gated separately in PR 165 on restricting that branch to release updates.
  • Missing docs.yml (P1): the loader now resolves the newest final release tag when a project has no matching workflow, preserving Quarto-only projects. An unreachable release source fails with an explicit ref error. Added both tests.
  • Offline clean (P1): standalone make clean deliberately removes only local Quarto output, even without a cache or network. Its documented scope does not depend on future managed cleanup behavior. A committed workspace.mk can override it, as the existing test confirms.
  • Explicit refresh target, duplicate Git check, tag URL, and archive filename pattern (P2): fixed in this commit. The latest branch exists; the fetch test covers it. The workflow's drift check covers the two copied scripts, not the project Makefile. The workflow-ref test now covers an inline YAML comment.

Validation: 52 focused workspace tests pass locally with GNU Make 4.3; Ruff check and format, and git diff --check, pass. CI on this commit is running. The paired eval and its limits are recorded in this comment.

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

The survey pilot's independent review exposed three shared Makefile risks. Fixed in 09b02e5 and fd10dbc:

  • An environment-provided ASTA_PLUGINS_REF now warns that local commands can differ from the workflow selected in docs.yml.
  • Thin projects reject older archives without assets/workspace.mk instead of including the old full Makefile and duplicating project recipes. The developer guide states the migration requirement.
  • make check fails if the managed include omits the shared check gate. The gate runs after Make loads or fetches the include, and a regression test covers a missing gate.

The survey pilot now points at the corrected head. Current-head CI is running. This changes executable Makefile code, so the draft still needs a fresh independent review before human handoff; the existing automatic review budget was already spent.

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

The meta-agent-notes pilot review exposed one shared-loader bug: when docs.yml exists but its workflow ref cannot be read, local make silently selected the newest release instead of failing. Commit 48f7140 now fails in that case while retaining the release fallback for projects without a docs workflow. It also restores the default dev target and correctly quotes archive/repository URL overrides. The 32 focused Makefile tests and all current PR checks pass. The meta-agent-notes pilot pins this commit for validation.

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

The survey pilot's independent review exposed a shared loader bug: a download that succeeded but contained an invalid archive stopped make despite a valid cached workspace.mk.

Commit 9190748 validates the archive and extracted include before replacing the cache. If validation fails, it uses the existing cache; without a cache, it fails without leaving a partial include. The new regression covers corrupt, missing-asset, and empty-asset archives in both states. All 58 workspace workflow tests, Ruff, and current PR checks pass. The survey pilot has the matching loader and passed its local make check with Quarto 1.7.29.

This is a substantive change after the earlier reviews. The PR remains draft and still needs the independent review recorded in its description before human handoff.

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

The meta-agent-notes pilot review exposed one shared loader bug: a committed workspace.mk could be blocked by parsing an unrelated or malformed docs.yml. Commit eec04ca now selects the committed override first and adds a regression case. All 58 workspace workflow tests and current PR checks pass. The pilot also picked up this PR's existing invalid-archive cache fallback in its fix commit.

The managed-Makefile PR remains draft pending its separate review gate. The pilot temporarily pins this head until the upstream PR merges.

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Independent AI code review (Codex)

Automated review of the PR by a separately invoked Codex reviewer. Prioritised P0/P1/P2; treat as advisory input for the human reviewer, not a merge gate.

P0 (blocking)

None.

P1 (should fix)

  • plugins/asta-tools/skills/workspace/assets/Makefile:42 — Without docs.yml, an offline build fails during release-tag lookup even when a managed Makefile is cached. Persist the last resolved ref and use its cache when lookup fails.
  • plugins/asta-tools/skills/workspace/assets/Makefile:88 — The download recipe rejects underscores in refs, although the earlier validation accepts them. Valid branch refs containing _ therefore fail. Use the same allowed characters in both checks.

P2 (nits)

None.

Recommendation: request-changes

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the latest independent review in commit 9039d85.

  • Offline without docs.yml (P1): the loader now records the last successfully fetched default release and reuses its cached Makefile when release lookup fails. It can also recover an existing versioned cache from before that record existed. With no usable cache, it still fails. The release lookup test now covers both offline paths.
  • Ref containing _ (P1): the download recipe now accepts the same ref characters as the earlier validation. The managed-file integration test covers a branch ref with an underscore.

CI on the fixed head passes all checks, including workspace tests on Python 3.11, 3.12, and 3.13. The PR remains draft pending an independent read of the new fix.

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Independent AI code review (Claude)

Automated review of the PR by a separately invoked Claude reviewer. Prioritised P0/P1/P2; treat as advisory input for the human reviewer, not a merge gate.

P0 (blocking)

None.

P1 (should fix)

  • assets/Makefile:87-93: Only main and latest are refreshed. Any other branch ref is cached in .asta/cache/<ref>/workspace.mk and never refetched, even though it moves. The test at tests/test_workspace_workflow.py:349 uses feature_branch and exercises exactly this path.
    • Fix: apply the hourly refresh to every ref that is not an exact ^v[0-9]+\.[0-9]+\.[0-9]+$ tag or a 40-hex SHA.
  • assets/Makefile:43: Without docs.yml, git ls-remote runs on every make parse, even when a cached copy exists, and it has no timeout. Captive portals, proxies or a slow network can hang every make, including make dev.
    • Fix: reuse .asta/cache/default-release with a TTL, the same way floating refs work.
    • Fix: bound the lookup, e.g. GIT_HTTP_LOW_SPEED_LIMIT=1000 GIT_HTTP_LOW_SPEED_TIME=5, or wrap it in timeout.
  • SKILL.md:53 / assets/Makefile:111-115: Bootstrap ordering hazard. The scaffold's docs.yml pins the current project-version tag. Until a release containing assets/workspace.mk is tagged, projects scaffolded from this branch or from main fail every non-clean target with "does not provide a managed workspace.mk".
    • Fix: gate the scaffold change on that release, or fall back to the legacy full Makefile when the ref predates workspace.mk.
    • Fix: add a test asserting the scaffolded ref's tag contains workspace.mk.

P2 (nits)

  • assets/Makefile:4: .DEFAULT_GOAL := dev silently changes bare make. Previously it ran workspace-assets; now it launches VS Code and needs code/xxd, and it fails in CI or headless shells. Fix: default to render or preview, or document the change.
  • assets/Makefile:77: The cache key ignores ASTA_PLUGINS_REPO and ASTA_PLUGINS_ARCHIVE_URL. Switching to a fork with the same tag reuses the other repo's cached code. Fix: key the cache by a short hash of the repo or URL plus the ref.
  • assets/Makefile:112: The grep for the archive entry is not anchored to the top-level directory, so a nested copy (e.g. a fixture) could be selected. Fix: anchor with ^[^/]*/plugins/asta-tools/skills/workspace/assets/workspace\.mk$.
  • assets/Makefile:103: The glob v[0-9]*.[0-9]*.[0-9]* matches non-semver refs such as v1.x.y-foo and routes them to refs/tags/. Fix: use a strict regex check before choosing the tags URL.
  • assets/Makefile:43 and workspace.mk:41: "$(ASTA_PLUGINS_REPO)" is make-expanded and inserted into a shell command inside double quotes, so $(...) or backticks in the env value execute. Fix: use $(value ...) and single-quote it with the same subst escaping used at line 99.
  • assets/Makefile:10 / DEVELOPER.md:7: With a committed workspace.mk, ref resolution is skipped, so the evidence fetch uses the latest tag rather than the docs.yml ref. The docs say the evidence extension "follows that same ref". Fix: resolve the ref before the override branch, or document the exception.
  • assets/Makefile:95-129 + workspace.mk:19: A new ref triggers two full repo tarball downloads, one for workspace.mk and one for the evidence extension. Fix: extract both from a single download into the cache.
  • assets/Makefile:15-17: The offline clean recipe duplicates workspace.mk's recipe. A project clean recipe in the root Makefile will produce "overriding recipe" warnings in the normal path. Fix: document that clean extensions must be added as prerequisites, e.g. clean: clean-extra.
  • tests/test_workspace_workflow.py (tests using {**os.environ, ...}): Tests inherit the developer's ASTA_PLUGINS_REF and ASTA_PLUGINS_ARCHIVE_URL, so they become flaky locally. Fix: strip ASTA_* from the copied environment.
  • SKILL.md:53: The root Makefile now carries project targets. If the CI drift check covers Makefile, it will warn on every project. Fix: confirm the drift check excludes the Makefile, or compare only its header.

Recommendation: request-changes

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

I checked the latest independent review against the current branch. Commit 60a3f2c addresses the warranted findings:

  • Moving branch refs (P1): every ref except a strict release tag or 40-character SHA now refreshes hourly. The feature_branch test covers this path.
  • Release lookup on every parse (P1): a valid cached default release is reused for one hour. A stale lookup is bounded by timeout or gtimeout when available, with Git HTTP low-speed and SSH connection limits as fallbacks. Tests cover a new release after expiry and an offline cache.
  • Scaffold bootstrap (P1): the default scaffold keeps the existing full Makefile while its workflow still pins a release without workspace.mk. The thin loader is an opt-in Makefile.managed until a release contains the shared asset. A test guards that ordering.
  • Bare make (P2): the thin loader's default target is workspace-assets, preserving the old behavior; the bare-make integration test exercises it.
  • Cache source identity (P2): nondefault repositories and archive URLs get distinct cache roots. A test switches archives at the same ref and confirms their targets do not mix.
  • Archive path and ref patterns (P2): extraction now requires the workspace asset at the archive's top level, and tag URL selection uses a strict version pattern. The nested-asset test covers the former.
  • Shell expansion of repository settings (P2): the loader and shared evidence target now quote literal Make variable values. Tests confirm a synthetic command in the repository setting is not executed.
  • Committed override's evidence ref (P2): a committed workspace.mk now receives the docs.yml ref when it is present, without requiring a valid workflow for the override to run. The override test covers both cases.
  • Project clean extension (P2): the loader documents prerequisite targets as the supported way to add cleanup; that avoids an overriding-recipe warning.
  • Test environment inheritance (P2): managed-loader tests now strip inherited ASTA_PLUGINS_REF, repository, and archive URL settings.
  • Makefile drift check (P2): already excluded. The workflow's drift loop names only quarto-check.sh and wait-for-preview.sh.
  • Two archive downloads (P2): deferred as a performance optimization. Combining the Makefile and evidence caches would add coupled cache state to this loader; the current behavior has independent offline fallback for each asset.

Local validation: 70 workspace workflow tests pass with GNU Make 4.4.1; Ruff and format checks pass. GitHub CI on this commit is running. The PR remains draft because this substantive loader change needs an independent read of the new head before the human handoff.

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Independent AI code review (Codex)

Automated review of the PR by a separately invoked Codex reviewer. Prioritised P0/P1/P2; treat as advisory input for the human reviewer, not a merge gate.

P0 (blocking)

None.

P1 (should fix)

  • plugins/asta-tools/skills/workspace/assets/Makefile.managed:76: When a newer release tag is found but its archive cannot be fetched, make fails even if an older release is cached. Fall back to the last cached release after a failed fetch.
  • plugins/asta-tools/skills/workspace/assets/Makefile.managed:149: A moving ref is fetched once for workspace.mk and again for the evidence extension (workspace.mk:78). If the branch advances between downloads, one build uses assets from different commits. Resolve the ref to one commit and use it for both fetches.
  • plugins/asta-tools/skills/workspace/assets/Makefile.managed:115: The check gate only tests a variable. A project recipe for check can override the shared recipe and skip scripts/quarto-check.sh while the gate passes. Put the shared check command in a separate prerequisite target.

P2 (nits)

None.

Recommendation: request-changes

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the latest independent review in commit 6efd481.

  • New release download fails: If a newer default release is found but its archive cannot be fetched or used, the loader selects the last cached release, including its ref for dependent assets. The release lookup test now covers that failure.
  • Moving ref changes between downloads: The loader caches the archive that supplied workspace.mk; workspace-assets reads that same archive. A test supplies a different archive on a possible second download and confirms there is only one download and the evidence comes from the first.
  • Project check recipe replaces the shared check: The shared quarto-check.sh command now runs in its own prerequisite target, so a project-owned check recipe still runs it. A test executes both recipes.

All 71 workspace workflow tests pass locally with GNU Make 4.3. Ruff and format checks pass. CI on the new commit is pending. The PR remains draft for an independent review of this change.

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Independent AI code review (Claude)

Automated review of the PR by a separately invoked Claude reviewer. Prioritised P0/P1/P2; treat as advisory input for the human reviewer, not a merge gate.

P0 (blocking)

  • plugins/asta-tools/skills/workspace/assets/Makefile.managed:158-164: When a newly resolved release fails to download, the fallback stub is written to that release's cache path (for example v0.107.0/workspace.mk). Line ~113 treats vX.Y.Z refs as immutable, so the stub is never refreshed. The default-release file also keeps pointing at the old version, because only the success path rewrites it.
    • Effect: once the hour expires, every run resolves v0.107.0, finds the non-empty stub, and loads v0.106.0 indefinitely. One transient network failure pins the project to a stale release until someone deletes .asta/cache by hand.
    • The offline scan at line ~79 can also select the poisoned directory as the highest version.
    • Fix: do not persist the fallback at $@. Use either option:
      • Write it to a separate, non-persistent file (for example $(ASTA_CACHE_ROOT)/.fallback.mk) and include that file conditionally.
      • Mark stubs (for example with a # asta-fallback header) and treat a marked file as stale in both the immutable-ref check and the line ~79 scan.
    • Add a test that restores the archive after failed_new_release and asserts that v0.107.0 is eventually fetched.

P1 (should fix)

  • Makefile.managed:~135: mktemp -d creates the temp directory in $TMPDIR, so mv "$$tmp/workspace.mk" "$@" and the archive mv are cross-filesystem copies, not atomic renames. A concurrent make, or a make -j restart, can include a half-written workspace.mk or read a partial archive.
    • Fix: run mktemp -d "$(ASTA_CACHE_ROOT)/.tmp.XXXXXX" after mkdir -p.
    • Rename the archive before workspace.mk, since workspace.mk is the commit point; this order is already correct.
  • Makefile.managed:~70: touch default-release runs after ls-remote whether the lookup succeeded or not. It also refreshes the TTL even when the resolved ref differs from the cached one and the later fetch fails. That suppresses retries for an hour and hides the failure.
    • Fix: touch only when ls-remote returned a ref equal to ASTA_CACHED_RELEASE.
  • workspace.mk and assets/Makefile: The workspace-assets, preview, render, check, dev, deployed-url and preview targets are now maintained in two copies. The new test only asserts that both copies exist, so they will drift. The existing evidence tests now cover only workspace.mk, which leaves the scaffolded Makefile untested; the URL scheme already diverges (archive/refs/tags/...).
    • Fix: generate Makefile from workspace.mk, or add a test asserting the shared recipe bodies are identical.
  • Makefile.managed:6-16: The tracked-workspace.mk branch skips all ref validation, the .DEFAULT_GOAL target check and the check gate.
    • Fix: either document that a committed override is fully trusted, or apply the same ref validation before include workspace.mk.

P2 (nits)

  • Makefile.managed:~140: The regex ^[^/]*/plugins/... rejects archives whose entries carry a ./ prefix, which is common with custom ASTA_PLUGINS_ARCHIVE_URL tarballs.
    • Fix: allow an optional \./ prefix, e.g. ^(\./)?[^/]+/plugins/....
  • Makefile.managed:~108: ASTA_WORKSPACE_CHECK can be supplied from the environment or command line, which spoofs the gate.
    • Fix: use ifneq ($(origin ASTA_WORKSPACE_CHECK),file), or check a variable the loader overrides to empty before the include.
  • Makefile.managed:~63-67: With no docs.yml and a stale cache, every parse runs a network ls-remote, including after make restarts. Without timeout/gtimeout, as on stock macOS, there is no hard bound.
    • Fix: add a shell-level fallback timeout, or document the network dependency.
  • assets/gitignore:13: Existing projects that opt into Makefile.managed will not have .asta/cache/ ignored.
    • Fix: have Makefile.managed warn when git check-ignore .asta/cache fails.
  • SKILL.md: There is no documentation of the opt-in Makefile.managed flow. Add a short section covering opt-in, override via a committed workspace.mk, and clearing the cache.
  • Makefile.managed:1-4: The header says "Commit workspace.mk", but git add alone is enough, because git ls-files sees staged files.
    • Fix: say "track (git add)", or check git ls-tree HEAD instead.

Recommendation: request-changes

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

I checked the latest independent review against head 6efd481 and pushed the fix plus a test formatting follow-up.

  • Fallback poisons a release cache (P0): fixed. Fallback files are marked and retried on the next make; an older unmarked fallback is also recognized. Offline cache discovery excludes both forms. The requested ref and archive path stay separate from the fallback's included ref. The regression test covers failed download, offline use, restoration, and successful fetch of the newer release.
  • Cross-filesystem cache writes (P1): fixed. The download temporary directory now lives under the cache root. Archive and Makefile renames therefore stay on that filesystem, with the Makefile published last.
  • Release lookup TTL after failure (P1): fixed. The cached release timestamp is refreshed only when lookup returns that same release. A newer release whose download fails remains eligible on the next invocation.
  • Two Makefile copies (P1): retained during migration. The scaffold still uses the full Makefile because its pinned release lacks workspace.mk; the managed loader is opt-in until a release includes it. I added a refresh test for both the scaffolded Makefile and workspace.mk. Removing the duplicate after that release is tracked in the workspace work item.
  • Tracked override skips loader checks (P1): intentional. Tracking workspace.mk opts the project into owning all shared targets, including check. The loader header now states that trust boundary.
  • Archive ./ prefix (P2): fixed and covered by the managed-fetch test.
  • Check-gate spoofing (P2): fixed. An environment or command-line value no longer satisfies the gate; regression tests cover both.
  • Cache ignore rule (P2): fixed. An opted-in Git project now warns if .asta/cache/ is not ignored.
  • Header wording (P2): fixed. It now says to track the override, which includes staging it.
  • No timeout on some hosts (P2): left open. The current Git HTTP/SSH timeout settings are best effort. A portable hard bound would add a runtime dependency to local workspace commands; the remaining limitation is tracked in the workspace work item.
  • Skill opt-in instructions (P2): deferred. The skill still scaffolds the full Makefile. The PR description and optional loader header document opting in; skill setup instructions should change when a release can support the managed loader by default.

Local validation: 84 workspace workflow tests pass with GNU Make 4.4.1; repository make lint and make format-check pass. CI on the pushed commit is running. The PR remains draft while the revised executable loader receives an independent review.

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Independent AI code review (Codex)

Automated review of the PR by a separately invoked Codex reviewer. Prioritised P0/P1/P2; treat as advisory input for the human reviewer, not a merge gate.

P0 (blocking)

None.

P1 (should fix)

  • plugins/asta-tools/skills/workspace/assets/Makefile.managed:162: The archive and workspace.mk are replaced separately. An interrupted refresh can leave a new archive paired with an old Makefile, so targets and evidence assets use different versions. Install them as one cache generation and switch to it atomically.
  • plugins/asta-tools/skills/workspace/assets/Makefile.managed:173: If default-release is missing, a failed download of a newly resolved release cannot fall back to an existing cached release. Find the latest valid cached release for this failure path too.

P2 (nits)

None.

Recommendation: request-changes

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

I checked the latest independent review against 9733896 and fixed both findings in commit ab7bb2a.

  • Archive and Makefile from different refreshes: Each downloaded archive now has a content-addressed cache name. The included workspace.mk points to that exact archive, and its rename is the final switch. An interrupted refresh leaves the previous Makefile and its archive together. A regression test stages a newer archive without switching the Makefile, then confirms the old evidence is used; after refresh, it confirms both assets move together.
  • Missing release pointer during a failed download: The loader now scans valid cached releases when default-release is absent. The release fallback test removes the pointer, makes the new release download fail, and confirms the older release still runs.

All 84 workspace workflow tests pass locally with GNU Make 4.4.1. Ruff check and format check pass. CI on this commit is pending. Old content-addressed archives remain in .asta/cache/ until that cache is cleared; this avoids deleting an archive a concurrent build may still be using. The PR stays draft while the executable loader awaits an independent pass.

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Independent AI code review (Claude)

Automated review of the PR by a separately invoked Claude reviewer. Prioritised P0/P1/P2; treat as advisory input for the human reviewer, not a merge gate.

P0 (blocking)

None.

P1 (should fix)

  • Makefile.managed:20-24 — make clean behaves differently depending on the other goals. A bare make clean always runs the inline rm -rf _site .quarto recipe, even when a cached managed workspace.mk exists. make clean render uses the managed recipe instead. If upstream later extends clean (for example to remove _freeze), a bare make clean will never pick that up. This also contradicts the header comment "its recipe is managed".
    • Fix: when $(ASTA_CACHE_ROOT)/<resolved-ref>/workspace.mk (or the default-release pointer) already exists, include it. Use the inline recipe only when nothing is cached.
  • Makefile.managed:163-166 — cache archives grow without bound. Every successful refresh writes a new archive-<hash>.tar.gz, and nothing ever deletes old ones. A floating ref such as main/latest/a branch refreshes hourly, so each upstream change adds a full-repo tarball to .asta/cache/. The test at tests/test_workspace_workflow.py (assert first_archive.is_file()) locks this behaviour in.
    • Fix: after mv "$$tmp/managed.mk" "$@", prune $(@D)/archive-*.tar.gz except the newly referenced one. Use a grace period (e.g. find -mmin +60) so a concurrent workspace-assets that is still reading the old archive is not broken.
  • Makefile.managed:73-74, 139-175 — the default path executes unreviewed remote code. If docs.yml is absent (or ASTA_PLUGINS_REF is a branch), the Makefile auto-resolves the newest tag or branch tip and then includes the downloaded workspace.mk. That code runs on every developer machine with no in-repo review and no integrity check. Previously the Makefile was vendored and visible in diffs.
    • Fix:
      • Require an explicit pinned ref when docs.yml is missing; don't silently fall back to "latest".
      • Optionally verify a checksum, or print the resolved ref and commit loudly on every fetch.
      • Document the trust model in the header comment.
  • Makefile.managed:125-130 — fallback state retries the download on every invocation. While a # asta-fallback file is in place, workspace-ref-check forces a refetch on every make run, not hourly. On a flaky or slow network each command can stall for up to --max-time 120.
    • Fix: apply the same find ... -mmin -60 throttle used for floating refs, based on the fallback file's mtime.
  • assets/Makefile vs assets/workspace.mk — two copies of the shared targets with no parity check. The full Makefile remains the scaffolded default, yet most workspace-assets tests were switched to workspace.mk. Only test_workspace_makefile_refreshes_evidence_extension still exercises the full Makefile, so the two will drift. The tag URL scheme has already diverged (archive/refs/tags/...), which is why _make_evidence_archive was moved.
    • Fix: generate Makefile from workspace.mk, or add a test asserting the shared recipe blocks are identical. Also parametrize the offline, race and latest-tag tests over both files.

P2 (nits)

  • Makefile.managed:96-111 — some refs pass validation but collide with cache bookkeeping. Accepted refs include ., default-release, sources/<id>, and trailing-slash forms.
    • default-release collides with the pointer file.
    • sources/... collides with the custom-source namespace.
    • . places workspace.mk at the cache root.
    • Fix: reject ././-prefixed refs, any ref with a .-only segment, and the reserved names default-release and sources.
  • Makefile.managed:67 — the legacy-fallback filter checks the wrong lines. grep -Eq '^(# asta-fallback|override ASTA_PLUGINS_REF := )' matches any line in the file, so a genuine upstream workspace.mk that contains an override ASTA_PLUGINS_REF := line is wrongly excluded.
    • Fix: use head -n 1 {} | grep ... to match the first-line check at line 125.
  • Makefile.managed:113 — the default archive path is never valid. override ASTA_WORKSPACE_ARCHIVE := .../archive.tar.gz points at a file that is never created, and the fallback printf at line ~179 repeats the same dead path. Both only work because the included file overrides them later.
    • Fix: drop both assignments, or point them at the real hashed name.
  • Makefile.managed:74 — the timeout and non-timeout branches duplicate the full environment and command.
    • Fix: build $$limit as an optional prefix ($${limit:+$$limit 15}) and invoke git ls-remote once.
  • Makefile.managed:34-35 — a missing ignore rule only produces a warning. Because it is non-fatal, projects that have not updated .gitignore can easily git add -A tarballs from .asta/cache/.
    • Fix: make this an error, or auto-append the ignore entry.
  • tests/test_workspace_workflow.py — test_workspace_makefile_uses_latest_release_without_docs_workflow is ~200 lines of sequential scenarios with the same env dict repeated. A failure in an early step obscures the later cases.
    • Fix: split it into focused tests, or at least extract a run() helper.

Recommendation: request-changes

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

I checked the latest independent review against ab7bb2a and pushed commit 28af7c4.

  • Bare make clean (P1): kept deliberately. It is an offline bootstrap command that removes local Quarto output before any managed file has been fetched. The header now states this exception; combined goals load the managed targets. A later upstream change to clean would need to account for that contract.
  • Archive growth (P1): fixed. After publishing a new cache generation, the loader prunes old content-addressed archives after a one-day grace period. A regression test ages the old archive and confirms it is removed after refresh; the current archive remains.
  • Remote Make rules (P1): intentional trust choice. The selected asta-plugins ref supplies executable rules by design. docs.yml or ASTA_PLUGINS_REF controls that choice; without either, the loader uses the newest final release tag. The header now says this explicitly, and successful fetches print the selected ref. Requiring a pin when docs.yml is absent would change the agreed release-following option.
  • Fallback retries (P1): fixed. A fallback file now throttles refetches for an hour, then retries. The test covers an immediate second invocation and recovery after the fallback ages.
  • Full and managed Makefile parity (P1): guarded. The full Makefile remains the scaffold default until a release contains workspace.mk. A test now compares the shared command recipes and check command across both files, catching accidental drift during that migration.
  • Reserved ref names (P2): fixed. Empty and dot path segments, sources/..., and default-release are rejected before inclusion; tests cover each case.
  • Legacy fallback detection (P2): fixed. The cache scan checks only the first line for a fallback marker, so a legitimate later override ASTA_PLUGINS_REF line no longer hides a valid cached release. A test covers this.
  • Dead archive path (P2): fixed. The loader and fallback stub no longer set a path that is never created. A fetched managed Makefile supplies the real content-addressed path.
  • Missing cache ignore rule (P2): fixed. Git projects now stop with a clear error until .asta/cache/ is ignored. A test covers the failure and the ignore rule.
  • Duplicated timeout command and long test (P2): left as readability suggestions. Neither changes the selected ref or cache behavior; I kept this fix focused on runtime behavior and the parity guard.

Validation: 393 tests passed and one was skipped in the full local suite; Ruff lint, Ruff format check, and skill validation passed. The initial full test run had one environment failure because this dispatcher's default home directory is read-only; the complete rerun with a writable home passed. GitHub CI on 28af7c4 is pending. The PR remains draft pending a fresh independent review of the executable loader.

@gas2own

gas2own commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Independent AI code review (Codex)

Automated review of the PR by a separately invoked Codex reviewer. Prioritised P0/P1/P2; treat as advisory input for the human reviewer, not a merge gate.

P0 (blocking)

None.

P1 (should fix)

None.

P2 (nits)

None.

Recommendation: approve

@gas2own
gas2own requested a review from jbragg October 4, 2026 23:26
@gas2own
gas2own marked this pull request as ready for review October 4, 2026 23:26
@gas2own

gas2own commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by the CLI-based design in #170. The long project-committed Makefile loader will not be adopted; the shared workspace.mk asset is retained upstream. The new PR remains draft for CI and independent review.

@gas2own gas2own closed this Oct 5, 2026
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.

1 participant