Skip to content

Let doctor report the installer's north-star placeholder from the install record - #256

Merged
yihanzhu merged 4 commits into
mainfrom
ystack/roadmap-10/doctor-install-record-v1
Sep 7, 2026
Merged

Let doctor report the installer's north-star placeholder from the install record#256
yihanzhu merged 4 commits into
mainfrom
ystack/roadmap-10/doctor-install-record-v1

Conversation

@yihanzhu

@yihanzhu yihanzhu commented Sep 7, 2026

Copy link
Copy Markdown
Owner

The target installer (roadmap step 10, PR #250) writes a north-star placeholder that deliberately carries no shipped-default marker, and records north_star.state: "placeholder-unset" in .ystack/install-record.json. Doctor's check (h) detected an unreplaced north star only by the marker, so an installed target's placeholder was invisible and doctor reported a set north star.

Check (h) now also reads the target's .ystack/install-record.json when it exists as a regular, non-symlink file of at most 64 KiB holding exactly one JSON text: placeholder-unset emits a WARN of the same style as the marker warning; a symlink, oversized, invalid, or multi-root record emits a distinct malformed WARN and never aborts the run; any other state adds nothing. It parses with jq when present and degrades to a scoped extraction otherwise, and is gated by the same target check the existing anchor resolution uses. Every existing doctor line and exit behaviour is unchanged. The check (h) comment block describes the second source.

Tests: nine new assertions in scripts/test/north-star-gate.test.sh, the suite that already drives check (h) end to end.

Proof run on a4877ce:

  • bash scripts/test/north-star-gate.test.sh → 235 passed, 0 failed
  • shellcheck 0.11.0 -x -S style clean; bash scripts/check-rename.sh clean
  • bash scripts/test/portable-core-schema.test.sh → failures: 0

Construction mode: repo-only diagnostic change, no human gate.

🤖 Generated with Claude Code

packaging/v1/install.sh (pending PR #250, roadmap item 10) writes an
installed target's own placeholder .ystack/north-star.md with NO
shipped-default marker and no `status: active` entry at all, so check
(h)'s existing marker-based detection can only fall through to a
generic UNSET/no-active-entry WARN — it never names the installer's
placeholder specifically for a target that installed and never
committed anything.

check (h) now ALSO reads the resolved target root's on-disk
.ystack/install-record.json (the installer's own record, not
git-committed state) and WARNs when its body.north_star.state is
"placeholder-unset", naming the installer's placeholder directly.
A record that isn't a regular, non-symlink, <=64 KiB file holding
exactly one JSON text WARNs as malformed instead of crashing; any
other state, or no record at all, adds nothing. Parsing prefers jq
(as check (e) already probes for) and degrades to a scoped regex read
when jq is not on PATH.

Added 8 cases to the existing scripts/test/north-star-gate.test.sh
suite (which already drives doctor.sh check (h) end-to-end): the
placeholder-unset WARN, a non-matching state adding nothing, symlink /
invalid-JSON / multi-root / oversized malformed refusals, absence
adding nothing, and a malformed record never aborting doctor's run.

Proof: shellcheck -x -S style clean on both files; the full
north-star-gate.test.sh suite passes (235 passed, 0 failed, including
the new (24a)-(24i) cases); scripts/check-rename.sh clean.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 7, 2026

Copy link
Copy Markdown

Deploying ystack with  Cloudflare Pages  Cloudflare Pages

Latest commit: d897a7f
Status: ✅  Deploy successful!
Preview URL: https://9d87d4c4.fabrica-6yx.pages.dev
Branch Preview URL: https://ystack-roadmap-10-doctor-ins.fabrica-6yx.pages.dev

View logs

@yihanzhu

yihanzhu commented Sep 7, 2026

Copy link
Copy Markdown
Owner Author

Codex reviewer (cross-vendor, read-only)

Reviewed-head: a4877ce
Reviewed-base: 3cbd236
reviewer: gpt-5.5 @ high

Posted verbatim by codex-review.sh (codex exec review --json --base refs/codex-review/256-48166/base in an isolated temp worktree, sandbox forced read-only). Comments only — Codex never pushes, approves, or merges.

The added install-record diagnostic can abort or do unbounded reads in the exact malformed-file cases it is meant to handle gracefully. This breaks doctor.sh's no-crash diagnostic behavior.

Review comment:

  • [P2] Bound the install-record size probe — /private/var/folders/rm/bkx4f4b91vqfn79vk02pcd140000gn/T/tmp.oqXEcWhBpg/scripts/doctor.sh:589-594
    If .ystack/install-record.json is unreadable or very large, this unguarded wc -c <"$ns_h_record" either exits the whole doctor.sh run under set -e or reads the entire file before applying the 64 KiB cap, so the new malformed-record path can fail to produce the promised warning/summary. Use a guarded metadata or bounded-read probe before parsing the file.

ci and others added 2 commits September 6, 2026 22:17
The record probe read the file with wc before applying the 64 KiB cap, so an
unreadable or very large record could abort doctor under set -e or be read in
full first. The size now comes from stat (GNU form first, BSD fallback), an
unreadable file is treated as malformed, and the run and summary continue.

Proof: north-star-gate 236/236 (new case: an unreadable install record warns
as malformed and doctor completes), shellcheck clean.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@yihanzhu

yihanzhu commented Sep 7, 2026

Copy link
Copy Markdown
Owner Author

Codex reviewer (cross-vendor, read-only)

Reviewed-head: 4c94be2
Reviewed-base: 14ba9dc
reviewer: gpt-5.5 @ high

Posted verbatim by codex-review.sh (codex exec review --json --base refs/codex-review/256-32504/base in an isolated temp worktree, sandbox forced read-only). Comments only — Codex never pushes, approves, or merges.

The added diagnostic can produce a persistent false warning for normally installed targets after they have correctly replaced their north star. That makes the new doctor check misleading in a common success path.

Review comment:

  • [P2] Avoid treating the install record as current state — /private/var/folders/rm/bkx4f4b91vqfn79vk02pcd140000gn/T/tmp.jrGwRM9q46/scripts/doctor.sh:638-639
    When a target was installed and later replaced/committed .ystack/north-star.md, the installer’s record normally still says north_star.state=placeholder-unset because packaging/v1/install.sh writes that audit record once during install and no update path changes it. This makes doctor continue warning that “north star is still the installer’s placeholder” even after the marker-based check above has passed on the committed real north star; compare the recorded placeholder digest to the current file, or only use this warning when the current north-star content still matches the recorded placeholder.

The install record is written once and never learns that the placeholder
north star was later replaced, so a stale placeholder-unset record kept doctor
warning forever. The warning now fires only when the on-disk
.ystack/north-star.md still has the digest the record recorded for the
installer's placeholder; a replaced star, or a record without a digest, adds
nothing.

Proof: north-star-gate 237/237 (new case: a stale placeholder-unset record adds
nothing once the star was replaced), shellcheck clean.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@yihanzhu

yihanzhu commented Sep 7, 2026

Copy link
Copy Markdown
Owner Author

Codex reviewer (cross-vendor, read-only)

Reviewed-head: d897a7f
Reviewed-base: 14ba9dc
reviewer: gpt-5.5 @ high

Posted verbatim by codex-review.sh (codex exec review --json --base refs/codex-review/256-55198/base in an isolated temp worktree, sandbox forced read-only). Comments only — Codex never pushes, approves, or merges.

No actionable correctness issues were found in the diff. The new doctor check and focused tests appear consistent with the intended install-record warning behavior.

@yihanzhu
yihanzhu merged commit 949e08d into main Sep 7, 2026
2 checks passed
@yihanzhu
yihanzhu deleted the ystack/roadmap-10/doctor-install-record-v1 branch September 7, 2026 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant