Skip to content

refactor: drop the two scan timestamps nothing reads - #18

Open
bradAGI wants to merge 1 commit into
trustabl:mainfrom
bradAGI:refactor/drop-unused-scan-timestamps
Open

bradAGI wants to merge 1 commit into
trustabl:mainfrom
bradAGI:refactor/drop-unused-scan-timestamps

Conversation

@bradAGI

@bradAGI bradAGI commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

SCAN_START and SCAN_END are assigned around the scan and never read again:

$ grep -rn 'SCAN_START\|SCAN_END' .
scan/trustabl-scan.sh:112:SCAN_START=$(date -u +%Y-%m-%dT%H:%M:%S)
scan/trustabl-scan.sh:142:SCAN_END=$(date -u +%Y-%m-%dT%H:%M:%S)

Two assignments, zero references. Not in the console report, not in trustabl-summary.md, not in trustabl.env, and not in either integration wrapper. Dead since the port from the GitLab component, where the surrounding code did consume them.

Worth removing rather than leaving as harmless noise, because they read as an intent the script does not deliver: a reviewer seeing two timestamps bracket the scan reasonably expects a duration somewhere in the output. There isn't one.

Removing rather than wiring up, since neither integration has anywhere to put a duration today — trustabl.env is the natural home and adding a field there is a documented-output change that should be its own decision. If one gains a use, one line brings it back.

bash -n scan/trustabl-scan.sh passes.

SCAN_START and SCAN_END are assigned around the scan and never referenced
again — not in the report, the summary, trustabl.env, or either integration
wrapper. Dead since the port from the GitLab component, where the surrounding
code did consume them.

Beyond the noise, they read as an intent the script does not deliver: a
reviewer sees two timestamps bracketing the scan and reasonably expects a
duration somewhere in the output. There is none.

Removing them rather than wiring them up, since neither integration has
anywhere to put a duration today. If one gains a use for it, one line brings
it back.
bradAGI added a commit to bradAGI/trustabl-aws that referenced this pull request Aug 24, 2026
The scanner is the product here and it is shell, with no static analysis over
it. shellcheck catches the class of defect that stays invisible until a
specific input hits it — an unquoted expansion, a masked exit status, a read of
an unset variable.

Run at --severity=warning so it gates on substance rather than style.

Two fixes were needed to make it pass, both of which the tool found on its own:

  scan/trustabl-scan.sh:112  SC2034: SCAN_START appears unused
  scan/trustabl-scan.sh:142  SC2034: SCAN_END appears unused

which is the dead code trustabl#18 removes, carried here so this job is green on its
own; and SCAN_OUT/SCAN_EXIT in the harness, which are set in harness.sh and
read by the test functions in run-tests.sh — a real cross-file reference
shellcheck cannot see, so that one is a disable with the reason recorded next
to it rather than a change.

Validated on a real runner before opening: the job failed with exactly those
four SC2034s, and passes with them addressed.
@sairenchristianbuerano

Copy link
Copy Markdown
Collaborator

Thanks @bradAGI. Flagging that this is being read rather than sitting unlooked-at.

We are reviewing all 52 open PRs together instead of one at a time. 31 of them edit scan/trustabl-scan.sh, so merge order decides as much as any individual verdict — GitHub reports almost all of these as mergeable, but that is each PR against main in isolation, not against each other. The first merge makes most of the rest conflict.

Queued with the cleanup changes.

The order we are working to: the test harness in #1 first, since twelve PRs depend on it and nothing is verifiable without it, then the fixes that close fail-open paths, then behaviour changes, then docs. A verdict on this one follows once its cluster is read.

Apologies for the wait, and thanks for the contribution.

@sairenchristianbuerano sairenchristianbuerano left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @bradAGI — the change looks good, but it needs a rebase.

Several PRs touching scan/trustabl-scan.sh have landed on main since you
opened this, so it no longer merges cleanly. Could you rebase and resolve?

bash test/run-tests.sh will confirm it — 19 passing on main right now.

Ping me when it's up.

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