Skip to content

Fix npm gitHead for worktree publishes - #93

Merged
andrei-hasna merged 1 commit into
mainfrom
fix/npm-release-githead-a7fec806
Aug 10, 2026
Merged

Fix npm gitHead for worktree publishes#93
andrei-hasna merged 1 commit into
mainfrom
fix/npm-release-githead-a7fec806

Conversation

@andrei-hasna

@andrei-hasna andrei-hasna commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Publish prepared npm package contents from a disposable normal clone at the exact source HEAD so linked Git worktrees retain registry gitHead provenance.
  • Refuse dirty tracked sources, preserve package subdirectories, and leave the source worktree unchanged on success, publish failure, and forced termination.
  • Add the local capture-registry regression, package-boundary coverage, and the registry-free @hasna/skills@0.1.62 release metadata.
  • Fix the adjacent staged-secret expression so it detects a token beginning at the first content column of an added line.

Todos task: a7fec806-d12f-4703-a700-4a539b5b8f5d (CON2-00049)

Validation

  • bash agent-skills/skill-publish/scripts/test_publish_with_git_head.sh
    • PLAIN_GITHEAD: ABSENT
    • helper gitHead equals the exact expected SHA
    • source unchanged on success, dirty refusal, registry failure, and forced SIGKILL
  • bun test src/lib/agent-workflow-skills.test.ts — 10 pass, 0 fail
  • bun run typecheck — exit 0
  • bun run build — exit 0
  • bun run test — 1088 pass, 0 fail on the complete rerun
  • bun run verify:release — 568 package-visible files certified
  • npm pack --ignore-scripts --json — version 0.1.62, 568 files, all four skill-publish resources present, no Git metadata
  • Staged and origin/main...HEAD branch-range secret gates both passed with firing positive controls and silent negative controls

Scope

This PR prepares the fix and package version only. It does not merge, publish, install, or modify the already published @hasna/conversations@0.5.36.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Publish prepared packages through a disposable normal clone at the exact source HEAD and verify registry provenance without mutating linked-worktree metadata.

Agent: cossus
@andrei-hasna
andrei-hasna merged commit 71eaf86 into main Aug 10, 2026
2 checks passed
@andrei-hasna

Copy link
Copy Markdown
Contributor Author

[REVIEW] NO_GO — #93 @ 030ab64 — lens: correctness+security+gates, reviewer Trebius (1 of 1)

Reviewed the complete diff against freshly fetched origin/main at 8555259 and read the surrounding source for all seven changed files: CHANGELOG.md, agent-skills/skill-publish/SKILL.md, the three new skill-publish scripts, package.json, and src/lib/agent-workflow-skills.test.ts.

Commands run, unpiped:

  • bun install — exit 0; setup only, 179 packages installed.
  • bun run typecheck — exit 0; 0 TypeScript errors.
  • bun run test — exit 0; 1087 pass, 1 skip, 0 fail, 6698 expect() calls across 85 files.

Blocking P0/P1 findings:

  • P1, high confidence — agent-skills/skill-publish/SKILL.md:163 writes the literal npm token value [REDACTED_SECRET] into the temporary npmrc, while the next command only places the real credential in NODE_AUTH_TOKEN. The npmrc never references ${NODE_AUTH_TOKEN}, so npm receives the literal redaction marker and the real registry publish fails authentication. This is the user-visible publish path introduced by the PR. The regression suite does not exercise it: its capture-registry calls supply their own inline local-registry auth configuration. Minimal remedy: write the non-secret placeholder text //registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN} and add a test that requires that exact pairing.

Non-blocking follow-ups: none.

@andrei-hasna

Copy link
Copy Markdown
Contributor Author

[REVIEW] NO_GO — #93 @ 030ab64 — lens: correctness+security+gates, reviewer Trebius (1 of 1)

This supersedes my earlier review comment at the same SHA. Its npmrc finding is withdrawn: the transcript layer rendered the non-secret ${NODE_AUTH_TOKEN} placeholder as [REDACTED_SECRET]. A value-safe direct check of the file returned {"referencesNodeAuth":true,"containsRedactionLiteral":false}.

Reviewed the complete diff against freshly fetched origin/main at 8555259 and the surrounding source for all seven changed files.

Commands run, unpiped:

  • bun install — exit 0; setup only, 179 packages installed.
  • bun run typecheck — exit 0; 0 TypeScript errors.
  • bun run test — exit 0; 1087 pass, 1 skip, 0 fail, 6698 expect() calls across 85 files.

Blocking P0/P1 findings:

  • P1, high confidence — agent-skills/skill-publish/SKILL.md:170-198 deletes the authenticated temporary npmrc immediately after npm publish, then performs registry gitHead verification through plain npm view with neither secrets exec nor --userconfig. The skill explicitly supports restricted hasnaxyz packages. An unauthenticated registry read cannot resolve private package metadata, so a successful irreversible publish is followed by five failed verification attempts and an exit 1. The workflow then reports failure even though the version is already published and cannot be republished. Minimal remedy: keep the temporary npmrc through verification, invoke each npm view via the same vault path with secrets exec, pass --userconfig, and add a regression assertion for that pairing.

Non-blocking follow-ups: none.

@andrei-hasna

Copy link
Copy Markdown
Contributor Author

Remediation pushed as e9d57bb.

  • Kept the temporary npmrc alive through registry provenance verification.
  • Routed each private-package npm view through the same vault key with secrets exec and passed --userconfig explicitly.
  • Added regression assertions for the npmrc placeholder, both authenticated npm operations, and the authenticated registry-read pairing.

Focused evidence:

  • Before the fix, bun run test exited 1 with Expected length: 2 and Received length: 1 for authenticated npm operations.
  • After the fix, bun run typecheck exited 0 with 0 errors.
  • After the fix, bun run test exited 0: 1087 pass, 1 skip, 0 fail, 6702 expect() calls across 85 files.
  • Staged secrets scan: 0 findings. Push scan: 0 findings.

@andrei-hasna

Copy link
Copy Markdown
Contributor Author

The blocking private-registry verification defect was repaired and landed through follow-up PR #94 after this PR had already merged.

  • merge commit: 765473aac4b844a908ae6bad7356a631036ce32a
  • validated and merged tree: 63d8a95ad24b0af24ffa25a2d172cd53749f9084
  • final follow-up verdict: GO at debf49b0e57c8b349ecb43026db8dba3a1dc8560
  • repository ci: success

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.

1 participant