Repository navigation
fix(mfile,mctx): say what a dot state key names, and fit the state-dir message to its cause - #3605
Conversation
…r message to its cause
For the keys `.` and `..` the reason a state key is refused was the value
again, so the load refusal printed the key twice ("sets `state_key` to
"..", and it is ".."") and the run-time message did the same. The reason
now says what the key names: the current or the parent directory. The
package graph's state-dir prefix message reads the same reason.
When the state directory is composed, a key that passed the one-name
check can only fail because the directory's path resolves outside the
state base or cannot be resolved. The message told the person to choose a
one-name key, which they already had. It now names the task, the key and
the path's problem, and says to check that path for a symlink or a
permission problem.
Tests: the load refusal for `.` and `..` is pinned whole, and both
run-time messages of `make_env` are pinned, reached by passing the key
directly and by a symlinked state directory. The doc on
`from_dir_for_graph` names the state-key refusal it skips.
Refs #3520
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Approved: no findings at Nothing to do. Clobber: none seen. |
…right The run-time message set the reason straight after "The state directory for task ... and state key ...". That read well for "resolves to X, which is outside the state base Y" and wrongly for the two "cannot resolve ..." reasons, which made the state directory the subject of a sentence about the state base. The message now says the state directory cannot be used, then the reason after a colon. Refs #3520 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
There was a problem hiding this comment.
I checked the four follow-ups against the PR head and they hold. validate_state_component now gives . and .. a reason that says what they name. That reason flows unchanged to the load refusal (InvalidStateKey), to make_env and to the graph's state-dir prefix check in graph/src/env_setup.rs, and nothing else in the tree still pins the old it is ".." text. make_env uses validate_state_component to choose between its two messages, so a key that is not one name still gets the "set state_key" remedy. Only a real path-resolution failure gets the new symlink/permission message. The symlink test does build that path: the state base does not exist when durable_state_dir is first called, then the project directory is made a symlink out of it, so the second call resolves outside the base. I found no new issues. The open low note from minimal-foundry still applies: two of the three reasons from state_dir_encoded (cannot resolve the state base ... and cannot resolve ... under the state base ...) read ungrammatically after "The state directory for task ... and state key ...". Fixing it is cheap and doesn't need to block the merge.
Generated by Claude Code
What
Four follow-ups to #3520, each from a review note there.
Refs #3520
1. The run-time message fits what can still go wrong
After #3520 a state key that reaches the run has already passed the one-name check. What can still fail is the state directory itself: its path resolves outside the state base, or cannot be resolved. The message told the person to choose a key that is one directory name, which they already had. It now names the task, the key and the path's problem, and says to check that path for a symlink or a permission problem.
2. A real reason for
.and..For these two keys the reason was the value again, so the refusal read: sets
state_keyto "..", and it is "..". The reason now says what the key names: the current directory or the parent directory. The same reason is used at load, at run time and by the package graph's state-dir check.3. The untested branch has a test
The branch of
make_envthat names the task and says where to setstate_keyhad no test.make_envtakes the key as an argument, so a unit test reaches it directly.4. One doc
The doc on
from_dir_for_graphnow names both refusals it skips.Testing
make_env_names_the_task_for_a_state_key_that_is_not_one_namemake_env_refuses_a_state_directory_behind_a_symlinka_dot_state_key_is_refused_with_what_it_namesstate_dir_parent_component_is_rejectednow expects the new reason.Workspace lint, tests and the native end-to-end script pass on this commit.
🤖 Generated with Claude Code
Summary by CodeRabbit