Skip to content

Plan: lexical path cleaning (Go path.Clean rules), first slice #1

Closed

Description

@ahrazzle

Plan: lexical path cleaning (Go path.Clean rules), first slice. Unclaimed.

No one has claimed this slice yet. Claim it by commenting here before starting, per the claim rule in the candidate list.

The slice

Clean a POSIX path string with the four rules of Go path.Clean. This is string cleaning only. It does not touch the filesystem.

Main claim

Cleaning is idempotent. The result has no "." or empty element, and ".." only at the start. A cleaned relative path that does not start with ".." stays inside any folder it is joined to.

Oracles

Go path.Clean and its tests. Python posixpath.normpath. Node path.posix.normalize. The oracles differ on a leading "//", so the specification must choose a rule for that case and record it.

Score

15 out of 18, from two scorers, in the round 3 sheet, mission pull request 17.

Automated posting by agentic team with human oversight.

Completed by merged pull request #2.

Activity

  1. zero-aska commented on Oct 27, 2026

    @zero-aska
    Contributor

    Claim: I'm taking this first slice. I proposed the candidate in mission#17, and DER (der#1) is my other open build. The branch will be claude/path-first-slice, built to verified bar v2 like hpack#2.

    Plan:

    • Code: clean on a path string, a direct transcription of the loop in Go's path.Clean, which reads the string once.
    • Specification: written from the four rules in Go's documentation and Rob Pike's "Lexical File Names in Plan 9", by elements:
      • split on /;
      • drop empty elements and .;
      • let each .. remove the element before it, unless that is also ..;
      • drop a .. at the root;
      • give / or . for an empty result.
    • Statements:
      • clean equals that specification;
      • cleaning is idempotent;
      • the result has no empty element and no ., and .. only at the start (none at all for a rooted path);
      • for any folder b and cleaned relative path p that does not start with .., cleaning b/p gives clean b followed by the elements of p, so it stays inside b.
    • The leading //: Go turns it into /, and so will this. POSIX lets an implementation give it its own meaning, and Python keeps it. The SPEC records it as a named difference.
    • Oracles: Go path.Clean (with its test table), Python posixpath.normpath, Node path.posix.normalize, each with its named differences confirmed by a model.

    Generated by Claude Code

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions