Skip to content

refactor(artifacts): describe formats in one registry - #8054

Merged
morluto merged 2 commits into
mainfrom
cursor/artifact-format-descriptors-80f0
Oct 29, 2026
Merged

morluto merged 2 commits into
mainfrom
cursor/artifact-format-descriptors-80f0

Conversation

@morluto

@morluto morluto commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

Artifact formats now have one descriptor each. The reader factory, classifier, graph builder, and extractor read that descriptor instead of repeating format switches.

Problem and expected behavior

Adding a format meant updating separate string lists in the reader factory, classifier, graph builder, and extractor. A format id from the domain list should have one descriptor. unknown stays an id with no reader. ZIP package families share one capability row. Formats that construct a reader stay in ArtifactReaderFormat; formats that do not, including unknown, stay out of that union.

Change and scope

ARTIFACT_FORMAT_IDS remains the domain list. src/artifacts/artifactFormats.ts is a Record<ArtifactFormatId, FormatDescriptor>. A missing id fails typecheck. ZIP ids are built from ZIP_PACKAGE_FORMATS with ZIP_FAMILY_CAPABILITIES. Helpers that attach a reader return a type where createReader is required, so ArtifactReaderFormat is the union of those ids rather than never. Byte probes that decide which format a prefix is stay in the classifier; only the per-format capability switches moved. Follow the contribution scope.
Ordinary refactor of existing format dispatch. Not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the domain format id list still names formats. The artifact registry owns reader construction and the capability flags consumers used to restate.
  • Contribution scope fit and linked maintainer decision: not applicable
  • CLI and MCP/tool-catalog contract: none
  • Provider, bridge, target-format, or platform compatibility: same readers and the same macOS gate for DMG and universal Mach-O
  • Evidence, artifact, provenance, or reconstruction contract: inventory limitations and container classification stay the same
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): none
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: src/artifacts/artifactFormats.test.ts checks that registry keys equal ARTIFACT_FORMAT_IDS, that unknown has no reader, that every ZIP package id matches ZIP_FAMILY_CAPABILITIES, and that ArtifactReaderFormat equals the ids whose descriptors construct a reader.
  • Base reproduction or other evidence: source-derived from the previous switches in createArtifactReader.ts, classify.ts, ArtifactGraphConstruction.ts, reader.ts, and ArtifactExtraction.ts. Greptile found ArtifactReaderFormat resolved to never because every helper returned FormatDescriptor.
  • User-visible CLI/MCP output (if applicable): none
  • Remaining proof gaps: byte-prefix classification order was not moved and was not remeasured against a new format.

For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.

FIT reader tests and artifact graph construction tests cover the reader and container classification those switches used. Lifecycle regressions are not applicable.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run format:check — all matched files use the correct format
  • npm run check:fast — typecheck and lint succeeded
  • npm run test:focused -- src/artifacts/artifactFormats.test.ts src/artifacts/FitArtifactReader.test.ts src/artifacts/inventory/ArtifactGraphConstruction.test.ts — 70 passed

Compatibility, safety, and release

  • Breaking changes or migration steps: none
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable. Darwin refusal for DMG and universal Mach-O remains a descriptor flag.
  • Package or release metadata impact: none
  • Security, privacy, process, or containment review: none

Author readiness

Human owner: @morluto

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.
Open in Web Open in Cursor 

Reader construction, classification retention, container role, and
extraction now read one descriptor per domain format id. unknown has
no reader, and zip package families share one capability row.
@cursor

cursor Bot commented Oct 29, 2026

Copy link
Copy Markdown

@gensokyo-dev @dandgabr Format capabilities now live in one descriptor per domain format id. unknown has no reader, and every ZIP package family uses the same capability row.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-29T20:03:23.515670Z
We couldn’t complete this review. Comment @codex review to try again.
ecf36fb New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous type issue is fixed and no new actionable issues were found.

Summary

Centralizes artifact reader construction and format capabilities in one registry.

  • Artifact format choices come from one shared registry.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  IDs[Domain format IDs] --> Registry[Format descriptors]
  Registry --> Factory[Reader factory]
  Registry --> Classifier[Source retention]
  Registry --> Graph[Container roles]
  Registry --> Inventory[Availability and limitations]
  Registry --> Extraction[Extractable formats]
Loading

Reviews (2) · Last reviewed commit: "fix(artifacts): keep reader presence in ..." · Reviewed by Greptile

Comment thread src/artifacts/createArtifactReader.ts Resolved
Descriptor helpers no longer widen every format to an optional reader,
so ArtifactReaderFormat stays the union of formats that construct one.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@morluto
morluto merged commit 5f9187c into main Oct 29, 2026
42 of 43 checks passed
@morluto
morluto deleted the cursor/artifact-format-descriptors-80f0 branch October 29, 2026 20:27
Entrpi added a commit to Entrpi/rea that referenced this pull request Oct 30, 2026
Take main d48e472. morluto#8054's registry, src/artifacts/artifactFormats.ts,
now owns the per-format switches this branch extended, so `uf2` and
`dfuse` become registry entries with the old switches' flags and
limitation texts, and the reader-format test lists them. morluto#7481's
vocabulary guard gains `uf2` and `dfuse` targets. The DfuSe element
declaration joins main's `declarationChanged`. Format lists keep both
sides, in embedded-integration's order.
Entrpi added a commit to Entrpi/rea that referenced this pull request Oct 30, 2026
This branch carried morluto#7498's pre-squash commits, which upstream merged as
squash 64196b0 with maintainer commits. The merge therefore used the
absorbed prototype ea2b386 as its base, so the result differs from main
only in this branch's own changes; git's own base reported every morluto#7498
region as a conflict.

Adaptations to main:

- morluto#8054 describes formats in one registry. The esp-flash-image descriptor
  in artifactFormats.ts now owns the reader construction, admission,
  classification retention, container role, extraction and reader
  limitation that this branch had spread over createArtifactReader,
  classify, ArtifactGraphConstruction, ArtifactExtraction and the
  inventory reader. EspFlashAdmission joins ArtifactFormatAdmission.
- morluto#7498 moved the ESP image fixture to tests/fixtures/espImage.ts; the ESP
  flash tests import it from there.
- morluto#7481's vocabulary guard expected every caller-selected format hint to
  name an executable target; an ESP flash dump is read as an archive.
- morluto#7905 bounds MCP arguments at 1,024 elements by default, which the inline
  flash-dump inventories exceed, so the ESP flash comparison test compares
  the Evidence its session retained.
@morluto morluto added the area: evidence Evidence, artifacts, and reconstruction label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: evidence Evidence, artifacts, and reconstruction

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants