Repository navigation
fix(cli): refuse a non-regular text destination before the plan reads it - #1256
Conversation
|
All five PR + field + reason: |
|
PR + field + reason: |
|
Returning this PR to draft: |
A text artifact's destination is judged by opening it (`_text_plan`), and the only destination refusal on that path tested a directory and a link. A named pipe at `target` therefore blocked forever -- no writer is ever coming -- on `show`, `show --diff`, `apply --dry-run` and `apply`, and `apply --from <file> --to <fifo>` blocked the same way with no text-destination refusal at all. `_refuse_text_dest` now applies the tree leaf's own rule one object type over: skip links (the link sentence keeps its bytes), skip a missing path, and refuse anything `open` cannot treat as a file, naming the kind through `filetree._entry_kind`. `show_payload` calls the refusal before `_text_plan` so the preview carries `apply`'s bytes and exits 0 (#1204), and `apply_from_payload` calls it before its own `_text_plan`.
|
PR + field + reason: State read in this turn (
The flip uses GraphQL |
|
@Birfy: review request for |
|
Lead pre-report: appending one correction section to the body (append-only; nothing above it is removed, tip
The red block and the rest of the list reproduce at this head: |
|
Review (Birfy) Tip SHA: 04d4821
|
Fixes #1248
What changed
show,show --diff,apply --dry-runandapplyplanned atextartifact by opening itstargetto decideunchanged(_text_plan), behind a destination refusal that tested only a directory and a link. A named pipe attargettherefore blocked inopenforever on all four surfaces, andapply --from <file> --to <fifo>blocked the same way because it has no text-destination refusal at all._refuse_text_destnow applies the tree leaf's own rule (_refuse_blocked_leaf) one object type over: skip a link (its sentence keeps its bytes), skip a missing path (apply creates it), and refuse anythingopencannot treat as a file, naming the kind throughfiletree._entry_kind—cannot write '<path>': '<path>' is a named pipe.show_payloadcalls the refusal before_text_plan, so the preview carriesapply's own bytes and still exits 0 (#1204);apply_from_payloadcalls it before its own_text_plan;apply_payloadneeds no reordering. Nothing changes for a regular destination, a directory, or a link.Verification at the tip
Tip SHA:
04d4821d231df333e9ae1f4ee6cbf5e75a08e087Ran:
22ea7528(new test only, no fix) →7 failed, 1 passed in 72.05s, every row killed attimeout 10(rc 124), stack naming_text_planatcli.py:3396reached fromshow_payload:3286andapply_from_payload:3797:FAILED tests/test_text_dest_non_regular.py::test_show_diff_names_a_fifo_target_instead_of_blockingFAILED ...::test_show_names_a_fifo_target_instead_of_blockingFAILED ...::test_apply_dry_run_refuses_a_fifo_targetFAILED ...::test_apply_refuses_a_fifo_targetFAILED ...::test_show_and_apply_print_the_same_sentence_for_a_fifo_targetFAILED ...::test_from_file_to_a_fifo_dest_is_refused_by_the_dry_runFAILED ...::test_from_file_to_a_fifo_dest_is_refused_by_the_real_applypytest tests/test_text_dest_non_regular.py→8 passed in 8.98spytest(8 related suites:test_show_dest_refusals,test_apply_from,test_apply_non_regular_leaf,test_apply_blocked_leaf,test_apply_symlink_dest,test_cli_apply_created_target,test_demo_dest_link,test_cli_apply_text_missing_parent) →36 passed in 13.51sAGENTDESCENT_HOMEwritable → 7000+ passed; the only failures are docker /markdown/ network rows that fail with the identicalFAILEDid set at base22ea7528(compared in.ci/base_cmp.txt)python3 -m tools.gen_api_docs --check→docs/api.md is up to datepython3 -m tools.changelog_fragments check→32 changelog fragment(s) OKNot run:
mkdocs build --strict— nodocs/ormkdocs.ymlchangeCorrection (appended by Lead; tip unchanged)
python3 -m tools.changelog_fragments checkat04d4821dreads33 changelog fragment(s) OK, not 32. The 32 is base22ea7528's count; this branch adds its own fragment, which moves the tip count by one.Every other number in the list reproduces at this head, red block included.