Skip to content

feat(stardust): replica --extend / --extend-next adds pages to a delivered site - #823

Open
catalan-adobe wants to merge 36 commits into
mainfrom
feat/stardust-replica-extend-core
Open

catalan-adobe wants to merge 36 commits into
mainfrom
feat/stardust-replica-extend-core

Conversation

@catalan-adobe

@catalan-adobe catalan-adobe commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Fixes #812. A replica run that reached replica handoff end had no way to deliver more pages of the same site. This adds an extend pass:

$stardust replica <URL> --extend <url,url,...>
$stardust replica <URL> --extend-next <n>

The contract is in skills/replica/reference/extend-pass.md. SKILL.md gains the two inputs and Setup step 0.

One rule keeps the pass small: a pass never sends a document under content/ that existed at its opening, and its localizer never rewrites one. That covers the pages, the nav, the footer and the fragments. It does not cover the block library under /library/ in DA: da-library.mjs generates that catalogue from the delivered pages and sends it whole in each pass. Older pages that link to the source site for a newly delivered page keep those links. The pass lists them in x<N>/relink-pending.txt and names the count in its report. Relinking and re-publishing older pages is a separate change. This pull request supersedes #813, which did that work inside the pass. The head of #813 (3f2bd07d) keeps that work.

  • For a caller. extend-pass.md opens with the contract for a person or a system that runs the skill unattended. A restart is the same command sent again. The state is one ledger line, ledger.mjs last replica. A refused request writes nothing. A blocked line says what to do next. Only a full first run can be extended: a page list on the first run makes a pilot.
  • Entry. ledger.mjs last replica decides first. After handoff end without --extend*, the agent renders the state report and stops. Replica writes nothing. The master skill's Setup has already refreshed stardust/scripts/, as on main. With --extend* it opens pass x<N>. An open pass is resumed first. The opening refuses another flow, a pilot, another site's URL and malformed flags. A pilot is a project whose direction.md spec line starts Synthesized (bounded-single):; a line that starts Promoted: is a full run. It also refuses an --extend URL with a query string. Every ledger line of the pass carries --track x<N>. ledger.mjs gains the replica phase extend.
  • One script opens and closes a pass: the new replica/scripts/extend-pass.mjs, with open and close. A test runs a first run, then pass x1, then pass x2, in a real git project.
  • Spec frozen. Phase 2 does not re-run. open copies the six spec files into x<N>/spec/ and freezes them. check runs after the extract, and close runs it again: a changed spec keeps the pass open.
  • The opening stops, with nothing written, on a project without content/ or without a spec file, on an uncommitted change under content/ (the deploy scripts' own content/.deploy-* files aside), and on a foundation file that changed since the site was delivered, committed or not.
  • A manifest that is only older than the delivery is no stop. A first run applies its foundation requests at C-final, and main's contract never froze again after that. open reads what was delivered from the commit that holds the closing ledger line. When every differing file is the same there as in the tree, it freezes the manifest again and opens. Row C of handoff-contract.md now tells C-final to run freeze --from after it applied the requests, as the pass's own C-final does.
  • Roster before capture. The crawler lists the source candidates: crawl.mjs --max 0 --skip-captured stardust/state.json --select-only. The new replica/scripts/extend-roster.mjs select keeps the ones whose EDS destination is free. A destination is taken when a captured page, a coverage row or an existing content document holds it. Captured pages include a redirect's final URL, read from the capture records as the crawler reads them. A document that a deploy ledger records as sent takes it too. --reserved-out records every taken destination in x<N>/reserved.paths. urls.txt is written last, and only on success. A page named with --extend is never dropped into a shorter roster: one whose destination is delivered, an existing document, or captured by an earlier run is refused with its reason.
  • Extract. --pages-file <roster> with --skip-captured. It runs Phases 1, 2, 2.5 and 6 plus prep typing and slots, never Phases 3–5.
  • New types only. A type that has an archetype goes to sibling tier. Only a new type runs Phases 3–4.
  • Phase 5 units. New units are named <unit>-x<N>, and done units are never reopened. Each pass gets its own C-deliver pair. done-check.mjs --track x<N> ends the pass.
  • The publish guard. extend-roster.mjs publish writes content/.deploy-allow: the DA paths of the pass's own documents. migrate.mjs render writes stardust/migrated/, so the guard stays empty during migrate. Right after the conversion writes a content/ document, the unit records it with extend-roster.mjs output and runs publish again. A new fragment is one line in x<N>/also.paths. While the guard file exists:
    • deploy-batch.mjs sends only the documents it lists, with or without --force. A --paths entry it does not list exits 2 before any request, its file on disk or not.
    • localize-links.mjs rewrites only the documents it lists. A link target is a document it lists, or one that existed when the pass opened (opening.paths). A new document that is held, such as an owner's draft, is never sent, so a link to it stays absolute. Where a listed document and an older one claim one URL, the listed one is the target. --json names the others in held.
    • Every command of handoff-contract.md § 2 runs as written there. No caller passes a new flag.
    • output and publish refuse a file at a destination of reserved.paths, and a symbolic or hard link. They hold and name an owner's draft. publish keeps one file per destination, and refuses a second one, listed in also.paths or not. It also refuses an also.paths entry at a roster page that no unit recorded: a page is published through output. publish works under a lock, so units can run it at the same time.
    • publish stops on a second file at a pass page's path, such as visit.html beside the recorded visit/index.html. autofix-aem.mjs and da-library.mjs read the first file that matches, so the contract runs publish before each.
  • Fail closed. Both scripts find the project from --content: the nearest directory, at or above it, that holds stardust/status.jsonl. While that ledger shows an open extend pass and the guard file is missing, they send and write nothing. They also refuse a --content that is not the project's content directory, such as content/en. The guard names its pass. A guard that names another pass, or none, is refused too, and only the open pass can run publish. A ledger that shows two passes open at once is refused by all three scripts. So is an extend start line without a track, which ledger.mjs writes when --track is missing. The shared check is the new deploy/scripts/publish-guard.mjs.
  • One writer. During a pass, deploy-batch.mjs sends every page and fragment, a single document too. The hand-written PUT that handoff-contract.md § 2 permits is not used: it does not read the guard. An older document that needs a repair is a blocked line for the owner.
  • Opening snapshot. Before extend start, open writes x<N>/opening.paths and x<N>/content-freeze.json: every content document on disk with its sha256, git-ignored ones too. select --opening keeps their destinations reserved, also for a file that has left the tree since. Once the pass is open, the snapshot is never made again: if it is missing, the pass is blocked.
  • The end. The guard stays through every check and retry. foundation-freeze.mjs check on content-freeze.json names each opening document that changed or went missing on disk, tracked by git or not. It skips dot-entries, so an edit to a document below a dot-directory is not in the report. The pass still never sends such a document. The pass reports them and never restores them. close writes extend end, removes the guard, and commits the ledger and that removal in one commit of its own two paths. So the next pass opens on a clean tree, and a clone of the last checkpoint holds no guard. close never pushes.

Changes to normal runs (outside an extend pass)

  • deploy-batch.mjs, localize-links.mjs: the guard above. Without content/.deploy-allow and without an open extend pass on the ledger, both behave exactly as on main.

  • da-library.mjs, rollout/lib.mjs, contracts.mjs, lib/: unchanged from main.

  • crawl.mjs: every new behaviour applies only under --skip-captured, --select-only or --link-first. A plain capped extract selects exactly as on main. Under --skip-captured:

    • --pages is exact: the entry page is not added.
    • www., /index.html and http/https fold into one source identity. Query strings stay part of it.
    • --reserve-slugs <file> names slugs no new page may take.
    • --max 0 lists every uncaptured candidate in order.
    • New --pages-file <file>: one URL per line, exclusive with --pages.
    • Assets and other hosts are filtered before the cap.

    Two changes apply to every run. The crawl log's discovery also records selection and max. _crawl-log.json appends each run to runs[], with the latest fields still at the top level.

  • ia-extraction.md § Incremental re-runs names --skip-captured for an extract re-run. It never applies with --refresh / --refresh-all.

  • plan.mjs: blocks of pages whose delivery status is deployed or verified count as converted for every run. A first rollout plans exactly as before. A resumed rollout whose representative failed while a sibling was deployed now gets reuse for the sibling's blocks. Pinned in the new plan.test.mjs. One line that computed a value nobody read is removed.

  • done-check.mjs: new --track <name>. Without the flag the verdict is unchanged.

  • foundation-freeze.mjs: new --paths-if-present and --from <manifest>. Plain --paths is unchanged. New export drift(): the comparison of check, without output.

Known limits

  • After a pass, older pages (nav and home included) still link to the source site for the new pages.
  • A candidate on an alias host is not discovered. With a www entry, --extend-next does not find a page that only the apex host links. main filters the sitemap and the links by the literal origin in the same three places. Naming the page with --extend works.
  • The one-writer rule is contract text. No script can stop a hand-written request to DA.
  • A file that appears at a pass page's path after the last publish is not caught before autofix-aem.mjs or da-library.mjs reads it.
  • The guard is a file in the checkout. Anything that edits it by hand defeats it.
  • The guard is found from the project that holds --content. A copy of the content tree outside the project has no ledger above it, so it is sent as on main.
  • A pass cannot deliver a page that an earlier run captured and never delivered. --extend refuses it with that reason, and --extend-next drops it.
  • A blocked pass ends only by delivering. There is no call that closes it without delivery.
  • extend-pass.mjs covers the opening and the end. The entry decision (resume, open or refuse), the spec restore and the relink list are still contract text: stardust:replica: move the extend pass's fixed sequences from extend-pass.md into an extend-pass.mjs #848.
  • When git cannot say what was delivered (a shallow checkout, or a closing ledger line that is not committed) and the foundation differs from its manifest, the opening stops and says so.
  • close commits locally. If that commit fails, the extend end line is already written: the same command finishes the close.
  • The checkout must hold stardust/migrated/ as the earlier passes committed it. inventory.mjs drops the coverage row of a delivered page whose migrated file is missing, as it does on main.
  • An owner's edit to an older document during a pass reaches the library refresh, as it does on main.

Evals

  • evals/replica-extend/: a delivered one-page run extended with --extend-next 1. It covers the opening, the freezes, the roster before capture, no re-capture, and the type routing. Its fixture holds the migrated home page and its sidecar, written by migrate.mjs.
  • evals/replica-extend-noop/: the same project resumed without flags. Nothing is written or re-run, the refreshed script copies aside.

New script / flag / endpoint: two new scripts, replica/scripts/extend-roster.mjs and replica/scripts/extend-pass.mjs, and one new library without a CLI, deploy/scripts/publish-guard.mjs. All three read and write local files only. extend-pass.mjs also runs git in the project: it reads the status, the history of the ledger and the delivered files, and close makes one local commit. It never pushes. The new flags all read local files only:

  • crawl.mjs: --skip-captured, --reserve-slugs, --pages-file, --skip-failed, --first-run-order, --select-only
  • foundation-freeze.mjs: --paths-if-present, --from
  • done-check.mjs: --track

The guard file only narrows what deploy-batch.mjs already sends. There is no new hook, MCP server, host or endpoint.

How I checked it

  • npm ci && npm run validate && node scripts/check-release-configs.mjs: pass, 44 configs and 0 broken.
  • npm test: 217/217. npm run lint:stardust: clean. npm run plugins:check: clean.
  • Every stardust script suite plus the golden snapshot: 138 of 141 pass. The three failures are qa/.../dropdown-unreachable.test.mjs, reskin/.../figma-gate.test.mjs and reskin/.../stream-render.test.mjs. All three need a browser and fail the same way on main.
  • Changed or added suites, with their check counts: extend-pass (new, 15), extend-roster (new, 30), deploy-batch (17), localize-links (11), crawl (58), foundation-freeze (22), done-check (31), plan (new, 5), ledger (35).
  • extend-roster.test.mjs runs the real deploy-batch.mjs and localize-links.mjs on the guard that publish writes. It asserts the PUT paths at a fake DA and the bytes of the older documents.
  • The tests fail when a fix is removed. I removed each guard and each review fix in turn: the open-pass refusal, the --paths check, the URL precedence, the captured reservations, the link checks, the lock, the alias report, the guard's pass name, the colliding file, the opening snapshot, the capture records, the also.paths collision, the two-open-passes refusal, the track case, the non-http named URL, the ledger directory, the pass without a track, the roster page in also.paths, the --content check, the project lookup, the link targets, the missing opening.paths, the named captured page, and 16 lines of extend-pass.mjs (the way through for an older manifest, the stop on an edit after delivery, the commit of the guard's removal, the resume rules, the order of the stops before the first write). Each time at least one suite failed.
  • check-skills --tokens: replica is at 4,833 of 5,000 tokens.
  • origin/main is merged in at a4883e92, with feat(stardust): a delivery unit closes only when every page it shipped has a gate row #788, fix(stardust): deploy-batch fails a page when a request gets no answer #831 and the reskin work (feat(stardust): reskin takes a Figma donor — headless capture, deterministic curation #439, feat(stardust): reskin checks a page against its Figma donor and on its aem.page preview (M2) #464, feat(stardust): reskin hands off to migrate — renderer, canon bridge, chrome hardening (M3) #531). The last merge had four conflicts with feat(stardust): reskin hands off to migrate — renderer, canon bridge, chrome hardening (M3) #531, and both sides are kept: the usage line of crawl.mjs, the arguments of doneGaps in done-check.mjs, row C of handoff-contract.md, and scripts-index.md.
  • The scripts index is at its size cap. main alone is at 12,283 of 12,288 bytes. To add the two lines for extend-roster.mjs and extend-pass.mjs, this pull request shortens the title, and writes 44 lines (deploy/, diff/, extract/, migrate/, qa/, rollout/) in the short form that main uses for spec/ and stardust/ (— what: flags). Only the separator changes: every code span and every exit note of main's file is kept. The index is now at 12,271 bytes.
  • prose-delta.mjs: +298 lines, +3,866 words. Almost all of it is extend-pass.md, read only when a run extends.
  • End to end: I ran the documented commands on a copy of the replica-extend fixture. The run used the local fixture site, Playwright and a fake DA:
    • The opening exits 0, and both freezes succeed.
    • The roster is /visit/ only, and reserved.paths is /.
    • The capture leaves index.json byte-identical, and a resume prints 0 new pages.
    • The real migrate.mjs render writes stardust/migrated/visit/index.html and nothing under content/. An output before the conversion is refused.
    • An output at the delivered home is refused.
    • The localizer rewrites the new page and leaves the home byte-identical.
    • The cluster deploy and the C-final --force deploy each PUT the two pass documents only.
    • --force --paths /index exits 2 with zero PUTs.
    • A recovery --force batch with the guard kept PUTs the two pass documents only, after an owner edited the home.
    • With the pass open and the guard deleted, both scripts refuse.
    • A second file at the new page's path stops publish.
    • After extend end the leftover guard authorizes nothing. Once it is deleted, both scripts behave as on main.
  • Fresh agent sessions. Each ran pi with github-copilot/claude-opus-5.5 in an empty home, with the skills of this branch. Each got only the text shown, and I checked each result against the work directory.
    • The two evals. replica-extend-noop: the session read the ledger, reported the state and wrote nothing. replica-extend: the session opened pass x1, froze the spec, selected /visit/ before capture, left the delivered page byte-identical, and routed the new type to Phases 3–4.
    • The command line alone, $stardust replica <URL> --extend-next 1 --hands-off. The session opened the pass and ran extract, recreation and the fidelity gate without a question. It stopped at delivery with a blocked line that names what is missing.
    • Restart with the plain command, and restart with the same extend command. Both resumed pass x1. Neither opened a second pass or ran the crawler.
    • Named pages, --extend <url>. The session ran the preflight, opened the pass for the named page and went on to delivery.
    • Three refused requests: a page that is already delivered, a URL of another site, and a bounded-single pilot. Each session refused, wrote no ledger line and created no pass directory.
    • A second pass on a site with nothing left. The session opened x2 and closed it with 0 new pages found by discovery.
    • The caller section itself. A session got five questions an outside system asks, and answered each correctly from extend-pass.md without changing the project.
    • Phase 5 against a local stand-in for DA that logs every request. The session ran publish at handoff start, output and publish right after the conversion, the localizer, deploy-batch.mjs, the forced re-send, E2, G and da-library.mjs. The stand-in received 6 PUTs: the new page twice, one media file and three library documents. It received none for the home, the nav or the footer, and none from a hand-written request. The three older documents are byte-identical on disk and in the stand-in. relink-pending.txt lists the home and the nav.
    • The pass did not close in the Phase 5 session. done-check.mjs reports header_parity, because the stand-in serves pages without block decoration. The session wrote a blocked line and kept the guard, as the contract says.
  • A full local scenario, on a static test site of 8 pages and a stand-in that serves decorated pages, so the published-origin gates and the header check run:
    • A first run of 3 pages reached handoff end, with gates 3/3 at 1440, 360 and wide.
    • Pass x1, --extend with 3 named pages, reached extend end. Pass x2, --extend-next 2, reached extend end, with gates 8/8.
    • In both passes, every write came from a script and none targeted a document of opening.paths. Those documents are byte-identical on disk and in the stand-in.
    • done-check.mjs --track x<N> exits 0 for both passes, and pass x2 changed no record of pass x1.
    • The visible text of all 8 delivered pages matches the source, word for word.
    • Five independent agents audited the three sessions read-only. Their corrections are in the pull request comment on the scenario, and the contract fixes are in 327da13c.
  • Not run: a real DA site and Code Sync, a pass that adds a new page type and closes, and --extend-next on a site with more pages left than requested.

Checklist

  • The change is to one plugin, or to repository tooling
  • npm run validate passes
  • Paths, commands and skills that the change names exist
  • New scripts, hooks, MCP servers or network endpoints are called out above
  • The human label is set, if a person and not an agent wrote this

…ling and republish steps

- extend-pass.md: --detail without leading dashes; input checks; spec opening bytes
  kept and restored by copy; foundation re-frozen from its own manifest; roster
  selected into urls.txt before capture (crawl --select-only) and read on resume;
  selection order recorded once in order.txt; siblings advanced to directed with a
  slot-filled source; republish list from localize-links --json perFile, held on
  unrelated edits and confirmed outside hands-off
- crawl.mjs: --select-only; relative state urls resolve against site.originUrl; a
  state file without pages[] and off-origin --pages exit 2; an all-captured --pages
  list exits 0 before any browser
- foundation-freeze.mjs: --paths-if-present, --from <manifest>
- deploy-batch.mjs: --paths accepts content file paths (/x.html)
- evals/replica-extend: a delivered one-page run extended with --extend-next 1
…ter and selection gaps

- extend-pass.md: relinked pages published only on the owner's yes in every mode
  (hands-off: a blocked line, nothing published), diffed against the opening commit;
  ledger read before flag checks, the positional URL must be the project's site;
  script copies refreshed at opening; roster written to a temp file and renamed on
  success, re-selected from request.txt; order from recorded provenance only;
  interrupted captures reconciled; spec files that were absent stay absent
- crawl.mjs: --pages exact under --skip-captured; same-origin non-asset filter in
  both orders before the cap; www-folded capture keys; records under <out>/pages
  count as captured; discovery.selection recorded; one-line all-captured exit
- foundation-freeze.mjs: --paths-if-present records absent[], check reports added
- plan.mjs: blocks delivered pages run are converted; a later pass reuses them;
  new plan.test.mjs
- evals/replica-extend: setup.sh commits the fixture; crawler path and criteria
… bounded pilot

- crawl.mjs: the asset/other-host filter applies only with --link-first or under
  --skip-captured, so a plain capped extract selects as before; /index.html folds
  into its folder for --skip-captured; --skip-urls <file> (pages an earlier pass
  could not capture)
- extend-pass.md, SKILL.md: no extend pass on a bounded-single pilot (it re-runs
  Phase 1 --prep); --extend URLs without query strings; pass number from the
  ledger, x<N>/ created after extend start; failed.txt; an empty roster is
  'nothing new found by discovery'; gate-all-x<N> re-gates earlier pages whose
  inputs changed (#793)
- ia-extraction.md, prep-mode.md: --skip-captured never with --refresh /
  --refresh-all; its effect on --pages and the crawl log stated
- plan.test.mjs: a failed representative with a deployed sibling (reuse, rep lost)
- evals/replica-extend-noop: a resume without --extend* after handoff end writes nothing
…elivered paths, allow-lists every PUT

- crawl.mjs: _crawl-log.json appends runs[] (latest fields stay at the top); --first-run-order and --skip-failed
  read it, replacing replica's order.txt / failed.txt; --delivered reserves coverage paths; strict selection folds
  queries and /index.html to one slot per delivery path, assets out even with an empty captured set
- deploy-batch.mjs --allow: no page outside the publish list is sent
- done-check.mjs --track: only the pass's own I-dashboard end completes it
- foundation-freeze --from: a formerly absent path that exists now is frozen, not dropped
- replica: the delivered-run check is Setup step 0, before installs and copies; idempotent opening;
  render units serialized; G per pass slug; fresh gate after an approved re-PUT
…dentity only against coverage; fail-closed --allow and --track

- crawl.mjs: --skip-captured keeps the source page identity (query strings stay); --delivered turns on
  delivery-roster mode, with destinations from contracts.mjs (lib/paths.mjs): named and discovered rosters
  dedupe by destination, named collisions checked before captured pages drop (case folded), coverage slugs
  reserved for the capture run too
- deploy-batch.mjs: --allow without a usable value exits 2 with nothing sent; a /x/ entry is /x/index
- done-check.mjs: --track without a usable name exits 2
- replica: Setup step 0 dispatches on the track first; extend pass preflights a named roster before opening,
  closes a rejected request, builds publish.paths from content files, scopes a republish approval to its revision
…ster.mjs; immutable republish revisions

- extract crawl.mjs back to a source tool: --delivered removed; --skip-captured dedupes new urls of one
  source page (query values stay distinct); --reserve-slugs; --max 0 lists every candidate
- replica/scripts/extend-roster.mjs (new): select filters candidates by EDS destination (contracts.mjs) against
  captured pages, coverage rows and existing content documents (nav, fragments), prefers a query-less url so the
  roster replays; publish lists only documents absent from the opening snapshot
- extend pass: opening content snapshot; pass-owned foundation manifest as re-freeze evidence; archetype
  representative rendered as archetype; republish as frozen revisions (digest, own ledger, safe restore); spec
  restore limited to the six spec paths
- foundation-freeze: manifest paths validated as root-relative; done-check --track uses the ledger's grammar
…snapshots out of commits, never restores over an owner's edit

- deploy-batch.mjs: a step succeeds only on 2xx (an exhausted transport failure is put-fail, not live); a
  --paths/--allow entry that names two documents (/nav.html) exits 2 before any request
- extend-roster.mjs: publish lists content file paths (/nav.html.html, /visit/index.html); select writes the
  slug reservations before the roster, so a roster on disk means the selection completed
- crawl.mjs --pages-file: a roster replays whole (a url may hold a comma)
- extend pass: C-final runs handoff-contract's three final units with -x<N>; opening/ and approved revisions are
  git-ignored with tracked sha256 lists; a declined republish restores only the localizer's own output, a mixed
  or edited file is held as a conflict
- foundation-freeze: a .. segment is refused as written, before normalizing
- eval fixture: content/index.html, the opening snapshot asserted
…e relinks checked by script

- extend-roster.mjs: a tracked opening inventory (path, sha256, tracked|ignored) replaces the content snapshot;
  publish lists only new documents of roster pages or also.paths (an owner's draft is held), enumerated exactly as
  deploy-batch does; relink-before/after record the localizer's input and output, relink-status classifies older
  documents against their last published bytes (opening blob or a landed revision) as candidate, conflict or held;
  relink-approve freezes a committed revision, relink-restore acts on candidates only
- deploy-batch.mjs: list entries resolved against the documents (literal or one .html dropped; ambiguous exits 2,
  unmatched --paths exits 1); the ledger records the sha256 each PUT sent and a live page changed since is driven again
- crawl.mjs: http and https are one site and one page; interrupted records are named
- extend pass: C-final re-runs each cluster's deploy (pages relinked after their PUT); an approved revision is
  re-gated in each final unit's own mode (--width, --wide); coverage reads the delivery tables only
…blication evidence from the deploy ledgers

- localize-links.mjs: --receipt <file> records the sha256 each run read and wrote for the files it rewrote (one
  receipt per run); --exclude-targets <file> keeps held documents from becoming link targets
- extend-roster.mjs: relink-status reads the receipts (relink-before/after and their shared pending file removed);
  the inventory records what the deploy ledgers and earlier passes say of each document (live, live-unverified,
  differs, unpublished) and only a published document has an opening baseline; publish refuses two new documents for
  one roster page and writes held.paths; new reconcile lists pass documents not delivered as they are now
- deploy-batch.mjs: the skip digest (sha256) is written only after live and verify succeed; putSha256 records what
  was sent, so a token halt never marks new bytes live
- crawl.mjs: an incremental run keeps an earlier locale root's outstanding capture gaps
- extend pass: checkpoint an approved revision before sending it; reconcile at C-final (archetypes, fragments); an
  approved nav or footer re-runs the final units over every page; unanswered candidates counted
…ublishes only recorded unit outputs

- lib/documents.mjs (new, shared): contentDocuments (lowercase .html, the deployer's rule), resolveEntry (what a
  path-list entry names), LIBRARY_ROOT / isLibraryPath; used by deploy-batch, localize-links, extend-roster and
  da-library instead of their own copies
- extend-roster: new output command (a unit records the exact files it wrote; publish lists only those plus
  also.paths, each checked with the deployer's entry rule); /library refused at selection and publication; a live
  row without a digest is held from approval; approve freezes the classified bytes; restore is a guarded
  move-aside/link write; new published command writes the library's input at delivered bytes; targets.paths
  replaces held.paths
- localize-links: --targets (an allow-list) replaces --exclude-targets; the receipt is written, its folder created,
  before any page; a file changed while the run read it is left alone
- deploy-batch: --adopt records a digest for a pre-digest live row when DA's source holds the local bytes exactly
- extend pass: units record outputs; the two localizer invocations spelled out; adopt at the opening; the library
  refresh from the published tree; shared-document approvals re-gate without --skip-existing
…ive documents; per-unit outputs

- deploy-batch: a re-run skips every page its ledger reads live and the origin serves, as documented (the
  changed-page re-drive is gone; digests are still recorded); --adopt records a digest only when the admin status
  shows the live page published from the matching source, else keeps sourceSha256 apart; a --content that is not
  a directory exits 2 before anything is written
- extend-roster: inventory writes reserved.paths (every DA document a ledger records live, file or not), enforced
  by select, output and publish; output writes per-unit outputs/<unit>.paths and publish validates the union; the
  newest live row decides the last published bytes, matched against any pass's committed copies; guardedRestore
  prepares the replacement first, handles EEXIST apart and puts the original back on any other failure
- extend pass: the reconcile deploy carries --force on redrive.paths under --allow
… forced re-drives keep the last verified publication

- deploy-batch --adopt (needs --paths): proof is DA's source bytes = the local file AND the source's Last-Modified =
  the admin status's live.sourceLastModified (a bare status request; helix-admin fills edit.lastModified only on an
  edit lookup, and not at all for a DA source); a page with no ledger row can be adopted; --force keeps the ledger and
  only bypasses the skip; each row keeps its last verified publication (published: {sha256, at}) apart from the
  attempt's status
- extend-roster: new opening-check (delivered documents whose published bytes cannot be recovered → unproven.paths);
  deploy ledgers (stardust/deploy/ledger-*.json …) that cannot be parsed stop every command; output records only grow;
  published also recovers documents missing from content/; link targets include pages coverage delivers
- lib/documents.mjs: deliveredRows and contentFile (moved from da-library), replaceIfUnchanged (used by localize-links
  and relink-restore); hidden entries skipped unless hidden: true (deploy-batch keeps sending them, as on main)
- localize-links: every page written through replaceIfUnchanged — a concurrent save is kept and reported as a conflict
- extend pass: opening-check reports at the opening; C-deliver proves (adopt) or blocks before the first PUT; after
  C-final, G and E2 re-run reconcile and the forced re-drive
…zen re-delivery; ledger runs merge only their rows

- deploy-batch: --adopt removed (a one-second Last-Modified cannot identify a revision); a run merges only the rows it
  drove and exits on the pages it selected; a live POST that succeeded but did not verify is recorded as liveAttempt
- extend-roster: opening-check covers the library's inputs (coverage pages) and recovers a missing file from a commit;
  new redeliver freezes the opening commit's bytes as an approved revision; publish writes rewrite.paths (never an
  opening document whose only proven copy is its working file); an unverified live publication makes the version
  unknown; ledger keys must be canonical DA document paths and materialization stays inside its tree
- lib/documents.mjs replaceIfUnchanged: refuses symlinks; keeps its files in the git dir, never staged
- localize-links: --rewrite (only the listed documents are rewritten)
- extend pass: unproven pages are re-delivered from frozen committed bytes on the owner's yes, or the pass ends
…end pass reads no older page it covers

- da-library --add: reads only the delivered pages the publication has not read (libraryDelta, the rule of
  done-check's stale gap), reads the published library back from DA first, appends new class combinations to the
  block documents DA holds, adds new blocks and templates, merges the sheets; any read that fails stops it before a
  DA write, and the marker stays standing (an append removes nothing it records)
- lib/documents.mjs: libraryMarkerPath and libraryDelta (rollout lib.mjs re-exports them)
- extend-roster opening-check: with a library published to this site its inputs are only the pages that publication
  has not read, so a legacy site's older pages need no proof and no re-delivery; publish reports how many opening
  documents may be relinked
- extend pass: the library refresh runs da-library --add when a library is published
A pass now sends and rewrites only its own documents. Relinking and
re-publishing older pages leaves the pass: the report lists them.

- extend-roster.mjs keeps select, output and publish. publish writes
  the guard content/.deploy-allow.
- deploy-batch.mjs and localize-links.mjs read that guard. Without the
  file they behave as on main.
- da-library.mjs, rollout lib.mjs, contracts.mjs and lib/ are main's
  again. lib/documents.mjs is removed.
- The digest ledger fields, --allow, --receipt, --targets, --rewrite
  and da-library --add are removed.

The relink work this replaces is the head of #813 (3f2bd07).

@catalan-adobe catalan-adobe left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Approach

What it does: Lets a completed replica run deliver named pages or the next N pages on the same site. Each pass fixes its page list before capture, preserves the approved design, and reuses gated archetypes. Without an extension request, a completed run just reports its state.

Fit with the repo: Replica is the right entry point for #812. The concern is how the pass establishes what it may publish. skills/replica/reference/extend-pass.md tells a migrate unit to register the files it wrote under content/, but plugins/stardust/README.md assigns migrate’s output to stardust/migrated/; deploy creates the content/ documents later. Both deploy-batch.mjs and localize-links.mjs also treat a missing content/.deploy-allow as unrestricted. The PR acknowledges: “The contract orders that step. No script enforces it.” During an open pass, that conflicts with root AGENTS.md’s fail-closed rule.

Strongest case for the approach as built: It reuses ledger tracks, rollout’s pending-page plan, and the existing gates instead of building a second pipeline. Deferring older-page relinking also avoids the approval and recovery machinery of #813.

Alternatives: Keep the pass. Register each new document at deploy conversion, when its actual path is known. Share one check between the two writers: if the ledger shows an open extension, require that pass’s allow-list before rewriting or sending anything. That costs a ledger read and a change to the handoff instructions; ordinary deployments keep their current behavior.

Questions for the author: Is there already an enforced delivery entry point that records converted files and refuses unscoped writes on an open pass? That would resolve my concern.

Missing context: The reported fake-DA run exercised the guard once installed, but not migrate.mjs render or rollout inside a pass. The field run on #812 is still pending.

Approach: Questionable

Strengths

  • plugins/stardust/skills/replica/scripts/extend-roster.mjs:193–195 writes the reservations before urls.txt. That gives resume a useful invariant: a roster on disk means selection finished.
  • plugins/stardust/skills/replica/scripts/test/extend-roster.test.mjs:216–237 exercises the real localizer and deployer against the guard that publish produced. Checking older documents’ bytes and the actual PUT destinations is stronger than testing the allow-list in isolation.
  • I ran the extend-roster, crawl, plan, and done-check suites; all passed. The delivery-stage failure below occurs at a boundary those suites do not exercise.

Issues

🚨 Critical (Must Fix Before Merge)

  • plugins/stardust/skills/replica/reference/extend-pass.md:150–156 — the documented handoff stops after a successful render. I ran the real sibling render on a temporary copy of the fixture. It reported rendered 1 … → stardust/migrated/; the prescribed output --files visit/index.html then exited 2: not a document under content. This is not a path-prefix typo: the migrated HTML is the input to deploy conversion, not the document to publish. Move output and the guard refresh to immediately after conversion creates the actual content/ file, before localization or PUT. Keep the guard empty during migrate.

  • plugins/stardust/skills/replica/reference/extend-pass.md:181–186 — following the closing instructions removes protection while delivery can still fail. The pass deletes .deploy-allow before done-check. If that check reports pages_not_live, the normal remedy is to publish and retry. At this point deploy-batch.mjs:306–314 treats the missing file as unrestricted, as does localize-links.mjs:204–206. A forced recovery batch can therefore send the older pages and an owner’s draft. Keep the guard through all checks and recovery; make both writers refuse to run when the ledger shows an open extension but its guard is missing. Ordinary runs with no open extension can retain today’s behavior.

⚠️ Important (Should Fix)

  • plugins/stardust/skills/replica/scripts/extend-roster.mjs:180–195 — reserved.paths is not the complete opening snapshot. It omits captured-only destinations, although selection treats them as taken; an also.paths entry can subsequently claim one. It also walks the current content tree after discovery, not the tree at base.txt. If an owner removes a tracked draft between opening and selection, no coverage or deploy ledger need name it, and the pass can publish a replacement at its opening destination. Record the opening set durably, including captured destinations and the opening commit’s content paths, and use it for both selection and publication.

  • plugins/stardust/skills/deploy/scripts/deploy-batch.mjs:300–311 — a forbidden --paths entry is silently ignored if its file is absent. For a list containing one allowed new page and a ledger-only older /footer, the initial filesystem filter drops /footer. The guard then sees no violation and sends the new page, contrary to the promised exit 2 with zero requests. Compare the normalized requested paths against the guard before intersecting them with the files on disk.

  • plugins/stardust/skills/deploy/scripts/localize-links.mjs:200–206 — a held draft can override the link target that will actually ship. With allowed visit/index.html and held visit.html—the competing-leaf case already in the composition fixture—I observed an allowed page’s link rewritten to /visit instead of /visit/. --check then passed. buildMap gives the last file with the same lookup key precedence, before it knows which file the guard allows. Keep older documents as targets, but give the recorded pass output precedence on a collision. Test the href from a third document.

  • plugins/stardust/skills/replica/scripts/extend-roster.mjs:73–78 — path membership does not protect older files reached through a symlink. documents() follows symlinks with statSync. A new roster path that links to an older HTML file can therefore be registered under its new name; localization through that name writes the older file’s bytes. Reject symlinked files and directory components for guarded outputs, and validate this at the writer as well as at registration.

  • plugins/stardust/skills/replica/scripts/extend-roster.mjs:250–278 — concurrent guard refreshes can lose a unit. Atomic rename prevents a torn file, not a stale write: one publisher can read the records, another can add a fragment and publish the larger set, and the first can then rename its smaller guard over it. The concurrent test at test/extend-roster.test.mjs:163–173 waits for all writers and calls publish only once. Serialize the read/build/replace operation or give one coordinator ownership of guard refreshes before releasing clusters to deploy.

  • plugins/stardust/skills/extract/scripts/crawl.mjs:347–352 — discovering a redirect alias is mistaken for recovering a missing state row. With an existing migrated index row for / and its on-disk capture recording finalUrl: /en/, addCapturedRecords reports index as absent from state. The pass explicitly tells the caller to add that row in Phase 6. Track state-row membership separately from URL aliases: reserve the final URL, but do not report an existing slug for reinsertion.

  • plugins/stardust/skills/extract/scripts/crawl.mjs:739–746 — automatic discovery drops valid site aliases before identity folding. With a www entry and the only uncaptured candidate on the apex host, strict selection returned no URLs. The link and sitemap readers also prefilter by the literal origin at lines 779 and 797. Thus --extend-next can report zero new pages where naming the same page explicitly works. Use the existing same-site predicate consistently in incremental discovery, while preserving plain-crawl behavior.

💡 Minor (Nice to Have)

  • plugins/stardust/skills/replica/reference/extend-pass.md:181–183 — the closing report misses renamed opening documents. I checked a staged rename: Git classified it as R100, so --diff-filter=MD printed nothing. Add --no-renames so the old path is reported as deleted, or explicitly handle rename records.

Recommendations

Extend the composition test by one stage on each side: start with a real migrate.mjs render, register the converted document, and end with a failed completion check followed by a retry. Assert both the exact PUT set and the older files’ bytes after recovery, not just during a successful guarded batch.

Assessment

Ready to merge? No

Reasoning: The documented path cannot register a normally rendered page, and the documented recovery path can publish documents outside the pass. Both affect the feature’s central delivery guarantee.


Review generated by gh pr-review · model: azure-openai-direct/gpt-6.2-astra

Fixes from the review of c3fd879 on #823.

- deploy-batch.mjs and localize-links.mjs share publish-guard.mjs. When
  the run ledger shows an open extend pass and the guard file is
  missing, they send and write nothing.
- deploy-batch.mjs checks the requested --paths against the guard, not
  the files found on disk.
- localize-links.mjs gives a listed document the URL when a held one
  claims the same.
- extend-roster.mjs: publish works under a lock; a document reached
  through a symbolic link is refused; captured destinations are
  reserved.
- crawl.mjs: a record whose slug the state holds is not reported as a
  missing row.
- extend-pass.md: output runs after conversion writes content/, not
  after migrate. The guard stays until extend end. The closing diff
  uses --no-renames.
@catalan-adobe

Copy link
Copy Markdown
Contributor Author

Reply to review 6063636756 (on c3fd8799). Fixes are in f42958d3 and 17af82d6. I reproduced each finding before changing anything.

The question

Is there already an enforced delivery entry point that records converted files and refuses unscoped writes on an open pass?

No, there was none. Now there is a refusal, and registration stays a documented step:

  • Refusal. deploy-batch.mjs and localize-links.mjs share the new deploy/scripts/publish-guard.mjs. When the run ledger beside content/ shows an open extend pass and content/.deploy-allow is missing, both send and write nothing. Without an open pass and without the file, both behave as on main.
  • Registration. No script writes content/: the agent's conversion does. So output stays a step of the contract, moved to right after the conversion. It fails closed: a page that no unit registered is not on the guard, is not sent, and done-check.mjs reports it unfinished.

Critical

  • output after render fails. Confirmed with the real migrate.mjs render: it wrote stardust/migrated/visit/index.html and nothing under content/. extend-pass.md now keeps the guard empty during migrate. output and publish run right after the conversion writes content/<page>.html, before the localizer and the PUT.
  • Guard removed before done-check. Fixed. The guard stays through every check and retry, and rm content/.deploy-allow is the last step, after extend end. If the guard is lost earlier, both writers refuse (above).

Important

  • reserved.paths incomplete. Captured destinations are now reserved, and an also.paths entry at one is refused. For the tree at base.txt, I added a contract check and no script snapshot: git diff --quiet $(cat $X/base.txt) -- content/ must exit 0 before the selection. Then the tree that select walks is the opening commit's. No script enforces that check; it is listed under Known limits.
  • --paths entry without a file. Fixed. The requested paths are compared with the guard before the files on disk are read. /footer with no file now exits 2 with zero requests.
  • Held draft takes a pass page's URL. Reproduced: a third document's link became /visit, not /visit/. Fixed: listed documents go last into the URL map, so the listed one is the target.
  • Symbolic links. output and publish refuse a file reached through a symbolic link, the file or a folder above it. I did not add the check to the writers: they only touch what the guard lists, and only publish writes the guard.
  • Concurrent publish. Fixed: publish reads the records and replaces the guard under a lock (deploy/file-lock.mjs). One test holds the lock and asserts that publish waits and writes nothing.
  • Redirect alias reported as a missing row. Reproduced with index and finalUrl: /en/. Fixed: a record whose slug the state holds still reserves its final URL, and is no longer reported for reinsertion.
  • Alias hosts dropped in discovery. Confirmed, not fixed here. The sitemap and link readers filter by the literal origin in three places, and those lines are main's. Changing them changes discovery for every --link-first run. --extend with the named URL works. It is listed under Known limits.

Minor

  • Renames. Fixed: the closing diff uses --no-renames.

Tests

  • extend-roster 21, deploy-batch 15, localize-links 10, crawl 57: all pass.
  • I removed each fix in turn. Each time at least one suite failed.
  • The composition test now ends with a recovery: guard deleted while the pass is open, both real scripts refuse, publish restores the guard, the forced batch PUTs the pass documents only, and the older files keep their bytes.
  • Still not run: the conversion to content/ itself, the gates and rollout's phases inside a pass, and the field run on stardust:replica: no way to add pages to a delivered replica run (extend after handoff) #812.

The web-cli-browser check failed on c3fd8799 with playwright-cli open timed out in plugins/web/cli. This pull request changes only plugins/stardust.

@catalan-adobe catalan-adobe left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Approach

What it does: Lets a completed replica run deliver named pages or the next N pages without rebuilding its approved design. With neither flag, it reports completion and writes nothing.

Fit with the repo: Replica is the right entry point for #812. The concern is the promise that “a pass never sends a document that existed at its opening.” The revised publish-guard.mjs protects two tools, deploy-batch.mjs and localize-links.mjs, including retries. But skills/replica/reference/extend-pass.md also says to follow handoff-contract.md §2 as written, and that contract permits direct DA PUTs for individual documents. Those writes do not consult the guard. The guard’s input also depends on a manual check: extend-roster.mjs select reads the checkout at selection time, not at opening. As the PR says, “No script enforces it.” Root AGENTS.md requires action guards to fail closed.

Strongest case for the approach as built: The pass reuses ledger tracks, rollout’s pending-page plan, and existing fidelity gates rather than building a second pipeline. Registering documents after deploy conversion respects the split between stardust/migrated/ and content/. Deferring older-page relinking avoids the approval and recovery machinery of #813.

Alternatives: Keep the pass. Record reserved content paths at opening alongside base.txt, and route every page or fragment PUT in an extension through the guarded batch writer, even for one document. That costs one snapshot and a narrower handoff instruction; ordinary deployments need not change.

Questions for the author: Is there already an enforced publishing path for single documents during an extension? If so, only the opening snapshot needs rework.

Missing context: The reported fake-DA run exercised guarded batches and recovery, but not conversion or a full rollout. The field run on #812 is pending.

Approach: Questionable

Strengths

  • plugins/stardust/skills/replica/scripts/extend-roster.mjs:197–200 writes the reservations before urls.txt. That gives resume a reliable signal that selection finished.
  • plugins/stardust/skills/replica/scripts/test/extend-roster.test.mjs:270–316 checks actual PUT destinations and older documents’ bytes, including recovery after a missing guard. The earlier missing-guard and localizer-precedence fixes are covered by behavior, not just by inspecting the allow-list.
  • I ran the extend-roster, crawl, localize-links, and plan suites; all passed. The failures below occur at boundaries those suites do not exercise.

Issues

Paths below are relative to plugins/stardust/.

🚨 Critical (Must Fix Before Merge)

  • skills/replica/reference/extend-pass.md:136–140 — the documented single-document publish path does not enforce the guard. The pass explicitly inherits handoff-contract.md §2 unchanged. That section permits a hand-written nav/footer PUT, specifies a direct per-page PUT, and says to publish chrome (skills/replica/reference/handoff-contract.md:47–51). A recovery following those instructions can send an older footer even when .deploy-allow correctly excludes it. The new missing-guard refusal fixes batch retries, not this path. Require the guarded batch writer for every page and fragment PUT during an extension, including one-document repairs. If an older document needs repair, report it as blocked rather than sending it.

  • skills/replica/reference/extend-pass.md:185–187 — Phase G and the library refresh can use a held draft instead of the registered output. I tested the same collision the PR handles in the localizer: registered visit/index.html, held visit.html, coverage path /visit. The real autofix-aem.mjs --slug visit edited the held file, and da-library.mjs --dry-run put its draft text in the generated library block. Both resolvers try the leaf first (skills/rollout/scripts/lib.mjs:176–179, skills/rollout/scripts/da-library.mjs:205–208); a non-dry library refresh then PUTs that block. This is not the acknowledged case of an owner editing an older delivered page: this file was never delivered. Resolve pass pages from their exact output records for both operations, or stop on ambiguity before editing or publishing.

⚠️ Important (Should Fix)

  • skills/deploy/scripts/publish-guard.mjs:29–34 — an existing guard is accepted without checking which pass owns it. During x2, retrying an x1 publish command rebuilds the global .deploy-allow from x1’s retained records. The publishers lock different pass directories (skills/replica/scripts/extend-roster.mjs:258–259), and the consumer returns the old allow-list before reading the ledger. A forced batch can therefore resend x1 documents that existed when x2 opened. Bind the guard to its track, reject a publish for a non-current track, and verify that binding at consumption.

  • skills/replica/reference/extend-pass.md:84–94 — the new Git check can pass even though an opening document is missing from reservations. I tested an ignored, never-published content/local-draft.html. Opening status was clean; after moving the draft aside, the prescribed git diff --quiet exited 0, and select admitted /local-draft. This is new evidence beyond the acknowledged risk of skipping the manual check: following it does not protect ignored documents. Persist the on-disk document paths at opening, including ignored files, and union that snapshot into selection and publication reservations.

  • skills/replica/scripts/extend-roster.mjs:185–190 — named selection and capture disagree about redirect aliases. With a state row for / and its capture recording finalUrl: /en/, I got a one-page named roster for /en/ and reserved.paths containing only /. Replaying that exact roster immediately printed 0 new pages because the crawler also reads the on-disk records. The earlier fix correctly stopped reporting the home slug as missing; the roster still promises a page that capture will never add. Use the same capture records, including final URLs, for selection and reservations.

  • skills/replica/SKILL.md:44–52 — the read-only decision is too late for the advertised $stardust replica entry point. The master skill copies its scripts before routing to replica (skills/stardust/SKILL.md:72–81,95–110). On a delivered project from an older plugin version, a no-flag resume can therefore modify the checkout before replica reads the ledger. The no-op eval expressly permits refreshed scripts (evals/replica-extend-noop/criteria.json:13), so it cannot catch this. Route this case before mutating master setup, and compare the entire checkout against its pre-invocation state in the eval.

  • skills/replica/scripts/extend-roster.mjs:85 — the link check misses hard-linked outputs. Unlike the previously fixed symlink case, a hard-linked copy of an opening document has its own real pathname and passes both output and publish without any subsequent file swap. The localizer’s in-place writeFileSync then changes the opening document’s bytes too (skills/deploy/scripts/localize-links.mjs:222–226). Reject multiply linked guarded outputs, or replace the allowed file atomically rather than modifying the shared inode.

💡 Minor (Nice to Have)

  • skills/deploy/scripts/localize-links.mjs:218–226 — held is broader than the closing report says. A draft created during the pass with /about.html linking to an already delivered page is counted as an “older document keeping source links,” even though neither part is true. Keep held as a diagnostic, but derive relink-pending.txt from opening documents with source-host links to this pass’s delivered destinations.

Recommendations

Extend the fake-DA test through Phase G and library generation with distinct marker text in the registered page and the competing draft. Assert that the draft stays byte-identical and that its text appears in no outgoing body. Then open x2 and verify that retrying an x1 command cannot authorize a write.

Assessment

Ready to merge? No.

Reasoning: The guarded batch and localizer paths are substantially improved, but the documented rollout can still publish an older document or expose a draft that the guard correctly held. Those failures break the central promise of the extend pass.


Review generated by gh pr-review · model: azure-openai-direct/gpt-6.2-astra

…erved

Fixes from the review of 17af82d on #823.

- publish-guard.mjs: a guard that names another pass, or none while a
  pass is open, authorizes nothing.
- extend-roster.mjs publish: only the open pass may run it. It stops on
  a second file at a pass output's path, because rollout's autofix and
  library read the first file that matches.
- extend-roster.mjs output and publish refuse a hard link too.
- extend-roster.mjs select: --opening keeps every document of the
  opening reserved, also one that has left the tree. It reads the
  capture records as the crawler does, so a redirect's final URL is
  captured.
- extend-pass.md: every document of a pass is sent by deploy-batch.mjs,
  never by a hand-written PUT. relink-pending.txt lists opening
  documents only. The entry text says what master Setup writes.
@catalan-adobe

Copy link
Copy Markdown
Contributor Author

Reply to review 6071205574 (on 17af82d6). Fixes are in e789a526. I reproduced all eight findings before changing anything.

The question

Is there already an enforced publishing path for single documents during an extension?

No. deploy-batch.mjs --paths is the guarded path for one document, and the contract now requires it. Nothing can enforce that in code: a hand-written request goes to DA directly and never passes through a script of this repository. So the rule is contract text, and the description lists it under Known limits.

Critical

  • Hand-written PUTs skip the guard. Confirmed: handoff-contract.md § 2 permits them, and extend-pass.md inherited § 2 as written. extend-pass.md no longer says that. It adds a "One writer" rule: deploy-batch.mjs sends every page and fragment of a pass, a single document too. An older document that needs a repair is a blocked line for the owner.
  • Phase G and the library read a held draft. Confirmed: resolveLocalFile and contentFile both return visit.html before visit/index.html. I did not change those two resolvers, because they are main's and serve every run. I took your second option, stop on ambiguity: extend-roster.mjs publish now exits 2 on a second file at a pass output's path. The contract runs publish before autofix-aem.mjs and before da-library.mjs. A file that appears after the last publish is not caught; that is under Known limits.

Important

  • Guard not bound to its pass. Fixed. publish writes a # pass x<N> line. publish-guard.mjs refuses a guard that names another pass, or none, while a pass is open. publish itself exits 2 for a pass that is not the open one.
  • Ignored opening document missing from the reservations. Fixed. The opening writes opening.paths: every content document on disk, ignored ones too. select --opening keeps their destinations reserved, and --reserved-out requires it. The git diff --quiet step is removed.
  • Redirect aliases. Fixed. select reads the capture records under current/pages/ as the crawler does. /en/ is now dropped as captured and reserved.
  • Read-only decision after master Setup. Confirmed, not fixed in code. Moving the dispatch means editing skills/stardust/SKILL.md, which is at 8,460 of its 1,000-token budget. The boy-scout rule then requires bringing it under budget in this pull request. I corrected the text: the entry section and the description now say that master Setup has refreshed stardust/scripts/ by then. The no-op eval already allows exactly that.
  • Hard links. Fixed. output and publish refuse a file with more than one link.

Minor

  • held is broader than the report. Fixed in the contract: relink-pending.txt gets the held entries that opening.paths lists.

Tests

  • extend-roster 23, deploy-batch 15, localize-links 10, crawl 57: all pass.
  • I removed each of the six code fixes in turn. Each time extend-roster.test.mjs failed.
  • New checks: a retried publish --pass x1 while x2 is open writes nothing, and the real deployer and localizer refuse a guard that names x1 or no pass.
  • Not added: the fake-DA test through Phase G and library generation. publish now refuses the collision before either runs, and I tested that refusal. Still not run: autofix-aem.mjs, da-library.mjs, the conversion and the gates inside a pass, and the field run on stardust:replica: no way to add pages to a delivered replica run (extend after handoff) #812.

… output

A fresh agent session passed `content/visit/index.html` to `output
--files`, was refused, and recovered from the message. The contract,
the usage text and the refusal now say that the path is relative to
the content dir.
… holds the migrated home

- extend-pass.md gains a section for a caller, a person or a system
  that runs the skill unattended: the three calls, that a restart is
  the same command sent again, the state as one ledger line, that a
  refused request writes nothing, and that a blocked line carries
  --next.
- The replica-extend fixture gains stardust/migrated/index.html and
  its sidecar, written by migrate.mjs, and the coverage row gains the
  file's sourceHash. inventory.mjs keeps a delivered row only while
  its migrated file is in the checkout: without it, two eval sessions
  lost the home row and restored it by hand.
@catalan-adobe

Copy link
Copy Markdown
Contributor Author

Local tests with fresh agent sessions

I tested the feature on one machine with 12 agent sessions. This comment gives the setup, the results and the limits. The head is b7966b00.

Setup

  • Each session ran pi in print mode with github-copilot/claude-opus-5.5, the way scripts/skill-eval.mjs runs its pi client.
  • Each session had an empty home directory and the stardust skills of this branch. It got only the text shown below.
  • The project was the replica-extend fixture: one delivered page, with the fixture site on localhost:8780.
  • I checked every result against the work directory and the ledger, not against the session's own report.
  • The 12 sessions took 49 minutes of agent time in total.

Results

# What the session got Result
1 The replica-extend-noop eval: "Continue the stardust replica run in this project." Read the ledger, reported the state, wrote nothing, and named the extend commands.
2 The replica-extend eval, --extend-next 1, told to stop before recreation Opened pass x1, froze the spec, selected /visit/ before capture, and left the delivered page byte-identical. It routed the new page type to Phases 3–4.
3 $stardust replica <URL> --extend-next 1 --hands-off, nothing else Opened the pass and ran extract, recreation and the fidelity gate without a question. It stopped at delivery with a blocked line that names what is missing.
4 $stardust replica <URL> --hands-off on the open pass of session 3 Resumed x1. No second pass, no crawl, and the capture is unchanged. It added one blocked line.
5 The command of session 3 again, on the same open pass Resumed x1. No second pass, no crawl.
6 --extend <url> with one named page Ran the preflight, opened the pass for that page, and went on to delivery. It blocked on the missing DA token.
7 --extend with a page that is already delivered Refused. No ledger line, no pass directory.
8 --extend with a URL of another site Refused. No ledger line, no pass directory.
9 --extend-next 1 on a bounded-single pilot Refused. No ledger line, no pass directory.
10 --extend-next 2 after a closed pass, on a site with no page left Opened x2 and closed it with 0 new pages found by discovery.
11 Five questions that an outside system asks about calls, restarts and states Answered all five correctly from extend-pass.md, and changed nothing.
12 Phase 5 of an open pass, against a local stand-in for DA See below.

Phase 5 against a stand-in for DA

No eval covers delivery, so I wrote a small server. It stands in for the DA source API, the admin API and the delivered origin. It stores what it receives, and it logs every request with the client's user agent. The project had a delivered home, nav and footer. The home and the nav linked to the source site for the page of the pass.

  • The guard: the session ran extend-roster.mjs publish at handoff start. It ran output and publish right after the conversion wrote content/visit/index.html, and publish again before da-library.mjs.
  • What the stand-in received: 6 PUTs. Two were the new page, one a media file, and three the library documents.
  • What it did not receive: no PUT for the home, the nav or the footer, and no PUT from a hand-written request. Every PUT came from a script.
  • The older documents: all three are byte-identical on disk and in the stand-in after the pass.
  • Relinking: the localizer rewrote the new page and held the home and the nav. relink-pending.txt lists both.
  • Not closed: done-check.mjs --track x1 reports header_parity. The stand-in serves pages without block decoration, so that check cannot pass there. The session wrote a blocked line and kept the guard, as the contract says.

What the sessions found

  • A stumble in the contract. A session passed content/visit/index.html to output --files. It was refused, and it recovered from the message. The contract, the usage text and the refusal now give the path form: relative to the content directory (ae058cc8).
  • A gap in the fixture. inventory.mjs drops the coverage row of a delivered page when its migrated file is not in the checkout. The fixture had no migrated file for the home. Two sessions lost that row and restored it by hand. The fixture now holds the file and its sidecar, written by migrate.mjs (b7966b00). The script is unchanged from main, and the contract states the precondition.
  • No caller contract. Nothing stated the calls and the end states in one place. extend-pass.md now opens with that section (b7966b00), and session 11 tested it.
  • Not confirmed. A session reported that sanitise.js fails under a package.json of type commonjs. I reproduced that only with a package.json from npm init. With the EDS boilerplate's file the script works. This pull request does not touch that script.

Limits of these tests

  • The setup for session 12 was mine. I wrote the prototype, the delivered nav and footer, the deploy ledger and the gate records by hand. They stand for Phases 3–4 and an earlier delivery. The session found that my prototype did not match the capture, and it redid Phases 3–4 before it delivered.
  • One run per case. I did not repeat a session to measure how often it passes.
  • One model and one client.
  • Which tree each session ran on: sessions 1, 2 and 12 on 58c996ef, sessions 3–5 on ae058cc8, session 11 on b7966b00. Sessions 6–10 ran on ae058cc8 with the corrected fixture. Sessions 7–9 ran before I wrote the caller section, and I wrote it while session 6 was running.
  • My first start of session 12 left a second agent in the same project. I stopped both, reset the project and ran it again with one agent. The results above are from that run.

Still not tested

  • A real DA site, Code Sync, and the pixel gates and the header comparison on a real aem.live origin.
  • A pass that delivers more than one page.
  • A second pass that delivers pages.

@catalan-adobe catalan-adobe left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Round 3 · since round 2

5 fixed · 2 still open · 2 new (2 in the new commits) · 1 declined · open blocking: 3 (was 7) · loop: converging

Approach

What it does: Adds tracked extension passes so a delivered replica can add named or next-ranked pages without rebuilding its approved design or reopening completed units.

Fit with the repo: plugins/stardust/README.md already makes replica the coordinator for the incremental extract → migrate → rollout pipeline, matching issue #812’s observation that those sub-skills largely support additional pages already. The round 2 concerns are now resolved: skills/replica/reference/extend-pass.md records opening.paths when the pass opens, and requires every pass document—including single-document repairs—to use deploy-batch.mjs. The shared deploy/scripts/publish-guard.mjs makes both publishing and localization fail closed from the tracked pass state, consistent with root AGENTS.md. The changes extend existing ledgers, planners, and writers rather than creating a parallel pipeline.

Strongest case for the approach as built: It preserves the established replica orchestration and existing delivery lifecycle while isolating each extension through ledger tracks, pass-suffixed units, a frozen specification, and a pass-owned publication allow-list.

Alternatives: A separate extension skill or copied rollout pipeline would duplicate replica’s state machine and delivery contracts. A broader generic transaction framework could replace the pass guard, but would require a much larger refactor without a demonstrated second use case.

Questions for the author: None. I would reconsider if any mandatory extension operation still had to publish a document outside deploy-batch.mjs.

Missing context: A real DA/aem.live field run and a successful multi-page or second delivery pass remain untested, but that affects confidence in execution rather than architectural fit.

Approach: Sound

Strengths

  • plugins/stardust/skills/replica/scripts/extend-roster.mjs:205-221 now combines state rows, capture-record redirect aliases, delivery records, current documents, and opening.paths, then writes reservations before the roster. This resolves several selection inconsistencies cleanly.
  • plugins/stardust/skills/deploy/scripts/publish-guard.mjs:40-51 correctly rejects missing, stale, unnamed, or wrong-pass guards in the normal single-open-pass case.
  • plugins/stardust/skills/replica/scripts/extend-roster.mjs:90-93 rejects both symbolic and hard-linked outputs, closing the older-document aliasing path.
  • plugins/stardust/skills/replica/scripts/test/extend-roster.test.mjs:324-359 exercises real localization and deployment across missing-guard recovery, stale guards, and a second pass, including assertions on actual PUTs and older-file bytes.
  • plugins/stardust/skills/rollout/scripts/plan.mjs:75-90 pre-seeds converted modules from deployed pages, ensuring later passes reuse already-live code rather than reconverting it.

Issues

🚨 Critical (Must Fix Before Merge)

  • F12 · plugins/stardust/skills/replica/scripts/extend-roster.mjs:307 — the collision guard can still let Phase G and the library read the wrong file.
    • The fix only rejects a colliding file when !keep.has(f). An entry in also.paths is added to keep first, so visit.html in also.paths is accepted beside the recorded visit/index.html.
    • I reproduced publish exiting 0 and writing both /visit and /visit/index to the guard. autofix-aem.mjs and da-library.mjs can consequently resolve the leaf instead of the registered page, despite the contract saying every such collision stops publication.
    • Reject any also.paths entry whose canonical destination is owned by a different recorded output, regardless of whether both files are allowed:
      const dest = pathKey(`/${f}`);
      if (owner.has(dest) && owner.get(dest).f !== f) {
        problems.push(`/${f} — shares ${dest} with /${owner.get(dest).f}`);
      }
      Add a regression test with /visit.html explicitly present in also.paths.

⚠️ Important (Should Fix)

  • F14 · plugins/stardust/skills/replica/reference/extend-pass.md:92 — an interrupted opening can recreate opening.paths from a later tree.

    • The snapshot is written after extend start, but the restart instructions say to recreate it when missing. If the session stops between those commands and an ignored opening document is moved before restart, the regenerated snapshot omits it. Selection can then admit that destination and the pass may publish over a document that existed when the pass actually opened.
    • Never derive an opening baseline from the current tree after extend start. Stage the snapshot before opening and preserve that staged copy across restart, or fail closed with a blocker when an opened pass lacks its baseline.
  • plugins/stardust/skills/deploy/scripts/publish-guard.mjs:30 — ambiguous ledgers with two open tracks authorize the first pass rather than failing closed.

    • openExtendPass() returns the first member of a Set. The ledger writer does not prevent extend start x2 while x1 remains open. With both starts present, a # pass x1 guard is accepted and can send x1 documents even though they existed when x2 opened.
    • Detect multiple open tracks and throw an ambiguous-ledger error. Neither publishing nor localization should proceed until the ledger has exactly zero or one open extension.

💡 Minor (Nice to Have)

  • plugins/stardust/skills/replica/reference/extend-pass.md:232 — the closing report cannot detect changes to ignored opening documents.
    • opening.paths intentionally includes ignored files, but git diff against base.txt cannot report an ignored file that was edited, moved, or deleted. Such an owner edit will be omitted from the promised report.
    • Record hashes for opening documents and compare that manifest against the final content tree, using hashes to identify moves where possible.
Fixed since the last round (6)
  • F11 — the extension contract now requires every page and fragment, including single-document repairs, to use guarded deploy-batch.mjs.
  • F13 — guards now name their pass, consumers verify that owner against the open track, and stale-pass publish calls are rejected.
  • F15 — roster selection now reads on-disk capture records and reserves redirect final URLs consistently with the crawler.
  • F16 — declined: “Moving the dispatch means editing skills/stardust/SKILL.md, which is at 8,460 of its 1,000-token budget… I corrected the text: the entry section and the description now say that master Setup has refreshed stardust/scripts/ by then.” The final accepted contract explicitly permits that refresh.
  • F17 — output and publish now reject files whose link count indicates a hard link.
  • F18 — relink-pending.txt is now restricted to held entries present in opening.paths.

Recommendations

  • Extend the collision test to cover duplicates explicitly listed in also.paths, not only held duplicates.
  • Add restart tests that terminate immediately after extend start, before each opening baseline artifact is written.
  • Test corrupted or overlapping pass state directly against both deploy-batch.mjs and localize-links.mjs.
  • Replace the path-only opening snapshot with a path-and-hash manifest that supports both reservation and final reporting.

Assessment

Ready to merge? No

Reasoning: The implementation substantially improves pass isolation, but the documented collision protection remains bypassable through also.paths, and restart or ambiguous-ledger states can still undermine the opening boundary or authorize the wrong pass.


Review generated by gh pr-review · model: github-copilot/gpt-5.6-sol

@catalan-adobe

Copy link
Copy Markdown
Contributor Author

Reply to reviews 6076863297 (on b7966b00) and 6086740115 (on 327da13c). Fixes are in 8e98001b. origin/main is merged in (22169d8d), and the conflict with it is resolved.

I reproduced each finding before changing anything. The review of b7966b00 raised three of them, and 327da13c did not answer them: I pushed that commit without reading the review. This reply covers both.

Critical

  • F12, an also.paths entry bypasses the collision check. Confirmed: with visit.html in also.paths beside the recorded visit/index.html, publish exited 0 and listed both. Fixed: publish keeps one file per destination. It refuses an also.paths entry when a recorded output holds that destination. It refuses it too when an earlier also.paths entry does. A test covers the leaf beside a page, and two fragments at one destination.

Important

  • F19, two open passes authorize the first. Confirmed: with x1 and x2 both open, a guard that names x1 was accepted. Fixed in publish-guard.mjs: more than one open pass throws. So deploy-batch.mjs, localize-links.mjs and publish all refuse. A track is now read in lower case, as ledger.mjs writes it. A test runs the real deployer and the real localizer on such a ledger, with a guard of either pass.
  • F14, an interrupted opening can recreate the snapshot from a later tree. Confirmed in the text. Fixed in the contract: the snapshot is written before extend start. A session that ends before that line opened nothing, and the next one starts again. Once extend start is on the ledger, the snapshot is never made again. If it is missing then, the pass writes a blocked line and stops.
  • select --named drops a URL that is not one. Confirmed: --extend /visit gave exit 0 and an empty roster. Fixed: a named entry that is no http(s) URL is refused with exit 2, and nothing is written. Another scheme, such as ftp:, is refused too. A discovered candidate keeps the old rule and is dropped.
  • liveDocuments() reads stardust/deploy from the working directory. Confirmed: from another directory, a footer that only a deploy ledger records was selected. Fixed: the ledgers are read beside --state.

Minor

  • F20, the closing report misses git-ignored documents. Fixed with the script the pass already uses. The opening writes content-freeze.json with foundation-freeze.mjs freeze --paths content, and the end runs check on it. I tested it on a tree with an edited tracked file, an edited ignored file and a renamed file: it names all three. It adds no new script.
  • scripts-index.md omits --opening. The index is at its size cap after the merge of main. So the extend-roster.mjs line now names the three subcommands and points to extend-pass.md. That file and --help give the flags.
  • A dangling symbolic link under content/ stops select, output and publish. Not changed. documents() mirrors the walk of deploy-batch.mjs on purpose, so both see the same documents. On main, deploy-batch.mjs fails on the same link with the same error. A change belongs in both scripts, in its own pull request.

Tests

  • extend-roster 27, deploy-batch 16, localize-links 10, crawl 57, foundation-freeze 22, done-check 27: all pass.
  • I wrote each new test before its fix and saw it fail. Then I removed each of the six code fixes in turn, and each time one check failed.
  • The end-to-end script follows the new opening order and the new closing report: 31 steps pass.
  • I asked a fresh agent session six questions about the new contract text. It answered five from the text. For the sixth, two open passes, it said the text did not cover the case. I added that sentence.
  • Not re-run after these fixes: the two evals and the local scenario of three sessions.

@catalan-adobe catalan-adobe left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Approach

What it does: Adds an extend pass (--extend <url,...> and --extend-next <n>) to stardust:replica so a delivered same-design migration can add pages on the same project and EDS site without re-running Phase 2 or reopening completed units, and makes resuming a delivered run without --extend* stop with a read-only state report.

Fit with the repo: Fits plugins/stardust/README.md and plugins/stardust/AGENTS.md. replica already coordinates extract, migrate, deploy, and rollout, and issue #812 establishes that those sub-skills mostly support incremental pages while replica lacked post-handoff entry, spec freeze, and unit isolation. The change extends existing primitives rather than building a parallel pipeline:

  • Tracks, phases, and freeze manifests: Adds one extend phase to skills/stardust/scripts/ledger.mjs, an optional --track filter to skills/rollout/scripts/done-check.mjs (reusing the track convention from skills/replica/reference/first-page-first.md), and --paths-if-present / --from to skills/replica/scripts/foundation-freeze.mjs so one manifest tool handles the spec, opening content/ snapshot, and re-frozen foundation.
  • Skill boundaries preserved: skills/extract/scripts/crawl.mjs stays a source-side tool (--skip-captured, --reserve-slugs, --pages-file, --skip-failed, --first-run-order, --select-only, plus runs[] in _crawl-log.json), while EDS destination selection and pass-output tracking live in skills/replica/scripts/extend-roster.mjs via skills/stardust/scripts/contracts.mjs. skills/rollout/scripts/plan.mjs pre-seeds already-delivered blocks as converted for any resumed rollout.
  • Fail-closed guard (AGENTS.md § Security): skills/deploy/scripts/deploy-batch.mjs and skills/deploy/scripts/localize-links.mjs share one library (skills/deploy/scripts/publish-guard.mjs, registered in evals/lint/libraries.mjs) that reads content/.deploy-allow and stardust/status.jsonl. Outside an open pass with no guard file, normal runs are unchanged; while a pass is open, missing, wrong-pass, or multi-open-pass states fail closed.
  • Repo budgets and hygiene: skills/replica/SKILL.md stays within the 5,000-token budget (4,832 tokens) backed by two new evals (evals/replica-extend/, evals/replica-extend-noop/), detail lives in skills/replica/reference/extend-pass.md, and scripts-index.md and evals/README.md are updated.

Strongest case for the approach as built: Bounding the pass to new content/ documents and deferring older-page relinking to relink-pending.txt (instead of #813's inline relink/approval/restore machinery) keeps shared delivery scripts (deploy-batch.mjs, localize-links.mjs, da-library.mjs, contracts.mjs) nearly untouched, enforces isolation through one fail-closed guard file without adding flags to every Phase 5 command, and leaves older-page relinking cleanly composable after extend end.

Alternatives:

  1. As-is (pass-scoped .deploy-allow guard + deferred relinking via relink-pending.txt): Small footprint on shared deploy/rollout scripts and no parallel pipeline. Cost: older documents keep source-host links until a follow-up relinking workflow consumes relink-pending.txt, and the single-writer rule ("no hand-written DA PUTs") remains contract text because scripts cannot intercept raw HTTP requests.
  2. Inline older-page relinking and approval inside the extend pass (superseded #813): Resolves source-host bounce links in older pages during the same pass (skills/rollout/reference/operational-learnings.md). Cost: substantially larger cross-cutting changes across deploy and rollout scripts for a separate concern that layers cleanly on top afterward.
  3. A standalone extend skill instead of flags on replica: Keeps extend docs outside skills/replica/. Cost: duplicates replica's flow guard, ledger state machine, archetype/sibling routing, and Phase 5 handoff contract, conflicting with plugins/stardust/AGENTS.md's single-home rule.

I would reconsider if a mandatory extend-pass step had to publish a content/ document outside deploy-batch.mjs, or if the follow-up relinking workflow could not consume relink-pending.txt without reworking the pass artifacts.

Questions for the author: None.

Missing context: Exercised via unit/composition suites, evals, and a local decorated-DA stand-in across two passes, but not yet on a real DA / Code Sync / aem.live site or a closing pass that introduces a new page type (and evals were not re-run after the final commit). That lowers execution confidence rather than changing architectural fit.

Approach: Sound

Strengths

  • Fail-closed publish guard with narrow blast radius (plugins/stardust/skills/deploy/scripts/publish-guard.mjs:23-56, deploy-batch.mjs:311-319, localize-links.mjs:204-213): Both writers share one guard module that throws on missing guards, wrong/unnamed pass headers, and multiple simultaneously open tracks in stardust/status.jsonl, while leaving ordinary non-extend runs completely unchanged.
  • Complete destination and aliasing protection in extend-roster.mjs (plugins/stardust/skills/replica/scripts/extend-roster.mjs:75-120, 211-235, 290-335): select combines state.json, on-disk current/pages/*.json redirect finalUrls, rollout coverage, deploy ledgers resolved relative to --state, live content/ documents, and the opening snapshot (--opening), writing reservations atomically before urls.txt. output and publish reject both symbolic and hard links (aliased), serialize guard updates via deploy/file-lock.mjs, and now enforce one-file-per-destination across unit outputs, also.paths, and stray competing files on disk.
  • Strong behavioral and composition test coverage (plugins/stardust/skills/replica/scripts/test/extend-roster.test.mjs, deploy-batch.test.mjs, localize-links.test.mjs, crawl.test.mjs, foundation-freeze.test.mjs, done-check.test.mjs, plan.test.mjs, ledger.test.mjs): All 8 suites pass locally (198 checks across these suites), exercising the real deploy-batch.mjs and localize-links.mjs against a fake DA server across concurrent output/publish races, missing-guard recovery, stale pass headers, multi-open-pass ledgers, and also.paths collisions.
  • Clean incremental primitives (crawl.mjs:393-397, foundation-freeze.mjs:176-184, plan.mjs:69-75, done-check.mjs:215-221): appendRun preserves legacy crawl logs as runs[0]; readManifest validates root-relative paths before touching the filesystem; plan.mjs pre-seeds blocks from deployed/verified pages as converted; done-check.mjs --track validates the track grammar strictly instead of falling back to the untracked verdict.

Issues

🚨 Critical (Must Fix Before Merge)

(none found)

⚠️ Important (Should Fix)

(none found)

💡 Minor (Nice to Have)

  • plugins/stardust/skills/deploy/scripts/publish-guard.mjs:29-31 — A whitespace-only track string in a hand-edited ledger line is added to the open set as "".

    • Why it matters: Line 29 checks !l.track, which is truthy for " "; line 30 then trims it to "" and adds "" to open. Alone, [...open][0] || null returns null, but if a valid pass x1 is also open, open.size becomes 2 and throws more than one extend pass is open (, x1). Checking if (!track) continue; after trimming avoids adding empty keys.
    • Suggested fix:
      const track = String(l.track).trim().toLowerCase();
      if (!track) continue;
  • plugins/stardust/skills/deploy/scripts/publish-guard.mjs:53-54 — The guard file's # pass <track> header is compared case-sensitively against the lower-cased open track.

    • Why it matters: openExtendPass normalizes ledger tracks with .trim().toLowerCase(), and extend-roster.mjs publish lower-cases track when writing the header, so normal runs always match. Normalizing owner with .trim().toLowerCase() keeps the reader consistent with openExtendPass if a guard header is ever checked or edited with uppercase letters (e.g. # pass X1).
  • plugins/stardust/skills/replica/scripts/extend-roster.mjs:295-306 — also.paths can authorize a roster page's destination without a unit output record.

    • Why it matters: extend-roster.mjs documents also.paths as "a NEW fragment the pages need" and holds any file at a roster page's destination that no unit recorded (output enforces the separation by rejecting non-roster pages and directing fragments to also.paths). In buildGuard(), also.paths checks reserved and destination collisions, but does not check pages.has(dest) when no unit recorded an output for that roster page yet — so putting /visit.html into also.paths before output runs succeeds and authorizes a roster page outside outputs/<unit>.paths. Refusing pages.has(dest) for also.paths entries would keep the contract symmetric with output.
  • plugins/stardust/skills/rollout/scripts/plan.mjs:84 — Unused local variable pending.

    • Why it matters: const pending = ['pending', 'stale', 'failed'].includes(p.delivery && p.delivery.status); is computed on every loop iteration and never referenced (dead code).
  • plugins/stardust/skills/replica/reference/extend-pass.md:93 — foundation-freeze.mjs freeze --paths content hashes every non-dot file under content/, while opening.paths lists *.html files.

    • Why it matters: In practice content/ holds .html documents (and dot-files like .deploy-allow and .deploy-ledger.json are skipped by foundation-freeze.mjs), so this works cleanly. If a project happens to store a non-HTML file (or a dot-directory containing .html) under content/, content-freeze.json and opening.paths cover slightly different sets. Worth noting or keeping in mind if non-HTML assets ever live under content/.

Recommendations

  • All blocking items from earlier review rounds (F11–F20, also.paths collision bypass, multi-open-pass ledger fail-closed, pre-extend start opening.paths snapshot ordering, select --named non-http(s) URL refusal, and --state-relative deploy ledger resolution) have been cleanly resolved and verified with regression tests.
  • Re-run the two new evals (replica-extend, replica-extend-noop) once after merge or in CI to confirm the final 8e98001b opening sequence (opening.paths + content-freeze.json before extend start) against a live agent session.

Assessment

Ready to merge? Yes

Reasoning: The implementation matches the PR plan and closes every blocking issue from previous review rounds with strong fail-closed guards, atomic file handling, and thorough unit + composition tests (all 8 changed/added suites and lint:stardust pass). Only minor polish items remain, none of which block merge.


Review generated by gh pr-review · model: github-copilot/gemini-4-neon

The scripts index stays under its 12,288-byte cap: the extend-roster line names its three subcommands only, and three of main's lines lose words, but no flag and no exit code.
… a roster page in also.paths

Fixes from the review of 8e98001 on #823.

- publish-guard.mjs: an `extend start` line without a track is an open
  pass that no guard can name. ledger.mjs writes such a line when
  --track is missing or blank, and the deployer then saw no pass and
  sent every document. deploy-batch.mjs, localize-links.mjs and
  publish now refuse, and name the `extend end` line that clears it.
- extend-roster.mjs publish: an also.paths entry at a roster page that
  no unit recorded is refused. A page is published through `output`.
- plan.mjs: remove a value that was computed and never read.
- extend-pass.md: the two rules above, and what the closing report
  does not cover (a document below a dot-directory).
@catalan-adobe

Copy link
Copy Markdown
Contributor Author

Reply to review 6089404296 (on 8e98001b). Fixes are in 627b2381. origin/main is merged in again (b2ce006a).

I checked each of the five minor findings against the code first.

  • publish-guard.mjs:29-31, a whitespace-only track. Confirmed, and the cause is wider than the finding. ledger.mjs drops a blank --track, so it writes an extend start line with no track at all. The guard skipped such a line. The deployer then saw no open pass and no guard. In my test it sent all 11 documents. The suggested continue keeps that hole, so the fix is another one. An extend start line without a track now counts as an open pass that no guard can name. deploy-batch.mjs, localize-links.mjs and publish refuse, and the message names the extend end line that clears it. A test runs the real deployer and the real localizer on both forms of the line.
  • extend-roster.mjs:295-306, also.paths can name a roster page. Confirmed: with /visit.html in also.paths and no output record, publish listed it. No existing check was bypassed: the reserved destinations still applied, and a second file for that page was still refused as a collision. It still let a page skip its unit record. Fixed: publish refuses an also.paths entry at a roster page that no unit recorded.
  • plan.mjs:84, unused pending. Confirmed. The line is from the first rollout commit on main, not from this pull request. It sits in the loop this pull request changes, so I removed it.
  • publish-guard.mjs:53-54, the guard header is compared case-sensitively. Not changed. Only publish writes the guard, and it writes the track in lower case. A header in another case means that something else wrote the file. The refusal is the fail-closed answer, and its message names the publish command that writes the guard again.
  • extend-pass.md:93, the manifest and opening.paths cover different sets. Half right. A file under content/ that is not .html is in the manifest only. If it changes, the closing report names it, and that does no harm. The other half is a gap. A document below a dot-directory is in opening.paths, so the pass never sends it. But the manifest skips it, so the report misses an edit to it. I measured both. The contract now says so. I did not change foundation-freeze.mjs for it: skipping dot-entries is how it keeps .env unread.

The merge of main, and the scripts index

main gained the Figma donor of reskin, which adds one line to scripts-index.md. That put main at 12,280 of the 12,288 bytes that the lint allows. With this pull request's one line the file was over the cap.

So this pull request now shortens the words of three of main's lines: the title, and the exit-code notes of gate-all.mjs and gate-evidence.mjs. No flag, exit code or script is dropped. The line for extend-roster.mjs names its three subcommands only. The index is at 12,285 bytes. A code owner may prefer a higher cap.

Tests

  • extend-roster 29, deploy-batch 16, localize-links 10, crawl 57, foundation-freeze 22, done-check 27, plan 5, ledger 34: all pass.
  • I wrote the two new tests first and saw each fail. Then I removed each fix in turn, three removals, and each time one check failed.
  • npm run validate, check-release-configs, npm test (217/217), lint:stardust and plugins:check pass. Of 103 stardust suites, 102 pass. The other one needs Playwright and fails the same way on main.
  • The end-to-end script passes its 31 steps.
  • Not re-run after these fixes: the two evals and the local scenario of three sessions.

@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

claude: approved on 2c0e8c8

This pull request adds an extend pass to stardust:replica (--extend <urls> / --extend-next <n>), so a site that has already been delivered can get more pages without re-running its design. The pass is opened and closed by the new extend-pass.mjs, picks its pages with the new extend-roster.mjs, and is protected by a fail-closed publish guard in publish-guard.mjs, which deploy-batch.mjs and localize-links.mjs share.

The last AI review (claude, on 0cae80a) denied for one reason only: the description did not call out the new script extend-pass.mjs or its local git commit. That is now fixed. The description names both new scripts and the library, says close makes one local commit of two paths and never pushes, and rewords the #848 limit.

The only commit since then, 2c0e8c80, fixes the two minor comments from that round:

  • It adds the missing words "than the delivery" to extend-pass.md.
  • It moves the content/ existence check and the snapshot read in open ahead of foundationAsDelivered, the only step that writes. So "nothing was written" is now true when the content tree can't be read. A test now asserts that the manifest is unchanged and the tree is clean in that case.

I checked foundationAsDelivered. Its stops all come before its single freeze, and the open writes come after it. So the reorder leaves no half-written pass behind.

Checks:

  • npm run validate and check-release-configs exit 0 on head (and on base).
  • I re-ran these suites on head and they pass: extend-pass 15/15, extend-roster 30/30, foundation-freeze 22/22, deploy-batch all checks; for localize-links I saw only the last line of its output, which was passing.
  • This round only reordered code and fixed wording, so I did not run an eval or a new test drive. Earlier rounds loaded 16/16 skills in all four clients, and the replica-extend scenario was inconclusive because it hit the turn limit.

Redundant lines: none. The only instruction line changed since the last review is the stale-manifest sentence in extend-pass.md. It was probed last round and was not redundant, and this round only re-wrapped it and added two words. Lines probed: 0 new; lines redundant: 0; lines I could not probe: 0.

@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

codex: approved on 2c0e8c8

The latest commit fixes the remaining write-before-refusal case: unreadable content now stops opening before the foundation manifest changes. All 15 extend-pass checks, 217 repository tests, and Stardust lint pass. Validation and release checks pass on both trees; all four clients load 16/16 skills. No new blocking defect found. No agent eval rerun: the instruction change only repairs a missing phrase.

Redundant lines
None. This round: 0 instruction lines requiring new probes, 0 redundant, 0 unable to probe.

@paolomoz paolomoz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@catalan-adobe four bugs inline. Two of them (the link map and the --content lookup) let the publish guard fail open, so those are the ones to fix first.

Prose: about 110 of the 275 lines of extend-pass.md are fixed sequences and decision tables, not judgment. My recommendation is one extend-pass.mjs that owns them:

  • status: the Entry table (ledger line, flow, spec line, URL site, flags give: state report, resume x<N>, open x<N+1>, or refuse). The caller's ledger-line table becomes its output.
  • open: the Opening block and its resume rules, idempotent. The foundation bug inline shows why: a script runs the check every time, and tests can cover it. Today only the evals reach the opening and the closing.
  • close: the end sequence (content check, done-check --track, handoff end, spec check, extend end with its detail, then removing the guard), plus the two early closes (rejected, 0 pages).
  • The § 1 spec restore loop as a foundation-freeze.mjs restore option, and the E2 relink list as a localize-links.mjs --opening flag.

Guard: the doc asks the agent to run publish at five points (handoff start, after each output, before each deploy, before autofix-aem.mjs and before da-library.mjs). If those scripts refresh or check the guard from $X/outputs/*.paths themselves, most of the § 4 guard bullets go and the step can't be missed. Script internals the agent can't act on (hard links, the lock, dot-entries, commas in URLs) can go too; the error messages already carry them.

Stays prose: new page types, migrate unit order and the sibling tier, module matching against the frozen DESIGN.json, foundation requests, the header re-exploration and the owner report. That takes the doc to roughly 170-190 lines.

Can you fix the four bugs here and take the script split as a follow-up?

const guarded = (f) => allow && !allow.has(`/${path.relative(opts.content, f).split(path.sep).join('/').replace(/\.html$/, '')}`);
const held = [];
// buildMap keeps the last file of a URL: the listed documents go last, so a held draft never takes a pass page's URL
const { map, redirects, pending } = buildMap([...files.filter(guarded), ...files.filter((f) => !guarded(f))], opts.content, opts.redirects);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

While the guard exists, buildMap still maps every file under --content, including the new documents the pass holds (an owner's draft, a roster page no unit recorded). A pass page linking to https://<source>/new-offer.html is rewritten to /new-offer, deploy-batch never sends the draft, and the published page has a 404 where it used to keep a working absolute link.

Older documents are live, so they should stay link targets; new documents the guard doesn't list (not in opening.paths) should not.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Confirmed. I reproduced it with both kinds of held document: an owner's draft and a roster page that no unit recorded. The pass page's links became /new-offer and /unrecorded, and neither document is sent.

Fixed in 1f97976a. While a pass is open, a link target is a document the guard lists, or one that existed when the pass opened (opening.paths). A link to a new document that is held stays absolute. Older documents are still targets.

The localizer now needs opening.paths during a pass. If the file is missing, it exits 1 and writes nothing. Without a guard and without an open pass, nothing changes.

A new check in extend-roster.test.mjs runs the real localizer on both cases. With the fix removed, it fails.

if (open.size > 1) throw new Error(`more than one extend pass is open (${[...open].sort().join(', ')}) — nothing was sent or written; close the earlier pass with its \`extend end\` line first`);
return [...open][0] || null;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The ledger and the guard are both found from --content (<content>/../stardust/status.jsonl, <content>/.deploy-allow), so the guard fails open when --content isn't the project's content/. With x1 open, deploy-batch.mjs --content content/en --force finds no ledger, publishGuard returns null, and every older /en/* document is sent.

What about finding the project root on its own (walk up to the directory holding stardust/status.jsonl), and refusing when a pass is open and --content isn't the directory the guard was written for?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Confirmed. With x1 open, --content content/en found no ledger, and in my test deploy-batch.mjs sent the page below it. A copy of the content tree further down the project was read as unguarded too.

Fixed in 1f97976a, as you suggest. publish-guard.mjs now walks up from --content to the nearest directory that holds stardust/status.jsonl. While a pass is open, it refuses a --content that is not a directory directly under that project. So content/en, a nested copy and the project root are all refused, by deploy-batch.mjs, localize-links.mjs and publish.

Two notes on the rule:

  • It compares the directory's place, not a path that the guard records. The guard file records no directory, and --content takes any name.
  • Symbolic links work both ways. One case is a link to the content directory from outside the project. The other is a content link that the project holds to a tree kept elsewhere. Each has a test.

One limit remains. A copy of the content tree outside the project has no ledger above it. So no pass is found, and the copy is sent as on main. I added it to the known limits.

// a named url is refused on a delivered or document destination even when it is captured too (checked first)
if (named && delivered.has(dest)) { refused.push({ url, why: `delivered at ${dest} (coverage)` }); continue; }
if (named && docs.has(dest)) { refused.push({ url, why: `an existing content document holds ${dest}` }); continue; }
if (captured.has(dest)) { dropped.push({ url, why: `already captured (${dest})` }); continue; }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A page the owner names with --extend that the first run captured but never delivered (no coverage row) is dropped here instead of refused. urls.txt comes out empty and the pass closes with 0 new pages found by discovery, which isn't what happened; the only trace is a dropped line on stderr.

In --named mode it should either join the roster or be refused with its reason.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Confirmed: exit 0, an empty urls.txt, and the reason only on stderr.

Fixed in 1f97976a: with --named, such a page is refused with its reason, exit 2, and nothing is written. The --extend preflight runs the same call, so the request is refused before a pass opens.

I chose the refusal, not the roster, for three reasons:

  • select reserves every captured destination in reserved.paths, so output refuses the page's document.
  • The crawl of the pass runs with --skip-captured and does not capture the page again.
  • A captured destination can be the redirect target of a delivered page. The roster then delivers that page a second time.

This leaves a gap that I added to the known limits. A pass cannot deliver a page that an earlier run captured and never delivered. --extend refuses it, and --extend-next still drops it, as before.

SPEC="PRODUCT.md DESIGN.md DESIGN.json stardust/current/PRODUCT.md stardust/current/DESIGN.md stardust/current/DESIGN.json"
for f in $SPEC; do [ -f "$f" ] && mkdir -p "$X/spec/$(dirname "$f")" && cp -p "$f" "$X/spec/$f"; done # the opening bytes
$F freeze --paths-if-present "$(echo $SPEC | tr ' ' ,)" --out $X/spec-freeze.json # a missing one is recorded absent
$F freeze --from stardust/rollout/foundation-freeze.json --out $X/foundation-freeze.json # the pass's own, as delivered

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

freeze --from re-hashes what is on disk and then replaces stardust/rollout/foundation-freeze.json. An edit made after delivery (a local change to styles/styles.css, say) becomes the delivered baseline, and C-final's check reports foundation unchanged while the pass pushes it.

Run $F check --manifest stardust/rollout/foundation-freeze.json before the re-freeze (exit 1 is a blocked line), and add the foundation paths to the opening's git status --porcelain.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Confirmed. I edited styles/styles.css after delivery: check exited 1 before the opening's re-freeze, and 0 after it.

Fixed in 1f97976a, in the contract:

  • The opening runs foundation-freeze.mjs check first. On exit 1 it stops, names the lines and writes nothing. The owner reverts the file, or records the change with freeze --from. The pass never does.
  • The re-freeze is gone from the opening, not moved behind the check. After a passing check it changed only frozenAt. The pass's own x<N>/foundation-freeze.json goes with it. The delivered manifest stays the baseline of every unit check.
  • C-final freezes again with freeze --from, only when it applied a foundation request. Without it, the next opening stops on the pass's own change.

I did not add the foundation paths to git status --porcelain. I measured check against it on six cases. Three are an edit: uncommitted, staged and committed. The others are a new untracked file, a deleted file and a renamed one. check exits 1 on all six. git status misses the committed edit.

Two limits:

  • This is contract text, so no unit test covers it. My end-to-end script and a fresh agent session do. That supports your point about a script that owns the opening.
  • A project whose first run applied a foundation request and did not freeze again now stops at the opening. main's contract does not say to freeze again, though its check at each unit end forces it. Two delivered projects that I checked, one of them made by main, pass the check.

Fixes the four findings of review 6113697153 on #823.

- publish-guard.mjs: the project is the nearest directory, at or above
  --content, that holds stardust/status.jsonl. While a pass is open, a
  --content that is not a directory directly under that project is
  refused: `--content content/en` found no ledger and sent every older
  document below it.
- localize-links.mjs: while a pass is open, a link target is a document
  the guard lists or one of the pass's opening.paths. A new document the
  guard holds is never sent, so a link to it stays absolute. A missing
  opening.paths exits 1 with nothing written.
- extend-roster.mjs select --named: a page an earlier run captured and
  never delivered is refused with its reason, not dropped into an empty
  roster.
- extend-pass.md: the opening runs `foundation-freeze.mjs check` and
  stops on exit 1. It no longer freezes the foundation again, which made
  an edit after delivery the baseline. C-final freezes it again only
  when it applied a foundation request.
@catalan-adobe

Copy link
Copy Markdown
Contributor Author

Reply to review 6113697153 (on 627b2381). The four bugs are fixed in 1f97976a, and each thread has its answer. origin/main is merged in again (1a8dde1b).

I reproduced all four before changing anything. The two that let the guard fail open came first: the --content lookup and the link map.

What changed

  • publish-guard.mjs: it finds the project by walking up from --content. While a pass is open, a --content that is not the project's content directory is refused.
  • localize-links.mjs: during a pass, a link target is a document the guard lists or one of opening.paths.
  • extend-roster.mjs select --named: a page that an earlier run captured and never delivered is refused with its reason.
  • extend-pass.md: the opening runs foundation-freeze.mjs check and stops on exit 1. It no longer freezes the foundation again.

Two limits came out of this, and both are in the description now. A copy of the content tree outside the project is not guarded. A pass cannot deliver a page that an earlier run captured and never delivered.

Tests

  • extend-roster 30, deploy-batch 17, localize-links 11: all pass. The other changed suites pass too.
  • I wrote each new test before its fix and saw it fail. Then I removed each fix in turn, eight removals, and each time at least one check failed.
  • npm run validate, check-release-configs, npm test (217/217), lint:stardust and plugins:check pass. Of 103 stardust suites, 102 pass. The other one needs Playwright and fails the same way on main.
  • Not re-run after these fixes: the two evals and the local scenario of three sessions.

The script split

Yes: the split is a follow-up, and it is not in this pull request. The foundation bug supports it. That fix is contract text, so no unit test covers it.

Three things I found that the follow-up can use:

  • localize-links.mjs now reads opening.paths itself during a pass. So it can name the older documents in its --json output without an --opening flag.
  • publish-guard.mjs now knows the pass directory. A check of the guard against outputs/*.paths can live there, for both writers. A refresh needs the lock that publish holds.
  • scripts-index.md is at 12,285 of 12,288 bytes. A new extend-pass.mjs needs one line there, so the cap or other lines must change first.

This round changed the contract from 275 to 281 lines.

The scripts index stays under its 12,288-byte cap: the extend-roster line takes main's new short form.
@catalan-adobe

Copy link
Copy Markdown
Contributor Author

@paolomoz the four bugs are fixed in 1f97976a, and each thread has its answer. Can you look again?

  • Head: 096771b8. main is merged in, and CI passes.
  • Two fixes differ from your suggestion. The threads say why.
    • A named page that an earlier run captured and never delivered is refused. It does not join the roster.
    • The opening no longer freezes the foundation. It runs check only, without git status on the foundation paths: check also catches a committed edit.
  • The script split is tracked in stardust:replica: move the extend pass's fixed sequences from extend-pass.md into an extend-pass.mjs #848. It is not in this pull request.

Four files conflicted with the reskin handoff (#531). Both sides are kept.

- crawl.mjs: the usage line lists main's --consent-overlays and the
  extend pass's flags.
- done-check.mjs: doneGaps takes main's sourceUrl404 and this branch's
  track.
- handoff-contract.md: row C is main's text, with the one phrase on the
  extend pass's own C-deliver pair.
- scripts-index.md: main's rewritten lines, plus the extend-roster line.
  The rollout lines take the short form main uses for spec/ and
  stardust/, so the file stays under its 12,288-byte cap. No flag, exit
  code or script is dropped.

@paolomoz paolomoz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@catalan-adobe thanks for the fixes. The --named refusal holds. Two things block the merge, both inline: the foundation stop came in with 1f97976a, the guard one was already in the PR.

Why we didn't see them before: both are about what one run leaves for the next, and my review followed a single pass from opening to close. The foundation stop comes from my own suggestion: I assumed stardust/rollout/foundation-freeze.json matches what's live, but the first run's C-final applies foundation-requests.md and never re-freezes. The re-freeze you removed was hiding that. The guard one only shows when x2 opens after x1, and the tests and evals run one pass.

Test: this is the case for the open / close split. A test that runs a first run with one applied foundation request, then x1 and x2, catches both. Can you add that test here along with the two fixes?

## Opening — idempotent on the open track

`git status --porcelain -- content/` must be empty (else stop: an uncommitted content edit is the owner's to
settle). `foundation-freeze.mjs check` must exit 0 (else stop, and name its lines: a foundation file changed since

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This stops every pass on a project whose first run applied a foundation request. handoff-contract.md row C applies foundation-requests.md at C-final and never runs freeze --from, so check reports the delivered CSS as changed after delivery, and the first fix it offers the owner (revert the file) would undo live changes.

What about adding freeze --from stardust/rollout/foundation-freeze.json to row C's C-final when a request was applied, as the pass's own C-final already does? Projects delivered before that change still need a way through, for example checking the opening against the foundation at the commit of the first run's C-deliver end.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Confirmed. I built a first run that applies one request at C-final and does not freeze again, as row C said. The opening's check exits 1 on it with changed styles/styles.css, and nothing changed after the delivery. Reverting that file brings the removed rule back.

Fixed in a899adef, both parts as you suggest:

  • Row C. C-final now runs freeze --from stardust/rollout/foundation-freeze.json after it applied the queued requests.
  • Projects delivered before that. The opening now compares the foundation with what the delivery commit holds. If every differing file is the same there as in the tree, the manifest is only older than the delivery. The opening then freezes it again from its own paths and opens. An edit after the delivery still stops it, committed or not.

One difference from your example: the commit it reads holds the run's closing ledger line, not the C-deliver end. That line is handoff end without a track, or the last extend end. Two reasons:

  • A first run can still change a frozen file after C-deliver end: the header_parity remedy fixes the header block.
  • After pass x1, the baseline is what x1 delivered, not the first run.

The opening finds that commit with git blame on the ledger line. If git cannot say (a shallow checkout, or a closing line that is not committed) and the foundation differs, it stops and says so.

The opening is now extend-pass.mjs open. The new extend-pass.test.mjs runs this case first: a first run with one applied request and no freeze, then x1 opens. Its other checks cover an edit after the delivery in four forms: uncommitted, committed, a new file and a deleted file.

`done-check.mjs --track x<N>` exit 0 — the pass's own `I-dashboard end`, never an earlier pass's — `replica
handoff end --track x<N>`, `$F check` on the spec manifest, `replica extend end --track x<N> --detail
"<n> pages delivered (x<N>), <total> live[; <n> older documents not relinked (relink-pending.txt)]"`. Only
then `rm content/.deploy-allow`, the last step of the pass. A pass that ends before Phase 5 (rejected, or 0 new

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

content/.deploy-allow is committed with the checkpoints (line 210), but this rm is never committed. The next opening then sees D content/.deploy-allow in git status --porcelain -- content/ and stops, so x2 can't open after x1. A clone of the last checkpoint also keeps a guard that names a closed pass, and deploy-batch.mjs refuses there.

My recommendation is to commit the deletion as part of this last step; the alternative is to never commit the guard and have the opening ignore it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Confirmed, both parts. After x1 closed as the contract said, git status --porcelain -- content/ reads D content/.deploy-allow. A clone of the last checkpoint holds the guard, and deploy-batch.mjs refuses there: the guard names a closed pass.

Fixed in a899adef, your recommendation. The last step is now extend-pass.mjs close. It writes extend end, removes the guard, and commits the ledger and that removal. The commit holds those two paths only, so other staged work stays out of it. It does not push.

Three more things came out of this:

  • Passes closed before this change. Their guard is committed and its removal is not. So the opening no longer counts the deploy scripts' own files under content/ as an owner's edit. Those are .deploy-allow, .deploy-ledger.json and .deploy-log.jsonl.
  • The same stop had a second cause. deploy-batch.mjs writes its ledger and its log under content/ by default. A re-deploy after the last checkpoint left them changed, and that stopped the next opening too. My local run found it.
  • A close that is cut short. extend end is on the ledger before the commit. If the commit fails, the same command again removes a guard that is still there and commits.

I did not take the alternative. It works: I tried it, and a clone of an open pass then fails closed until publish writes the guard again. But it needs a new ignore rule for a file under content/. The template that Setup writes covers stardust/ only. Passes that ran before the rule have a tracked guard anyway. The commit covers both.

extend-pass.test.mjs runs x1 to its close, checks that the tree is clean and that a clone holds no guard, then opens x2.

…uest, and x2 after x1

Fixes the two findings of review 6131724174 on #823, with the test it
asks for. The opening and the end of a pass are now one script, so a
test can run a first run, then x1, then x2.

- extend-pass.mjs (new): `open` and `close`.
  - open: a delivered manifest that is only older than the delivery no
    longer stops the pass. A first run applies its foundation requests
    at C-final and did not freeze again. `open` reads what was delivered
    from the commit of the closing ledger line. When every differing
    file is the same there as in the tree, it freezes the manifest
    again. An edit after the delivery, committed or not, still stops.
  - open: the deploy scripts' own files under content/ (.deploy-allow,
    .deploy-ledger.json, .deploy-log.jsonl) are not an owner's edit.
  - close: it removes the guard and commits that removal with the
    `extend end` line. The next opening and a clone of the last
    checkpoint start clean.
- handoff-contract.md row C: C-final runs `freeze --from` after it
  applied the queued requests.
- foundation-freeze.mjs: `drift()` is the comparison of `check`,
  without output.
- extend-pass.md: the opening and the end call the script.
- scripts-index.md: one line for the new script. The deploy, diff,
  extract, migrate and qa lines take the short form of spec/ and
  stardust/, so the file stays under its cap. No flag, exit code or
  script is dropped.
`open` read the content tree and the spec after its first writes. A
project without content/, with a dangling link in it, or with none of
the six spec files left a half-made pass directory, and in the last
case an `extend start` line.

It now reads the whole snapshot and checks the spec files before the
first write. Each of the three cases stops with exit 1 and nothing
written.
@catalan-adobe

Copy link
Copy Markdown
Contributor Author

Reply to review 6131724174 (on 1a6fe327). Both findings are fixed in a899adef and 0cae80a4, and each thread has its answer.

I reproduced both before changing anything. You are right about the cause: my tests and my local run followed one pass, and the re-freeze I removed hid the first one.

The test

It is in this pull request: replica/scripts/test/extend-pass.test.mjs, 15 checks, in real git projects. Its main line is the one you describe: a first run with one applied foundation request, then x1, then x2.

A test needs something to run. So the opening and the end are now one script: replica/scripts/extend-pass.mjs, with open and close. That is the open / close part of #848, done here. The rest stays in #848: status (the Entry table), the spec restore, the relink list, and the guard check in the writers.

I wrote the test first and saw every check fail. Then I removed 15 lines of the script in turn, and each removal made at least one check fail.

What else changed

  • extend-pass.md: the opening and the end call the script. The file went from 281 to 275 lines.
  • open writes nothing when it cannot open. It reads the content tree and checks the spec files before its first write.
  • scripts-index.md: one more line, for the new script. To stay under the cap, 44 lines now use the short form that main uses for spec/ and stardust/. Only the separator changes: every code span and every exit note of main's file is kept.
  • close runs git commit. It is the second script in the plugin that runs git, and the first one that commits. The description calls it out.

Checks

  • npm run validate, check-release-configs, npm test (217/217), lint:stardust and plugins:check pass.
  • Of 141 stardust suites, 138 pass. The other three need a browser and fail the same way on main.
  • My local end-to-end run uses the script now. It closes x1 and opens x2.
  • Not re-run: the two evals. No fresh agent session read the new contract text this time. My local session tooling is gone, and I did not rebuild it.

function commitClose(track, detail) {
const paths = [LEDGER, GUARD].filter((p) => git('ls-files', '--error-unmatch', '--', p).code === 0);
if (!paths.length || !gitOk('status', '--porcelain', '--', ...paths).trim()) return;
gitOk('commit', '-q', '-m', `replica extend ${track} end: ${detail}`, '--', ...paths);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude: close runs git commit in the user's checkout. It commits only the ledger and the guard, and it never pushes. This is a new script with a side effect on the repository, but the PR description still lists extend-roster.mjs as the only new script, and still calls the open/close split a follow-up (#848). Please call out extend-pass.mjs and its local commit in the description (AGENTS.md, Security: call out a new script).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The description names it now:

I updated the description right after the push of 0cae80a4, when this review had started. So it read the earlier text.

not count.
- **A foundation file changed since the site was delivered,** committed or not: the pass's checkpoints would push
it. The message names each file. The owner reverts it, or records it as delivered with
`$F freeze --from stardust/rollout/foundation-freeze.json`; the pass never does. A manifest that is only older than

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude: A word is missing: "A manifest that is only older than (a first run applied …)" should read "only older than the delivery".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 2c0e8c80: "only older than the delivery". A re-wrap of mine dropped the two words.

const dirty = gitOk('status', '--porcelain', '--', 'content/').split('\n').filter((l) => l.trim() && !/^content\/\.deploy-[^/]*\/?$/.test(l.slice(3)));
if (dirty.length) stop(`uncommitted changes under content/ — the owner settles them first; nothing was written\n${dirty.map((l) => ` ${l}`).join('\n')}`);
if (!SPEC.some((f) => existsSync(f))) stop(`none of the six spec files exists (${SPEC[0]} … ${SPEC.at(-1)}): not a delivered replica run — nothing was written`);
const note = await foundationAsDelivered(lines, state.last, freezer);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude: foundationAsDelivered can rewrite stardust/rollout/foundation-freeze.json (line 105) before two later stops: the check that content/ exists (line 154) and the snapshot read (line 155). On a project with a stale manifest and no readable content/, open says "nothing was written" but has already re-frozen the manifest. The re-freeze is legitimate, so this is minor, but the message is wrong. Moving the content/ check and the snapshot read above the foundation step would make the claim true.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Confirmed. On a project with a manifest older than the delivery and no content/, open froze the manifest again and then stopped with "nothing was written".

Fixed in 2c0e8c80, as you suggest. The content/ check and the snapshot read now come before the foundation step. That step is the last stop and the first write.

The test covers it. The check for an unreadable content tree now uses a project with such a manifest. It asserts that the manifest is byte-identical after the stop. With the old order it fails.

…zes the manifest

From the AI review of 0cae80a on #823.

- extend-pass.mjs open: on a project whose manifest is older than the
  delivery and whose content/ cannot be read, `open` froze the manifest
  again and then stopped with "nothing was written". The content check
  and the snapshot read now come first. The manifest step is the last
  stop and the first write.
- extend-pass.md: a missing word, "only older than the delivery".
@catalan-adobe

Copy link
Copy Markdown
Contributor Author

@paolomoz both findings are fixed, with the test you asked for. Can you look again?

  • Head: 2c0e8c80. CI passes, and both AI reviews approve it.
  • The test: replica/scripts/test/extend-pass.test.mjs. It runs a first run with one applied foundation request, then x1, then x2.
  • To run it, the opening and the end are now a script: replica/scripts/extend-pass.mjs, with open and close. close makes one local git commit and never pushes. Please check that this is fine for you.
  • One difference from your example: the opening reads the commit of the run's closing ledger line, not of C-deliver end. The thread says why.
  • The index: to make room for the new line, 44 lines of scripts-index.md now use the short form of spec/ and stardust/. If you prefer a higher cap, I will change it back.

This branch has not been deployed

No deployments
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.

stardust:replica: no way to add pages to a delivered replica run (extend after handoff)

2 participants