Skip to content

feat(roadmap): let a negative search verify check more than one name #3276

Closed
2 of 2 issues completed

Description

@dan-petty

Problem

The negative search that the implement step runs (! git grep [options] <literal> [--] <path>..., #3263) takes one literal and no -e or -E. A group that removes several names cannot check them in one command. The plan of #2610 (openspec/changes/2610-devops-k8s-image-pins-resolves-with/tasks.md, group 3) has the Verification line ! git grep -n -E "ImagetoolsFake|inspect_command|imagetools_recording|imagetools_runs" -- src tests. The step refuses it with "the option -E is not allowed", so the step for #2610 would stop on that group. The stage gate cannot catch this, because that plan was staged before the gate read the step policy.

Proposed change

Decide one of two ways, and state it in docs/TESTING.md:

  • Allow -e <literal> more than once. Git treats several -e patterns as OR. Check each value as a literal with the same rules, so a pipe or a shell character stays refused. The step still passes only on exit 1.
  • Or keep one literal, and tell the planner to write one ! git grep line for each name, in separate tasks of the group.

A path that matches no file still passes (exit 1 with --). A group that deletes a directory needs that, and the stage job checks the verify paths at plan time.

Acceptance criteria

  1. A test shows that a search for two names runs and passes on exit 1, and fails on exit 0 with the matching lines.
  2. A test shows that a pipe, a shell character, -E, -P and every other option stay refused.
  3. The plan of perf(k8s): use tag_digest HEAD for image pins #2610 is rewritten, so that its line uses the allowed form.

This item delivers these three criteria. Its pull request closes this item.

Moved to #3579: the test that reads every active tasks.md and fails on a Verification: line that the step refuses. That work is separate, because 15 refused commands stay in three active plans, and those plans need a rewrite first.

Related: #3263, #3275, #2610.

Proposed design

Problem statement

The implement step refuses a negative search that names more than one literal. The plan of #2610 has a ! git grep -E line that names four, so its group 3 stops. The change lets -e repeat, keeps every other rule of the fixed shape, requires -- before the paths when -e is used, and updates the documentation and the #2610 line.

Acceptance criteria

Requirement: Repeated -e literals

The negative search SHALL accept one or more -e options, each with a plain literal, as an alternative to the single positional literal, with -- before the paths.

Scenario: Two names that do not occur

  • WHEN A Verification line holds ! git grep -n -e "ImagetoolsFake" -e "inspect_command" -- src tests, and neither name occurs in those paths.
  • THEN The step runs the command and the group passes on exit 1.

Requirement: A matched literal fails

A negative search MUST fail when git exits 0, and its reason MUST show the matching lines.

Scenario: One name occurs

  • WHEN One of the -e literals occurs in a path of the search.
  • THEN The step fails the group, and the reason holds the lines that git grep printed.

Requirement: Refused options and characters

The negative search MUST refuse -E, -P, a pipe, a shell character and every option outside the allowed list, in the positional literal and in each -e value.

Scenario: A pipe in an -e value

  • WHEN An -e value holds a pipe, or the line holds -E or -P.
  • THEN The step refuses the line with a reason that names the refused token, and it runs no command.

Requirement: One form only

The negative search SHALL require -- before the paths when it uses one or more -e options, and MUST refuse a word between the last -e value and --.

Scenario: Both forms in one line

  • WHEN A line holds ! git grep -e name literal -- src.
  • THEN The step refuses the line and names the two forms.

Requirement: A path that matches no file

A negative search with several -e literals SHALL pass when its paths match no file and git exits 1.

Scenario: A directory that the change deletes

  • WHEN The search names a directory that the change deletes.
  • THEN git exits 1 and the step passes.

Requirement: The positional literal stays

The negative search SHALL still accept one plain positional literal when the line holds no -e option.

Scenario: A committed line with one literal

  • WHEN A Verification line holds ! git grep -n name -- src tests.
  • THEN The parser accepts the line and the step runs the same command as before.

Requirement: The documented shape

docs/TESTING.md SHALL state that the ! git grep form takes one positional literal or one or more -e literals with -- before the paths, and that a pipe, -E and -P stay refused.

Scenario: The documentation check

  • WHEN The change runs uv run devops ci docs.
  • THEN The check passes, and the negative-search rule holds the -e form, the -- requirement and the refused tokens.

Requirement: The plan of #2610 uses the allowed form

The Verification: line of task 3.3 in openspec/changes/2610-devops-k8s-image-pins-resolves-with/tasks.md SHALL use four -e literals in place of -E and the pipe.

Scenario: The rewritten line

  • WHEN The parser reads the Verification line of task 3.3.
  • THEN The parser accepts it, and the four patterns are ImagetoolsFake, inspect_command, imagetools_recording and imagetools_runs.

Requirement: An -e with no value

The negative search MUST refuse an -e option that has no following value or whose following word is --.

Scenario: A missing -e value

  • WHEN A line holds ! git grep -e -- src.
  • THEN The step refuses the line with a reason that names the missing literal.

Existing Tool Considered

Git's git grep (https://git-scm.com/docs/git-grep) covers the need: -F with one -e for each literal matches any of them. Git is open and maintained. It lacks an option policy: it accepts -E, -P and a regex pattern. The step must keep its allowlist, its plain-literal check, and require -- before the paths with -e. The change uses this tool and builds no replacement, so it has no build cost.

Key questions

  • Which way does the project take: repeated -e, or one ! git grep line for each name?: Repeat -e. Git matches any of the patterns in one command, so one line per group stays short. Each -e value gets the same plain-literal check as the positional literal. (best practice) [sources: docs/TESTING.md:62, https://git-scm.com/docs/git-grep, openspec/changes/2610-devops-k8s-image-pins-resolves-with/tasks.md:30, openspec/changes/archive/2026-11-02-3263-negative-search-followup/tasks.md:26]
    • Chosen: Repeat -e. Git matches any pattern in one command. The fixed shape keeps each value plain, and one line covers a group.
    • Rejected: One ! git grep line for each name. It adds a line or a task for each name. It cannot run the two-name search that the first criterion needs.
  • Does git grep match any of several -e patterns?: Yes. The synopsis of git grep admits -e more than once. With no --and, --or or --all-match, a line that matches any of the patterns is a match; --all-match is what would require all of them. The step uses no --all-match, so repeated -e values are OR. [sources: https://git-scm.com/docs/git-grep, https://man.archlinux.org/man/git-grep.1.en]
  • Which options and literals does the step allow today?: The options -n -I -F -i -w -l -c -q, one plain literal and relative paths. A pipe, ;, &&, a redirect, -E, -P and every other option are refused. The parser is read_negative_search, which holds the option letters and the literal signs, and the refusal text is search_reason_option. [sources: docs/TESTING.md:62, src/devops_cli/roadmap/implement_shell_policy.py:153, src/devops_cli/roadmap/implement_shell_policy.py:156, src/devops_cli/roadmap/implement_shell_policy.py:252, src/devops_cli/lang/en/messages.py:2466]
  • Which test pins that -e is refused today?: test_a_negative_search_outside_the_fixed_shape_is_refused_and_starts_no_process lists ! git grep -e name src/ with the reason "the option -e is not allowed". The change moves that case to the accepted form and keeps the other option cases. [sources: tests/roadmap/test_roadmap_implement_negative_search.py:133, tests/roadmap/test_roadmap_implement_negative_search.py:147]
  • Does the single positional literal stay?: Yes. Committed plans use it, such as task 1.1 of perf(k8s): use tag_digest HEAD for image pins #2610. The parser keeps it and adds the -e form beside it. (best practice) [sources: docs/TESTING.md:62, openspec/changes/2610-devops-k8s-image-pins-resolves-with/tasks.md:10]
    • Chosen: Keep the positional literal and add -e. Committed plans use the positional form. Dropping it would refuse every committed line of the current shape.
    • Rejected: Replace it with -e only. It refuses every committed line of the current shape. Each plan would need a rewrite.
  • Is the line in group 3 of perf(k8s): use tag_digest HEAD for image pins #2610 refused under both ways?: Yes. The line holds -E and a pipe, and the step refuses both. The change rewrites the line to four -e values. [sources: openspec/changes/2610-devops-k8s-image-pins-resolves-with/tasks.md:30, docs/TESTING.md:62, src/devops_cli/roadmap/implement_shell_policy.py:263]
  • How does the parser treat a line with both a positional literal and -e?: It refuses the line. With -e, git reads a positional word as a path, so the line would search other paths without an error. The parser requires -- before the paths when -e is used, so a word between the last -e value and -- is refused. (best practice) [sources: https://git-scm.com/docs/git-grep, docs/TESTING.md:62, src/devops_cli/roadmap/implement_shell_policy.py:157]
    • Chosen: Require -- before the paths with -e and refuse a word before it. The rule makes the mixed form detectable: with -e, every word before -- is a positional literal and is refused.
    • Rejected: Let git read the positional word as a path. The search then covers other paths, and the plan does not say so.
    • Rejected: Accept the mixed form. The grammar is ambiguous: a plain word is both a valid literal and a valid path, so the step cannot tell which the plan meant.
  • Which committed tasks.md files does the invariant test read?: Every tasks.md of an active change folder under openspec/changes/, and none under openspec/changes/archive/. The implement step runs an active plan only, and the archive is a record. The change folder invariant test already walks the active folders by path. (best practice) [sources: docs/TESTING.md:92, tests/invariants/test_change_folders.py:1, .github/workflows/ci.yml:100]
    • Chosen: Read the active change folders only. The step runs an active plan only. A refused line in the archive cannot stop a step, and the archive is a record.
    • Rejected: Read the archive too. An archived line never runs. A refused line there would fail the test with no fix but an edit of the record.
  • Where does the test that reads every active tasks.md live?: In tests/invariants/test_change_folders.py, the invariant file for change folders. Its docstring already states that every active change folder under openspec/changes/ is a plan with a task list. (best practice) [sources: docs/TESTING.md:92, tests/invariants/test_change_folders.py:1, .github/workflows/ci.yml:100]
    • Chosen: Add it to tests/invariants/test_change_folders.py. docs/TESTING.md gives one invariant file for each subject, and test_change_folders.py is the file for change folders.
    • Rejected: Create tests/invariants/test_verification_lines.py. It makes a second file for the same subject, which the one-file-per-subject rule refuses.
  • Does the stage gate check the paths of a negative search at plan time?: Yes. stage_paths.py checks the paths against the staged commit. A path that matches no file still passes, because the step runs git with -- and passes on exit 1. [sources: src/devops_cli/roadmap/stage_paths.py:143, docs/TESTING.md:62]
  • What does docs/TESTING.md say today about the negative search?: It says the ! git grep form has a fixed shape: the options -n -I -F -i -w -l -c -q, one plain literal and relative paths. A pipe, ;, &&, a redirect and any other option are refused. [sources: docs/TESTING.md:62]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Sub-issues

Sub-issues

2 of 2 Issues completed
Loading 2 sub-issues

Activity

  1. added
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 2, 2026
  2. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. It blocks one specific plan (#2610) but a workaround exists by writing one line per name.
    • Value: Medium. It removes a friction point for groups that delete several names, but the workaround keeps the workflow functional.
    • Effort: Medium. It needs a code change to accept multiple '-e' values, tests for pass and fail cases, and a check over all committed tasks.md files.
    • Related: fix(roadmap): the stage form admits a negative search verify that the implement step refuses #3263, which asks for a different change. Both items work on the '! git grep' command in the implement step, but #3263 fixes the allowlist to accept the '!' prefix while this candidate extends the command to accept multiple patterns.
  3. added
    priority/p2-medium
    status/ready
    and removed
    status/new
    on Nov 2, 2026
  4. devops-cli-service commented on Nov 3, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 1b3184b (see proposed design in issue body).

  5. devops-cli-service commented on Nov 3, 2026

    @devops-cli-service
    Contributor

    The stage job returned the item to New. The premise of the issue does not hold at the staging commit, so the job planned no change and opened no pull request.

    Evidence:

    placeholder

  6. added
    status/new
    and removed
    status/ready
    on Nov 3, 2026
  7. dan-petty commented on Nov 4, 2026

    @dan-petty
    OwnerAuthor

    Evaluation of 2026-11-04. Input for the invariant test of this item, which reads every active tasks.md.

    • A scan of the active plans at origin/main finds 16 of 195 Verification: code spans that the step refuses, in 3 folders: 2441 (2), 2610 (5) and 3187 (9). So the invariant test also catches the prose spans of fix(k8s): name the Loki deployment mode Monolithic #2441 and perf(k8s): use tag_digest HEAD for image pins #2610 and the test -z spans of refactor(roadmap): group the job modules in subpackages #3187, not only the line that this item names. These plans need a rewrite in the same pull request, or through the new issue feat(roadmap): one pass re-checks each merged plan against main.
    • A wider scan of ! spans in tasks.md finds 8 folders with a span that the step would refuse: 2147, 2184, 2570, 2592, 2610, 2644, 3187 and 3373. The span in 3373 is the fragment ! git grep. Many of these spans are in task text, so the step does not run them.
    • The stage gate and the step already call one function, read_verification (src/devops_cli/roadmap/implement_shell_policy.py:305-312). A plan passes only because of the reader: read_change gives only the first span of a task (_task in plan_read.py takes task.verification[0]), and perf(k8s): use tag_digest HEAD for image pins #2610 fails in the reader with a ValidationError, so check_proposal does not run on it. The new issue fix(roadmap): the plan reader reports each bad plan with no crash owns that defect.

    This item went back to New on 2026-11-03T01:02Z with the evidence text placeholder. That return carries no evidence, so a person or agent must check it again.

  8. 1 remaining item

  9. added
    status/ready
    on Nov 5, 2026
  10. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at d72ec47 (see proposed design in issue body).

    Moved to new items: #3579.

  11. added
    owner/agent
    on Nov 5, 2026
  12. dan-petty commented on Nov 5, 2026

    @dan-petty
    OwnerAuthor

    Answer from project standards, under the owner's instruction of 2026-11-05.

    Question: The branch of this item delivers criteria 1 and 2 and the #2610 part of criterion 3. It does not add the test over every tasks.md. Does its pull request use Plans #3276 or Closes #3276?

    Answer: Closes #3276. The test over every active tasks.md moves to #3579, which already holds it. The body of this issue now lists what this item delivers and names #3579.

    Source:

    The work of the test is separate. At the rebased head, a scan with verification_problem finds 15 refused commands in other active plans: #2441 (2), #2610 (4) and #3187 (9). The test cannot pass until those plans change.

  13. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 5, 2026
  14. removed
    status/in-review
    owner/agent
    on Nov 5, 2026
  15. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-05 19:48 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/roadmaptype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions