Skip to content

Fetch UnsatCoreTAC files via unsat_core_map.json instead of the whole archive#2

Open
jar-ben wants to merge 3 commits into
mainfrom
jaroslav/unsat-core-apis
Open

Fetch UnsatCoreTAC files via unsat_core_map.json instead of the whole archive#2
jar-ben wants to merge 3 commits into
mainfrom
jaroslav/unsat-core-apis

Conversation

@jar-ben

@jar-ben jar-ben commented Jul 16, 2026

Copy link
Copy Markdown

Uses the job's unsat_core_map.json ({ ruleId -> [UnsatCoreTAC .txt] }) to fetch only
the referenced files via the per-file endpoint, instead of pulling the full output tar.

  • fetch_output_file(job, rel_path) — fetch one Reports/-relative file via the /f/<name>
    endpoint (added to all fetchers). fetch_statsdata now delegates to it.
  • unsat_core_map / unsat_core_filenames / read_unsat_cores — look up a rule's unsat-core
    .txt files (and their contents) by its treeView ruleId.
  • extract_unsat_core_files — fetches only the mapped files; falls back to the output tar when
    the map is absent.
  • CheckResult.rule_id (parsed from the treeView node) and NodeStatus.SANITY_FAILED.

Consumer flow: parse the treeView, select rules by status, then fetch their .txt by rule_id.
Works for any rule with unsat cores (verified, failed satisfy, or vacuous), not just sanity.

@jar-ben jar-ben changed the title Fetch UnsatCoreTAC files via unsat_core_map.json instead of the whole… Fetch UnsatCoreTAC files via unsat_core_map.json instead of the whole archive Jul 16, 2026
@jar-ben
jar-ben requested a review from shellygr July 16, 2026 19:30
Fetch statsdata.json for a job via Lambda.
"""Fetch statsdata.json for a job via Lambda."""
try:
return cast(Dict[str, Any], json.loads(self.fetch_output_file(job_identifier, "statsdata.json")))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TIOLI: are we sure we want to load it all to memory? iirc statsdata.json can get pretty big

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

We already did that before this PR. I don't want to change the interface (the return type of this function). I don't need fetch_statsdata for my current efforts, I am just simplifying the code since I have added fetch_output_file.

Though, note that my change actually improves things - the peak memory is reduced by ~29% when calling fetch_statsdata (based on some measurements I made).

dest_dir.mkdir(parents=True, exist_ok=True)
tar_content = self._fetch_outputs_cached(job_identifier)
extracted: List[Path] = []
with tarfile.open(fileobj=io.BytesIO(tar_content), mode="r:gz") as tar:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

worth checking - this does not open the whole thing in memory?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Well, this was preexisting before this PR - we were fetching the whole tar to extract the unsat core files. Now, we fetch only the unsat core files and avoid fetching the whole tar - it is done via the unsat_core_map which depends on a change on the prover side (not released yet). So, for backward compatibility, we keep also the original "whole tar" approach.

I don't see a regression here, only improvement if the user will run with a new prover version.

shellygr
shellygr previously approved these changes Jul 16, 2026

@shellygr shellygr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm, two memory related nits

@shellygr

Copy link
Copy Markdown
Contributor

also - what is the rule_id?

@jar-ben

jar-ben commented Jul 17, 2026

Copy link
Copy Markdown
Author

also - what is the rule_id?

It's a unique rule identifier. We added it to the prover already some time ago, but it was not exported. There is a prover PR that exports it to treeView (which allows us to match treeView items (rule&method results) to corresponding unsat core files).

@jar-ben
jar-ben requested a review from shellygr July 17, 2026 07:44
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