Repository navigation
mxcli fix hashes + git-state warnings for Studio Pro (#972 items 1, 3) - #973
Merged
Merged
Conversation
…ash index Compares every Unit.ContentsHash with base64(SHA-256) of its .mxunit and reports mismatches, missing files and orphan files; --repair rewrites the mismatched hashes in one transaction under the writer's Studio Pro guard. exec and docker check warn when the index disagrees (~0.2 s on 900 units). Part of #972 (item 1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Studio Pro 11.13 fails with "Unable to find 'system' property in 'system'" when the branch has no upstream or git reports dubious ownership. docker check, run --local and diag -p now warn with the remedy. Never fatal; silent outside a repo, on a detached HEAD, under CI or with MXCLI_NO_GIT_WARNINGS=1. Part of #972 (item 3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Part of #972. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
watchAndApply held a bare *WebClientWatcher. A bundler that exited was never restarted, so every later page change failed with "watcher exited"; a failed incremental build (ENOTDIR on web/pages mid-rewrite, measured on 11.13 after adding an entity) dropped the change and the next one too; and ensureClientServed's recovery ran a one-shot production bundle in the same web/ directory while the watcher was still running. bundlerSupervisor now owns the bundler: EnsureAlive restarts an exited one with backoff, AwaitRebuild retries a failed incremental rebuild once with a fresh bundler, and a recovery re-bundle replaces the bundler (stop and reap, then start) instead of running beside it. The bundle-build limit is configurable (--web-client-timeout, MXCLI_WEB_CLIENT_TIMEOUT) and a timeout prints the tail of web-client-build.log. A change that restarts the runtime says that browser sessions were dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After each apply watchAndApply moved its change baseline to the source's current mtime, so an exec or save that landed during the build was folded into the baseline and never rebuilt. Keep the baseline at the mtime the build settled on; the build writes nothing under the watched source. Found while reproducing #971. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #972 — items 1 and 3. Item 2 (
mx_metadatagit notes) is not in this PR.Item 1:
mxcli fix hashesmodelsdk/mpr/contents_hash.go:Reader.VerifyContentsHashes()compares everyUnit.ContentsHashwithbase64(SHA-256(file))of itsmprcontents/xx/yy/<uuid>.mxunit, using the writer's hash and path code. It reports MISMATCH, MISSING (indexed, no file) and ORPHAN (file, not indexed).Writer.RepairContentsHashes()rewrites the mismatched hashes and bumps_Transaction.LastTransactionIDin one SQLite transaction. It takes the same guard as every write (guardWrite, the Studio Pro.mpr.lockcheck). The files are the source of truth and are never touched. MISSING and ORPHAN are reported only;diag --check-units --fixalready removes orphans. On MPR v1 it returnsErrNotMPRv2.cmd/mxcli/cmd_fix_hashes.go:mxcli fix hashes -p app.mpr [--repair], a sibling offix widgets/fix design-properties. It exits 1 while issues remain, so it can gate CI. On MPR v1 it says the check does not apply and exits 0. Each reported line names the unit ([DomainModels$DomainModel]).execanddocker check: cost measured on testapp (900 units). The wholemxcli fix hashesprocess takes about 0.2 s, so both commands now print a one-line warning when the hashes do not match or a unit file is missing. The warning never fails the command, and on v1 or an error it prints nothing.Item 3: git-state warnings
cmd/mxcli/gitstate.gowarns when the checked-out branch has no upstream (remedygit push -u <remote> <branch>, orgit remote add origin <url> && …when there is no remote). It also warns on "detected dubious ownership", reusing thesafe.directorycommand that git itself prints and telling the user to run it on the Studio Pro machine.docker check,run --localand a newmxcli diag -p app.mprproject section. That section reports both the hash drift and the git state. There is nodoctorcommand;diagis the closest one.checkout <sha>, where there is no branch to push). They are also silent when$CIis set orMXCLI_NO_GIT_WARNINGS=1. Each git call has a 3 s timeout and runs withGIT_TERMINAL_PROMPT=0.Docs
A new page,
docs-site/src/tools/outside-studio-pro.md(in SUMMARY). Also short notes indocker-check.mdandrun-local.md, a tip in thediff-localcommand, and a CHANGELOG entry under Unreleased/Added. No finding was recorded because these are features, not bug fixes.Test plan
go test ./modelsdk/mpr/uses a minimal v2 harness. It covers: an untouched control is clean; a reverted file is detected; a missing file and an orphan file are reported; repair rewrites the hash and leaves the file alone; repair is refused while.mpr.lockexists and the hash is unchanged; v1 returnsErrNotMPRv2.go test ./cmd/mxcli/runs on a pedapp copy:errHashIssuesRemain, MISMATCH names the unit, and the drift warning fires. After--repairthe project is clean and the warning is gone.go test ./cmd/mxcli/with temp git repos:execcreate persistent entity MyFirstModule.HashProbe, then restore the changed.mxunitbytes from a snapshot (asgit checkoutwould).fix hashesreports 1DomainModels$DomainModelmismatch and exits 1.--repairexits 0, and the next verify is clean.mx check(11.14.0) reports 0 errors; the untouched control copy also reports 0 errors.docker checkandexecon a drifted copy in a freshgit initrepo print both warnings.chowned to root via sudo,safe.directoryoverride removed):mxcli diag -pprinted the warning with git's own remedy line.TestFixHashes_DetectsAndRepairsRevertedUnitfails.gitStateWarningsWithreturning nil → the no-upstream, no-remote and dubious tests fail.TestGitState_WithUpstreamIsSilentfails.make build,make check-conformance,make lint,make check-findings: all pass.Follow-ups (not done)
mxcli notes write, mx_metadata).MXCLI_NO_GIT_WARNINGS=1silences it.🤖 Generated with Claude Code