Skip to content

feat(classification): generated-code exclusion + PII policy enforcement (6.5, D5/G7)#56

Merged
officialCodeWork merged 1 commit into
developmentfrom
build/phase-6/step-6.5-generated-classification
Jul 16, 2026
Merged

feat(classification): generated-code exclusion + PII policy enforcement (6.5, D5/G7)#56
officialCodeWork merged 1 commit into
developmentfrom
build/phase-6/step-6.5-generated-classification

Conversation

@officialCodeWork

Copy link
Copy Markdown
Owner

Phase 6.5 — Generated/vendored classification & PII policy (failure modes D5, G7)

Closes the D5/G7 criteria of the Phase 6 gate.

Generated-code classification (D5)

Machine-generated code is retained in the graph as lineage / API metadata but excluded from match candidates — it is not authored UI, so a screenshot or ticket must never resolve to it.

  • New isGeneratedFile classifies a file by:
    • a __generated__/ or generated/ directory segment, or a .generated. / .gen. filename infix;
    • an @generated / DO NOT EDIT / AUTO-GENERATED banner in the file head;
    • a sourcemap-less minified line (≥ 3000 chars).
  • A post-pass tags component and hook nodes in those files with a generated flag (uniform across function components, class components, hooks).
  • matchComponents drops generated components from the candidate pool and the IDF corpus; their nodes/edges — including data sources — stay for tracing.

PII policy (G7)

  • New docs/security.md: screenshots are ephemeral (processed in memory, never written/embedded/logged); the graph and corrections store hold terms only, never images.
  • Enforced by packages/vision/src/policy.test.ts — greps the vision source for filesystem-write / image-persistence APIs (writeFile*, appendFile*, createWriteStream, toDataURL, …) and asserts the package never imports fs. Fails CI on regression.

Fixture

d5-generated-code: path-classified GlyphCatalog + banner/filename-classified SchemaViewer + hand-written RevenuePanel. Both generated components trace to their endpoints yet decline on their rendered text; RevenuePanel matches and is not poisoned by generated text mixed into the query.

Verification

  • pnpm eval → 314 pass · 0 fail · determinism 1.000 · all metrics 1.000
  • 6 new parser-react tests + 7 vision policy tests; full suite, pnpm typecheck, pnpm lint green.

Tracker updated. 6.1 / 6.2 / 6.4 still to land for the full lifecycle phase.

🤖 Generated with Claude Code

…nt (6.5, D5/G7)

Machine-generated code is retained as lineage/API metadata but kept out of match
candidates, and the screenshot-privacy policy is enforced in CI.

- isGeneratedFile classifies files by __generated__//generated/ path segment,
  .generated./.gen. filename infix, @generated/DO NOT EDIT banner, or a
  minified (>=3000-char) line. A post-pass tags component/hook nodes with a
  `generated` flag (function + class components + hooks, uniformly).
- matchComponents drops `generated` components from the candidate pool and IDF
  corpus; their nodes/edges (incl. data sources) stay for tracing.
- docs/security.md states the G7 PII policy; packages/vision/src/policy.test.ts
  enforces it — greps vision source for fs-write/image-persistence APIs and
  asserts the package never imports fs.
- New fixture d5-generated-code: path- and banner-classified generated
  components trace to endpoints but decline on their text; the hand-written
  component matches and isn't poisoned by generated text in the query.

6 parser-react + 7 vision tests; eval 314/0/0/0, determinism 1.000, all metrics
1.000; typecheck + lint clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@officialCodeWork
officialCodeWork merged commit 8d4688f into development Jul 16, 2026
1 check passed
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