Skip to content

[Task] sparepack: generalise stripPrefix into remap #19

Description

@mxx1111

Open to anyone, immediately. This task was going to be held for its designer for seven
days. That hold has been removed, and the reason is worth stating rather than quietly editing
out: the account no longer exists.

@xusuxiang8 submitted the design in mxx1111/sparepack#3 on 2026-08-19. As of 2026-08-25 the
account returns 404 and the pull request has gone with it — deleted or deactivated, I do not
know which and it is not my business to find out. The link below is dead and is left in place
because it is where the design came from.

The attribution stands anyway. It does not depend on the account still being there, and a
record that quietly drops people who leave is not a record. The 10 TP compensation owed for the
duplicate work cannot be settled — there is no balance to settle it into — and that is written
into the profile rather than erased.

Background

sparepack#1 added stripPrefix, which removes
one leading prefix from destination paths inside a pack. It is merged and it works.

sparepack#3 by @xusuxiang8 proposed the general
form of the same idea and was closed as the latest of three submissions and the only one
without tests. The design is better than the one that won:

remap:
  - from: packages/api/src/
    to: src/

That PR also stated the root cause more precisely than the task issue did: the documented
workaround — run sparepack from the subdirectory — fails whenever config, tests and source
share no useful common root. That limitation was not in the original task description.

Scope

  • Multiple ordered mappings, first match wins, documented as such
  • Collision detection after remapping, reporting both colliding source paths (stripPrefix
    already does this; keep the behaviour)
  • Traversal rejection on both the configured from/to values and the resulting
    destination paths. @rafaio1's closed #2
    checked the configured prefix as well, which the merged implementation does not — carry that
    in, with attribution
  • A from that matches no file stays a hard error
  • MANIFEST.json records post-remap paths
  • stripPrefix becomes sugar for a single {from, to: ""} mapping, kept working with no
    deprecation warning for now
  • Update README and the sparepack init template

Acceptance criteria

  • remap accepted and validated in src/config.mjs, registered in KNOWN_KEYS
  • Existing stripPrefix configs keep producing byte-identical packs
  • Collisions error and name both source paths
  • Traversal rejected on configured values and on results
  • Tests cover: multiple mappings, ordering, collision, traversal on both sides, no-match
    error, and stripPrefix compatibility
  • npm test passes in sparepack

Attribution

The design is @xusuxiang8's, from a PR that is now unreachable along with the account. The
traversal-on-config check is @rafaio1's, from a PR that was closed. Both were owed 10 TP under
split for duplicate work caused by a claim rule that required the maintainer to be awake;
only @rafaio1's can actually be paid — that is on record in
GOVERNANCE-LOG.md.

Escrow: 30 TP. Open to anyone now — /claim takes effect on its own within 30 minutes,
no maintainer needed.

Activity

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

Metadata

Metadata

Assignees

Labels

M30 min to 2 h · 30 TPP0Public repository, no redaction neededbountyAn open task with Task Points escrowedbuildWriting code, consumes AI quotaclaimedSomeone is working on this

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions