fix(plan): reject date-prefixed slugs reserved for archives - #97
Merged
Conversation
isValidSlug now rejects YYYY-MM-DD- prefix so active slugs cannot collide with archive naming (plans/completed/<date>-<slug>). assertValidSlug surfaces dedicated next guidance for date prefix. Add unit and creation integration tests for valid/invalid date prefixes and non-date slug acceptance.
…ility Move date-prefix check from global isValidSlug/assertValidSlug to creation-only assertCreatableSlug/isCreatableSlug so pre-existing active and completed planlets with date-prefixed logical slugs remain readable, validatable, task-updatable and completable. parseArchiveName still uses isValidSlug so legacy archives like 2026-09-01-2026-08-25-my-plan stay parseable. createPlanlet now calls assertCreatableSlug. Add CHANGELOG Unreleased entry, update planlet_design.md and AGENTS.md to distinguish persistent slug syntax from new-creation reservation, and add unit + integration regression tests for legacy readability and completion.
Drop unused isCreatableSlug predicate; tests assertCreatableSlug directly. Keep isValidSlug for persistent storage and assertCreatableSlug for creation policy. Trim legacy-date-prefix suite to focused coverage: one legacy active updates and completes, one legacy archive stays readable, and creation rejects YYYY-MM-DD- prefix.
vipentti
marked this pull request as ready for review
August 25, 2026 07:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reject date-prefixed slugs at create time so new active slugs cannot collide with archive naming (
plans/completed/<YYYY-MM-DD>-<slug>/), while keeping all existing date-prefixed planlets fully readable and operable.assertCreatableSlug(used bycreatePlanlet) rejects aYYYY-MM-DD-prefix with a dedicatedinvalid_slugerror andnextguidance:Slugs must not start with a date (YYYY-MM-DD-); that prefix is reserved for archived plans under plans/completed/.isValidSlug/assertValidSlug/parseArchiveNamestay backward compatible: legacy active planlets with date-prefixed logical slugs remain targetable, updatable, and completable, and legacy archives whose logical slug itself is date-prefixed remain parseable and readable.CHANGELOG.md([Unreleased]),planlet_design.md, andAGENTS.mddocument the creation-only restriction and legacy compatibility.Tests
tests/unit/slugs.test.ts: creation-rejection cases for real date prefix (2026-08-25-my-plan), invalid date-shape prefix (2026-99-99-foo), archive-date prefix (2024-02-29-cli-core); valid non-date slug (my-2026-plan/cli-2024-01-01/a-2026-08-25) stays accepted; persistentisValidSlugunchangedtests/integration/creation.test.ts: create-command-level test for date-prefix rejection and non-date acceptance, rejection beforeplans/is createdtests/integration/legacy-date-prefix.test.ts: focused compatibility coverage - one legacy active date-prefixed slug updates and completes, one legacy date-prefixed archive remains readable, new creation rejects the prefixVerification
npm run buildgreennpm testgreen (253 pass, 1 pre-existing packaging failure on main due to npm allow-scripts)npm run lintgreen,npm run format:checkgreen afternpm run formatnode dist/planlet.mjs --root $TMP create 2026-08-25-my-plan->invalid_slugwith date next;2026-99-99-foosame;my-2026-plansucceeds