Complete HBNJ eight-day compatibility pass - #5
Conversation
Reviewer's GuideExtend the HBNJ tooling and adapter to collect, validate, pack, and serve an eight-day native TV no Tomo guide, while enforcing payload capacity limits and tightening WC24/runtime behavior and documentation. Sequence diagram for HBNJ area payload GET handling with unknown-area rejectionsequenceDiagram
actor WiiClient
participant HBNJServer as jwc24_server
participant FileSystem
WiiClient->>HBNJServer: do_GET
HBNJServer->>FileSystem: resolve area_payload path
alt area_payload exists
HBNJServer->>FileSystem: read_bytes
alt item.compression == nintendo-lz10
HBNJServer->>HBNJServer: _nintendo_lz10_literal(body)
end
HBNJServer-->>WiiClient: 200 OK native payload
else area_payload missing
HBNJServer->>WiiClient: send_error(HTTPStatus.NOT_FOUND)
end
Flow diagram for eight-day HBNJ guide collection and capacity validationflowchart LR
update_hbnj_daily[update_hbnj_daily.py main]
collect_all[collect_hbnj_all.py main]
validate_guide[validate_hbnj_guide.py main]
validate_area[validate_hbnj_area_payloads.py main]
pack_header[pack_hbnj_guide.py make_header]
validate_payloads[validate_hbnj_payloads.py main]
publish[collect_hbnj_region.atomic_json]
update_hbnj_daily --> collect_all
collect_all --> validate_guide
validate_guide --> validate_area
validate_area --> pack_header
pack_header --> validate_payloads
validate_payloads --> publish
subgraph Multi_day_collection
collect_all_days[collect_hbnj_all: iterate broadcast_dates]
merge_programs[merge_duplicate_program per area]
annotate_sources[per-area source_urls broadcast_dates daily_program_counts]
collect_all --> collect_all_days --> merge_programs --> annotate_sources
end
subgraph Capacity_checks
guide_limits[validate_hbnj_guide: days 1..8, per-channel 768-program limit]
area_limits[validate_hbnj_area_payloads: literal_lz10_size, VFF_CAPACITY]
header_genres[validate_hbnj_payloads: header genre table labels]
validate_guide --> guide_limits
validate_area --> area_limits
validate_payloads --> header_genres
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tools/validate_hbnj_guide.py" line_range="106-113" />
<code_context>
)
descriptions += bool(description)
programs_by_channel[channel_id].append((start, end))
+ dates_by_channel[channel_id].add(start.strftime("%Y%m%d"))
empty_channels = set(channel_ids) - programs_by_channel.keys()
if empty_channels:
fail(f"channels without programs: {sorted(empty_channels)[:5]}")
for channel_id, windows in programs_by_channel.items():
+ missing_dates = broadcast_dates - dates_by_channel[channel_id]
+ if missing_dates:
+ fail(
+ f"channel {channel_id} has no program starts on broadcast dates "
</code_context>
<issue_to_address>
**question:** The per-channel date coverage check only considers program starts, not full-day coverage.
This logic only verifies that each channel has a program *start* on each broadcast date. A long-running program that begins before the window and spans an entire day will be treated as missing, even though coverage exists. If the goal is to ensure per-day viewer coverage, consider validating based on time windows (start/end) rather than starts only, or clearly document the assumption that there must be at least one program start per channel per day.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| dates_by_channel[channel_id].add(start.strftime("%Y%m%d")) | ||
|
|
||
| empty_channels = set(channel_ids) - programs_by_channel.keys() | ||
| if empty_channels: | ||
| fail(f"channels without programs: {sorted(empty_channels)[:5]}") | ||
| for channel_id, windows in programs_by_channel.items(): | ||
| missing_dates = broadcast_dates - dates_by_channel[channel_id] | ||
| if missing_dates: |
There was a problem hiding this comment.
question: The per-channel date coverage check only considers program starts, not full-day coverage.
This logic only verifies that each channel has a program start on each broadcast date. A long-running program that begins before the window and spans an entire day will be treated as missing, even though coverage exists. If the goal is to ensure per-day viewer coverage, consider validating based on time windows (start/end) rather than starts only, or clearly document the assumption that there must be at least one program start per channel per day.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8dd2faa381
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "refresh_minutes": 1440, | ||
| "retry_minutes": 5, | ||
| "unsigned": false, | ||
| "mode": "create", |
There was a problem hiding this comment.
Maintain the task-table count when creating the header task
When this manifest is applied to a clean post-setup table containing only the native EPG and string tasks, mode: "create" invokes _write_task(), which writes slot 12 but never increments the active-entry count at offset 0x10 that dl_list.validate() identifies as an entry count. Unlike the duplicate-migration case, no entry is removed to balance this addition, so provisioning leaves nwc24dl.bin internally inconsistent and the new daily header task may not be scheduled; update the count when adding or removing entries.
Useful? React with 👍 / 👎.
| wc24_download_bytes = literal_lz10_size(epg_size) + literal_lz10_size(string_size) | ||
| vff_payload_bytes = header_size + wc24_download_bytes | ||
| if vff_payload_bytes >= VFF_CAPACITY: |
There was a problem hiding this comment.
Account for the compressed header and VFF filesystem overhead
For an area whose three files approach the 4 MiB limit, this calculation can accept a package that cannot fit in wc24dl.vff: the manifest stores header.bin with Nintendo LZ10 compression, but header_size is counted as raw HDPK bytes rather than literal_lz10_size(header_size), and the comparison reserves nothing for the FAT copies, directory, boot sector, or per-file cluster rounding. Use the VFF's actual usable data-cluster capacity and the stored sizes of all three files so the newly added size guard cannot publish an undownloadable guide.
Useful? React with 👍 / 👎.
What changed
header.binheader.bincurrent through a dedicated daily WC24 taskWhy
The working one-day guide still left the date carousel mostly empty, Genre Search had no labels because cached setup metadata contained a zero-count table, and an unknown area route could fall back to a package far beyond the channel's 24-station model.
Validation
/bin1/CGI contracts verifiedSummary by Sourcery
Extend the HBNJ adapter to build and serve a native eight-day guide window while keeping header metadata and payload sizes within original channel constraints.
New Features:
Bug Fixes:
Enhancements:
Tests: