Skip to content

Refuse a parent blocked by a non-directory early in project new (feature 006-refuse-non-directory-parent-early) - #35

Open
brettheap wants to merge 34 commits into
mainfrom
006-refuse-non-directory-parent-early
Open

brettheap wants to merge 34 commits into
mainfrom
006-refuse-non-directory-parent-early

Conversation

@brettheap

@brettheap brettheap commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openRepoProject-1

Closes #20

This PR realizes the ratified OpenSpec change refuse-non-directory-parent-early as Speckit feature 006-refuse-non-directory-parent-early.

What changes

project (design.md D1 and D2)

  • parent_case() reads the resolved parent with is_dir() and exists(). It then calls exists() up parent.parents until it reaches a path that exists, and calls is_dir() on that path. It opens nothing, reads no permission and adds no import.
  • The existing parent sentences stay byte for byte. One sentence is new. It covers a missing parent whose nearest existing path above it is not a directory (a file, a FIFO, a socket or a device):
    The parent PARENT cannot be created because ANCESTOR exists but is not a directory; choose a parent that is a directory.
  • The question and the Triad refusal still share one read, known_obstacles().
  • One new block in new() sits after the shape-only flag refusal and before choose(). It reads the parent again and refuses a blocked parent with exit 2, printing the parent's sentence followed by Nothing was created. (FR-003 to FR-005). The refusal comes before the plan and before anything is created. It applies however the single-repository path was chosen: by flag, without being asked, or by the answer 2, with or without --dry-run.

tests/test_project.py (design.md D3)

  • Twelve blocked-parent givens in six forms (Q1 B, Q3 A). The givens are:
    • a file, a link and a FIFO;
    • FILE/, and a parent below the file, three ways;
    • a socket and /dev/null;
    • three more routes to the file.
  • 15 new test methods, taking the suite from 96 to 111 tests at the merge base. Among them, one checks that FILE stays intact in case (b) (Q2 A), and one checks the order of the refusals (Q4 B).
  • Two case (b) rows are added to known_obstacle_cases(), which the two existing Triad-answer tests run, and one to test_pty_dry_run_with_an_obstacle_refuses. No existing row changes.
  • One existing test is rewritten in its comparison form. This is the only place lines are removed (15 lines).

README.md

  • The four texts of D2. Lines 53 to 55 are unchanged (FR-012).

Records

Not changed (design.md D6)

  • The shape branch.
  • The backstop (parent.mkdir and main()'s handlers). A parent that becomes blocked later still ends with the raw errno.
  • Permissions: none is read.
    • A directory the person can search but cannot write still passes --dry-run and fails at creation, as before.
    • A directory the person cannot search is refused earlier, at the existing-destination check, as before.
  • The question is still asked for a blocked parent, and no line is added under entry 2 (N6). Only its case (b) line is new.
  • The archived N1 residuals.
  • The CI matrix.
  • Everything from discover down.

Verification

Every check was re-run on the final head 309885e by the lead and the reviewer. The exception is T019's mutants, which the build agent ran.

Check Result
Suite, Python 3.12.3 and 3.10.18 Ran 111 tests, OK on both (N0 = 96 at the merge base 15504f1, plus 15 new methods)
Red first (T013 and T018; the review's re-run at 309885e) checkpoint as planned
Mutants (T019) M1 to M3 caught; M4a and M4b exit 1
readme-texts, ascii-added, files-changed, fixed-text, ast-project, ast-tests, traceability all exit 0
openspec validate --all --strict (1.6.0) 9 of 9
governance (g2) OK at 403a15d; the change's tasks.md is unchanged since
PR #33 (feature 004) merge-check exit 0 against its head b60792c, and again against 41dcdd2. The merged tree with b60792c runs 462 tests, OK on 3.12 and 3.10, with 1 skip: #33's own Git-version test
Lane 4's pins All hold: parent_case() by name; the README phrase "a parent that is a directory the person cannot write" once, after "Existing destinations refuse."; the base's project:322-329 (now :353-360) byte for byte; the test harness helpers untouched
Hand walk of quickstart.md (lane step 1) 53 runs, 52 as written. The 1 divergence was a quickstart ordering defect, fixed in fc71792
Adversarial review (lane step 2, an independent opus-xhigh reviewer) Three nits at fc71792: two in tests/test_project.py, fixed by T029 at 4205263, and one in traceability.md, fixed by T030 at f1265d4. On the re-run at 309885e every check exited 0. VERDICT: ready
CI (ubuntu-latest, Python 3.10 and 3.12) green on 309885e: test (3.10) and test (3.12) SUCCESS at 16:38Z; SonarCloud SUCCESS

Analyze gate: ready (0 critical, 0 high). Its fixes landed as a688c46.

Landing

🤖 Generated with Claude Code

Brett Heap and others added 30 commits October 21, 2026 12:25
…f refuse-non-directory-parent-early, #20)

Lane: openRepoProject-1
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lane: openRepoProject-1
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ons) into 006-refuse-non-directory-parent-early

Lane: openRepoProject-1

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Encodes the five answers of 2026-10-22 (Q1 B, Q2 A, Q3 A, Q4 B, Q5 A) in
spec.md's new Clarifications section and in the places the spec states each
matter: Test breadth and SC-001 (Q1), FR-014's FILE-intact note (Q2), EC-001
and the kinds (Q3), the order runs in FR-014, US1 and US5 (Q4), and Scope and
FR-016 (Q5, narrowed to the change's tasks.md entries 1.6, 2.1, 2.2 and the
Speckit Handoff fields). Also fixes the FR-003 note's citation and adds 3.1
to the post-merge lane steps (analysis findings F1 and F7).

Lane: openRepoProject-1
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…uickstart, qs.sh)

Plan, research, quickstart and the check runner qs.sh for the single Speckit
feature that realizes refuse-non-directory-parent-early, following Brett
Heap's clarify answers of 2026-10-22 ("all recommended": Q1 B, Q2 A, Q3 A,
Q4 B, Q5 A) as recorded in spec.md's Clarifications. The appendix is "Options
not taken". No code changes.

Lane: openRepoProject-1
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… [S], 1 [O])

The dependency-ordered task list for the single Speckit feature that
realizes refuse-non-directory-parent-early, following Brett Heap's clarify
answers of 2026-10-22 ("all recommended") as recorded in spec.md's
Clarifications. Every verify is one self-contained line that runs a check of
quickstart.md through qs.sh. Appendix A is "Options not taken". No code
changes.

Lane: openRepoProject-1
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…C2, A2-G2)

Record commit under specs/ from the committed-file analysis A2. tasks.md: the Bash timeout note naming the long verifies (A2-C1), T028's verify ends with the ascii-added and files-changed checks (A2-F4), the line-shift sentence (A2-C2), the earlier-task failure note (A2-G2). checklists/requirements.md: the re-validation note after the 2026-10-22 Clarifications, the stale SC-001 quote dated, OSError named on purpose (A2-F1). clarify-questions.md: the answer record; plan.md: two wording fixes (A2-F2). spec.md: FR-016 names line 31 as G1 does (A2-F3); EC-006 says what Q4 B pins (A2-E1). No code and no governed file changes.

Lane: openRepoProject-1
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…nd 2.1 ticked, handoff fields filled)

Task T001 of feature 006-refuse-non-directory-parent-early: exactly G1 of plan.md "G1 and G2 exact text", the six whole-line replacements of lines 16, 20, 31, 36, 37 and 38 of openspec/changes/refuse-non-directory-parent-early/tasks.md, each copied character for character from the plan. 2.2 and 3.1 to 3.3 stay open. Committed alone, before the first implementation commit.

Lane: openRepoProject-1
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…parent-early (40 delta rows, 20 cells pending T028)

Task T003: specs/006-refuse-non-directory-parent-early/traceability.md in feature 003's form (columns #, Requirement, Scenario, FRs, Tests), one row per scenario of the delta in file order, numbered 1 to 40. The 20 scenarios plan.md's Coverage map lists carry the FRs of T003 and the Tests cell "pending (T028)"; the other 20 carry FR-011 and feature 002's Tests cell for the same title, with feature 003's cell for "No known obstacle". A record commit under specs/, not an implementation commit.

Lane: openRepoProject-1
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…oject.py

OBSTACLE_PARENT_BELOW_A_NON_DIRECTORY, HEAD_REFUSAL_END as its own literal,
head_refusal(), and the kept texts SHAPE_NEEDS_EXISTING_PARENT,
GENERATOR_LIST_FIRST and FAMILY_NOT_A_FOLDER_NAME. Added lines only.

Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… the dry-run obstacle test

Added lines only: the local below_line, the rows 'parent below a file' and
'all three with the parent below a file', and the 'parent below a file' case of
test_pty_dry_run_with_an_obstacle_refuses (research R5 R-5.1 to R-5.5).

Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… matrix runs)

The builder returns research R5's givens K1 to K12; N1 runs forms F1 and F2
(24 runs) and N2 form F5 (12 runs) through run_cli, each refused with the head
refusal before the plan.

Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…he matrix

Each is a pty method over every given of blocked_parents() (12, 12 and 12 plus
R-3.1), refused with the head refusal before any prompt.

Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…the file proved intact

N7 (pty) and N8 (in process) run the two case (b) rows of known_obstacle_cases()
as the existing Triad-answer tests do, plus assert_parent_file_unchanged on the
ancestor the refusal names (clarification Q2, report A1).

Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…nt_ends_as_the_flag_chosen_path

The asked run answers 2 only and the baseline is --type test with no step;
both are refused at once with exit 2 and one equal REFUSED: line, the head
refusal (design D3 item 6, N3, AC5; research R5 R-6.1, R-6.2).

Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…at once

FILE and FILE/sub, with and without --dry-run, with a second generator in place
so that the base waits at the generator prompt (research R5 R-4.1 to R-4.4).

Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…nged while the question waits)

run_inproc_acting() is run_inproc() with answers that may be callables; N9 (a
guard, green at the base) repairs the parent and N10 breaks it while the
question waits (research R5 R-7.1, R-7.2).

Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…der of the head refusal)

N11 dangling link, N12 the head refusal before later faults, N13 earlier
refusals keep their text, N14 the shape refusal by flag, N15 an unwritable
directory's child (research R5 R-8.1, R-9.x, R-10.x). N11, N13, N14 and N15 are
guards, green at the base.

Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Edits 1 to 4 copy design.md:169, :177, :184 and :190 character for character
and rewrap by the recipe (textwrap width 79, no hyphen or word breaks): edit 1
at lines 60-68, edits 2 and 3 at 79-86, edit 4 at 101-105 (FR-012, SC-009).

Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…g (TMPDIR length)

Check red-first read each failure's text for its planned reason, but
unittest renders a failed list comparison with pprint.pformat (80
columns) and then ndiff, so where a long string breaks, and which lines
of the other side land between its pieces, depends on the length of the
temporary path: with TMPDIR unset the split fell inside "cannot " /
"be created because" and the check printed "red for the wrong reason".

flat() now normalizes the text before matching: ndiff is split back into
its two sides, pprint's continuation of a string (closing quote,
whitespace or newline, opening quote) is removed on each side, and runs
of whitespace become one space. Nothing else in the block changes.

Lane: openRepoProject-1
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Lane: openRepoProject-1
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…project new (D1, D2)

Lane: openRepoProject-1
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…aea233, first implementation commit 7dcaf5f)

Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…mapped to their tests

Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…e, US2 row 5 / US3 row 6a)

User Story 2's last row now creates $T/absent2/my-app, so $T/absent stays missing for User Story 3's row 6a (the missing line). The two rows that move openRepoShape aside say to put it back after the run, and the fixture section says which rows change the fixture. The twelve check blocks are untouched.

Lane: openRepoProject-1
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Lane: openRepoProject-1

The lead ruled both nits of the review at fc71792 fixed by a new task on
its own file set (tests/test_project.py), as lane step 2 says.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ty standard error

Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Brett Heap and others added 4 commits October 22, 2026 15:41
Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…step 2)

Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Lane: openRepoProject-1

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@brettheap
brettheap marked this pull request as ready for review October 22, 2026 16:47
@sourcery-ai

sourcery-ai Bot commented Oct 22, 2026

Copy link
Copy Markdown

Sorry @brettheap, your pull request is larger than the review limit of 150,000 diff characters

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.

OpenSpec: refuse-non-directory-parent-early (a parent that is not a directory is refused only after the plan and the yes, and its dry run exits 0)

1 participant