Skip to content

fix(hygiene): 5→6 .. for repo-root paths in 0213Z tick shard#3680

Merged
AceHack merged 1 commit into
mainfrom
fix-0213z-links-on-main
May 16, 2026
Merged

fix(hygiene): 5→6 .. for repo-root paths in 0213Z tick shard#3680
AceHack merged 1 commit into
mainfrom
fix-0213z-links-on-main

Conversation

@AceHack
Copy link
Copy Markdown
Member

@AceHack AceHack commented May 16, 2026

Same Copilot P1 pattern flagged on PR #3676 (0210Z shard): tick shards live 5 directories below docs/, so ../../../../../ lands at docs/ not repo root.

PR #3679 merged at 02:19:07Z before review caught the issue → fixing on main.

Diff: 2 broken links (1 .claude/rules/..., 1 docs/backlog/...) → correct 6-level form.

Co-Authored-By: Claude noreply@anthropic.com

…rge fix)

Same Copilot P1 pattern flagged on PR #3676 (0210Z shard): tick shards live
5 directories below docs/, so `../../../../../` lands at `docs/` not repo
root. `.claude/rules/...` and `docs/backlog/...` need 6 `..` segments.

PR #3679 (0213Z) merged at 02:19:07Z before review caught these — fixing on
main: 2 broken links (1 .claude/rules, 1 docs/backlog) → correct 6-level
form. Both target files verified extant.

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 16, 2026 02:21
@AceHack AceHack enabled auto-merge (squash) May 16, 2026 02:21
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes two broken relative links in the 0213Z.md tick shard. The file lives 6 directories below the repo root (docs/hygiene-history/ticks/2026/05/16/), so paths needed ../../../../../../ (six ..) rather than the original five to reach repo root before descending into docs/backlog/... and .claude/rules/.... Same xref-integrity pattern previously flagged on PR #3676.

Changes:

  • Corrects .. depth from 5 to 6 on the B-0545 backlog row link.
  • Corrects .. depth from 5 to 6 on the .claude/rules/codeql-no-source-on-docs-only-pr-is-broken-commit-canary.md link.

@AceHack AceHack merged commit dcb91e9 into main May 16, 2026
26 of 28 checks passed
@AceHack AceHack deleted the fix-0213z-links-on-main branch May 16, 2026 02:24
AceHack added a commit that referenced this pull request May 16, 2026
…fixes (#3676 + #3680) (#3681)

* shard(tick): 2026-05-16T02:18Z — thread-investigation catch + 5→6 .. fixes (#3676 + #3680)

Tick 3 of post-cold-boot loop. PR #3676 unresolved threads surfaced a real
Copilot P1: tick-shard relative links use 5 .. (→ docs/) instead of 6 ..
(→ repo root). Fixed on PR #3676's branch; same bug landed on main via
PR #3679 race — PR #3680 fixes post-merge. Threads resolved via correct
GraphQL variable-binding form. This shard uses correct 6-level paths.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(md032): blank line before list under 'PR #3676 status at tick-start'

Copilot flagged MD032 (blank lines around lists) — the list of three
bullets starting at line 21 came immediately after the paragraph at
line 19. Add the missing blank.

Resolves Copilot review thread on PR #3681.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
AceHack added a commit that referenced this pull request May 16, 2026
…cleanup pending) (#3692)

* feat(hygiene): tick-shard relative-path audit (detect-only; baseline cleanup pending)

Bug class: tick shards live 5 directories below docs/, so the count-the-..
pattern is error-prone. Empirical evidence this session: PR #3676 + PR #3679
both shipped with 5-`..` paths that resolved to docs/ instead of repo root;
Copilot caught both via review threads, but the broken links landed on main
briefly (PR #3680 fixed post-merge).

This audit walks docs/hygiene-history/ticks/**/*.md, extracts every relative
markdown link target (skipping URLs/anchors/code-blocks/images), resolves
from the shard's directory, and reports missing-or-escaping targets.

Empirical baseline (run on origin/main at 2026-05-16T02:48Z):
  - 833 tick shards scanned
  - 17 broken relative-path links across multiple historical shards
  - Real bug classes detected: wrong-depth `..` (B-0442 link in 1436Z),
    malformed link syntax (`docs/api(v2`), missing-file refs

Detect-only initially. CI enforce wires in after baseline cleanup (same
pattern as §33 migration xrefs: PR #3513#3529#3548#3552 → enforce).

`bun --bun tsc --noEmit -p tsconfig.json` exit 0.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(audit): skip placeholder targets (..., parens, identifier-only)

First baseline showed 17 findings; ~7 were false positives where shard prose
contained inline `[label](path-shape)` constructs as pattern illustrations:
- `path` / `otto-kenji-...` / `.claude/...` / `docs/...` — placeholder names
- `docs/api(v2` — fragmentary malformed syntax
- `docs/research/...amara-...md` — ellipsis-marked example

Add `isPlaceholderTarget` filter:
- contains `...` → placeholder
- contains `(` or `)` → malformed/fragment
- no `/` AND no `.` → pure identifier (not a path)

Re-run: 17 → 10 findings. The 10 remaining are real broken links
(wrong-depth `..` in `1436Z.md`, `0329Z.md`, `0852Z.md`; one borderline
`docs/foo.md` example). Worth a separate baseline-cleanup PR.

`bun --bun tsc --noEmit -p tsconfig.json` exit 0.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(audit): 4 Copilot P1/P2 — sonarjs disable, main export, URI scheme, --files validation

PR #3692 review threads:

P1 (lint failure risk):
1. spawnSync("git", ...) at repoRoot() needs the standard repo-convention
   `// eslint-disable-next-line sonarjs/no-os-command-from-path` comment.
   Every sibling tool (check-tick-history-shard-schema.ts:23, etc.) uses it.
2. Top-level `process.exit(main(...))` blocks safe module-import for tests
   or composition. Switch to `export function main` + guarded
   `if (import.meta.main) { process.exit(main(...)); }` per the sibling
   audit-section-33-migration-xrefs.ts convention.

P2 (precision / brittleness):
3. isRelativeTarget only exempts http(s) + mailto. Replace with a generic
   `<scheme>:` regex (`/^[A-Za-z][A-Za-z0-9+.-]*:/`) so ftp:, file:, tel:,
   data:, etc. are properly classified as absolute.
4. --files inputs aren't validated; readFileSync throws on missing path.
   Add an explicit existence check at the args boundary; emit
   `input not found: <path>` and return exit 64.

Local verify:
- Baseline still 10 findings (no regression)
- `--files /tmp/does-not-exist` → exit 64 with structured message
- `bun --bun tsc --noEmit -p tsconfig.json` exit 0

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(audit): 2 Copilot fixups — directory inputs + Windows path separator

PR #3692 second-pass review threads:

P1 (line 244): --files validation only checked existsSync; a directory or
unreadable file passed the preflight, then `readFileSync` threw EISDIR/EACCES
inside extractLinks, bypassing the structured exit-64 contract. Tighten to
also require `statSync(abs).isFile()` and wrap stat in try/catch for
permission failures. Empirical verify:
- --files docs/hygiene-history/ → "input not a regular file" + exit 64
- --files /tmp/does-not-exist → "input not found" + exit 64

P2 (line 210): Repo-boundary check hardcoded "/" in `ROOT + "/"`. On Windows
`resolve()` returns paths with `\\` separators, so valid in-repo targets like
`C:\\repo\\docs\\...` would fail the `C:\\repo/` prefix test and be flagged
as `escapes-repo` — false positive that would break --enforce mode on
Windows CI. Replace with platform-correct `PATH_SEP` imported as
`sep as PATH_SEP` from node:path.

Local verify:
- Baseline still 10 findings (no regression)
- `bun --bun tsc --noEmit -p tsconfig.json` exit 0

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
AceHack added a commit that referenced this pull request May 16, 2026
…seline (#3708)

Adds the final step of the tick-shard-relative-path audit lifecycle:
discovery (#3676/#3679) → narrow fix (#3680) → scanner (#3692) → filter +
quality × 3 (#3692 fixups) → baseline mechanism (#3699) → THIS JOB.

The job runs `audit-tick-shard-relative-paths.ts --enforce --baseline
tools/hygiene/audit-tick-shard-relative-paths.baseline.json`, exiting 1
only on NEW findings (not in baseline). The 10 pre-existing findings
recorded in the baseline file stay grandfathered — same shape as Stryker
`--reset` or ESLint suppressions.

This is a NON-required check by default per gate.yml convention (only the
checks explicitly listed in branch-protection rules are required). The job
will surface as a status check on every PR; specific path-failure
detection prevents the wrong-depth-`..` bug class from recurring on new
shards.

Local verify on origin/main + new files:
- 842 shards scanned (was 833 in tick 7; +9 from this session's merges)
- 10 grandfathered (matches baseline)
- 0 NEW findings
- exit 0

Composes with: audit-section-33-migration-xrefs.ts (sibling gate, same
lifecycle pattern), blocked-green-ci-investigate-threads.md (the rule
this catch surface mechanizes for tick-shard navigation specifically).

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants